mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Feature #1112: Cluster -1 elements now have empty Cluster name element. The CLI shows '-' for these resources
This commit is contained in:
parent
187265f828
commit
761e3d5973
@ -399,6 +399,18 @@ EOT
|
||||
end
|
||||
end
|
||||
|
||||
# If the cluster name is empty, returns a '-' char.
|
||||
#
|
||||
# @param str [String || Hash] Cluster name, or empty Hash (when <CLUSTER/>)
|
||||
# @return [String] the same Cluster name, or '-' if it is empty
|
||||
def OpenNebulaHelper.cluster_str(str)
|
||||
if str != nil && !str.empty?
|
||||
str
|
||||
else
|
||||
"-"
|
||||
end
|
||||
end
|
||||
|
||||
def OpenNebulaHelper.update_template(id, resource)
|
||||
require 'tempfile'
|
||||
|
||||
|
@ -57,11 +57,7 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
||||
end
|
||||
|
||||
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
|
||||
if d["CLUSTER"] == "none"
|
||||
"-"
|
||||
else
|
||||
d["CLUSTER"]
|
||||
end
|
||||
OpenNebulaHelper.cluster_str(d["CLUSTER"])
|
||||
end
|
||||
|
||||
column :IMAGES, "Number of Images", :left, :size=>6 do |d|
|
||||
@ -111,8 +107,7 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
||||
puts str % ["NAME", datastore.name]
|
||||
puts str % ["USER", datastore['UNAME']]
|
||||
puts str % ["GROUP", datastore['GNAME']]
|
||||
puts str % ["CLUSTER", datastore['CLUSTER']]
|
||||
puts str % ["CLUSTER_ID", datastore['CLUSTER_ID']]
|
||||
puts str % ["CLUSTER", OpenNebulaHelper.cluster_str(datastore['CLUSTER'])]
|
||||
|
||||
puts str % ["DS_MAD", datastore['DS_MAD']]
|
||||
puts str % ["TM_MAD", datastore['TM_MAD']]
|
||||
|
@ -44,11 +44,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
end
|
||||
|
||||
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
|
||||
if d["CLUSTER"] == "none"
|
||||
"-"
|
||||
else
|
||||
d["CLUSTER"]
|
||||
end
|
||||
OpenNebulaHelper.cluster_str(d["CLUSTER"])
|
||||
end
|
||||
|
||||
column :RVM, "Number of Virtual Machines running", :size=>6 do |d|
|
||||
@ -126,7 +122,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
puts str % ["ID", host.id.to_s]
|
||||
puts str % ["NAME", host.name]
|
||||
puts str % ["CLUSTER", host['CLUSTER']]
|
||||
puts str % ["CLUSTER", OpenNebulaHelper.cluster_str(host['CLUSTER'])]
|
||||
puts str % ["STATE", host.state_str]
|
||||
puts str % ["IM_MAD", host['IM_MAD']]
|
||||
puts str % ["VM_MAD", host['VM_MAD']]
|
||||
|
@ -55,11 +55,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
end
|
||||
|
||||
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
|
||||
if d["CLUSTER"] == "none"
|
||||
"-"
|
||||
else
|
||||
d["CLUSTER"]
|
||||
end
|
||||
OpenNebulaHelper.cluster_str(d["CLUSTER"])
|
||||
end
|
||||
|
||||
column :TYPE, "Type of Virtual Network", :size=>6 do |d|
|
||||
@ -111,7 +107,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
puts str % ["NAME", vn['NAME']]
|
||||
puts str % ["USER", vn['UNAME']]
|
||||
puts str % ["GROUP", vn['GNAME']]
|
||||
puts str % ["CLUSTER", vn['CLUSTER']]
|
||||
puts str % ["CLUSTER", OpenNebulaHelper.cluster_str(vn['CLUSTER'])]
|
||||
puts str % ["TYPE", vn.type_str]
|
||||
puts str % ["BRIDGE", vn["BRIDGE"]]
|
||||
puts str % ["VLAN", OpenNebulaHelper.boolean_to_str(vn['VLAN'])]
|
||||
|
@ -26,7 +26,7 @@
|
||||
/* Regular ones start from ID 100 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
const string ClusterPool::NONE_CLUSTER_NAME = "none";
|
||||
const string ClusterPool::NONE_CLUSTER_NAME = "";
|
||||
const int ClusterPool::NONE_CLUSTER_ID = -1;
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -126,7 +126,7 @@ module Migrator
|
||||
" <TM_MAD>shared</TM_MAD>" <<
|
||||
" <BASE_PATH>#{var_location}/datastores/0</BASE_PATH>" <<
|
||||
" <CLUSTER_ID>-1</CLUSTER_ID>" <<
|
||||
" <CLUSTER>none</CLUSTER>" <<
|
||||
" <CLUSTER/>" <<
|
||||
" <IMAGES/>" <<
|
||||
" <TEMPLATE>" <<
|
||||
" <DS_MAD><![CDATA[-]]></DS_MAD>" <<
|
||||
@ -169,7 +169,7 @@ module Migrator
|
||||
|
||||
# Add Cluster elements
|
||||
doc.root.add_element("CLUSTER_ID").text = "-1"
|
||||
doc.root.add_element("CLUSTER").text = "none"
|
||||
doc.root.add_element("CLUSTER").text = ""
|
||||
|
||||
@db[:host_pool].insert(
|
||||
:oid => row[:oid],
|
||||
@ -198,7 +198,7 @@ module Migrator
|
||||
|
||||
# Add Cluster elements
|
||||
doc.root.add_element("CLUSTER_ID").text = "-1"
|
||||
doc.root.add_element("CLUSTER").text = "none"
|
||||
doc.root.add_element("CLUSTER").text = ""
|
||||
|
||||
@db[:network_pool].insert(
|
||||
:oid => row[:oid],
|
||||
@ -283,7 +283,7 @@ module Migrator
|
||||
" <TM_MAD>shared</TM_MAD>" <<
|
||||
" <BASE_PATH>#{var_location}/datastores/1</BASE_PATH>" <<
|
||||
" <CLUSTER_ID>-1</CLUSTER_ID>" <<
|
||||
" <CLUSTER>none</CLUSTER>" <<
|
||||
" <CLUSTER/>" <<
|
||||
images_element <<
|
||||
" <TEMPLATE>" <<
|
||||
" <DS_MAD><![CDATA[fs]]></DS_MAD>" <<
|
||||
|
Loading…
x
Reference in New Issue
Block a user