Skip to content

Commit a1eca8b

Browse files
Likitha Shettyyadvr
authored andcommitted
CLOUDSTACK-8118. Root volume migration fails with 'No such disk device' in case of vCenter 5.5 setup.
If an exact match is being done while locating disk chain by name, don't trim snapshot postfix appended to the disk name. (cherry picked from commit ddcae8a) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent ad92b85 commit a1eca8b

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3208,7 +3208,7 @@ private Answer execute(MigrateVolumeCommand cmd) {
32083208
}
32093209

32103210
private int getVirtualDiskInfo(VirtualMachineMO vmMo, String srcDiskName) throws Exception {
3211-
Pair<VirtualDisk, String> deviceInfo = vmMo.getDiskDevice(srcDiskName, true);
3211+
Pair<VirtualDisk, String> deviceInfo = vmMo.getDiskDevice(srcDiskName, false);
32123212
if (deviceInfo == null) {
32133213
throw new Exception("No such disk device: " + srcDiskName);
32143214
}

vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,10 +1931,13 @@ public Pair<VirtualDisk, String> getDiskDevice(String vmdkDatastorePath, boolean
19311931

19321932
DatastoreFile dsSrcFile = new DatastoreFile(vmdkDatastorePath);
19331933
String srcBaseName = dsSrcFile.getFileBaseName();
1934+
String trimmedSrcBaseName = trimSnapshotDeltaPostfix(srcBaseName);
19341935

1935-
srcBaseName = trimSnapshotDeltaPostfix(srcBaseName);
1936-
1937-
s_logger.info("Look for disk device info from volume : " + vmdkDatastorePath + " with trimmed base name: " + srcBaseName);
1936+
if (matchExactly) {
1937+
s_logger.info("Look for disk device info from volume : " + vmdkDatastorePath + " with base name: " + srcBaseName);
1938+
} else {
1939+
s_logger.info("Look for disk device info from volume : " + vmdkDatastorePath + " with trimmed base name: " + trimmedSrcBaseName);
1940+
}
19381941

19391942
if (devices != null && devices.size() > 0) {
19401943
for (VirtualDevice device : devices) {
@@ -1957,7 +1960,7 @@ public Pair<VirtualDisk, String> getDiskDevice(String vmdkDatastorePath, boolean
19571960
return new Pair<VirtualDisk, String>((VirtualDisk)device, deviceNumbering);
19581961
}
19591962
} else {
1960-
if (backingBaseName.contains(srcBaseName)) {
1963+
if (backingBaseName.contains(trimmedSrcBaseName)) {
19611964
String deviceNumbering = getDeviceBusName(devices, device);
19621965

19631966
s_logger.info("Disk backing : " + diskBackingInfo.getFileName() + " matches ==> " + deviceNumbering);

0 commit comments

Comments
 (0)