rhtyd commented on a change in pull request #4148:
URL: https://github.com/apache/cloudstack/pull/4148#discussion_r441243375



##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1187,6 +1189,16 @@ private VolumeVO orchestrateResizeVolume(long volumeId, 
long currentSize, long n
             if (currentSize != newSize && 
_volsDao.getHypervisorType(volume.getId()) == HypervisorType.XenServer && 
!userVm.getState().equals(State.Stopped)) {
                 throw new InvalidParameterValueException(errorMsg);
             }
+
+            /* Do not resize volume of running vm on KVM host if host is not 
Up or not Enabled */
+            if (currentSize != newSize && userVm.getState() == State.Running 
&& userVm.getHypervisorType() == HypervisorType.KVM) {
+                HostVO host = _hostDao.findById(userVm.getHostId());
+                if (host.getStatus() != Status.Up) {

Review comment:
       @ustcweizhou should you do a null check, what if the host was removed?




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


Reply via email to