File tree Expand file tree Collapse file tree
server/src/main/java/com/cloud/storage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1061,6 +1061,14 @@ public VolumeVO resizeVolume(ResizeVolumeCmd cmd) throws ResourceAllocationExcep
10611061 * This will be checked again at the hypervisor level where we can see
10621062 * the actual disk size.
10631063 */
1064+ if (currentSize > newSize ) {
1065+ VolumeVO vol = _volsDao .findById (cmd .getEntityId ());
1066+ if (vol != null && ImageFormat .QCOW2 .equals (vol .getFormat ()) && !Volume .State .Allocated .equals (volume .getState ())) {
1067+ String message = "Unable to shrink volumes of type QCOW2" ;
1068+ s_logger .warn (message );
1069+ throw new InvalidParameterValueException (message );
1070+ }
1071+ }
10641072 if (currentSize > newSize && !shrinkOk ) {
10651073 throw new InvalidParameterValueException ("Going from existing size of " + currentSize + " to size of " + newSize + " would shrink the volume."
10661074 + "Need to sign off by supplying the shrinkok parameter with value of true." );
You can’t perform that action at this time.
0 commit comments