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

Feature #4369: Show multiple clusters in cli

This commit is contained in:
Carlos Martín 2016-03-16 12:49:56 +01:00
parent 724e9fe2b0
commit ac5b0ff526
5 changed files with 25 additions and 14 deletions

View File

@ -27,8 +27,8 @@
:size: 5
:left: true
:CLUSTER:
:desc: Name of the Cluster
:CLUSTERS:
:desc: Cluster IDs
:size: 12
:left: true
@ -61,7 +61,7 @@
- :NAME
- :SIZE
- :AVAIL
- :CLUSTER
- :CLUSTERS
- :IMAGES
- :TYPE
- :DS

View File

@ -18,8 +18,8 @@
:size: 19
:left: true
:CLUSTER:
:desc: Name of the Cluster
:CLUSTERS:
:desc: Cluster IDs
:size: 10
:left: true
@ -37,6 +37,6 @@
- :USER
- :GROUP
- :NAME
- :CLUSTER
- :CLUSTERS
- :BRIDGE
- :LEASES

View File

@ -820,6 +820,15 @@ EOT
end
end
def OpenNebulaHelper.clusters_str(clusters)
if clusters.nil?
"-"
else
[clusters].flatten.join(',')
end
end
def OpenNebulaHelper.update_template(id, resource, path=nil, xpath='TEMPLATE')
return update_template_helper(false, id, resource, path, xpath)
end

View File

@ -75,8 +75,8 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
end
end
column :CLUSTER, "Name of the Cluster", :left, :size=>12 do |d|
OpenNebulaHelper.cluster_str(d["CLUSTER"])
column :CLUSTERS, "Cluster IDs", :left, :size=>12 do |d|
OpenNebulaHelper.clusters_str(d["CLUSTERS"]["ID"])
end
column :IMAGES, "Number of Images", :size=>6 do |d|
@ -105,7 +105,7 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
Datastore::SHORT_DATASTORE_STATES[state]
end
default :ID, :USER, :GROUP, :NAME, :SIZE, :AVAIL, :CLUSTER, :IMAGES,
default :ID, :USER, :GROUP, :NAME, :SIZE, :AVAIL, :CLUSTERS, :IMAGES,
:TYPE, :DS, :TM, :STAT
end
@ -136,7 +136,8 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
puts str % ["NAME", datastore.name]
puts str % ["USER", datastore['UNAME']]
puts str % ["GROUP", datastore['GNAME']]
puts str % ["CLUSTER", OpenNebulaHelper.cluster_str(datastore['CLUSTER'])]
puts str % ["CLUSTERS",
OpenNebulaHelper.clusters_str(datastore.retrieve_elements("CLUSTERS/ID"))]
puts str % ["TYPE", datastore.type_str]
puts str % ["DS_MAD", datastore['DS_MAD']]

View File

@ -149,8 +149,8 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
d["NAME"]
end
column :CLUSTER, "Name of the Cluster", :left, :size=>10 do |d|
OpenNebulaHelper.cluster_str(d["CLUSTER"])
column :CLUSTERS, "Cluster IDs", :left, :size=>10 do |d|
OpenNebulaHelper.clusters_str(d["CLUSTERS"]["ID"])
end
column :BRIDGE, "Bridge associated to the Virtual Network", :left,
@ -163,7 +163,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
d["USED_LEASES"]
end
default :ID, :USER, :GROUP, :NAME, :CLUSTER, :BRIDGE, :LEASES
default :ID, :USER, :GROUP, :NAME, :CLUSTERS, :BRIDGE, :LEASES
end
table
@ -209,7 +209,8 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
puts str % ["NAME", vn['NAME']]
puts str % ["USER", vn['UNAME']]
puts str % ["GROUP", vn['GNAME']]
puts str % ["CLUSTER", OpenNebulaHelper.cluster_str(vn['CLUSTER'])]
puts str % ["CLUSTERS",
OpenNebulaHelper.clusters_str(vn.retrieve_elements("CLUSTERS/ID"))]
puts str % ["BRIDGE", vn["BRIDGE"]]
puts str % ["VLAN", OpenNebulaHelper.boolean_to_str(vn['VLAN'])]
puts str % ["PHYSICAL DEVICE", vn["PHYDEV"]] if !vn["PHYDEV"].empty?