mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Block volume shrink on Xen (#11004)
Co-authored-by: João Jandre <joao@scclouds.com.br>
This commit is contained in:
parent
75147b7811
commit
ba0204f8ed
@ -49,9 +49,12 @@ public final class CitrixResizeVolumeCommandWrapper extends CommandWrapper<Resiz
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (command.getCurrentSize() >= newSize) {
|
if (command.getCurrentSize() == newSize) {
|
||||||
logger.info("No need to resize volume: " + volId +", current size " + toHumanReadableSize(command.getCurrentSize()) + " is same as new size " + toHumanReadableSize(newSize));
|
logger.info("No need to resize volume [{}], current size [{}] is same as new size [{}].", volId, toHumanReadableSize(command.getCurrentSize()), toHumanReadableSize(newSize));
|
||||||
return new ResizeVolumeAnswer(command, true, "success", newSize);
|
return new ResizeVolumeAnswer(command, true, "success", newSize);
|
||||||
|
} else if (command.getCurrentSize() > newSize) {
|
||||||
|
logger.error("XenServer does not support volume shrink. Volume [{}] current size [{}] is smaller than new size [{}]", volId, toHumanReadableSize(command.getCurrentSize()), toHumanReadableSize(newSize));
|
||||||
|
return new ResizeVolumeAnswer(command, false, "operation not supported");
|
||||||
}
|
}
|
||||||
if (command.isManaged()) {
|
if (command.isManaged()) {
|
||||||
resizeSr(conn, command);
|
resizeSr(conn, command);
|
||||||
|
|||||||
@ -2429,6 +2429,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
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.");
|
||||||
}
|
}
|
||||||
|
if (ApiDBUtils.getHypervisorTypeFromFormat(volume.getDataCenterId(), volume.getFormat()) == HypervisorType.XenServer) {
|
||||||
|
throw new InvalidParameterValueException("Shrink volume is not supported for the XenServer hypervisor.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Check resource limit for this account */
|
/* Check resource limit for this account */
|
||||||
|
|||||||
@ -90,7 +90,7 @@
|
|||||||
:checked="autoMigrate"
|
:checked="autoMigrate"
|
||||||
@change="val => { autoMigrate = val }"/>
|
@change="val => { autoMigrate = val }"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item name="shrinkOk" ref="shrinkOk" :label="$t('label.shrinkok')">
|
<a-form-item name="shrinkOk" ref="shrinkOk" :label="$t('label.shrinkok')" v-if="!['XenServer'].includes(resource.hypervisor)">
|
||||||
<a-switch
|
<a-switch
|
||||||
v-model:checked="form.shrinkOk"
|
v-model:checked="form.shrinkOk"
|
||||||
:checked="shrinkOk"
|
:checked="shrinkOk"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user