From e43a4b9a09eb330ab148a4913c36e1ca2738adc3 Mon Sep 17 00:00:00 2001 From: Rashmi D Date: Thu, 3 Aug 2017 04:15:45 +0530 Subject: [PATCH] CLOUDSTACK-9697: Added better error message user if tries to shrink (#2145) the VM ROOT volume size Skip the API call altogether if the UI detects this and throw a more user friendly message --- ui/l10n/en.js | 1 + ui/scripts/storage.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ui/l10n/en.js b/ui/l10n/en.js index a5797845cb3..3503296c69f 100644 --- a/ui/l10n/en.js +++ b/ui/l10n/en.js @@ -2276,6 +2276,7 @@ var dictionary = {"ICMP.code":"ICMP Code", "message.vnmc.available.list":"VNMC is not available from provider list.", "message.vnmc.not.available.list":"VNMC is not available from provider list.", "message.volume.create.template.confirm":"Please confirm that you wish to create a template for this disk volume. Creation of the template can range from several minutes to longer depending on the size of the volume.", +"message.volume.root.shrink.disk.size" :"Shrink operation on ROOT volume not supported", "message.waiting.for.builtin.templates.to.load":"Waiting for builtin templates to load...", "message.you.must.have.at.least.one.physical.network":"You must have at least one physical network", "message.your.cloudstack.is.ready":"Your CloudStack is ready!", diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index 9638f1e5e2a..b71dbe2ec2f 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -1706,6 +1706,11 @@ array1.push("&maxiops=" + todb(maxIops)); } } + //if original disk size > new disk size + if ((args.context.volumes[0].type == "ROOT") + && (args.context.volumes[0].size > (newSize * (1024 * 1024 * 1024)))) { + return args.response.error('message.volume.root.shrink.disk.size'); + } $.ajax({