From e2d38abe064dc25244102ec436feb8fae2641acd Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Wed, 22 Mar 2017 11:32:47 +0100 Subject: [PATCH 01/15] F #5001 Added trash icon in VM.TerminateHARD (#227) --- src/sunstone/public/app/tabs/vms-tab/buttons.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/vms-tab/buttons.js b/src/sunstone/public/app/tabs/vms-tab/buttons.js index 0a210276d2..7512bb6d81 100644 --- a/src/sunstone/public/app/tabs/vms-tab/buttons.js +++ b/src/sunstone/public/app/tabs/vms-tab/buttons.js @@ -141,9 +141,11 @@ define(function(require) { custom_classes : "state-dependent" }, "VM.terminate_hard" : { - type: text, - text: Locale.tr("Terminate") + ' ' + Locale.tr("hard") + '', + type: "confirm", + icon: "", + text: Locale.tr(" Terminate") + ' ' + Locale.tr("hard") + '', layout: "vmsdelete_buttons", + tip: Locale.tr("This will remove information from non-persistent hard disks"), custom_classes : "state-dependent" }, "VM.resched" : { From dec4ac7b5711885fd50cc187e89d190937bd7933 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Wed, 22 Mar 2017 13:31:09 +0100 Subject: [PATCH 02/15] Added dialog in Revert Snapshots (#228) --- src/sunstone/public/app/tabs/vms-tab.js | 1 + .../public/app/tabs/vms-tab/dialogs/revert.js | 92 +++++++++++++++++++ .../tabs/vms-tab/dialogs/revert/dialogId.js | 19 ++++ .../app/tabs/vms-tab/dialogs/revert/html.hbs | 40 ++++++++ .../app/tabs/vms-tab/panels/snapshots.js | 6 +- 5 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/revert.js create mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/revert/dialogId.js create mode 100644 src/sunstone/public/app/tabs/vms-tab/dialogs/revert/html.hbs diff --git a/src/sunstone/public/app/tabs/vms-tab.js b/src/sunstone/public/app/tabs/vms-tab.js index f8c62025f0..2264fbce52 100644 --- a/src/sunstone/public/app/tabs/vms-tab.js +++ b/src/sunstone/public/app/tabs/vms-tab.js @@ -33,6 +33,7 @@ define(function(require) { require('./vms-tab/dialogs/disk-resize'), require('./vms-tab/dialogs/attach-nic'), require('./vms-tab/dialogs/snapshot'), + require('./vms-tab/dialogs/revert'), require('./vms-tab/dialogs/vnc'), require('./vms-tab/dialogs/spice'), require('./vms-tab/dialogs/saveas-template') diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/revert.js b/src/sunstone/public/app/tabs/vms-tab/dialogs/revert.js new file mode 100644 index 0000000000..19805bcb63 --- /dev/null +++ b/src/sunstone/public/app/tabs/vms-tab/dialogs/revert.js @@ -0,0 +1,92 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +define(function(require) { + /* + DEPENDENCIES + */ + + var BaseDialog = require('utils/dialogs/dialog'); + var TemplateHTML = require('hbs!./revert/html'); + var Sunstone = require('sunstone'); + var Tips = require('utils/tips'); + + /* + CONSTANTS + */ + + var DIALOG_ID = require('./revert/dialogId'); + var TAB_ID = require('../tabId') + + /* + CONSTRUCTOR + */ + + function Dialog() { + this.dialogId = DIALOG_ID; + + BaseDialog.call(this); + }; + + Dialog.DIALOG_ID = DIALOG_ID; + Dialog.prototype = Object.create(BaseDialog.prototype); + Dialog.prototype.constructor = Dialog; + Dialog.prototype.html = _html; + Dialog.prototype.onShow = _onShow; + Dialog.prototype.setup = _setup; + Dialog.prototype.setElement = _setElement; + + return Dialog; + + /* + FUNCTION DEFINITIONS + */ + + function _html() { + return TemplateHTML({ + 'dialogId': this.dialogId + }); + } + + function _setup(context) { + + var that = this; + + Tips.setup(context); + + $('#' + DIALOG_ID + 'Form', context).submit(function() { + + var snapshot_id = $(this).parents('tr').attr('snapshot_id'); + Sunstone.runAction('VM.snapshot_revert', that.element.ID, {"snapshot_id": snapshot_id}); + + Sunstone.getDialog(DIALOG_ID).hide(); + Sunstone.getDialog(DIALOG_ID).reset(); + return false; + }); + + return false; + } + + function _onShow(context) { + this.setNames( {tabId: TAB_ID} ); + return false; + } + + function _setElement(element) { + this.element = element + } + +}); diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/revert/dialogId.js b/src/sunstone/public/app/tabs/vms-tab/dialogs/revert/dialogId.js new file mode 100644 index 0000000000..14a82c35cd --- /dev/null +++ b/src/sunstone/public/app/tabs/vms-tab/dialogs/revert/dialogId.js @@ -0,0 +1,19 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +define(function(require) { + return 'revertVMDialog'; +}); diff --git a/src/sunstone/public/app/tabs/vms-tab/dialogs/revert/html.hbs b/src/sunstone/public/app/tabs/vms-tab/dialogs/revert/html.hbs new file mode 100644 index 0000000000..1aa1649b9c --- /dev/null +++ b/src/sunstone/public/app/tabs/vms-tab/dialogs/revert/html.hbs @@ -0,0 +1,40 @@ +{{! -------------------------------------------------------------------------- }} +{{! Copyright 2002-2016, OpenNebula Project, OpenNebula Systems }} +{{! }} +{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }} +{{! not use this file except in compliance with the License. You may obtain }} +{{! a copy of the License at }} +{{! }} +{{! http://www.apache.org/licenses/LICENSE-2.0 }} +{{! }} +{{! Unless required by applicable law or agreed to in writing, software }} +{{! distributed under the License is distributed on an "AS IS" BASIS, }} +{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }} +{{! See the License for the specific language governing permissions and }} +{{! limitations under the License. }} +{{! -------------------------------------------------------------------------- }} + +
+
+

+ {{tr "Revert"}} +

+
+
+
+
+
+
{{tr "You have to confirm this action."}}
+
+
{{tr "Do you want to proceed?"}}
+
+
+
+ +
+ +
+
+
diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/snapshots.js b/src/sunstone/public/app/tabs/vms-tab/panels/snapshots.js index 369dea7c9f..ba6d083e11 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/snapshots.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/snapshots.js @@ -34,6 +34,7 @@ define(function(require) { var TAB_ID = require('../tabId'); var PANEL_ID = require('./snapshots/panelId'); var SNAPSHOT_DIALOG_ID = require('../dialogs/snapshot/dialogId'); + var REVERT_DIALOG_ID = require('../dialogs/revert/dialogId'); var RESOURCE = "VM" var XML_ROOT = "VM" @@ -165,8 +166,9 @@ define(function(require) { if (Config.isTabActionEnabled("vms-tab", "VM.snapshot_revert")) { context.off('click', '.snapshot_revert'); context.on('click', '.snapshot_revert', function() { - var snapshot_id = $(this).parents('tr').attr('snapshot_id'); - Sunstone.runAction('VM.snapshot_revert', that.element.ID, {"snapshot_id": snapshot_id}); + var dialog = Sunstone.getDialog(REVERT_DIALOG_ID); + dialog.setElement(that.element); + dialog.show(); return false; }); } From 11b636133ab9bc324e1b7b738166333b2c78e6ef Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Wed, 22 Mar 2017 19:11:38 +0100 Subject: [PATCH 03/15] Add usage comment to patch ip4_6_static.rb --- src/onedb/patches/ip4_ip6_static.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/onedb/patches/ip4_ip6_static.rb b/src/onedb/patches/ip4_ip6_static.rb index 5effc77b25..739e448df9 100644 --- a/src/onedb/patches/ip4_ip6_static.rb +++ b/src/onedb/patches/ip4_ip6_static.rb @@ -14,6 +14,18 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +# This patch changes the type of an AR to IP4_6_STATIC and also lets +# us add or change parameters. The AR must be specified in the extra +# option. For example, to change network 2, ar 1 and add ip6 and +# prefix_length you can use: +# +# onedb patch -s one.db ip4_6_static.rb \ +# --extra vn=2;ar=1;ip6=2001::1;prefix_length=48 +# +# You can also specify several ARs separated by ,: +# +# vn=3;ar=0;ip6=2001::1;prefix_length=48,vn=3;ar=1;ip6=2001::2;prefix_length=64 + if !ONE_LOCATION LOG_LOCATION = "/var/log/one" else From 5e9dbba51577e04aac9a48e66c798c6c021a70fe Mon Sep 17 00:00:00 2001 From: abelCoronado93 Date: Thu, 23 Mar 2017 10:39:17 +0100 Subject: [PATCH 04/15] Solves bugs: * issue with DISK_COST attribute for regaular users (cherry picked from commit 8353763bc776992f809b0a8cdcc909ae6f24c9ac) * IPv6 remove attribute from AR (cherry picked from commit 54ecd1e2ab0c88266aefce520aeec39211661fcc) --- .../templates-tab/form-panels/create/wizard-tabs/general.js | 2 +- .../form-panels/create/wizard-tabs/network/nic-tab/html.hbs | 2 +- src/sunstone/public/app/tabs/vnets-tab/utils/ar-tab/html.hbs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js index 4945e55170..1800b5784b 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js @@ -182,7 +182,7 @@ define(function(require) { templateJSON["DISK_COST"] = templateJSON["DISK_COST"] * 1024; } else{ - templateJSON["DISK_COST"] = "0"; + delete templateJSON["MEMORY_UNIT_COST"]; } if(templateJSON["MEMORY_UNIT_COST"] == "GB") templateJSON["MEMORY_COST"] = templateJSON["MEMORY_COST"] * 1024; diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs index b50bdf0ac8..1f7e6af1ff 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs @@ -106,7 +106,7 @@
diff --git a/src/sunstone/public/app/tabs/vnets-tab/utils/ar-tab/html.hbs b/src/sunstone/public/app/tabs/vnets-tab/utils/ar-tab/html.hbs index fda4190888..df52e55a05 100644 --- a/src/sunstone/public/app/tabs/vnets-tab/utils/ar-tab/html.hbs +++ b/src/sunstone/public/app/tabs/vnets-tab/utils/ar-tab/html.hbs @@ -44,7 +44,7 @@
- +
From 57bc086cb89297a3295b549d3d1b19b0099c2fd0 Mon Sep 17 00:00:00 2001 From: mcabrerizo Date: Fri, 24 Mar 2017 13:02:05 +0100 Subject: [PATCH 05/15] B #5077: Destroy VM if reconfigure or poweron actions fail in clone_vm --- src/vmm_mad/remotes/vcenter/vcenter_driver.rb | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb index 3d3e741cac..686c28cbfe 100644 --- a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb +++ b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb @@ -2677,20 +2677,31 @@ private end + begin + # Reconfigure the VM + reconfigure_vm(vm, xml, true, hostname) + rescue Exception => e + vm.Destroy_Task.wait_for_completion + raise "Could not reconfigure the VM after a clone has been created: #{e.message}" + end + begin + # Power on the VM + vm.PowerOnVM_Task.wait_for_completion + rescue Exception => e + vm.Destroy_Task.wait_for_completion + raise "Could not power on the VM: #{e.message}" + end - reconfigure_vm(vm, xml, true, hostname) - - # Power on the VM - vm.PowerOnVM_Task.wait_for_completion - - # Set to yes the running flag - - config_array = [{:key=>"opennebula.vm.running",:value=>"yes"}] - spec = RbVmomi::VIM.VirtualMachineConfigSpec( - {:extraConfig =>config_array}) - - vm.ReconfigVM_Task(:spec => spec).wait_for_completion + begin + # Set the running flag to yes + config_array = [{:key=>"opennebula.vm.running",:value=>"yes"}] + spec = RbVmomi::VIM.VirtualMachineConfigSpec({:extraConfig =>config_array}) + vm.ReconfigVM_Task(:spec => spec).wait_for_completion + rescue Exception => e + vm.Destroy_Task.wait_for_completion + raise "Could not set opennebula.vm.running: #{e.message}" + end return vm.config.uuid end From 80b0991cc9adf861d8d65cc2df8f28d86a721206 Mon Sep 17 00:00:00 2001 From: juanmont Date: Mon, 27 Mar 2017 12:32:10 +0200 Subject: [PATCH 06/15] Feature #5027 (PR #229): Sunstone IPv6 interface * changed ar-datatable with ranges * Feature vnet Added IPV6 support to virtual routers --- .../create/wizard-tabs/network/nic-tab/html.hbs | 4 ++-- .../form-panels/instantiate.js | 1 + .../app/tabs/vrouters-tab/dialogs/attach-nic.js | 1 + src/sunstone/public/app/utils/nics-section.js | 9 +++++++++ .../public/app/utils/nics-section/dd.hbs | 17 +++++++++++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs index 1f7e6af1ff..701b179b93 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs @@ -105,10 +105,10 @@ {{tr "Override Network Values IPv6"}}
-
{{/if}}
+
+ {{#if options.forceIPv6}} +
+ +
+ {{/if}} +
{{#if options.securityGroups}}
From 0d6259e009ee958843bbb34c48bf3352a494a14a Mon Sep 17 00:00:00 2001 From: juanmont Date: Mon, 27 Mar 2017 18:51:20 +0200 Subject: [PATCH 07/15] B #5079 Displayed advanced parameters per Role (#234) --- .../public/app/tabs/oneflow-templates-tab/form-panels/create.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js index 84c27b6c69..9bb19dd135 100644 --- a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js @@ -399,7 +399,6 @@ define(function(require) { $(".networks_role", role_section).show(); } - $(".vm_template_contents", role_section).val(""); $.each(selected_networks, function(){ $(".service_network_checkbox[value='"+this+"']", role_section).attr('checked', true).change(); From d90cd64cca544a7b0ea06018ff1c527e507c50e4 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 30 Mar 2017 18:54:58 +0200 Subject: [PATCH 08/15] B #5032: Add datastore capacity usage in quota calculations for storage drivers that clone to SELF (e.g. Ceph) --- include/Quotas.h | 19 +++++ include/VirtualMachine.h | 2 +- include/VirtualMachineDisk.h | 21 ++++- src/dm/DispatchManagerActions.cc | 4 +- src/dm/DispatchManagerStates.cc | 4 +- src/lcm/LifeCycleStates.cc | 11 ++- src/rm/RequestManagerAllocate.cc | 19 ++++- src/rm/RequestManagerVirtualMachine.cc | 47 ++++++---- src/vm/VirtualMachine.cc | 4 +- src/vm/VirtualMachineDisk.cc | 113 +++++++++++++++++-------- 10 files changed, 181 insertions(+), 63 deletions(-) diff --git a/include/Quotas.h b/include/Quotas.h index 030aca1fcc..d2da91e913 100644 --- a/include/Quotas.h +++ b/include/Quotas.h @@ -181,6 +181,25 @@ public: quota_del(DATASTORE, uid, gid, tmpl); } + /** + * Delete Datastore related usage from quota counters. + * for the given user and group + * @param uid of the user + * @param gid of the group + * @param tmpl template for the image, with usage + */ + static void ds_del(int uid, int gid, vector