GabrielBrascher commented on a change in pull request #4915:
URL: https://github.com/apache/cloudstack/pull/4915#discussion_r616916422



##########
File path: 
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
##########
@@ -3706,6 +3691,34 @@ public void checkIfCanUpgrade(final VirtualMachine 
vmInstance, final ServiceOffe
         }
     }
 
+    protected void 
checkIfNewOfferingStorageScopeMatchesStoragePool(VirtualMachine vmInstance, 
ServiceOffering newServiceOffering) {
+        boolean isRootVolumeOnLocalStorage = 
isRootVolumeOnLocalStorage(vmInstance.getId());
+
+        if (newServiceOffering.isUseLocalStorage() && 
!isRootVolumeOnLocalStorage) {
+            String message = String .format("Unable to upgrade virtual machine 
%s, target offering use local storage but the storage pool where "
+                    + "the volume is allocated is a shared storage.", 
vmInstance.toString());
+            throw new InvalidParameterValueException(message);
+        } else if (!newServiceOffering.isUseLocalStorage() && 
isRootVolumeOnLocalStorage) {

Review comment:
       Thanks for the suggestion @DaanHoogland, makes sense :+1:




-- 
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]


Reply via email to