Skip to content

Commit ab98daa

Browse files
committed
fix create vol from snap and attach
1 parent 8a7e48a commit ab98daa

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,22 +1285,6 @@ private String computeMd5Hash(String input) {
12851285
}
12861286
}
12871287

1288-
/**
1289-
* Extract VG name from CLVM disk path.
1290-
* Path format: /dev/vgname/volumeuuid
1291-
* Returns: vgname
1292-
*/
1293-
private String extractVgNameFromDiskPath(String diskPath) {
1294-
if (diskPath == null || diskPath.isEmpty()) {
1295-
return null;
1296-
}
1297-
String[] pathParts = diskPath.split("/");
1298-
if (pathParts.length >= 3) {
1299-
return pathParts[2]; // /dev/vgname/volumeuuid -> vgname
1300-
}
1301-
return null;
1302-
}
1303-
13041288
protected synchronized void attachOrDetachISO(final Connect conn, final String vmName, String isoPath, final boolean isAttach, Map<String, String> params, DataStoreTO store) throws
13051289
LibvirtException, InternalErrorException {
13061290
DiskDef iso = new DiskDef();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ private KVMPhysicalDisk createPhysicalDiskByLibVirt(String name, KVMStoragePool
12271227
* Activates a CLVM volume in shared mode so all hosts in the cluster can access it.
12281228
* This is necessary after volume creation since libvirt creates LVs with exclusive activation by default.
12291229
*
1230-
* @param volumePath The full path to the LV (e.g., /dev/vgname/volume-uuid)
1230+
* @param volumePath The full path to the LV (e.g., /dev/vgname/volume-path)
12311231
*/
12321232
private void activateClvmVolumeInSharedMode(String volumePath) {
12331233
try {

server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,8 +3055,8 @@ private boolean transferClvmVolumeLock(VolumeInfo volume, Long sourceHostId, Lon
30553055
vgName = vgName.substring(1);
30563056
}
30573057

3058-
// Full LV path: /dev/vgname/volume-uuid
3059-
String lvPath = String.format("/dev/%s/%s", vgName, volumeUuid);
3058+
// Full LV path: /dev/vgname/volume-path
3059+
String lvPath = String.format("/dev/%s/%s", vgName, volume.getPath());
30603060

30613061
try {
30623062
// Step 1: Deactivate on source host (if different from dest)

0 commit comments

Comments
 (0)