mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +02: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 {
|
||||
|
||||
if (command.getCurrentSize() >= newSize) {
|
||||
logger.info("No need to resize volume: " + volId +", current size " + toHumanReadableSize(command.getCurrentSize()) + " is same as new size " + toHumanReadableSize(newSize));
|
||||
if (command.getCurrentSize() == 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);
|
||||
} 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()) {
|
||||
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."
|
||||
+ "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 */
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
:checked="autoMigrate"
|
||||
@change="val => { autoMigrate = val }"/>
|
||||
</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
|
||||
v-model:checked="form.shrinkOk"
|
||||
:checked="shrinkOk"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user