mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-10 01:17:40 +03:00
feature #200: Fix uppercase XPATH variables
This commit is contained in:
parent
104387a75b
commit
6ffad9cdef
@ -42,14 +42,14 @@ ShowTableHost={
|
||||
:name => {
|
||||
:name => "NAME",
|
||||
:desc => "Hostname",
|
||||
:size => 15,
|
||||
:size => 25,
|
||||
:left => true,
|
||||
:proc => lambda {|d,e| d.name }
|
||||
},
|
||||
:cluster => {
|
||||
:name => "CLUSTER",
|
||||
:desc => "Clustername",
|
||||
:size => 15,
|
||||
:size => 25,
|
||||
:left => true,
|
||||
:proc => lambda {|d,e| d.cluster }
|
||||
},
|
||||
@ -103,7 +103,7 @@ ShowTableHost={
|
||||
d.short_state_str()
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
:default => [:id, :name, :cluster, :rvm, :tcpu, :fcpu, :acpu, :tmem, :fmem, :stat]
|
||||
}
|
||||
@ -113,7 +113,7 @@ class HostShow
|
||||
@hostpool=OpenNebula::HostPool.new(client)
|
||||
@table=ShowTable.new(ShowTableHost)
|
||||
end
|
||||
|
||||
|
||||
def header_host_small
|
||||
scr_bold
|
||||
scr_underline
|
||||
@ -121,7 +121,7 @@ class HostShow
|
||||
scr_restore
|
||||
puts ""
|
||||
end
|
||||
|
||||
|
||||
def list_short(options=nil)
|
||||
res=@hostpool.info
|
||||
if options
|
||||
@ -141,13 +141,13 @@ class HostShow
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def top(options=nil)
|
||||
delay=1
|
||||
delay=options[:delay] if options && options[:delay]
|
||||
|
||||
|
||||
result=nil
|
||||
|
||||
|
||||
begin
|
||||
while true
|
||||
scr_cls
|
||||
@ -162,28 +162,28 @@ class HostShow
|
||||
end
|
||||
|
||||
class OnehostParse < CommandParse
|
||||
|
||||
|
||||
COMMANDS_HELP=<<-EOT
|
||||
Commands:
|
||||
|
||||
* create (Adds a new machine to the pool)
|
||||
onehost create <hostname> <im_mad> <vmm_mad> <tm_mad>
|
||||
|
||||
|
||||
* show (Gets info from a host)
|
||||
onehost show <host_id>
|
||||
|
||||
|
||||
* delete (Removes a machine from the pool)
|
||||
onehost delete <host_id>
|
||||
|
||||
|
||||
* list (Lists machines in the pool)
|
||||
onehost list
|
||||
|
||||
|
||||
* enable (Enables host)
|
||||
onehost enable <host_id>
|
||||
|
||||
|
||||
* disable (Disables host)
|
||||
onehost disable <host_id>
|
||||
|
||||
|
||||
* top (Lists hosts continuously)
|
||||
onehost top
|
||||
|
||||
@ -215,7 +215,7 @@ def vms_in_host?(host_id)
|
||||
puts rc.message
|
||||
exit -1
|
||||
end
|
||||
|
||||
|
||||
host['HOST_SHARE/RUNNING_VMS'].to_i
|
||||
|
||||
end
|
||||
@ -234,26 +234,26 @@ when "add", "create"
|
||||
check_parameters("create", 4)
|
||||
host=OpenNebula::Host.new(OpenNebula::Host.build_xml, get_one_client)
|
||||
result=host.allocate(ARGV[0], ARGV[1], ARGV[2], ARGV[3])
|
||||
|
||||
|
||||
if is_successful?(result)
|
||||
puts "ID: " + host.id.to_s if ops[:verbose]
|
||||
exit 0
|
||||
end
|
||||
|
||||
|
||||
when "show"
|
||||
check_parameters("show", 1)
|
||||
#args=expand_args(ARGV)
|
||||
|
||||
|
||||
host_id=get_host_id(ARGV[0])
|
||||
|
||||
|
||||
host=OpenNebula::Host.new_with_id(host_id, get_one_client)
|
||||
|
||||
|
||||
result=host.info
|
||||
if is_successful?(result)
|
||||
if !ops[:xml]
|
||||
str = "%-22s: %-20s"
|
||||
str_h1 = "%-80s"
|
||||
|
||||
|
||||
print_header(str_h1, "HOST #{host_id} INFORMATION", true)
|
||||
|
||||
puts str % ["ID", host.id.to_s]
|
||||
@ -266,7 +266,7 @@ when "show"
|
||||
puts
|
||||
|
||||
print_header(str_h1, "HOST SHARES", false)
|
||||
|
||||
|
||||
puts str % ["MAX MEM", host['HOST_SHARE/MAX_MEM']]
|
||||
puts str % ["USED MEM (REAL)", host['HOST_SHARE/USED_MEM']]
|
||||
puts str % ["USED MEM (ALLOCATED)", host['HOST_SHARE/MEM_USAGE']]
|
||||
@ -290,7 +290,7 @@ when "delete"
|
||||
|
||||
args.each do |param|
|
||||
host_id=get_host_id(param)
|
||||
|
||||
|
||||
host = OpenNebula::Host.new_with_id(host_id,get_one_client)
|
||||
|
||||
rc = host.info
|
||||
@ -300,7 +300,7 @@ when "delete"
|
||||
exit -1
|
||||
end
|
||||
|
||||
if host['host_share/running_vms'].to_i != 0
|
||||
if host['HOST_SHARE/RUNNING_VMS'].to_i != 0
|
||||
puts "Host still has associated VMs, aborting delete."
|
||||
else
|
||||
result=host.delete
|
||||
@ -310,7 +310,7 @@ when "delete"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
when "list"
|
||||
if !ops[:xml]
|
||||
hostlist=HostShow.new(get_one_client)
|
||||
@ -326,7 +326,7 @@ when "top"
|
||||
hostlist=HostShow.new(get_one_client)
|
||||
ops[:columns]=ops[:list] if ops[:list]
|
||||
result=hostlist.top(ops)
|
||||
|
||||
|
||||
when "enable"
|
||||
check_parameters("enable", 1)
|
||||
args=expand_args(ARGV)
|
||||
@ -356,13 +356,13 @@ when "disable"
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
else
|
||||
onehost_opts.print_help
|
||||
exit -1
|
||||
end
|
||||
|
||||
if is_error?(result)
|
||||
if is_error?(result)
|
||||
puts "Error: " + result.message
|
||||
exit -1
|
||||
end
|
||||
|
@ -686,7 +686,8 @@ when "show"
|
||||
str="%-15s: %-20s"
|
||||
str_h1="%-80s"
|
||||
|
||||
print_header(str_h1, "VIRTUAL MACHINE #{vm[:id]} INFORMATION", true)
|
||||
print_header(str_h1, "VIRTUAL MACHINE #{vm['ID']} INFORMATION",
|
||||
true)
|
||||
|
||||
puts str % ["ID", vm.id.to_s]
|
||||
puts str % ["NAME", vm.name]
|
||||
|
Loading…
Reference in New Issue
Block a user