rafaelweingartner commented on a change in pull request #2761: Add managed 
storage pool constraints to MigrateWithVolume API method
URL: https://github.com/apache/cloudstack/pull/2761#discussion_r205258446
 
 

 ##########
 File path: 
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
 ##########
 @@ -2302,8 +2302,11 @@ protected void migrate(final VMInstanceVO vm, final 
long srcHostId, final Deploy
             StoragePoolVO targetPool = _storagePoolDao.findById(poolId);
             StoragePoolVO currentPool = 
_storagePoolDao.findById(volume.getPoolId());
 
-            if (_poolHostDao.findByPoolHost(targetPool.getId(), host.getId()) 
== null) {
-                throw new CloudRuntimeException(String.format("Cannot migrate 
the volume [%s] to the storage pool [%s] while migrating VM [%s] to target host 
[%s]. The host does not have access to the storage pool entered.", 
volume.getUuid(), targetPool.getUuid(), profile.getUuid(), host.getUuid()));
+            executeManagedStorageChecks(targetHost, currentPool, volume);
+            if (_poolHostDao.findByPoolHost(targetPool.getId(), 
targetHost.getId()) == null) {
+                throw new CloudRuntimeException(
+                        String.format("Cannot migrate the volume [%s] to the 
storage pool [%s] while migrating VM [%s] to target host [%s]. The host does 
not have access to the storage pool entered.",
+                                volume.getUuid(), targetPool.getUuid(), 
profile.getUuid(), targetHost.getUuid()));
             }
             if (currentPool.getId() == targetPool.getId()) {
 
 Review comment:
   You mean, I should not add an entry to the map if the volume is already in 
the "targetPool"?
   
   I did this way because of XenServer; when we have VMs with more than one 
volume. Then, if one volume is in a shared storage and the other in local 
storage, we need to send to Xen the complete map of “volume-storagePool”. 
Otherwise, the migration will not work. Since I am mapping the volume to its 
current storage pool I am expecting the other hypervisors to simply ignore the 
entry.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to