shwstppr commented on a change in pull request #4895:
URL: https://github.com/apache/cloudstack/pull/4895#discussion_r608380844
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -4839,6 +4852,11 @@ private Answer migrateVolume(MigrateVolumeCommand cmd) {
String path = cmd.getVolumePath();
VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext());
+ VmwareHypervisorHost hyperHostInTargetCluster = null;
+ if (cmd.getHostGuidInTargetCluster() != null) {
+ hyperHostInTargetCluster =
VmwareHelper.getHostMOFromHostName(getServiceContext(),
cmd.getHostGuidInTargetCluster());
+ }
+ VmwareHypervisorHost targetDSHost = hyperHostInTargetCluster != null ?
hyperHostInTargetCluster : hyperHost;
Review comment:
@DaanHoogland which specific method? I didn't get you
##########
File path:
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -4854,23 +4872,32 @@ private Answer migrateVolume(MigrateVolumeCommand cmd) {
// we need to spawn a worker VM to attach the volume to and move it
morSourceDS =
HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,
cmd.getSourcePool().getUuid());
dsMo = new DatastoreMO(hyperHost.getContext(), morSourceDS);
- morDestintionDS =
HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,
cmd.getTargetPool().getUuid());
- destinationDsMo = new DatastoreMO(hyperHost.getContext(),
morDestintionDS);
+ morDestintionDS =
HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(targetDSHost,
cmd.getTargetPool().getUuid());
+ destinationDsMo = new DatastoreMO(targetDSHost.getContext(),
morDestintionDS);
vmName = getWorkerName(getServiceContext(), cmd, 0, dsMo);
if (destinationDsMo.getDatastoreType().equalsIgnoreCase("VVOL")) {
isvVolsInvolved = true;
vmName = getWorkerName(getServiceContext(), cmd, 0,
destinationDsMo);
}
+ String hardwareVersion = null;
+ if (hyperHostInTargetCluster != null) {
+ Integer sourceHardwareVersion =
HypervisorHostHelper.getHostHardwareVersion(hyperHost);
+ Integer destinationHardwareVersion =
HypervisorHostHelper.getHostHardwareVersion(hyperHostInTargetCluster);
+ if (sourceHardwareVersion != null &&
destinationHardwareVersion != null &&
!sourceHardwareVersion.equals(destinationHardwareVersion)) {
+ hardwareVersion =
String.valueOf(Math.min(sourceHardwareVersion, destinationHardwareVersion));
+ }
+ }
Review comment:
@DaanHoogland done
##########
File path:
plugins/hypervisors/vmware/src/main/java/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
##########
@@ -188,20 +177,42 @@ public void copyAsync(DataObject srcData, DataObject
destData, Host destHost, As
throw new UnsupportedOperationException();
}
StoragePool sourcePool = (StoragePool) srcData.getDataStore();
+ ScopeType sourceScopeType =
srcData.getDataStore().getScope().getScopeType();
StoragePool targetPool = (StoragePool) destData.getDataStore();
+ ScopeType targetScopeType =
destData.getDataStore().getScope().getScopeType();
+ Long hostId = null;
+ String hostGuidInTargetCluster = null;
+ if (ScopeType.CLUSTER.equals(sourceScopeType)) {
+ // Find Volume source cluster and select any Vmware hypervisor
host to attach worker VM
+ hostId =
findSuitableHostIdForWorkerVmPlacement(sourcePool.getClusterId());
+ if (hostId == null) {
+ throw new CloudRuntimeException("Offline Migration failed,
unable to find suitable host for worker VM placement in the cluster of storage
pool: " + sourcePool.getName());
+ }
+ if (ScopeType.CLUSTER.equals(targetScopeType) &&
!sourcePool.getClusterId().equals(targetPool.getClusterId())) {
+ // Without host vMotion might fail between non-shared storages
with error similar to,
+ // https://kb.vmware.com/s/article/1003795
+ List<HostVO> hosts =
hostDao.findHypervisorHostInCluster(targetPool.getClusterId());
+ if (CollectionUtils.isNotEmpty(hosts)) {
+ hostGuidInTargetCluster = hosts.get(0).getGuid();
+ }
+ if (hostGuidInTargetCluster == null) {
+ throw new CloudRuntimeException("Offline Migration failed,
unable to find suitable target host for worker VM placement while migrating
between storage pools of different cluster without shared storages");
+ }
+ }
+ } else if (ScopeType.CLUSTER.equals(targetScopeType)) {
+ hostId =
findSuitableHostIdForWorkerVmPlacement(targetPool.getClusterId());
+ if (hostId == null) {
+ throw new CloudRuntimeException("Offline Migration failed,
unable to find suitable host for worker VM placement in the cluster of storage
pool: " + targetPool.getName());
+ }
+ }
Review comment:
@DaanHoogland done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]