Updated Branches: refs/heads/4.2-forward 2c2ebee3f -> e362f51f3
CLOUDSTACK-4362: always honor vCenter on-disk meta data to work with live migration better Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e362f51f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e362f51f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e362f51f Branch: refs/heads/4.2-forward Commit: e362f51f37b718466f2d80d9193e58e1fafcb8fb Parents: 2c2ebee Author: Kelven Yang <kelv...@gmail.com> Authored: Fri Aug 30 11:10:56 2013 -0700 Committer: Kelven Yang <kelv...@gmail.com> Committed: Fri Aug 30 11:11:20 2013 -0700 ---------------------------------------------------------------------- .../vmware/resource/VmwareResource.java | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e362f51f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index 96ee201..de6885c 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -3031,27 +3031,27 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa throw new Exception("Primary datastore " + primaryStore.getUuid() + " is not mounted on host."); DatastoreMO dsMo = volumeDsDetails.second(); + // we will honor vCenter's meta if it exists + if(diskInfoBuilder != null && diskInfoBuilder.getDiskCount() > 0) { + // we will always on-disk info from vCenter in this case + VirtualMachineDiskInfo diskInfo = diskInfoBuilder.getDiskInfoByDeviceBusName(deviceBusName); + if(diskInfo != null) { + if(s_logger.isInfoEnabled()) + s_logger.info("Volume " + volumeTO.getId() + " does not seem to exist on datastore. use on-disk chain: " + + _gson.toJson(diskInfo)); + + return diskInfo.getDiskChain(); + } else { + s_logger.warn("Volume " + volumeTO.getId() + " does not seem to exist on datastore. on-disk may be out of sync as well. disk device info: " + deviceBusName); + } + } + String datastoreDiskPath = VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder( - dcMo, vmMo.getName(), dsMo, volumeTO.getPath()); - + dcMo, vmMo.getName(), dsMo, volumeTO.getPath()); if(!dsMo.fileExists(datastoreDiskPath)) { if(s_logger.isInfoEnabled()) s_logger.info("Volume " + volumeTO.getId() + " does not seem to exist on datastore, out of sync? path: " + datastoreDiskPath); - if(diskInfoBuilder != null && diskInfoBuilder.getDiskCount() > 0) { - // we will always on-disk info from vCenter in this case - VirtualMachineDiskInfo diskInfo = diskInfoBuilder.getDiskInfoByDeviceBusName(deviceBusName); - if(diskInfo != null) { - if(s_logger.isInfoEnabled()) - s_logger.info("Volume " + volumeTO.getId() + " does not seem to exist on datastore. use on-disk chain: " + - _gson.toJson(diskInfo)); - - return diskInfo.getDiskChain(); - } else { - s_logger.warn("Volume " + volumeTO.getId() + " does not seem to exist on datastore. on-disk may be out of sync as well. disk device info: " + deviceBusName); - } - } - // last resort, try chain info stored in DB if(volumeTO.getChainInfo() != null) { VirtualMachineDiskInfo diskInfo = _gson.fromJson(volumeTO.getChainInfo(), VirtualMachineDiskInfo.class); @@ -3061,7 +3061,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } throw new Exception("Volume " + volumeTO.getId() + " does not seem to exist on datastore. Broken disk chain"); - } + } } return new String[] { datastoreDiskPath };