mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
kvm: Disable shrinking QCOW2 volumes (#4679)
Since QCOW2 volumes cannot be resized to lower value in any case, just disable it in backend.
This commit is contained in:
parent
7208fac18b
commit
262285639e
@ -1061,6 +1061,14 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
* This will be checked again at the hypervisor level where we can see
|
* This will be checked again at the hypervisor level where we can see
|
||||||
* the actual disk size.
|
* the actual disk size.
|
||||||
*/
|
*/
|
||||||
|
if (currentSize > newSize) {
|
||||||
|
VolumeVO vol = _volsDao.findById(cmd.getEntityId());
|
||||||
|
if (vol != null && ImageFormat.QCOW2.equals(vol.getFormat()) && !Volume.State.Allocated.equals(volume.getState())) {
|
||||||
|
String message = "Unable to shrink volumes of type QCOW2";
|
||||||
|
s_logger.warn(message);
|
||||||
|
throw new InvalidParameterValueException(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (currentSize > newSize && !shrinkOk) {
|
if (currentSize > newSize && !shrinkOk) {
|
||||||
throw new InvalidParameterValueException("Going from existing size of " + currentSize + " to size of " + newSize + " would shrink the volume."
|
throw new InvalidParameterValueException("Going from existing size of " + currentSize + " to size of " + newSize + " would shrink the volume."
|
||||||
+ "Need to sign off by supplying the shrinkok parameter with value of true.");
|
+ "Need to sign off by supplying the shrinkok parameter with value of true.");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user