You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/07/25 20:43:34 UTC

[GitHub] rafaelweingartner commented on a change in pull request #2761: Add managed storage pool constraints to MigrateWithVolume API method

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_r205255796
 
 

 ##########
 File path: engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
 ##########
 @@ -2332,15 +2339,44 @@ protected void migrate(final VMInstanceVO vm, final long srcHostId, final Deploy
         return volumeToPoolObjectMap;
     }
 
+    /**
+     *  If we the volume is placed in a managed storage we execute the following checks:
+     *  <ul>
+     *      <li> If the volume is not placed in a managed storage, then we do not need to proceed with these checks
+     *      <li> Cross cluster migration with cluster-wide storage pool. Volumes in managed storage cannot be migrated out of their current pool. Therefore, an exception is thrown.
+     *  </ul>
+     */
+    protected void executeManagedStorageChecks(Host targetHost, StoragePoolVO currentPool, VolumeVO volume) {
+        if (!currentPool.isManaged()) {
+            return;
+        }
+        if (currentPool.getClusterId() == targetHost.getClusterId()) {
 
 Review comment:
   Ok, got the first issue. If it is a zone wide storage,  we do not have a cluster ID. I fixed it now.
   
   I just do not understand why we need the `equals` method though. Even though both `currentPool.getClusterId()` and `targetHost.getClusterId()` return a Long object, because of Java auto boxing, everything is going to work just fine.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services