From 5ae65bfab058a37eda0f90f9a495658ae7f3d37e Mon Sep 17 00:00:00 2001 From: Spaceman1984 <49917670+Spaceman1984@users.noreply.github.com> Date: Wed, 12 Feb 2020 15:33:14 +0200 Subject: [PATCH] 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 --- ui/scripts/storage.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index ab9747990eb..f790593fc3d 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -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",