Added quiescevm option to volume snapshot dialog when storage supports it

CLOUDSTACK-5388
This commit is contained in:
Chris Suich 2013-12-05 15:40:07 -05:00 committed by Brian Federle
parent d09d21847c
commit 06344db330
2 changed files with 28 additions and 5 deletions

View File

@ -560,16 +560,39 @@
takeSnapshot: {
label: 'label.action.take.snapshot',
messages: {
confirm: function(args) {
return 'message.action.take.snapshot';
},
notification: function(args) {
return 'label.action.take.snapshot';
}
},
createForm: {
title: 'label.action.take.snapshot',
desc: 'message.action.take.snapshot',
fields: {
quiescevm: {
label: 'Quiesce VM',
isBoolean: true,
isHidden: function(args) {
var hidden = true;
$.ajax({
url: createURL('listStoragePools&id='+args.context.volumes[0].storageid),
dataType: "json",
async: false,
success: function(json) {
if (json.liststoragepoolsresponse.storagepool[0].storagecapabilities.VOLUME_SNAPSHOT_QUIESCEVM == 'true')
hidden = false;
else
hidden = true;
}
});
return hidden;
}
}
}
},
action: function(args) {
$.ajax({
url: createURL("createSnapshot&volumeid=" + args.context.volumes[0].id),
url: createURL("createSnapshot&volumeid=" + args.context.volumes[0].id + "&quiescevm=" + args.context.quiescevm),
dataType: "json",
async: true,
success: function(json) {

View File

@ -144,7 +144,7 @@
if (field.isHidden != null) {
if (typeof(field.isHidden) == 'boolean' && field.isHidden == true)
$formItem.hide();
else if (typeof(field.isHidden) == 'function' && field.isHidden() == true)
else if (typeof(field.isHidden) == 'function' && field.isHidden(args) == true)
$formItem.hide();
}