Commit 4c8421bd authored by Dietmar Maurer's avatar Dietmar Maurer

HDMove: add flag to delete source volume after move

And use new API entry point move_disk (changed in recent qemu-server)
parent d7003146
...@@ -4,7 +4,7 @@ Ext.define('PVE.window.HDMove', { ...@@ -4,7 +4,7 @@ Ext.define('PVE.window.HDMove', {
resizable: false, resizable: false,
move_disk: function(disk, storage, format) { move_disk: function(disk, storage, format, delete_disk) {
var me = this; var me = this;
params = { disk: disk, storage: storage }; params = { disk: disk, storage: storage };
...@@ -12,10 +12,14 @@ Ext.define('PVE.window.HDMove', { ...@@ -12,10 +12,14 @@ Ext.define('PVE.window.HDMove', {
if (format) { if (format) {
params.format = format; params.format = format;
} }
if (delete_disk) {
params['delete'] = 1;
};
PVE.Utils.API2Request({ PVE.Utils.API2Request({
params: params, params: params,
url: '/nodes/' + me.nodename + '/qemu/' + me.vmid + '/move', url: '/nodes/' + me.nodename + '/qemu/' + me.vmid + '/move_disk',
waitMsgTarget: me, waitMsgTarget: me,
method: 'POST', method: 'POST',
failure: function(response, opts) { failure: function(response, opts) {
...@@ -97,9 +101,18 @@ Ext.define('PVE.window.HDMove', { ...@@ -97,9 +101,18 @@ Ext.define('PVE.window.HDMove', {
}); });
items.push(me.hdstoragesel); items.push(me.hdstoragesel);
items.push(me.formatsel); items.push(me.formatsel);
items.push({
xtype: 'pvecheckbox',
fieldLabel: gettext('Delete source'),
name: 'deleteDisk',
uncheckedValue: 0,
checked: false
});
me.formPanel = Ext.create('Ext.form.Panel', { me.formPanel = Ext.create('Ext.form.Panel', {
bodyPadding: 10, bodyPadding: 10,
border: false, border: false,
...@@ -120,7 +133,8 @@ Ext.define('PVE.window.HDMove', { ...@@ -120,7 +133,8 @@ Ext.define('PVE.window.HDMove', {
handler: function() { handler: function() {
if (form.isValid()) { if (form.isValid()) {
var values = form.getValues(); var values = form.getValues();
me.move_disk(me.disk, values.hdstorage, values.diskformat); me.move_disk(me.disk, values.hdstorage, values.diskformat,
values.deleteDisk);
} }
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment