Merge remote-tracking branch 'apache/4.18' into 4.19

This commit is contained in:
Wei Zhou 2024-02-09 11:53:39 +01:00
commit af2e277999
3 changed files with 13 additions and 11 deletions

View File

@ -144,7 +144,7 @@ public class Storage {
LVM(false, false, false), // XenServer local LVM SR LVM(false, false, false), // XenServer local LVM SR
CLVM(true, false, false), CLVM(true, false, false),
RBD(true, true, false), // http://libvirt.org/storage.html#StorageBackendRBD RBD(true, true, false), // http://libvirt.org/storage.html#StorageBackendRBD
SharedMountPoint(true, false, true), SharedMountPoint(true, true, true),
VMFS(true, true, false), // VMware VMFS storage VMFS(true, true, false), // VMware VMFS storage
PreSetup(true, true, false), // for XenServer, Storage Pool is set up by customers. PreSetup(true, true, false), // for XenServer, Storage Pool is set up by customers.
EXT(false, true, false), // XenServer local EXT SR EXT(false, true, false), // XenServer local EXT SR
@ -159,12 +159,12 @@ public class Storage {
FiberChannel(true, true, false); // Fiber Channel Pool for KVM hypervisors is used to find the volume by WWN value (/dev/disk/by-id/wwn-<wwnvalue>) FiberChannel(true, true, false); // Fiber Channel Pool for KVM hypervisors is used to find the volume by WWN value (/dev/disk/by-id/wwn-<wwnvalue>)
private final boolean shared; private final boolean shared;
private final boolean overprovisioning; private final boolean overProvisioning;
private final boolean encryption; private final boolean encryption;
StoragePoolType(boolean shared, boolean overprovisioning, boolean encryption) { StoragePoolType(boolean shared, boolean overProvisioning, boolean encryption) {
this.shared = shared; this.shared = shared;
this.overprovisioning = overprovisioning; this.overProvisioning = overProvisioning;
this.encryption = encryption; this.encryption = encryption;
} }
@ -173,14 +173,16 @@ public class Storage {
} }
public boolean supportsOverProvisioning() { public boolean supportsOverProvisioning() {
return overprovisioning; return overProvisioning;
} }
public boolean supportsEncryption() { return encryption; } public boolean supportsEncryption() {
return encryption;
}
} }
public static List<StoragePoolType> getNonSharedStoragePoolTypes() { public static List<StoragePoolType> getNonSharedStoragePoolTypes() {
List<StoragePoolType> nonSharedStoragePoolTypes = new ArrayList<StoragePoolType>(); List<StoragePoolType> nonSharedStoragePoolTypes = new ArrayList<>();
for (StoragePoolType storagePoolType : StoragePoolType.values()) { for (StoragePoolType storagePoolType : StoragePoolType.values()) {
if (!storagePoolType.isShared()) { if (!storagePoolType.isShared()) {
nonSharedStoragePoolTypes.add(storagePoolType); nonSharedStoragePoolTypes.add(storagePoolType);

View File

@ -52,7 +52,7 @@ public class StorageTest {
} }
@Test @Test
public void supportsOverprovisioningStoragePool() { public void supportsOverProvisioningTestAllStoragePoolTypes() {
Assert.assertTrue(StoragePoolType.Filesystem.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.Filesystem.supportsOverProvisioning());
Assert.assertTrue(StoragePoolType.NetworkFilesystem.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.NetworkFilesystem.supportsOverProvisioning());
Assert.assertFalse(StoragePoolType.IscsiLUN.supportsOverProvisioning()); Assert.assertFalse(StoragePoolType.IscsiLUN.supportsOverProvisioning());
@ -63,7 +63,7 @@ public class StorageTest {
Assert.assertFalse(StoragePoolType.CLVM.supportsOverProvisioning()); Assert.assertFalse(StoragePoolType.CLVM.supportsOverProvisioning());
Assert.assertTrue(StoragePoolType.RBD.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.RBD.supportsOverProvisioning());
Assert.assertTrue(StoragePoolType.PowerFlex.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.PowerFlex.supportsOverProvisioning());
Assert.assertFalse(StoragePoolType.SharedMountPoint.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.SharedMountPoint.supportsOverProvisioning());
Assert.assertTrue(StoragePoolType.VMFS.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.VMFS.supportsOverProvisioning());
Assert.assertTrue(StoragePoolType.PreSetup.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.PreSetup.supportsOverProvisioning());
Assert.assertTrue(StoragePoolType.EXT.supportsOverProvisioning()); Assert.assertTrue(StoragePoolType.EXT.supportsOverProvisioning());

View File

@ -72,7 +72,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
private String getHostname() { private String getHostname() {
// either there is already some function for that in the agent or a better way. // either there is already some function for that in the agent or a better way.
ProcessBuilder pb = new ProcessBuilder("/usr/bin/hostname"); ProcessBuilder pb = new ProcessBuilder("hostname");
try try
{ {
String result; String result;
@ -88,7 +88,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
return result.trim(); return result.trim();
} catch (IOException | InterruptedException exc) { } catch (IOException | InterruptedException exc) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
throw new CloudRuntimeException("Unable to run '/usr/bin/hostname' command."); throw new CloudRuntimeException("Unable to run 'hostname' command.");
} }
} }