Skip to content
Permalink
Browse files
CLOUDSTACK-9101: add UI support for root volume resize
  • Loading branch information
ustcweizhou committed Dec 3, 2015
1 parent 119b27b commit d6e21f74163212b198731ddf23dd48bc4c787b84
Showing 1 changed file with 22 additions and 7 deletions.
@@ -1536,14 +1536,27 @@
},
createForm: {
title: 'label.action.resize.volume',
preFilter: function(args) {
if (args.context.volumes != null && args.context.volumes[0].type == 'ROOT') {
args.$form.find('.form-item[rel=newdiskoffering]').hide();
} else {
args.$form.find('.form-item[rel=newsize]').hide();
}
},
fields: {
newdiskoffering: {
label: 'label.resize.new.offering.id',
select: function(args) {
if (args.context.volumes != null && args.context.volumes[0].type == 'ROOT') {
args.response.success({
data: []
});
return;
}

$.ajax({
url: createURL("listDiskOfferings"),
dataType: "json",
async: false,
success: function(json) {
diskofferingObjs = json.listdiskofferingsresponse.diskoffering;
var items = [];
@@ -1605,8 +1618,7 @@
validation: {
required: true,
number: true
},
isHidden: true
}
},
shrinkok: {
label: 'label.resize.shrink.ok',
@@ -1640,7 +1652,7 @@

var newDiskOffering = args.data.newdiskoffering;
var newSize;
if (selectedDiskOfferingObj.iscustomized == true) {
if (selectedDiskOfferingObj == null || selectedDiskOfferingObj.iscustomized == true) {
newSize = args.data.newsize;
}
if (newDiskOffering != null && newDiskOffering.length > 0) {
@@ -1651,9 +1663,9 @@
}

var minIops;
var maxIops
var maxIops;

if (selectedDiskOfferingObj.iscustomizediops == true) {
if (selectedDiskOfferingObj != null && selectedDiskOfferingObj.iscustomizediops == true) {
minIops = args.data.minIops;
maxIops = args.data.maxIops;
}
@@ -2338,11 +2350,14 @@
allowedActions.push("takeSnapshot");
allowedActions.push("recurringSnapshot");
}
}

if (jsonObj.type == "DATADISK") {
if (jsonObj.hypervisor == "KVM" || jsonObj.hypervisor == "XenServer" || jsonObj.hypervisor == "VMware") {
if (jsonObj.state == "Ready" || jsonObj.state == "Allocated") {
allowedActions.push("resize");
}
}

if (jsonObj.state != "Allocated") {
if ((jsonObj.vmstate == "Stopped" || jsonObj.virtualmachineid == null) && jsonObj.state == "Ready") {
allowedActions.push("downloadVolume");

0 comments on commit d6e21f7

Please sign in to comment.