1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #2138 Add Sunstone changes

This commit is contained in:
Christian González 2018-12-11 10:07:49 +01:00 committed by Ruben S. Montero
parent 9888a193b9
commit d2204ab4d6
8 changed files with 79 additions and 9 deletions

View File

@ -45,8 +45,10 @@ module OpenNebulaJSON
rc = case action_hash['perform']
when "deploy" then self.deploy(action_hash['params'])
when "hold" then self.hold
when "livemigrate" then self.migrate(action_hash['params'], true)
when "migrate" then self.migrate(action_hash['params'], false)
when "livemigrate" then self.migrate(action_hash['params'], true, 0)
when "migrate" then self.migrate(action_hash['params'], false, 0)
when "migrate_poff" then self.migrate(action_hash['params'], false, 1)
when "migrate_poff_hard" then self.migrate(action_hash['params'], false, 2)
when "resume" then self.resume
when "release" then self.release
when "stop" then self.stop
@ -107,8 +109,8 @@ module OpenNebulaJSON
super(params['hard'])
end
def migrate(params=Hash.new, live=false)
super(params['host_id'], live, params['enforce'], params['ds_id'])
def migrate(params=Hash.new, live=false, mtype)
super(params['host_id'], live, params['enforce'], params['ds_id'], mtype)
end
def disk_saveas(params=Hash.new)

View File

@ -447,6 +447,14 @@ define(function(require) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "migrate", action_obj);
},
"migrate_poff": function(params) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "migrate_poff", action_obj);
},
"migrate_poff_hard": function(params) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "migrate_poff_hard", action_obj);
},
"disk_saveas": function(params) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "disk_saveas", action_obj);

View File

@ -408,6 +408,11 @@ define(function(require) {
text = button.text;
buttonCode = "<li><a class=\"" + strClass.join(" ") + "\" href=\"" + buttonName + "\">" + text + "</a></li>";
break;
case "vmsmigration_buttons":
buttonContext = $("#" + customId + "vmsmigration_buttons", buttonsRow);
text = button.text;
buttonCode = "<li><a class=\"" + strClass.join(" ") + "\" href=\"" + buttonName + "\">" + text + "</a></li>";
break;
case "more_select":
buttonContext = $("#" + customId + "more_buttons", buttonsRow);
text = button.text;
@ -461,6 +466,10 @@ define(function(require) {
$("button[data-toggle=" + customId + "vmsplanification_buttons]", actionBlock).remove();
}
if ($("#" + customId + "vmsmigration_buttons li", actionBlock).length == 0) {
$("button[data-toggle=" + customId + "vmsmigration_buttons]", actionBlock).remove();
}
if ($("#" + customId + "vmsdelete_buttons li", actionBlock).length == 0) {
$("button[data-toggle=" + customId + "vmsdelete_buttons]", actionBlock).remove();
}

View File

@ -65,6 +65,11 @@
</button>
<ul id='{{customId}}vmsplanification_buttons' class='only-sunstone-info only-sunstone-list dropdown-pane menu vertical' data-dropdown></ul>
<button type='button' data-toggle='{{customId}}vmsmigration_buttons' class='only-sunstone-info only-sunstone-list top_button button secondary dropdown'>
<i class='fas fa-share-square'/>
</button>
<ul id='{{customId}}vmsmigration_buttons' class='only-sunstone-info only-sunstone-list dropdown-pane menu vertical' data-dropdown></ul>
</span>
<span>
<button type='button' data-toggle='{{customId}}more_buttons' class='only-sunstone-info only-sunstone-list top_button button secondary dropdown'>

View File

@ -86,6 +86,8 @@ define(function(require) {
"VM.append_template": _commonActions.appendTemplate(),
"VM.deploy_action": _commonActions.singleAction('deploy'),
"VM.migrate_action": _commonActions.singleAction('migrate'),
"VM.migrate_poff_action": _commonActions.singleAction('migrate_poff'),
"VM.migrate_poff_hard_action": _commonActions.singleAction('migrate_poff_hard'),
"VM.migrate_live_action": _commonActions.singleAction('livemigrate'),
"VM.attachdisk": _commonActions.singleAction('attachdisk'),
"VM.detachdisk": _commonActions.singleAction('detachdisk'),
@ -135,6 +137,27 @@ define(function(require) {
var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID);
dialog.reset();
dialog.setLive(false);
dialog.setType(0);
dialog.show();
}
},
"VM.migrate_poff" : {
type: "custom",
call: function() {
var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID);
dialog.reset();
dialog.setLive(false);
dialog.setType(1);
dialog.show();
}
},
"VM.migrate_poff_hard" : {
type: "custom",
call: function() {
var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID);
dialog.reset();
dialog.setLive(false);
dialog.setType(2);
dialog.show();
}
},
@ -144,6 +167,7 @@ define(function(require) {
var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID);
dialog.reset();
dialog.setLive(true);
dialog.setType(0);
dialog.show();
}
},

View File

@ -57,13 +57,25 @@ define(function(require) {
"VM.migrate" : {
type: "action",
text: Locale.tr("Migrate"),
layout: "vmsplanification_buttons",
layout: "vmsmigration_buttons",
custom_classes : "state-dependent"
},
"VM.migrate_poff" : {
type: "action",
text: Locale.tr("Migrate") + ' <span class="label secondary radius">' + Locale.tr("Poweroff") + '</span>',
layout: "vmsmigration_buttons",
custom_classes : "state-dependent"
},
"VM.migrate_poff_hard" : {
type: "action",
text: Locale.tr("Migrate") + ' <span class="label secondary radius">' + Locale.tr("Poweroff-hard") + '</span>',
layout: "vmsmigration_buttons",
custom_classes : "state-dependent"
},
"VM.migrate_live" : {
type: "action",
text: Locale.tr("Migrate") + ' <span class="label secondary radius">' + Locale.tr("live") + '</span>',
layout: "vmsplanification_buttons",
layout: "vmsmigration_buttons",
custom_classes : "state-dependent"
},
"VM.hold" : {

View File

@ -62,6 +62,7 @@ define(function(require) {
Dialog.prototype.onShow = _onShow;
Dialog.prototype.setup = _setup;
Dialog.prototype.setLive = _setLive;
Dialog.prototype.setType = _setType;
return Dialog;
@ -103,8 +104,12 @@ define(function(require) {
$.each(Sunstone.getDataTable(TAB_ID).elements(), function(index, elem) {
if (that.live) {
Sunstone.runAction("VM.migrate_live_action", elem, extra_info);
} else {
} else if (that.type == 0) {
Sunstone.runAction("VM.migrate_action", elem, extra_info);
} else if (that.type == 1){
Sunstone.runAction("VM.migrate_poff_action", elem, extra_info);
} else if (that.type == 2){
Sunstone.runAction("VM.migrate_poff_hard_action", elem, extra_info);
}
});
@ -152,4 +157,9 @@ define(function(require) {
function _setLive(live) {
this.live = live;
}
// @param [Int] type Set migration type
function _setType(type) {
this.type = type;
}
});

View File

@ -60,7 +60,7 @@ define(function(require) {
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.PROLOG ] = ["VM.updateconf"];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.BOOT ] = [];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.RUNNING ] =
["VM.stop", "VM.suspend", "VM.reboot", "VM.reboot_hard", "VM.resched", "VM.unresched", "VM.poweroff", "VM.poweroff_hard", "VM.undeploy", "VM.undeploy_hard", "VM.migrate", "VM.migrate_live", "VM.attachdisk", "VM.detachdisk", "VM.attachnic", "VM.detachnic", "VM.disk_saveas", "VM.disk_snapshot_create", "VM.disk_snapshot_delete", "VM.terminate", "VM.terminate_hard", "VM.disk_resize"];
["VM.stop", "VM.suspend", "VM.reboot", "VM.reboot_hard", "VM.resched", "VM.unresched", "VM.poweroff", "VM.poweroff_hard", "VM.undeploy", "VM.undeploy_hard", "VM.migrate", "VM.migrate_live", "VM.migrate_poff", "VM.migrate_poff_hard", "VM.attachdisk", "VM.detachdisk", "VM.attachnic", "VM.detachnic", "VM.disk_saveas", "VM.disk_snapshot_create", "VM.disk_snapshot_delete", "VM.terminate", "VM.terminate_hard", "VM.disk_resize"];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.MIGRATE ] = [];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.SAVE_STOP ] = [];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.SAVE_SUSPEND ] = [];
@ -74,7 +74,7 @@ define(function(require) {
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.FAILURE ] = ["VM.terminate"];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.CLEANUP_RESUBMIT ] = ["VM.updateconf"];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.UNKNOWN ] =
["VM.resched", "VM.unresched", "VM.poweroff", "VM.poweroff_hard", "VM.undeploy", "VM.undeploy_hard", "VM.migrate", "VM.migrate_live", "VM.resume", "VM.terminate", "VM.terminate_hard"];
["VM.resched", "VM.unresched", "VM.poweroff", "VM.poweroff_hard", "VM.undeploy", "VM.undeploy_hard", "VM.migrate", "VM.migrate_live", "VM.migrate_poff", "VM.migrate_poff_hard", "VM.resume", "VM.terminate", "VM.terminate_hard"];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.HOTPLUG ] = [];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.SHUTDOWN_POWEROFF ] = ["VM.updateconf"];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.BOOT_UNKNOWN ] = [];