Skip to content

Commit 7b5af5e

Browse files
committed
fix locking at vol/vm creation
1 parent 82d6edd commit 7b5af5e

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,12 +1206,6 @@ private KVMPhysicalDisk createPhysicalDiskByLibVirt(String name, KVMStoragePool
12061206
volName = vol.getName();
12071207
volAllocation = vol.getInfo().allocation;
12081208
volCapacity = vol.getInfo().capacity;
1209-
1210-
// For CLVM volumes, activate in shared mode so all cluster hosts can access it
1211-
if (pool.getType() == StoragePoolType.CLVM) {
1212-
logger.info("Activating CLVM volume {} in shared mode for cluster-wide access", volPath);
1213-
activateClvmVolumeInSharedMode(volPath);
1214-
}
12151209
} catch (LibvirtException e) {
12161210
throw new CloudRuntimeException(e.toString());
12171211
}
@@ -1223,30 +1217,6 @@ private KVMPhysicalDisk createPhysicalDiskByLibVirt(String name, KVMStoragePool
12231217
return disk;
12241218
}
12251219

1226-
/**
1227-
* Activates a CLVM volume in shared mode so all hosts in the cluster can access it.
1228-
* This is necessary after volume creation since libvirt creates LVs with exclusive activation by default.
1229-
*
1230-
* @param volumePath The full path to the LV (e.g., /dev/vgname/volume-path)
1231-
*/
1232-
private void activateClvmVolumeInSharedMode(String volumePath) {
1233-
try {
1234-
Script cmd = new Script("lvchange", 5000, logger);
1235-
cmd.add("-asy"); // Activate in shared mode
1236-
cmd.add(volumePath);
1237-
1238-
String result = cmd.execute();
1239-
if (result != null) {
1240-
logger.error("Failed to activate CLVM volume {} in shared mode. Result: {}", volumePath, result);
1241-
throw new CloudRuntimeException("Failed to activate CLVM volume in shared mode: " + result);
1242-
}
1243-
logger.info("Successfully activated CLVM volume {} in shared mode", volumePath);
1244-
} catch (Exception e) {
1245-
logger.error("Exception while activating CLVM volume {} in shared mode: {}", volumePath, e.getMessage(), e);
1246-
throw new CloudRuntimeException("Failed to activate CLVM volume in shared mode: " + e.getMessage(), e);
1247-
}
1248-
}
1249-
12501220

12511221
private KVMPhysicalDisk createPhysicalDiskByQemuImg(String name, KVMStoragePool pool, PhysicalDiskFormat format, Storage.ProvisioningType provisioningType, long size,
12521222
byte[] passphrase) {

0 commit comments

Comments
 (0)