ui: Fixed root volume resize from ui (#3873)

This PR fixes the volume resize action for a root volume from the UI.

Fixes: #3860 #3874
This commit is contained in:
Spaceman1984 2020-02-12 15:33:14 +02:00 committed by GitHub
parent 78cc0a44c1
commit 5ae65bfab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1575,13 +1575,13 @@
if (newDiskOffering != null && newDiskOffering.length > 0) {
array1.push("&diskofferingid=" + encodeURIComponent(newDiskOffering));
}
if (selectedDiskOfferingObj.iscustomized == true) {
if (args.context.volumes[0].type == "ROOT" || selectedDiskOfferingObj.iscustomized == true) {
cloudStack.addNewSizeToCommandUrlParameterArrayIfItIsNotNullAndHigherThanZero(array1, args.data.newsize);
}
var minIops;
var maxIops
if (selectedDiskOfferingObj.iscustomizediops == true) {
if (selectedDiskOfferingObj != null && selectedDiskOfferingObj.iscustomizediops == true) {
minIops = args.data.minIops;
maxIops = args.data.maxIops;
}
@ -1593,13 +1593,12 @@
if (maxIops != null && maxIops.length > 0) {
array1.push("&maxiops=" + encodeURIComponent(maxIops));
}
//if original disk size > new disk size
if ((args.context.volumes[0].type == "ROOT")
&& (args.context.volumes[0].size > (newSize * (1024 * 1024 * 1024)))) {
//if original disk size > new disk size
if (args.context.volumes[0].type == "ROOT" &&
args.context.volumes[0].size > (args.data.newsize * (1024 * 1024 * 1024))) {
return args.response.error('message.volume.root.shrink.disk.size');
}
$.ajax({
url: createURL("resizeVolume&id=" + args.context.volumes[0].id + array1.join("")),
dataType: "json",