From cccffde4a6dc54d5f8aceefe7101d5df33c10e71 Mon Sep 17 00:00:00 2001 From: juanmont Date: Sun, 30 Oct 2016 12:04:34 +0100 Subject: [PATCH 01/13] F #4826: Confirm all vms actions - new tag 'confirm_vms' in .yalm files - change in users: cloud, admin and groupadmin --- src/sunstone/etc/sunstone-views/admin.yaml | 1 + src/sunstone/etc/sunstone-views/cloud.yaml | 1 + src/sunstone/etc/sunstone-views/groupadmin.yaml | 1 + src/sunstone/public/app/sunstone-config.js | 5 +++++ 4 files changed, 8 insertions(+) diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index fbb43d0725..c7841aa65a 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -1,5 +1,6 @@ small_logo: images/opennebula-5.0.png provision_logo: images/opennebula-5.0.png +confirm_vms: true enabled_tabs: - dashboard-tab - instances-top-tab diff --git a/src/sunstone/etc/sunstone-views/cloud.yaml b/src/sunstone/etc/sunstone-views/cloud.yaml index 00c5133b29..7201d6b9e9 100644 --- a/src/sunstone/etc/sunstone-views/cloud.yaml +++ b/src/sunstone/etc/sunstone-views/cloud.yaml @@ -1,4 +1,5 @@ provision_logo: images/opennebula-5.0.png +confirm_vms: true enabled_tabs: - provision-tab - settings-tab diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index c829ef12bc..144207051f 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -1,5 +1,6 @@ small_logo: images/opennebula-5.0.png provision_logo: images/opennebula-5.0.png +confirm_vms: true enabled_tabs: - dashboard-tab - instances-top-tab diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index d1c02c1f3e..6666a9a9e9 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -146,10 +146,15 @@ define(function(require) { 'vmLogos': (_config['vm_logos']), 'enabledTabs': _config['view']['enabled_tabs'], 'onedConf': _config['oned_conf'], + 'confirmVMActions': _config['view']['confirm_vms'], "allTabs": function() { return Object.keys(_config['view']['tabs']); } + + /*"isConfirmVmsActionsEnable": function() { + Console.Log(_config['view']['confirm_vms']); + }*/ } return Config; From 21913d5825e4329b99aa387eef22e811c458dec0 Mon Sep 17 00:00:00 2001 From: juanmont Date: Sun, 30 Oct 2016 12:00:11 +0100 Subject: [PATCH 02/13] B #4800 Sunstone show IP on main info page --- src/sunstone/public/app/tabs/vms-tab/panels/info.js | 4 +++- src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs | 7 +++++++ .../public/app/tabs/vms-tab/utils/datatable-common.js | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info.js b/src/sunstone/public/app/tabs/vms-tab/panels/info.js index a7b334a711..2784b5597a 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/info.js @@ -77,6 +77,8 @@ define(function(require) { var hostnameHTML = OpenNebula.VM.hostnameStrLink(this.element); var vrouterHTML = '--'; + var IP = OpenNebula.VM.ipsStr(this.element); + if (this.element.TEMPLATE.VROUTER_ID != undefined){ vrouterHTML = Navigation.link( OpenNebula.VirtualRouter.getName(this.element.TEMPLATE.VROUTER_ID), @@ -122,6 +124,7 @@ define(function(require) { 'hostnameHTML': hostnameHTML, 'prettyStartTime': prettyStartTime, 'deployId': deployId, + 'IP': IP, 'resched': resched, 'permissionsTableHTML': permissionsTableHTML, 'templateTableHTML': templateTableHTML, @@ -133,7 +136,6 @@ define(function(require) { function _setup(context) { RenameTr.setup(TAB_ID, RESOURCE, this.element.ID, context); PermissionsTable.setup(TAB_ID, RESOURCE, this.element, context); - // Get rid of the unwanted (for show) SCHED_* keys var that = this; var strippedTemplate = {}; diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs index 10bae54700..e19be83db1 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs +++ b/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs @@ -43,6 +43,13 @@ {{{hostnameHTML}}} + + + {{tr "IP"}} + {{{IP}}} + + + {{tr "Start time"}} {{prettyStartTime}} diff --git a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js index 6e8c515d09..657edb0649 100644 --- a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js +++ b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js @@ -130,6 +130,7 @@ define(function(require) { ]; } + function _emptyElementArray(vmId) { return [ ' Date: Thu, 3 Nov 2016 17:05:00 +0100 Subject: [PATCH 04/13] F #4841 IE Compatibility mode force off - new tag meta in index.erb and login.erb for force the compatibility mode off --- src/sunstone/views/index.erb | 2 ++ src/sunstone/views/login.erb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index 41f7ad04ee..c082b45c25 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -2,6 +2,7 @@ + OpenNebula Sunstone: Cloud Operations Center @@ -59,6 +60,7 @@ <% else %> + <% end %> diff --git a/src/sunstone/views/login.erb b/src/sunstone/views/login.erb index 1aba62d546..2c4d711d2e 100644 --- a/src/sunstone/views/login.erb +++ b/src/sunstone/views/login.erb @@ -1,7 +1,9 @@ + + OpenNebula Sunstone Login From 4c555b0d165a7bc2c69e089d0481e095e4223311 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Thu, 3 Nov 2016 18:06:29 +0100 Subject: [PATCH 05/13] B #4895: onedb fsck breaks with volatile disks --- src/onedb/fsck.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onedb/fsck.rb b/src/onedb/fsck.rb index 3862d0d9f8..9f52c559ab 100644 --- a/src/onedb/fsck.rb +++ b/src/onedb/fsck.rb @@ -2637,7 +2637,7 @@ EOT # Params: # +disk+:: Nokogiri::XML::Node describing a disk used by a template def get_image_from_name(disk) - name = disk.at_xpath("IMAGE").content # always defined + name = disk.at_xpath("IMAGE") && disk.at_xpath("IMAGE").content uid = disk.at_xpath("IMAGE_UID") uname = disk.at_xpath("IMAGE_UNAME") From f46d64f785dab684a936325b9e8e49b41c0521ec Mon Sep 17 00:00:00 2001 From: Roy Keene Date: Fri, 4 Nov 2016 11:02:20 +0100 Subject: [PATCH 06/13] B #4896: xpath.rb can't print XPath-specified attributes Signed-off-by: Ruben S. Montero --- src/datastore_mad/remotes/xpath.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/datastore_mad/remotes/xpath.rb b/src/datastore_mad/remotes/xpath.rb index ec424f0e85..ce57ddb651 100755 --- a/src/datastore_mad/remotes/xpath.rb +++ b/src/datastore_mad/remotes/xpath.rb @@ -64,7 +64,13 @@ ARGV.each do |xpath| values << ar.join(' ') else element = xml.elements[xpath.dup] - values << element.text.to_s if !element.nil? + if !element.nil? + if element.class.method_defined?(:text) + values << element.text + else + values << element.to_s + end + end end values << "\0" end From 9c92e6ea1ef964804688e9417319acbb30bc70a6 Mon Sep 17 00:00:00 2001 From: Laurent Grawet Date: Sat, 5 Nov 2016 21:24:28 +0100 Subject: [PATCH 07/13] tm_mad: fix wrong variable names that prevents execution of migrate_other (#138) --- src/tm_mad/common/prepostmigrate | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tm_mad/common/prepostmigrate b/src/tm_mad/common/prepostmigrate index 3948c77672..44a1a18463 100755 --- a/src/tm_mad/common/prepostmigrate +++ b/src/tm_mad/common/prepostmigrate @@ -25,8 +25,8 @@ # - template is the template of the VM in XML and base64 encoded # - system_ds_mad flag if called by other SYSTEM_DS TM_MAD -SRC="$1" -DST="$2" +SRC_HOST="$1" +DST_HOST="$2" DST_PATH="$3" VM_ID="$4" DS_ID="$5" From 1ba3862b64fd30c08be1c43bbf3d9fb21e429d99 Mon Sep 17 00:00:00 2001 From: Laurent Grawet Date: Sat, 5 Nov 2016 21:46:15 +0100 Subject: [PATCH 08/13] vnm_mad: Use absolute instead of relative path to require scripts in vnmmad-load.d directory (#139) --- src/vnm_mad/remotes/lib/vnmmad.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vnm_mad/remotes/lib/vnmmad.rb b/src/vnm_mad/remotes/lib/vnmmad.rb index 8d965bcdf9..4bf39119df 100644 --- a/src/vnm_mad/remotes/lib/vnmmad.rb +++ b/src/vnm_mad/remotes/lib/vnmmad.rb @@ -32,7 +32,7 @@ require 'sg_driver' require 'vlan' require 'scripts_common' -Dir["vnmmad-load.d/*.rb"].each{ |f| require f } +Dir[File.expand_path('vnmmad-load.d', File.dirname(__FILE__)) + "/*.rb"].each{ |f| require f } include OpenNebula From ad74e4fe2dffeb2bd7c7dc10f0affa1de1eea763 Mon Sep 17 00:00:00 2001 From: Sledge Sulaweyo Date: Sat, 5 Nov 2016 22:12:37 +0100 Subject: [PATCH 09/13] B #4656: EC2QueryServer.rb redender launch time using the utc xmlschema The resulting string before/after this change: Time.at(Time.now).xmlschema => "2016-11-05T22:11:37+01:00" Time.at(Time.now).utc.xmlschema => "2016-11-05T21:11:34Z" --- src/cloud/ec2/lib/EC2QueryServer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cloud/ec2/lib/EC2QueryServer.rb b/src/cloud/ec2/lib/EC2QueryServer.rb index 7dc310fd96..12d8441b10 100644 --- a/src/cloud/ec2/lib/EC2QueryServer.rb +++ b/src/cloud/ec2/lib/EC2QueryServer.rb @@ -241,7 +241,7 @@ class EC2QueryServer < CloudServer private def render_launch_time(vm) - return "#{Time.at(vm["STIME"].to_i).xmlschema}" + return "#{Time.at(vm["STIME"].to_i).utc.xmlschema}" end end From 0a91d6e941e41154cb3a468ca539b8f6859deb21 Mon Sep 17 00:00:00 2001 From: Corey Melanson Date: Tue, 20 Sep 2016 17:52:20 -0400 Subject: [PATCH 10/13] work around cleanup bug for vms with multiple nics --- src/vnm_mad/remotes/lib/vlan.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vnm_mad/remotes/lib/vlan.rb b/src/vnm_mad/remotes/lib/vlan.rb index a63f3f0094..c685cbd5fd 100644 --- a/src/vnm_mad/remotes/lib/vlan.rb +++ b/src/vnm_mad/remotes/lib/vlan.rb @@ -94,6 +94,9 @@ module VNMMAD # Get the name of the vlan device. get_vlan_dev_name + # Return if the bridge doesn't exist because it was already deleted (handles last vm with multiple nics on the same vlan) + next if !@bridges.include? @nic[:bridge] + # Return if the vlan device is not the only left device in the bridge. next if @bridges[@nic[:bridge]].length > 1 or !@bridges[@nic[:bridge]].include? @nic[:vlan_dev] From 1205d23e60223d7586728080f55776a3c2a69e49 Mon Sep 17 00:00:00 2001 From: mcabrerizo Date: Tue, 8 Nov 2016 12:46:53 +0100 Subject: [PATCH 11/13] Fix duplicated NICs issue --- src/vmm_mad/remotes/vcenter/vcenter_driver.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb index d21d3d9a7e..9f259d85f4 100644 --- a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb +++ b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb @@ -2589,8 +2589,7 @@ private vm.config.hardware.device.each{ |dv| if is_nic?(dv) nics.each{|nic| - if nic.elements["MAC"].text == dv.macAddress and - nic.elements["BRIDGE"].text == dv.deviceInfo.summary + if nic.elements["MAC"].text == dv.macAddress nics.delete(nic) end } From e115900c657053f142702c6d6f16f75e0069d936 Mon Sep 17 00:00:00 2001 From: juanmont Date: Wed, 9 Nov 2016 20:11:45 +0100 Subject: [PATCH 12/13] F-2921 Added new function isDiskGraphsSopported --- src/sunstone/public/app/opennebula/vm.js | 10 ++ .../public/app/tabs/vms-tab/panels/storage.js | 134 +++++++++++++++++- 2 files changed, 143 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/app/opennebula/vm.js b/src/sunstone/public/app/opennebula/vm.js index 56fce9d983..f4f0c17ab5 100644 --- a/src/sunstone/public/app/opennebula/vm.js +++ b/src/sunstone/public/app/opennebula/vm.js @@ -612,6 +612,7 @@ define(function(require) { "retrieveExternalIPs": retrieveExternalIPs, "retrieveExternalNetworkAttrs": retrieveExternalNetworkAttrs, "isNICGraphsSupported": isNICGraphsSupported, + "isDiskGraphsSupported": isDiskGraphsSupported, "isNICAttachSupported": isNICAttachSupported, "isVNCSupported": isVNCSupported, "isSPICESupported": isSPICESupported, @@ -643,6 +644,15 @@ define(function(require) { } } + function isDiskGraphsSupported(element) { + var history = retrieveLastHistoryRecord(element) + if (history) { + return $.inArray(history.VM_MAD, ['ec2','az']) == -1; + } else { + return false; + } + } + function isNICAttachSupported(element) { var history = retrieveLastHistoryRecord(element) if (history) { diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/storage.js b/src/sunstone/public/app/tabs/vms-tab/panels/storage.js index b4bfdf4078..12d3c1289e 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/storage.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/storage.js @@ -29,6 +29,8 @@ define(function(require) { var TemplateHtml = require('hbs!./storage/html'); var DiskDetailsHtml = require('hbs!./storage/disk-details'); var Navigation = require('utils/navigation'); + var Notifier = require('utils/notifier'); + var Graphs = require('utils/graphs'); /* CONSTANTS @@ -62,6 +64,7 @@ define(function(require) { Panel.prototype.setup = _setup; Panel.prototype.getState = _getState; Panel.prototype.setState = _setState; + Panel.prototype.onShow = _onShow; return Panel; @@ -76,10 +79,82 @@ define(function(require) { diskCost = Config.onedConf.DEFAULT_COST.DISK_COST; } - return TemplateHtml({ + var html = TemplateHtml({ element: this.element, diskCost: diskCost }); + // Do not show statistics for not hypervisors that do not gather net data + //if (OpenNebulaVM.isNICGraphsSupported(that.element)) { + html += '\ +
\ +
\ +
\ + ' + Locale.tr("Disk RD Bytes") + '\ +
\ +
\ +
\ + \ + \ + \ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ + ' + Locale.tr("Disk WR Bytes") + '\ +
\ +
\ +
\ + \ + \ + \ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ + ' + Locale.tr("Disk RD IOPS") + '\ +
\ +
\ +
\ + \ + \ + \ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ + ' + Locale.tr("Disk WR IOPS") + '\ +
\ +
\ +
\ + \ + \ + \ +
\ +
\ +
\ +
\ +
\ +
\ +
\ +
\ + '; + // } + return html; } function _setup(context) { @@ -571,4 +646,61 @@ define(function(require) { subTree : subTree }; } + + function _onShow(context) { + var that = this; + if (OpenNebulaVM.isDiskGraphsSupported(that.element)) { + OpenNebulaVM.monitor({ + data: { + id: that.element.ID, + monitor: { + monitor_resources : "MONITORING/DISKRDBYTES,MONITORING/DISKWRBYTES,MONITORING/DISKRDIOPS,MONITORING/DISKWRIOPS" + } + }, + success: function(req, response) { + var vmGraphs = [ + { + labels : Locale.tr("Disk read bytes"), + monitor_resources : "MONITORING/DISKRDBYTES", + humanize_figures : true, + convert_from_bytes : true, + derivative : true, + div_graph : $("#vm_st_drb_graph") + }, + { + labels : Locale.tr("Disk write bytes"), + monitor_resources : "MONITORING/DISKWRBYTES", + humanize_figures : true, + convert_from_bytes : true, + derivative : true, + div_graph : $("#vm_st_dwb_graph") + }, + { + labels : Locale.tr("Disk Read IOPS"), + monitor_resources : "MONITORING/DISKRDIOPS", + //humanize_figures : true, + //convert_from_bytes : true, + y_sufix : "IOPS/s", + derivative : true, + div_graph : $("#vm_st_drio_graph") + }, + { + labels : Locale.tr("Disk write IOPS"), + monitor_resources : "MONITORING/DISKWRIOPS", + //humanize_figures : true, + //convert_from_bytes : true, + y_sufix : "IOPS/s", + derivative : true, + div_graph : $("#vm_st_dwio_graph") + } + ]; + + for (var i = 0; i < vmGraphs.length; i++) { + Graphs.plot(response, vmGraphs[i]); + } + }, + error: Notifier.onError + }); + } + } }); From 5e231696890334871be82d92c966f88e0ddd5a2d Mon Sep 17 00:00:00 2001 From: juanmont Date: Wed, 9 Nov 2016 20:12:23 +0100 Subject: [PATCH 13/13] merge with origin/master --- src/cloud/ec2/lib/EC2QueryServer.rb | 2 +- src/datastore_mad/remotes/xpath.rb | 8 +-- src/onedb/fsck.rb | 2 +- src/sunstone/etc/sunstone-views/admin.yaml | 1 - src/sunstone/etc/sunstone-views/cloud.yaml | 1 - .../etc/sunstone-views/groupadmin.yaml | 1 - src/sunstone/public/app/sunstone-config.js | 5 -- .../public/app/tabs/vms-tab/panels/info.js | 4 +- .../app/tabs/vms-tab/panels/info/html.hbs | 7 --- .../tabs/vms-tab/utils/datatable-common.js | 1 - src/sunstone/views/index.erb | 2 - src/sunstone/views/login.erb | 2 - src/tm_mad/common/prepostmigrate | 4 +- src/vmm_mad/remotes/kvm/poll | 49 +++++++++++++++++++ src/vmm_mad/remotes/vcenter/vcenter_driver.rb | 3 +- src/vnm_mad/remotes/802.1Q/vlan_tag_driver.rb | 13 ----- src/vnm_mad/remotes/OpenNebulaNetwork.conf | 4 -- src/vnm_mad/remotes/lib/vlan.rb | 28 ----------- src/vnm_mad/remotes/lib/vnmmad.rb | 2 +- src/vnm_mad/remotes/vxlan/vxlan_driver.rb | 13 ----- 20 files changed, 58 insertions(+), 94 deletions(-) diff --git a/src/cloud/ec2/lib/EC2QueryServer.rb b/src/cloud/ec2/lib/EC2QueryServer.rb index 12d8441b10..7dc310fd96 100644 --- a/src/cloud/ec2/lib/EC2QueryServer.rb +++ b/src/cloud/ec2/lib/EC2QueryServer.rb @@ -241,7 +241,7 @@ class EC2QueryServer < CloudServer private def render_launch_time(vm) - return "#{Time.at(vm["STIME"].to_i).utc.xmlschema}" + return "#{Time.at(vm["STIME"].to_i).xmlschema}" end end diff --git a/src/datastore_mad/remotes/xpath.rb b/src/datastore_mad/remotes/xpath.rb index ce57ddb651..ec424f0e85 100755 --- a/src/datastore_mad/remotes/xpath.rb +++ b/src/datastore_mad/remotes/xpath.rb @@ -64,13 +64,7 @@ ARGV.each do |xpath| values << ar.join(' ') else element = xml.elements[xpath.dup] - if !element.nil? - if element.class.method_defined?(:text) - values << element.text - else - values << element.to_s - end - end + values << element.text.to_s if !element.nil? end values << "\0" end diff --git a/src/onedb/fsck.rb b/src/onedb/fsck.rb index 9f52c559ab..3862d0d9f8 100644 --- a/src/onedb/fsck.rb +++ b/src/onedb/fsck.rb @@ -2637,7 +2637,7 @@ EOT # Params: # +disk+:: Nokogiri::XML::Node describing a disk used by a template def get_image_from_name(disk) - name = disk.at_xpath("IMAGE") && disk.at_xpath("IMAGE").content + name = disk.at_xpath("IMAGE").content # always defined uid = disk.at_xpath("IMAGE_UID") uname = disk.at_xpath("IMAGE_UNAME") diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index c7841aa65a..fbb43d0725 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -1,6 +1,5 @@ small_logo: images/opennebula-5.0.png provision_logo: images/opennebula-5.0.png -confirm_vms: true enabled_tabs: - dashboard-tab - instances-top-tab diff --git a/src/sunstone/etc/sunstone-views/cloud.yaml b/src/sunstone/etc/sunstone-views/cloud.yaml index 7201d6b9e9..00c5133b29 100644 --- a/src/sunstone/etc/sunstone-views/cloud.yaml +++ b/src/sunstone/etc/sunstone-views/cloud.yaml @@ -1,5 +1,4 @@ provision_logo: images/opennebula-5.0.png -confirm_vms: true enabled_tabs: - provision-tab - settings-tab diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index 144207051f..c829ef12bc 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -1,6 +1,5 @@ small_logo: images/opennebula-5.0.png provision_logo: images/opennebula-5.0.png -confirm_vms: true enabled_tabs: - dashboard-tab - instances-top-tab diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index 6666a9a9e9..d1c02c1f3e 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -146,15 +146,10 @@ define(function(require) { 'vmLogos': (_config['vm_logos']), 'enabledTabs': _config['view']['enabled_tabs'], 'onedConf': _config['oned_conf'], - 'confirmVMActions': _config['view']['confirm_vms'], "allTabs": function() { return Object.keys(_config['view']['tabs']); } - - /*"isConfirmVmsActionsEnable": function() { - Console.Log(_config['view']['confirm_vms']); - }*/ } return Config; diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info.js b/src/sunstone/public/app/tabs/vms-tab/panels/info.js index 2784b5597a..a7b334a711 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/info.js @@ -77,8 +77,6 @@ define(function(require) { var hostnameHTML = OpenNebula.VM.hostnameStrLink(this.element); var vrouterHTML = '--'; - var IP = OpenNebula.VM.ipsStr(this.element); - if (this.element.TEMPLATE.VROUTER_ID != undefined){ vrouterHTML = Navigation.link( OpenNebula.VirtualRouter.getName(this.element.TEMPLATE.VROUTER_ID), @@ -124,7 +122,6 @@ define(function(require) { 'hostnameHTML': hostnameHTML, 'prettyStartTime': prettyStartTime, 'deployId': deployId, - 'IP': IP, 'resched': resched, 'permissionsTableHTML': permissionsTableHTML, 'templateTableHTML': templateTableHTML, @@ -136,6 +133,7 @@ define(function(require) { function _setup(context) { RenameTr.setup(TAB_ID, RESOURCE, this.element.ID, context); PermissionsTable.setup(TAB_ID, RESOURCE, this.element, context); + // Get rid of the unwanted (for show) SCHED_* keys var that = this; var strippedTemplate = {}; diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs index e19be83db1..10bae54700 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs +++ b/src/sunstone/public/app/tabs/vms-tab/panels/info/html.hbs @@ -43,13 +43,6 @@ {{{hostnameHTML}}} - - - {{tr "IP"}} - {{{IP}}} - - - {{tr "Start time"}} {{prettyStartTime}} diff --git a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js index 657edb0649..6e8c515d09 100644 --- a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js +++ b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js @@ -130,7 +130,6 @@ define(function(require) { ]; } - function _emptyElementArray(vmId) { return [ ' - OpenNebula Sunstone: Cloud Operations Center @@ -60,7 +59,6 @@ <% else %> - <% end %> diff --git a/src/sunstone/views/login.erb b/src/sunstone/views/login.erb index 2c4d711d2e..1aba62d546 100644 --- a/src/sunstone/views/login.erb +++ b/src/sunstone/views/login.erb @@ -1,9 +1,7 @@ - - OpenNebula Sunstone Login diff --git a/src/tm_mad/common/prepostmigrate b/src/tm_mad/common/prepostmigrate index 44a1a18463..3948c77672 100755 --- a/src/tm_mad/common/prepostmigrate +++ b/src/tm_mad/common/prepostmigrate @@ -25,8 +25,8 @@ # - template is the template of the VM in XML and base64 encoded # - system_ds_mad flag if called by other SYSTEM_DS TM_MAD -SRC_HOST="$1" -DST_HOST="$2" +SRC="$1" +DST="$2" DST_PATH="$3" VM_ID="$4" DS_ID="$5" diff --git a/src/vmm_mad/remotes/kvm/poll b/src/vmm_mad/remotes/kvm/poll index ee56cdbda6..3c7222da79 100755 --- a/src/vmm_mad/remotes/kvm/poll +++ b/src/vmm_mad/remotes/kvm/poll @@ -49,6 +49,7 @@ module KVM :list => 'virsh --connect LIBVIRT_URI --readonly list', :dumpxml => 'virsh --connect LIBVIRT_URI --readonly dumpxml', :domifstat => 'virsh --connect LIBVIRT_URI --readonly domifstat', + :domblkstat => 'virsh --connect LIBVIRT_URI --readonly domblkstat', :top => 'top -b -d2 -n 2 -p ', 'LIBVIRT_URI' => 'qemu:///system' } @@ -154,6 +155,8 @@ module KVM vm[:name] = uuid end + values.merge!(get_diskio_statistics(name, xml)) + vms_info[vm[:name]] = values end @@ -322,6 +325,52 @@ module KVM values end + def self.get_disk_names(vmid, text = nil) + text = dump_xml(vmid) if !text + + doc=REXML::Document.new(text) + disks = [] + doc.elements.each('domain/devices/disk/target') do |ele| + disks << ele.attributes["dev"] + end + + disks + end + + def self.get_diskio_statistics(vmid, text = nil) + disks=get_disk_names(vmid, text) + + if disks && !disks.empty? + values={} + values[:diskrdbytes]=0 + values[:diskwrbytes]=0 + values[:diskrdiops]=0 + values[:diskwriops]=0 + + disks.each do |disk| + text=`#{virsh(:domblkstat)} #{vmid} #{disk}` + + text.each_line do |line| + columns=line.split(/\s+/) + case columns[1] + when 'rd_bytes' + values[:diskrdbytes]+=columns[2].to_i + when 'wr_bytes' + values[:diskwrbytes]+=columns[2].to_i + when 'rd_req' + values[:diskrdiops]+=columns[2].to_i + when 'wr_req' + values[:diskwriops]+=columns[2].to_i + end + end + end + + values + else + {} + end + end + # Translate libvirt state to Opennebula monitor state # @param state [String] libvirt state # @return [String] OpenNebula state diff --git a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb index 9f259d85f4..d21d3d9a7e 100644 --- a/src/vmm_mad/remotes/vcenter/vcenter_driver.rb +++ b/src/vmm_mad/remotes/vcenter/vcenter_driver.rb @@ -2589,7 +2589,8 @@ private vm.config.hardware.device.each{ |dv| if is_nic?(dv) nics.each{|nic| - if nic.elements["MAC"].text == dv.macAddress + if nic.elements["MAC"].text == dv.macAddress and + nic.elements["BRIDGE"].text == dv.deviceInfo.summary nics.delete(nic) end } diff --git a/src/vnm_mad/remotes/802.1Q/vlan_tag_driver.rb b/src/vnm_mad/remotes/802.1Q/vlan_tag_driver.rb index 691ade0310..282d6afd0e 100644 --- a/src/vnm_mad/remotes/802.1Q/vlan_tag_driver.rb +++ b/src/vnm_mad/remotes/802.1Q/vlan_tag_driver.rb @@ -51,17 +51,4 @@ class VLANTagDriver < VNMMAD::VLANDriver OpenNebula.exec_and_log("#{command(:ip)} link set #{@nic[:vlan_dev]} up") end - - def get_interface_vlan(name) - text = %x(#{command(:ip)} -d link show #{name}) - return nil if $?.exitstatus != 0 - - text.each_line do |line| - m = line.match(/vlan protocol 802.1Q id (\d+)/) - - return m[1] if m - end - - nil - end end diff --git a/src/vnm_mad/remotes/OpenNebulaNetwork.conf b/src/vnm_mad/remotes/OpenNebulaNetwork.conf index 16ae01a7eb..9c58fb556a 100644 --- a/src/vnm_mad/remotes/OpenNebulaNetwork.conf +++ b/src/vnm_mad/remotes/OpenNebulaNetwork.conf @@ -14,10 +14,6 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -# Set to true to check that no other vlans are connected to the bridge. -# Works with 802.1Q and VXLAN. -:validate_vlan_id: false - ################################################################################ # Open vSwitch Options ################################################################################ diff --git a/src/vnm_mad/remotes/lib/vlan.rb b/src/vnm_mad/remotes/lib/vlan.rb index c685cbd5fd..578ef10814 100644 --- a/src/vnm_mad/remotes/lib/vlan.rb +++ b/src/vnm_mad/remotes/lib/vlan.rb @@ -46,9 +46,6 @@ module VNMMAD # Create the bridge. create_bridge - # Check that no other vlans are connected to this bridge - validate_vlan_id - # Return if vlan device is already in the bridge. next if @bridges[@nic[:bridge]].include? @nic[:vlan_dev] @@ -94,9 +91,6 @@ module VNMMAD # Get the name of the vlan device. get_vlan_dev_name - # Return if the bridge doesn't exist because it was already deleted (handles last vm with multiple nics on the same vlan) - next if !@bridges.include? @nic[:bridge] - # Return if the vlan device is not the only left device in the bridge. next if @bridges[@nic[:bridge]].length > 1 or !@bridges[@nic[:bridge]].include? @nic[:vlan_dev] @@ -155,27 +149,5 @@ module VNMMAD bridges end - - def get_interface_vlan(name) - nil - end - - def validate_vlan_id - @bridges[@nic[:bridge]].each do |interface| - vlan = get_interface_vlan(interface) - - if vlan && vlan.to_s != @nic[:vlan_id] - OpenNebula.log_error("The interface #{interface} has "\ - "vlan_id = #{vlan} but the network is configured "\ - "with vlan_id = #{@nic[:vlan_id]}") - - msg = "Interface with an incorrect vlan_id is already in "\ - "the bridge" - OpenNebula.error_message(msg) - - exit(-1) - end - end - end end end diff --git a/src/vnm_mad/remotes/lib/vnmmad.rb b/src/vnm_mad/remotes/lib/vnmmad.rb index 4bf39119df..8d965bcdf9 100644 --- a/src/vnm_mad/remotes/lib/vnmmad.rb +++ b/src/vnm_mad/remotes/lib/vnmmad.rb @@ -32,7 +32,7 @@ require 'sg_driver' require 'vlan' require 'scripts_common' -Dir[File.expand_path('vnmmad-load.d', File.dirname(__FILE__)) + "/*.rb"].each{ |f| require f } +Dir["vnmmad-load.d/*.rb"].each{ |f| require f } include OpenNebula diff --git a/src/vnm_mad/remotes/vxlan/vxlan_driver.rb b/src/vnm_mad/remotes/vxlan/vxlan_driver.rb index 509c7c24e1..3ca84b1ee7 100644 --- a/src/vnm_mad/remotes/vxlan/vxlan_driver.rb +++ b/src/vnm_mad/remotes/vxlan/vxlan_driver.rb @@ -54,17 +54,4 @@ class VXLANDriver < VNMMAD::VLANDriver OpenNebula.exec_and_log("#{command(:ip)} link set #{@nic[:vlan_dev]} up") end - - def get_interface_vlan(name) - text = %x(#{command(:ip)} -d link show #{name}) - return nil if $?.exitstatus != 0 - - text.each_line do |line| - m = line.match(/^\s*vxlan id (\d+)/) - - return m[1] if m - end - - nil - end end