diff --git a/src/oca/ruby/OpenNebula/XMLUtils.rb b/src/oca/ruby/OpenNebula/XMLUtils.rb index 41d689ad19..44f1553a4b 100644 --- a/src/oca/ruby/OpenNebula/XMLUtils.rb +++ b/src/oca/ruby/OpenNebula/XMLUtils.rb @@ -365,9 +365,8 @@ module OpenNebula # def attr_to_str(attr) attr.gsub!('"',"\\\"") - attr.prepend('"') - attr << '"' - + attr = "\"#{attr}\"" + return attr end end diff --git a/src/ozones/Server/public/css/application.css b/src/ozones/Server/public/css/application.css index cf7eb9e96b..45942c3305 100644 --- a/src/ozones/Server/public/css/application.css +++ b/src/ozones/Server/public/css/application.css @@ -19,44 +19,44 @@ body { } p{ - margin:0 10px 10px; - } + margin:0 10px 10px; +} a { - color: #000C96; text-decoration: none; - } + color: #000C96; text-decoration: none; +} a:hover { - color: #127FE4; text-decoration: none; - } + color: #127FE4; text-decoration: none; +} select, button { - padding: 2px; - } + padding: 2px; +} h2 { - float:left; - font-size:20px; - margin-bottom: 5px; - padding-bottom: 0} + float:left; + font-size:20px; + margin-bottom: 5px; + padding-bottom: 0} h3 { - border-bottom: 1px solid #CCCCCC; - color: #353735; - font-size: 14px; - font-weight: normal; - padding: 5px 8px; - margin: 0 0; + border-bottom: 1px solid #CCCCCC; + color: #353735; + font-size: 14px; + font-weight: normal; + padding: 5px 8px; + margin: 0 0; } table#dashboard_table{ - width:100%; - margin: 0; - } + width:100%; + margin: 0; +} table#dashboard_table tr { vertical-align: top; } table#dashboard_table > tbody > tr > td{ - width:50%; + width:50%; } div.panel { @@ -130,16 +130,16 @@ ul.multi_action_menu li:hover { background-color: #D3D3D3;} div.action_block { - display:inline; - margin-right: 5px; - border-right: 1px solid #D3D3D3; - } + display:inline; + margin-right: 5px; + border-right: 1px solid #D3D3D3; +} div.action_blocks { - margin-bottom: 0.5em; - text-align: right; - margin-top: 0.5em; - } + margin-bottom: 0.5em; + text-align: right; + margin-top: 0.5em; +} input, textarea, select { border: 1px #bbbbbb solid; @@ -147,51 +147,51 @@ input, textarea, select { input, textarea { -webkit-border-radius: 3px; - -moz-border-radius: 3px; + -moz-border-radius: 3px; } form.create_form{ - margin:0; - padding:0;} + margin:0; + padding:0;} fieldset{ - margin:0 0; - border:none; - border-top:1px solid #ccc; - padding: 10px 5px;} + margin:0 0; + border:none; + border-top:1px solid #ccc; + padding: 10px 5px;} fieldset div{ - margin-bottom:.5em; - padding:0; - display:block; - } + margin-bottom:.5em; + padding:0; + display:block; +} fieldset input, fieldset textarea{ - width:150px; - /*border-top:1px solid #555; - border-left:1px solid #555; - border-bottom:1px solid #ccc; - border-right:1px solid #ccc;*/ - padding:1px;color:#333; - vertical-align: middle; - margin: 0 2px; - margin-bottom: 4px; - } + width:150px; + /*border-top:1px solid #555; + border-left:1px solid #555; + border-bottom:1px solid #ccc; + border-right:1px solid #ccc;*/ + padding:1px;color:#333; + vertical-align: middle; + margin: 0 2px; + margin-bottom: 4px; +} fieldset select{ - width:154px; - /*border-top:1px solid #555; - border-left:1px solid #555; - border-bottom:1px solid #ccc; - border-right:1px solid #ccc;*/ - padding:1px; - color:#333; - vertical-align: top; - margin: 0 2px; - margin-bottom: 4px; - } + width:154px; + /*border-top:1px solid #555; + border-left:1px solid #555; + border-bottom:1px solid #ccc; + border-right:1px solid #ccc;*/ + padding:1px; + color:#333; + vertical-align: top; + margin: 0 2px; + margin-bottom: 4px; +} /*Chrome hack*/ input[type="radio"],input[type="checkbox"] { @@ -199,21 +199,21 @@ input[type="radio"],input[type="checkbox"] { } legend{ - margin-top:0; - margin-bottom: 5px; - padding:0 .5em; - color:#036; - background:transparent; - font-size:1.0em; - font-weight:bold; - } + margin-top:0; + margin-bottom: 5px; + padding:0 .5em; + color:#036; + background:transparent; + font-size:1.0em; + font-weight:bold; +} label{ float: left; - width:150px; - padding:0 1em; - text-align:left; - } + width:150px; + padding:0 1em; + text-align:left; +} .dataTables_wrapper label { float: none; @@ -223,21 +223,26 @@ label{ } div.tip { - display: inline-block; - padding-left: 5px; - vertical-align: middle; - float:none; - } + display: inline-block; + padding-left: 5px; + vertical-align: middle; + float:none; +} -div.tip span.ui-icon{ - display:inline-block; +div.tip span.ui-icon { + display:inline-block; +} + +.vdc_show_hide span.ui-icon{ + display: inline-block; + vertical-align: middle; } div.tip span.man_icon { - display:none; + display:none; } .img_man .man_icon { - display:inline-block!important; + display:inline-block!important; } span.tipspan,div.full_info { @@ -255,51 +260,51 @@ span.tipspan,div.full_info { font-size:10px; } .vm_section input { - float:none; + float:none; } .vm_section legend{ - display:none!important; + display:none!important; } .vm_section fieldset { - border:none!important; + border:none!important; } div.show_hide { - float:none; - clear:both; + float:none; + clear:both; } .vm_param label{ - float:left; + float:left; } fieldset div.vm_section { - margin-top:-8px; - margin-bottom:0px; + margin-top:-8px; + margin-bottom:0px; } input:focus, textarea:focus{ - background:#efefef; - color:#000; + background:#efefef; + color:#000; } .form_buttons { - margin-top:25px; - text-align:right; + margin-top:25px; + text-align:right; } .add_remove_button { - font-size:0.8em !important; - height:25px !important; - margin-bottom:4px; + font-size:0.8em !important; + height:25px !important; + margin-bottom:4px; } .add_button { - margin-left:148px; - width: 58px !important; + margin-left:148px; + width: 58px !important; } .remove_button { @@ -317,15 +322,15 @@ tr.odd td, tr.even td{ } tr.odd:hover{ - background-color: #88C140 !important; + background-color: #88C140 !important; } tr.even:hover{ - background-color: #88C140 !important; + background-color: #88C140 !important; } .show_hide label{ - width: 100%; + width: 100%; } .clear { @@ -339,8 +344,8 @@ tr.even:hover{ } .action_block_info{ - width: 235px; - margin: auto; + width: 235px; + margin: auto; } .icon_right { @@ -348,33 +353,33 @@ tr.even:hover{ margin-left: 20px; position: relative; top: 2px; - } +} .icon_left { float: left; margin-right: 20px; position: relative; top: 0px; - /*border:1px solid;*/ +/*border:1px solid;*/ } .info_table{ - background: none repeat scroll 0 0 #FFFFFF; - border-collapse: collapse; - margin: 20px; - text-align: left; - display: inline-block; - width:45%; - vertical-align:top; - } + background: none repeat scroll 0 0 #FFFFFF; + border-collapse: collapse; + margin: 20px; + text-align: left; + display: inline-block; + width:45%; + vertical-align:top; +} .info_table > thead th,h3 { - border-bottom: 2px solid #353735; - color: #353735; - font-size: 14px; - font-weight: normal; - padding: 10px 8px; + border-bottom: 2px solid #353735; + color: #353735; + font-size: 14px; + font-weight: normal; + padding: 10px 8px; } @@ -385,13 +390,13 @@ tr.even:hover{ padding-bottom: 6px; padding-left: 8px; padding-right: 8px; - } +} .info_table td.key_td{ - width: 55%; - text-align:left; - font-weight:bold; + width: 55%; + text-align:left; + font-weight:bold; } .info_table td.graph_td{ @@ -401,8 +406,8 @@ tr.even:hover{ } .info_table td.value_td{ - text-align:left; - width: 45%; + text-align:left; + width: 45%; } #dialog > div > div { @@ -411,9 +416,9 @@ tr.even:hover{ } .loading_img { - vertical-align:middle; - display:inline; - overflow:hide; + vertical-align:middle; + display:inline; + overflow:hide; } @@ -422,32 +427,32 @@ tr.even:hover{ height: 25px; margin: 3px 2px; vertical-align: middle; - /*width: 89px;*/ +/*width: 89px;*/ } .top_button button { - font-size: 0.9em; - height: 25px; - vertical-align: middle; + font-size: 0.9em; + height: 25px; + vertical-align: middle; } .image_button { - font-size: 0.8em; - margin: 3px 2px; - vertical-align: middle; - border:0; + font-size: 0.8em; + margin: 3px 2px; + vertical-align: middle; + border:0; } /* -.multi_action_slct{ - font-size: 0.7em; - vertical-align:middle; - margin:3px 0; - height: 25px; -}*/ + .multi_action_slct{ + font-size: 0.7em; + vertical-align:middle; + margin:3px 0; + height: 25px; + }*/ .ui-icon-refresh{ - position:relative!important; - top:14px!important; + position:relative!important; + top:14px!important; } #vm_log { @@ -509,21 +514,21 @@ tr.even:hover{ ul.action_list{ - /*background: #EDEDED;*/ - border: 1px solid #525252; - background-image: -webkit-gradient( - linear, - left bottom, - left top, - color-stop(0.25, #E9E9E9), - color-stop(0.63, #F5F5F5) - ); - background-image: -moz-linear-gradient( - center bottom, - #E9E9E9 25%, - #F5F5F5 63% - ); - position:absolute; + /*background: #EDEDED;*/ + border: 1px solid #525252; + background-image: -webkit-gradient( + linear, + left bottom, + left top, + color-stop(0.25, #E9E9E9), + color-stop(0.63, #F5F5F5) + ); + background-image: -moz-linear-gradient( + center bottom, + #E9E9E9 25%, + #F5F5F5 63% + ); + position:absolute; z-index:1; list-style-type:none; text-align:left; @@ -550,20 +555,21 @@ ul.action_list li a:hover{ } .progress_bar{ - height:10px; - background: #8F9392; + height:10px; + background: #8F9392; } .dd_lists{ - width:154px; + width:250px; display:inline-block; height:200px; margin-left:2px; + margin-bottom: 10px; } ul.dd_list{ height:200px; - width:67px; + width:115px; margin:0; border: 1px #bbbbbb solid; list-style-type:none; diff --git a/src/ozones/Server/public/js/ozones-util.js b/src/ozones/Server/public/js/ozones-util.js index f7edb069d1..b8f8e16547 100644 --- a/src/ozones/Server/public/js/ozones-util.js +++ b/src/ozones/Server/public/js/ozones-util.js @@ -30,10 +30,26 @@ function updateHostsList(req,list,tag,zone_id,zone_name){ function updateVMsList(req,list,tag,zone_id,zone_name){ var vmsDataTable = $(tag).dataTable(); var vms_array = []; + + var ip_str = function ip_str(vm){ + var nic = vm.TEMPLATE.NIC; + var ip = '--'; + if ($.isArray(nic)) { + ip = ''; + $.each(nic, function(index,value){ + ip += value.IP+'
'; + }); + } else if (nic && nic.IP) { + ip = nic.IP; + }; + return ip; + }; + $.each(list,function(){ var vm = this.VM; var state = oZones.Helper.resource_state("vm",vm.STATE); var hostname = "--"; + var ip = ip_str(vm); if (state == "ACTIVE" || state == "SUSPENDED"){ if (vm.HISTORY_RECORDS.HISTORY.constructor == Array){ @@ -59,6 +75,7 @@ function updateVMsList(req,list,tag,zone_id,zone_name){ vm.CPU, humanize_size(vm.MEMORY), hostname, + ip, pretty_time(vm.STIME) ]); } else { @@ -71,6 +88,7 @@ function updateVMsList(req,list,tag,zone_id,zone_name){ vm.CPU, humanize_size(vm.MEMORY), hostname, + ip, pretty_time(vm.STIME) ]); }; @@ -101,16 +119,18 @@ function updateVNsList(req,list,tag,zone_id,zone_name){ network.UNAME, network.GNAME, network.NAME, + network.CLUSTER.length ? network.CLUSTER : "-", parseInt(network.TYPE) ? "FIXED" : "RANGED", network.BRIDGE, total_leases ]); } else { - vn_array.push([ + vn_array.push([ network.ID, network.UNAME, network.GNAME, network.NAME, + network.CLUSTER.length ? network.CLUSTER : "-", parseInt(network.TYPE) ? "FIXED" : "RANGED", network.BRIDGE, total_leases @@ -276,6 +296,7 @@ function hostElementArray(host,zone_id,zone_name){ zone_name, host.ID, host.NAME, + host.CLUSTER.length ? host.CLUSTER : "-", host.HOST_SHARE.RUNNING_VMS, //rvm pb_cpu, pb_mem, @@ -285,8 +306,68 @@ function hostElementArray(host,zone_id,zone_name){ return [ host.ID, host.NAME, + host.CLUSTER.length ? host.CLUSTER : "-", host.HOST_SHARE.RUNNING_VMS, //rvm pb_cpu, pb_mem, oZones.Helper.resource_state("host_simple",host.STATE) ]; -} \ No newline at end of file +}; + + +function updateClustersList(req,list,tag, zone_id,zone_name){ + var dataTable = $(tag).dataTable(); + var array = []; + + $.each(list,function(){ + var cluster = this.CLUSTER; + + if (zone_id){ + array.push([ + zone_id, + zone_name, + cluster.ID, + cluster.NAME + ]); + } else { + array.push([ + cluster.ID, + cluster.NAME + ]); + }; + + }); + dataTable.fnAddData(array); + dataTable.fnDraw(false); +}; + +function updateDatastoresList(req,list,tag, zone_id,zone_name){ + var dataTable = $(tag).dataTable(); + var array = []; + + $.each(list,function(){ + var ds = this.DATASTORE; + + if (zone_id){ + array.push([ + zone_id, + zone_name, + ds.ID, + ds.UNAME, + ds.GNAME, + ds.NAME, + ds.CLUSTER.length ? ds.CLUSTER : "-", + ]); + } else { + array.push([ + ds.ID, + ds.UNAME, + ds.GNAME, + ds.NAME, + ds.CLUSTER.length ? ds.CLUSTER : "-", + ]); + }; + + }); + dataTable.fnAddData(array); + dataTable.fnDraw(false); +}; diff --git a/src/ozones/Server/public/js/ozones.js b/src/ozones/Server/public/js/ozones.js index 414e4e687a..a18bac581d 100644 --- a/src/ozones/Server/public/js/ozones.js +++ b/src/ozones/Server/public/js/ozones.js @@ -431,10 +431,15 @@ var oZones = { "vnet": function(params){ oZones.Zone.subresource(params,"vnet"); }, - "group": function(params){ oZones.Zone.subresource(params,"group"); - } + }, + "cluster": function(params){ + oZones.Zone.subresource(params,"cluster"); + }, + "datastore": function(params){ + oZones.Zone.subresource(params,"datastore"); + }, }, "VDC": { @@ -497,5 +502,19 @@ var oZones = { "list": function(params){ oZones.Action.list(params,oZones.ZoneImages.resource,"vmtemplate"); } - } -} + }, + + "ZoneClusters": { + "resource": "ZONE", + "list": function(params){ + oZones.Action.list(params,oZones.ZoneClusters.resource,"cluster"); + } + }, + + "ZoneDatastores": { + "resource": "ZONE", + "list": function(params){ + oZones.Action.list(params,oZones.ZoneDatastores.resource,"datastore"); + } + }, +}; diff --git a/src/ozones/Server/public/js/plugins/aggregated-tab.js b/src/ozones/Server/public/js/plugins/aggregated-tab.js index 3286773632..35928f61a4 100644 --- a/src/ozones/Server/public/js/plugins/aggregated-tab.js +++ b/src/ozones/Server/public/js/plugins/aggregated-tab.js @@ -25,6 +25,7 @@ var aggregated_hosts_tab_content = Zone Name\ ID\ Name\ + Cluster\ Running VMs\ CPU Use\ Memory use\ @@ -68,6 +69,7 @@ var aggregated_vns_tab_content = Owner\ Group\ Name\ + Cluster\ Type\ Bridge\ Total Leases\ @@ -113,7 +115,6 @@ var aggregated_users_tab_content = \ \ '; - var aggregated_templates_tab_content = '
\
\ @@ -133,12 +134,49 @@ var aggregated_templates_tab_content = \ '; +var aggregated_clusters_tab_content = +'
\ +
\ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
Zone IDZone NameIDName
'; + +var aggregated_datastores_tab_content = +'
\ +
\ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
Zone IDZone NameIDOwnerGroupNameCluster
'; + var dataTable_agg_hosts; var dataTable_agg_vms; var dataTable_agg_vns; var dataTable_agg_images; var dataTable_agg_users; var dataTable_agg_templates; +var dataTable_agg_cluters; +var dataTable_agg_datastores; var agg_actions = { "ZoneHosts.list" : { @@ -177,6 +215,18 @@ var agg_actions = { callback: templatesListCB, error: onError }, + "ZoneClusters.list" : { + type: "single", + call: oZones.ZoneClusters.list, + callback: clustersListCB, + error: onError + }, + "ZoneDatastores.list" : { + type: "single", + call: oZones.ZoneDatastores.list, + callback: datastoresListCB, + error: onError + }, "ZoneHosts.refresh" : { type: "custom", call: function() { @@ -295,7 +345,47 @@ var agg_actions = { success: templatesListCB, error: onError}) } - } + }, + + "ZoneClusters.refresh" : { + type: "custom", + call: function() { + waitingNodes(dataTable_agg_clusters); + Sunstone.runAction("ZoneClusters.list"); + }, + error: onError, + notify: false + }, + + "ZoneClusters.autorefresh" : { + type: "custom", + call: function() { + oZones.ZoneClusters.list({ + timeout:true, + success: clustersListCB, + error: onError}) + } + }, + + "ZoneDatastores.refresh" : { + type: "custom", + call: function() { + waitingNodes(dataTable_agg_datastores); + Sunstone.runAction("ZoneDatastores.list"); + }, + error: onError, + notify: false + }, + + "ZoneDatastores.autorefresh" : { + type: "custom", + call: function() { + oZones.ZoneDatastores.list({ + timeout:true, + success: datastoresListCB, + error: onError}) + } + }, }; @@ -347,6 +437,22 @@ var templates_buttons = { } }; +var clusters_buttons = { + "ZoneClusters.refresh" : { + type: "image", + text: "Refresh list", + img: "images/Refresh-icon.png" + } +}; + +var datastores_buttons = { + "ZoneDatastores.refresh" : { + type: "image", + text: "Refresh list", + img: "images/Refresh-icon.png" + } +}; + var hosts_tab = { title: "Hosts", content: aggregated_hosts_tab_content, @@ -396,13 +502,32 @@ var templates_tab = { parentTab: "dashboard_tab" }; +var clusters_tab = { + title: "Clusters", + content: aggregated_clusters_tab_content, + buttons: clusters_buttons, + tabClass: "subTab", + parentTab: "dashboard_tab" +}; + +var datastores_tab = { + title: "Datastores", + content: aggregated_datastores_tab_content, + buttons: datastores_buttons, + tabClass: "subTab", + parentTab: "dashboard_tab" +}; + Sunstone.addActions(agg_actions); -Sunstone.addMainTab("agg_hosts_tab",hosts_tab); -Sunstone.addMainTab("agg_vms_tab",vms_tab); -Sunstone.addMainTab("agg_vns_tab",vns_tab); -Sunstone.addMainTab("agg_images_tab",images_tab); Sunstone.addMainTab("agg_users_tab",users_tab); +Sunstone.addMainTab("agg_vms_tab",vms_tab); Sunstone.addMainTab("agg_templates_tab",templates_tab); +Sunstone.addMainTab("agg_images_tab",images_tab); +Sunstone.addMainTab("agg_clusters_tab",clusters_tab); +Sunstone.addMainTab("agg_hosts_tab",hosts_tab); +Sunstone.addMainTab("agg_datastores_tab",datastores_tab); +Sunstone.addMainTab("agg_vns_tab",vns_tab); + function hostsListCB(req,list){ @@ -499,7 +624,39 @@ function templatesListCB(req,list){ }); updateZonesDashboard("templates",total_templates); -} +}; + +function clustersListCB(req,list){ + dataTable_agg_clusters.fnClearTable(); + var total = []; + $.each(list,function(){ + if (this.ZONE.error){ + notifyError(this.ZONE.error.message); + return; + }; + var json = oZones.Helper.pool("CLUSTER",this.ZONE); + total = total.concat(json); + updateClustersList(req,json,'#datatable_agg_clusters',this.ZONE.ID,this.ZONE.NAME); + }); + + updateZonesDashboard("clusters",total); +}; + +function datastoresListCB(req,list){ + dataTable_agg_datastores.fnClearTable(); + var total = []; + $.each(list,function(){ + if (this.ZONE.error){ + notifyError(this.ZONE.error.message); + return; + }; + var json = oZones.Helper.pool("DATASTORE",this.ZONE); + total = total.concat(json); + updateDatastoresList(req,json,'#datatable_agg_datastores',this.ZONE.ID,this.ZONE.NAME); + }); + + updateZonesDashboard("datastores",total); +}; function setAutorefreshes(){ setInterval(function(){ @@ -543,6 +700,20 @@ function setAutorefreshes(){ Sunstone.runAction("ZoneTemplates.autorefresh"); }; },INTERVAL+someTime()); + + setInterval(function(){ + var filter = $('#datatable_agg_clusters_filter input').attr("value"); + if (!filter.length){ + Sunstone.runAction("ZoneClusters.autorefresh"); + }; + },INTERVAL+someTime()); + + setInterval(function(){ + var filter = $('#datatable_agg_datastores_filter input').attr("value"); + if (!filter.length){ + Sunstone.runAction("ZoneDatastores.autorefresh"); + }; + },INTERVAL+someTime()); } $(document).ready(function(){ @@ -556,10 +727,10 @@ $(document).ready(function(){ "bAutoWidth":false, "sPaginationType": "full_numbers", "aoColumnDefs": [ - { "sWidth": "60px", "aTargets": [4,7] }, + { "sWidth": "60px", "aTargets": [5,8] }, { "sWidth": "35px", "aTargets": [0,2] }, - { "sWidth": "160px", "aTargets": [5,6] }, - { "sWidth": "100px", "aTargets": [1] } + { "sWidth": "160px", "aTargets": [6,7] }, + { "sWidth": "100px", "aTargets": [1,4] } ] }); @@ -581,9 +752,9 @@ $(document).ready(function(){ "bAutoWidth":false, "sPaginationType": "full_numbers", "aoColumnDefs": [ - { "sWidth": "60px", "aTargets": [6,7,8] }, + { "sWidth": "60px", "aTargets": [7,8,9] }, { "sWidth": "35px", "aTargets": [0,2] }, - { "sWidth": "100px", "aTargets": [1,3,4] } + { "sWidth": "100px", "aTargets": [1,3,4,6] } ] }); @@ -621,12 +792,36 @@ $(document).ready(function(){ ] }); + dataTable_agg_clusters = $('#datatable_agg_clusters').dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "sPaginationType": "full_numbers", + "bAutoWidth":false, + "aoColumnDefs": [ + { "sWidth": "35px", "aTargets": [0,2] }, + { "sWidth": "100px", "aTargets": [1] } + ] + }); + + dataTable_agg_datastores = $('#datatable_agg_datastores').dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "sPaginationType": "full_numbers", + "bAutoWidth":false, + "aoColumnDefs": [ + { "sWidth": "35px", "aTargets": [0,2] }, + { "sWidth": "100px", "aTargets": [1,3,4,6] } + ] + }); + Sunstone.runAction("ZoneHosts.list"); Sunstone.runAction("ZoneVMs.list"); Sunstone.runAction("ZoneVNs.list"); Sunstone.runAction("ZoneImages.list"); Sunstone.runAction("ZoneUsers.list"); Sunstone.runAction("ZoneTemplates.list"); + Sunstone.runAction("ZoneClusters.list"); + Sunstone.runAction("ZoneDatastores.list"); setAutorefreshes(); }); diff --git a/src/ozones/Server/public/js/plugins/dashboard-tab.js b/src/ozones/Server/public/js/plugins/dashboard-tab.js index 4403394e5c..012e690d91 100644 --- a/src/ozones/Server/public/js/plugins/dashboard-tab.js +++ b/src/ozones/Server/public/js/plugins/dashboard-tab.js @@ -55,7 +55,38 @@ var dashboard_tab_content = \ \
\ -

Hosts\ +

Clusters\ +

\ +
\ + \ + \ + \ + \ + \ +
Total
\ +
\ +
\ + \ + \ +
\ +

Datastores\ +

\ +
\ + \ + \ + \ + \ + \ +
Total
\ +
\ +
\ + \ + \ + \ + \ + \ +
\ +

Hosts\

\
\ \ @@ -130,7 +161,7 @@ var dashboard_tab_content =
\
\

\ - Images\ + Images\

\
\ \ @@ -144,7 +175,7 @@ var dashboard_tab_content = \
\
\ -

Users\ +

Users\

\
\ \ @@ -238,5 +269,13 @@ function updateZonesDashboard(what,json_info){ var total_images=json_info.length; $('#total_images',db).html(total_images); break; - } -} + case "clusters": + var total_clusters=json_info.length; + $('#total_clusters',db).html(total_clusters); + break; + case "datastores": + var total_datastores=json_info.length; + $('#total_datastores',db).html(total_datastores); + break; + }; +}; diff --git a/src/ozones/Server/public/js/plugins/vdcs-tab.js b/src/ozones/Server/public/js/plugins/vdcs-tab.js index dd25dd8b27..858beb081b 100644 --- a/src/ozones/Server/public/js/plugins/vdcs-tab.js +++ b/src/ozones/Server/public/js/plugins/vdcs-tab.js @@ -25,7 +25,10 @@ var vdcs_tab_content = \ \ \ + \ \ + \ + \ \ \ \ @@ -47,17 +50,34 @@ var create_vdc_tmpl =
\
\ - \ - \ -
Allows hosts belonging to other VDCs to be re-added to this one. They will appear greyed-out in the lists.
\ + \ +
\ + \ + \ +
Allows hosts, Vnets, datastores belonging to other VDCs to be re-added to this one. They will appear greyed-out in the lists.
\
\ + \ \
\
\ - \ -
\ -
    \ -
      \ + \ +
      \ +
        \ +
          \ +
          \ +
          \ + \ +
          \ +
            \ +
              \ +
              \ +
              \ + \ +
              \ +
                \ +
                  \ +
                  \
                  \ \
                  \ @@ -72,20 +92,33 @@ var update_vdc_tmpl = '
                  \
                  \
                  \ - \ + \ \
                  \ - \ - \ -
                  Allows hosts belonging to other VDCs to be re-added to this one. They will appear greyed-out in the list.
                  \ + \ + \ +
                  Allows hosts, Vnets belonging to other VDCs to be re-added to this one. They will appear greyed-out in the list.
                  \
                  \ - \ - \ - \ + \ + \ + \
                  \
                    \
                      \ +
                      \ +
                      \ + \ +
                      \ +
                        \ +
                          \ +
                          \ +
                          \ + \ +
                          \ +
                            \ +
                              \ +
                              \
                              \
                              \
                              \ @@ -178,7 +211,46 @@ var vdc_actions = { call: oZones.Zone.host, callback: fillUpdateHostList, error: onError - } + }, + "VDC.zone_vnets" : { + type: "single", + call: oZones.Zone.vnet, + callback: fillVNetList, + error: onError + }, + "VDC.update_zone_vnets" : { + type: "single", + call: oZones.Zone.vnet, + callback: fillUpdateVNetList, + error: onError + }, + "VDC.zone_datastores" : { + type: "single", + call: oZones.Zone.datastore, + callback: fillDatastoreList, + error: onError + }, + "VDC.update_zone_datastores" : { + type: "single", + call: oZones.Zone.datastore, + callback: fillUpdateDatastoreList, + error: onError + }, + "VDC.zone_clusters" : { + type: "single", + call: oZones.Zone.cluster, + callback: function(req, list_json){ + var options=''; + options += ''; + $.each(list_json,function(){ + options += ''; + }); + if (options) + $('div#create_vdc_dialog select#clusterid').html(options); + }, + error: onError + }, + }; var vdc_buttons = { @@ -194,13 +266,13 @@ var vdc_buttons = { }, "VDC.update_dialog" : { type: "action", - text: "Add/Remove hosts", + text: "Update VDC resources", }, "VDC.delete" : { type: "action", text: "Delete", type : "confirm", - tip: "Careful! This will delete the selected VDCs and associated resources" + tip: "Careful! This will delete the selected VDCs" } }; @@ -229,7 +301,10 @@ function vdcElementArray(vdc_json){ vdc.ID, vdc.NAME, vdc.ZONES_ID, - vdc.HOSTS ? vdc.HOSTS : "none" + vdc.CLUSTER_ID, + vdc.RESOURCES.HOSTS.length ? vdc.RESOURCES.HOSTS.join() : "none", + vdc.RESOURCES.NETWORKS.length ? vdc.RESOURCES.NETWORKS.join() : "none", + vdc.RESOURCES.DATASTORES.length ? vdc.RESOURCES.DATASTORES.join() : "none", ]; } @@ -312,9 +387,21 @@ function updateVDCInfo(req,vdc_json){
                              \ \ \ + \ + \ + \ + \ \ \ - \ + \ + \ + \ + \ + \ + \ + \ + \ + \ \ \ \ @@ -326,7 +413,7 @@ function updateVDCInfo(req,vdc_json){ \ \ \ - \ + \ \ \ \ @@ -350,89 +437,140 @@ function updateVDCInfo(req,vdc_json){ setTimeout(function(){ $('#vdc_info_panel input#one_xmlrpc').select(); }, 700); -} +}; -function fillHostList(req, host_list_json){ +function inCluster(resCluster, selCluster){ + if (selCluster == "-")//cluster none + return resCluster == "-1"; + else return resCluster == selCluster; +}; + +function fillList(res, req, list_json){ var list = ""; - var force = $('div#create_vdc_dialog #vdc_force_hosts:checked').length ? - true : false; + var dialog = $('div#create_vdc_dialog'); + var force = $('#vdc_force',dialog).is(':checked'); + var cluster = $('select#clusterid',dialog).val(); var zone_id = req.request.data[0]; var free; - $.each(host_list_json,function(){ - free = isHostFree(this.HOST.ID,zone_id); + $.each(list_json,function(){ + var id = this[res.toUpperCase()].ID; + var name = this[res.toUpperCase()].NAME; + if (!inCluster(this[res.toUpperCase()].CLUSTER_ID,cluster)) + return true; //continue + free = isResourceFree(res,id,zone_id); if (force || free){ - list+='
                            • '+(free? this.HOST.NAME : ''+this.HOST.NAME+'')+'
                            • '; - } + list+='
                            • '+(free ? name : ''+name+'')+'
                            • '; + }; }); - $('div#create_vdc_dialog #vdc_available_hosts_list').html(list); -} + $('#vdc_available_'+res+'s_list',dialog).html(list); +}; + +function fillHostList(req, list_json){ + fillList("host",req,list_json); +}; + +function fillVNetList(req, list_json){ + fillList("vnet",req,list_json); +}; + +function fillDatastoreList(req, list_json){ + fillList("datastore",req,list_json); +}; + +//returns if resource with id is from a certain VDC +function isResourceMine(resource,id,vdc_id){ + var column; + switch (resource){ + case "host": column = 5; break; + case "vnet" : column = 6; break; + case "datastore" : column = 7; break; + default: return false; + }; -//return the array of hosts -function isHostMine(host_id,vdc_id){ //locate myself var vdcs = dataTable_vdcs.fnGetData(); - var my_hosts=null; + var my_resources=[]; for (var i=0; i < vdcs.length; i++){ if (vdcs[i][1]==vdc_id){ - my_hosts = vdcs[i][4].split(','); + if (vdcs[i][column] != "none") + my_resources = vdcs[i][column].split(','); break; - } + }; }; - if (!my_hosts) return false; - return $.inArray(host_id,my_hosts) >= 0; -} + return $.inArray(id,my_resources) >= 0; +}; -function fillUpdateHostList(req, host_list_json){ +function fillUpdateList(res, req, list_json){ var list = ""; var list_mine = ""; var vdc_id = $('#vdc_update_id',$update_vdc_dialog).val(); - var force = $('#vdc_update_force_hosts:checked',$update_vdc_dialog).length ? - true : false; + var force = $('#vdc_update_force',$update_vdc_dialog).is(':checked'); + var cluster = dataTable_vdcs.fnGetData($('#vdc_'+vdc_id, dataTable_vdcs.fnGetNodes()).parents('tr')[0])[4]; var zone_id = req.request.data[0]; var free,li; - $.each(host_list_json,function(){ + $.each(list_json,function(){ //if mine, put in mine_list - if (isHostMine(this.HOST.ID,vdc_id)){ - list_mine+='
                            • '+this.HOST.NAME+'
                            • '; + var id = this[res.toUpperCase()].ID; + var name = this[res.toUpperCase()].NAME; + if (!inCluster(this[res.toUpperCase()].CLUSTER_ID,cluster)) return true; //continue - } + + if (isResourceMine(res,id,vdc_id)){ + list_mine+='
                            • '+name+'
                            • '; + return true; //continue + }; //otherwise, check if its free etc... - free = isHostFree(this.HOST.ID,zone_id); + free = isResourceFree(res,id,zone_id); if (force || free){ - list+='
                            • '+(free? this.HOST.NAME : ''+this.HOST.NAME+'')+'
                            • '; + list+='
                            • '+(free? name : ''+name+'')+'
                            • '; } }); + $('#vdc_update_available_'+res+'s_list', $update_vdc_dialog).html(list); + $('#vdc_update_selected_'+res+'s_list', $update_vdc_dialog).html(list_mine); +}; +function fillUpdateHostList(req, list_json){ + fillUpdateList("host", req, list_json); +}; +function fillUpdateVNetList(req, list_json){ + fillUpdateList("vnet", req, list_json); +}; +function fillUpdateDatastoreList(req, list_json){ + fillUpdateList("datastore", req, list_json); +}; - $('#vdc_update_available_hosts_list',$update_vdc_dialog).html(list); - $('#vdc_update_selected_hosts_list',$update_vdc_dialog).html(list_mine); - -} - -function isHostFree(id,zone_id){//strings +function isResourceFree(res, id, zone_id){//id, zone_id strings + var column; + switch (res){ + case "host": column = 5; break; + case "vnet": column = 6; break; + case "datastore": column = 7; break; + }; var data = dataTable_vdcs.fnGetData(); var result = true; - var hosts; + var resources; for (var i=0; i= 0){ + if ($.inArray(id,resources) >= 0){ result = false; break; - } - } + }; + }; return result; -} +}; function setupCreateVDCDialog(){ $('div#dialogs').append('
                              '); @@ -448,6 +586,12 @@ function setupCreateVDCDialog(){ width: 500 }); + $('div#vdc_hosts_lists,div#vdc_vnets_lists,div#vdc_datastores_lists',dialog).hide(); + $('.vdc_show_hide',dialog).click(function(){ + $('span',this).toggleClass('ui-icon-triangle-1-s ui-icon-triangle-1-n'); + $(this).parent().next().toggle(); + }); + $('button',dialog).button(); $('#vdc_available_hosts_list',dialog).sortable({ connectWith : '#vdc_selected_hosts_list', @@ -457,58 +601,118 @@ function setupCreateVDCDialog(){ connectWith : '#vdc_available_hosts_list', containment: dialog }); + $('#vdc_available_vnets_list',dialog).sortable({ + connectWith : '#vdc_selected_vnets_list', + containment: dialog + }); + $('#vdc_selected_vnets_list',dialog).sortable({ + connectWith : '#vdc_available_vnets_list', + containment: dialog + }); + $('#vdc_available_datastores_list',dialog).sortable({ + connectWith : '#vdc_selected_datastores_list', + containment: dialog + }); + $('#vdc_selected_datastores_list',dialog).sortable({ + connectWith : '#vdc_available_datastores_list', + containment: dialog + }); - $('input#vdc_force_hosts',dialog).change(function(){ - select = $('select#zoneid',$('#create_vdc_dialog')); + $('input#vdc_force',dialog).change(function(){ + select = $('div#create_vdc_dialog select#clusterid'); if (select.val().length){ select.trigger("change"); - } + }; }); //load zone hosts - $('select#zoneid').change(function(){ + $('select#zoneid',dialog).change(function(){ var id=$(this).val(); + if (!id) { + $('select#clusterid').html(''); + $('select#clusterid').trigger('change'); + return true; + }; + $('select#clusterid').html(''); + $('select#clusterid').trigger('change'); + Sunstone.runAction("VDC.zone_clusters",id); + }); + + $('select#clusterid',dialog).change(function(){ + var context = $('div#create_vdc_dialog'); + var id=$('select#zoneid',context).val(); + var clusterid=$(this).val(); var av_hosts= - $('div#create_vdc_dialog #vdc_available_hosts_list'); + $('#vdc_available_hosts_list', context); var sel_hosts= - $('div#create_vdc_dialog #vdc_selected_hosts_list'); - if (!id.length){ + $('#vdc_selected_hosts_list', context); + var av_vnets= + $('#vdc_available_vnets_list', context); + var sel_vnets= + $('#vdc_selected_vnets_list', context); + var av_datastores= + $('#vdc_available_datastores_list', context); + var sel_datastores= + $('#vdc_selected_datastores_list', context); + + if (!clusterid){ av_hosts.empty(); sel_hosts.empty(); + av_vnets.empty(); + sel_vnets.empty(); + av_datastores.empty(); + sel_datastores.empty(); return true; } av_hosts.html('
                            • '+spinner+'
                            • '); + av_vnets.html('
                            • '+spinner+'
                            • '); + av_datastores.html('
                            • '+spinner+'
                            • '); sel_hosts.empty(); + sel_vnets.empty(); + sel_datastores.empty(); Sunstone.runAction("VDC.zone_hosts",id); + Sunstone.runAction("VDC.zone_vnets",id); + Sunstone.runAction("VDC.zone_datastores",id); }); $('#create_vdc_form', dialog).submit(function(){ - var name = $('#name',$(this)).val(); - var vdcadminname = $('#vdcadminname',$(this)).val(); - var vdcadminpass = $('#vdcadminpass',$(this)).val(); - var zoneid = $('select#zoneid',$(this)).val(); - var force = $('#vdc_force_hosts:checked',$(this)).length ? "yes" : "please no"; - if (!name.length || !vdcadminname.length - || !vdcadminpass.length || !zoneid.length){ - notifyError("Name, administrator credentials or zone are missing"); + var name = $('#name',this).val(); + var vdcadminname = $('#vdcadminname',this).val(); + var vdcadminpass = $('#vdcadminpass',this).val(); + var zoneid = $('select#zoneid',this).val(); + var clusterid = $('select#clusterid',this).val(); + var force = $('#vdc_force',this).is(':checked') ? "yes" : "please no"; + if (!name || !vdcadminname + || !vdcadminpass || !zoneid || !clusterid){ + notifyError("Name, administrator, credentials, zone and cluster are mandatory parameters"); return false; } - var hosts=""; + var hosts=[]; $('#vdc_selected_hosts_list li',$(this)).each(function(){ - hosts+=$(this).attr("host_id")+','; + hosts.push($(this).attr("host_id")); + }); + var vnets=[]; + $('#vdc_selected_vnets_list li',$(this)).each(function(){ + vnets.push($(this).attr("vnet_id")); + }); + var datastores=[]; + $('#vdc_selected_datastores_list li',$(this)).each(function(){ + datastores.push($(this).attr("datastore_id")); }); - if (hosts.length){ - hosts= hosts.slice(0,-1); - }; var vdc_json = { "VDC" : { "NAME" : name, - "ZONEID" : zoneid, + "ZONE_ID" : zoneid, "VDCADMINNAME" : vdcadminname, "VDCADMINPASS" : vdcadminpass, "FORCE" : force, - "HOSTS" : hosts + "CLUSTER_ID" : clusterid, + "RESOURCES" : { + "HOSTS" : hosts, + "DATASTORES" : datastores, + "NETWORKS" : vnets, + }, } }; @@ -516,7 +720,7 @@ function setupCreateVDCDialog(){ dialog.dialog('close'); return false; }); -} +}; function openCreateVDCDialog(){ var dialog = $('div#create_vdc_dialog') @@ -526,8 +730,6 @@ function openCreateVDCDialog(){ }; $('select#zoneid',dialog).html(zones_select); $('select#zoneid',dialog).trigger("change"); - $('#vdc_available_hosts_list',dialog).empty(); - $('#vdc_selected_hosts_list',dialog).empty(); dialog.dialog('open'); } @@ -539,7 +741,13 @@ function setupUpdateVDCDialog(){ dialog.dialog({ autoOpen: false, modal: true, - width: 420 + width: 500 + }); + + $('div#vdc_update_hosts_lists,div#vdc_update_vnets_lists,div#vdc_update_datastores_lists',dialog).hide(); + $('.vdc_show_hide',dialog).click(function(){ + $('span',this).toggleClass('ui-icon-triangle-1-s ui-icon-triangle-1-n'); + $(this).parent().next().toggle(); }); $('button',dialog).button(); @@ -551,8 +759,24 @@ function setupUpdateVDCDialog(){ connectWith : '#vdc_update_available_hosts_list', containment: dialog }); + $('#vdc_update_available_vnets_list',dialog).sortable({ + connectWith : '#vdc_update_selected_vnets_list', + containment: dialog + }); + $('#vdc_update_selected_vnets_list',dialog).sortable({ + connectWith : '#vdc_update_available_vnets_list', + containment: dialog + }); + $('#vdc_update_available_datastores_list',dialog).sortable({ + connectWith : '#vdc_update_selected_datastores_list', + containment: dialog + }); + $('#vdc_update_selected_datastores_list',dialog).sortable({ + connectWith : '#vdc_update_available_datastores_list', + containment: dialog + }); - $('#vdc_update_force_hosts',dialog).change(function(){ + $('#vdc_update_force',dialog).change(function(){ select = $('select#vdc_update_id',$update_vdc_dialog); if (select.val().length){ select.trigger("change"); @@ -566,10 +790,22 @@ function setupUpdateVDCDialog(){ $('#vdc_update_available_hosts_list',$update_vdc_dialog); var sel_hosts= $('#vdc_update_selected_hosts_list',$update_vdc_dialog); + var av_vnets= + $('#vdc_update_available_vnets_list',$update_vdc_dialog); + var sel_vnets= + $('#vdc_update_selected_vnets_list',$update_vdc_dialog); + var av_datastores= + $('#vdc_update_available_datastores_list',$update_vdc_dialog); + var sel_datastores= + $('#vdc_update_selected_datastores_list',$update_vdc_dialog); - if (!id || !id.length) { + if (!id) { av_hosts.empty(); sel_hosts.empty(); + av_vnets.empty(); + sel_vnets.empty(); + av_datastores.empty(); + sel_datastores.empty(); return true; }; //A VDC has been selected @@ -577,32 +813,44 @@ function setupUpdateVDCDialog(){ //move current hosts to current av_hosts.html('
                            • '+spinner+'
                            • '); sel_hosts.empty(); + av_vnets.html('
                            • '+spinner+'
                            • '); + sel_vnets.empty(); + av_datastores.html('
                            • '+spinner+'
                            • '); + sel_datastores.empty(); Sunstone.runAction("VDC.update_zone_hosts",zone_id); + Sunstone.runAction("VDC.update_zone_vnets",zone_id); + Sunstone.runAction("VDC.update_zone_datastores",zone_id); }); $('#update_vdc_form').submit(function(){ - var force = $('#vdc_update_force_hosts',this).length ? "yes" : "nein"; + var force = $('#vdc_update_force',this).length ? "yes" : "nein"; var id = $('#vdc_update_id',this).val(); - var hosts=""; + var hosts=[]; $('#vdc_update_selected_hosts_list li',this).each(function(){ - hosts+=$(this).attr("host_id")+','; + hosts.push($(this).attr("host_id")); + }); + var vnets=[]; + $('#vdc_update_selected_vnets_list li',this).each(function(){ + vnets.push($(this).attr("vnet_id")); + }); + var datastores=[]; + $('#vdc_update_selected_datastores_list li',this).each(function(){ + datastores.push($(this).attr("datastore_id")); }); - if (hosts.length){ - hosts= hosts.slice(0,-1); - }; var vdc_json = { "VDC" : { "ID": id, "FORCE": force, - "HOSTS": "" - } + "RESOURCES": { + "HOSTS": hosts, + "NETWORKS": vnets, + "DATASTORES": datastores, + } + }, }; - if (hosts.length){ - vdc_json["VDC"]["HOSTS"]=hosts; - }; Sunstone.runAction("VDC.update",id,vdc_json); dialog.dialog('close'); return false; @@ -630,6 +878,10 @@ function openUpdateVDCDialog(){ $('#vdc_update_available_hosts_list',dialog).empty(); $('#vdc_update_selected_hosts_list',dialog).empty(); + $('#vdc_update_available_vnets_list',dialog).empty(); + $('#vdc_update_selected_vnets_list',dialog).empty(); + $('#vdc_update_available_datastores_list',dialog).empty(); + $('#vdc_update_selected_datastores_list',dialog).empty(); $('select#vdc_update_id',dialog).html(options); if (selected_elems.length == 1){ @@ -663,13 +915,13 @@ $(document).ready(function(){ "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "60px", "aTargets": [0] }, - { "sWidth": "150px", "aTargets": [4] }, - { "sWidth": "35px", "aTargets": [1,3] } + { "sWidth": "150px", "aTargets": [5,6,7] }, + { "sWidth": "35px", "aTargets": [1,3,4] } ] }); dataTable_vdcs.fnClearTable(); - addElement([spinner,'','','',''],dataTable_vdcs); + addElement([spinner,'','','','','','',''],dataTable_vdcs); Sunstone.runAction("VDC.list"); setupCreateVDCDialog(); diff --git a/src/ozones/Server/public/js/plugins/zones-tab.js b/src/ozones/Server/public/js/plugins/zones-tab.js index 00ab69e0c7..54b1049694 100644 --- a/src/ozones/Server/public/js/plugins/zones-tab.js +++ b/src/ozones/Server/public/js/plugins/zones-tab.js @@ -178,7 +178,23 @@ var zone_actions = { updateUsersList(req,user_json,'#datatable_zone_users'); }, error: onError - } + }, + "Zone.cluster" : { + type: "single", + call: oZones.Zone.cluster, + callback: function(req,json){ + updateClustersList(req,json,'#datatable_zone_clusters'); + }, + error: onError + }, + "Zone.datastore" : { + type: "single", + call: oZones.Zone.datastore, + callback: function(req,json){ + updateDatastoresList(req,json,'#datatable_zone_datastores'); + }, + error: onError + }, } var zone_buttons = { @@ -210,26 +226,38 @@ var zone_info_panel = { title : "Zone Information", content : "" }, - "zone_hosts_tab" : { - title : "Hosts", - content : "" - }, - "zone_templates_tab" : { - title : "Templates", + "zone_users_tab" : { + title : "Users", content : "" }, "zone_vms_tab" : { title : "Virtual Machines", content : "" }, - "zone_vnets_tab" : { - title : "Virtual Networks", + "zone_templates_tab" : { + title : "Templates", content : "" }, "zone_images_tab" : { title : "Images", content : "" - } + }, + "zone_clusters_tab" : { + title : "Clusters", + content : "" + }, + "zone_hosts_tab" : { + title : "Hosts", + content : "" + }, + "zone_datastores_tab" : { + title : "Datastores", + content : "" + }, + "zone_vnets_tab" : { + title : "Virtual Networks", + content : "" + }, }; Sunstone.addActions(zone_actions); @@ -339,6 +367,7 @@ function updateZoneInfo(req,zone_json){
                              \ \ \ + \ \ \ \ @@ -384,6 +413,7 @@ function updateZoneInfo(req,zone_json){ \ \ \ + \ \ \ \ @@ -403,6 +433,7 @@ function updateZoneInfo(req,zone_json){ \ \ \ + \ \ \ \ @@ -453,6 +484,43 @@ function updateZoneInfo(req,zone_json){ ' }; + var clusters_tab = { + title: "Clusters", + content: +'
                              \ +
                              IDNameZone IDCluster IDHostsVirtual NetworksDatastores
                              Zone ID'+vdc.ZONES_ID+'
                              Cluster ID'+vdc.CLUSTER_ID+'
                              Hosts'+(vdc.HOSTS? vdc.HOSTS : "none")+''+(vdc.RESOURCES.HOSTS.length? vdc.RESOURCES.HOSTS.join() : "none")+'
                              Virtual Networks'+(vdc.RESOURCES.NETWORKS.length? vdc.RESOURCES.NETWORKS.join() : "none")+'
                              Datastores'+(vdc.RESOURCES.DATASTORES.length? vdc.RESOURCES.DATASTORES.join() : "none")+'
                              Admin name
                              ACLs'+vdc.ACLS+''+(vdc.RESOURCES.ACLS.length ? vdc.RESOURCES.ACLS.join() : "none") +'
                              Sunstone public link
                              IDNameClusterRunning VMsCPU UseMemory useCPUMemoryHostnameIPsStart Time
                              OwnerGroupNameClusterTypeBridgeTotal Leases
                              \ + \ + \ + \ + \ + \ + \ + \ + \ +
                              IDName
                              \ +
                              ' + }; + + var datastores_tab = { + title: "Datastores", + content: +'
                              \ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
                              IDOwnerGroupNameCluster
                              \ +
                              ' + }; + Sunstone.updateInfoPanelTab("zone_info_panel","zone_info_tab",info_tab); Sunstone.updateInfoPanelTab("zone_info_panel","zone_hosts_tab",hosts_tab); Sunstone.updateInfoPanelTab("zone_info_panel","zone_templates_tab",templates_tab); @@ -460,6 +528,8 @@ function updateZoneInfo(req,zone_json){ Sunstone.updateInfoPanelTab("zone_info_panel","zone_vnets_tab",vnets_tab); Sunstone.updateInfoPanelTab("zone_info_panel","zone_images_tab",images_tab); Sunstone.updateInfoPanelTab("zone_info_panel","zone_users_tab",users_tab); + Sunstone.updateInfoPanelTab("zone_info_panel","zone_clusters_tab",clusters_tab); + Sunstone.updateInfoPanelTab("zone_info_panel","zone_datastores_tab",datastores_tab); //Pop up the info we have now. Sunstone.popUpInfoPanel("zone_info_panel"); @@ -472,9 +542,10 @@ function updateZoneInfo(req,zone_json){ "bAutoWidth":false, "sPaginationType": "full_numbers", "aoColumnDefs": [ - { "sWidth": "60px", "aTargets": [2,5] }, + { "sWidth": "60px", "aTargets": [3,6] }, + { "sWidth": "100px", "aTargets": [2] }, { "sWidth": "35px", "aTargets": [0] }, - { "sWidth": "200px", "aTargets": [3,4] } + { "sWidth": "200px", "aTargets": [4,5] } ] }); @@ -497,9 +568,9 @@ function updateZoneInfo(req,zone_json){ "bAutoWidth":false, "sPaginationType": "full_numbers", "aoColumnDefs": [ - { "sWidth": "60px", "aTargets": [4,5,6] }, + { "sWidth": "60px", "aTargets": [5,6,7] }, { "sWidth": "35px", "aTargets": [0] }, - { "sWidth": "100px", "aTargets": [1,2] } + { "sWidth": "100px", "aTargets": [1,2,4] } ] }); @@ -536,6 +607,26 @@ function updateZoneInfo(req,zone_json){ ] }); + $('#datatable_zone_clusters').dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "bAutoWidth":false, + "sPaginationType": "full_numbers", + "aoColumnDefs": [ + { "sWidth": "35px", "aTargets": [0] }, + ] + }); + + $('#datatable_zone_datastores').dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "bAutoWidth":false, + "sPaginationType": "full_numbers", + "aoColumnDefs": [ + { "sWidth": "35px", "aTargets": [0] }, + { "sWidth": "100px", "aTargets": [1,2,4] } + ] + }); /*End init dataTables*/ @@ -546,6 +637,8 @@ function updateZoneInfo(req,zone_json){ Sunstone.runAction("Zone.vnet",zone.ID); Sunstone.runAction("Zone.image",zone.ID); Sunstone.runAction("Zone.user",zone.ID); + Sunstone.runAction("Zone.cluster",zone.ID); + Sunstone.runAction("Zone.datastore",zone.ID); } diff --git a/src/vmm_mad/remotes/vmware/shutdown b/src/vmm_mad/remotes/vmware/shutdown index b154da7dd9..315acff535 100755 --- a/src/vmm_mad/remotes/vmware/shutdown +++ b/src/vmm_mad/remotes/vmware/shutdown @@ -29,9 +29,26 @@ $: << File.dirname(__FILE__) require 'vmware_driver' +#------------------------------------------------------------------------------ +# Wait the VM to shutdown TIMEOUT (xPOLL_INTERVAL) seconds. +# Set to ~10min +#------------------------------------------------------------------------------ +POLL_INTERVAL=2 +TIMEOUT=300 + deploy_id = ARGV[0] host = ARGV[1] vmware_drv = VMwareDriver.new(host) vmware_drv.shutdown(deploy_id) + +count=0 +while (vmware_drv.poll(deploy_id).match(/STATE=(.*)/)[1] != "d") do + sleep POLL_INTERVAL + if count > TIMEOUT then + OpenNebula.log_debug("Timeout reached and VM #{deploy_id} is still alive.") + exit -1 + end + count+=POLL_INTERVAL +end