1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-25 06:03:36 +03:00

feature #200 Fixed uppercase paths in xml

This commit is contained in:
Daniel Molina 2010-07-20 19:19:31 +02:00 committed by Ruben S. Montero
parent 10bfc260ff
commit 104387a75b
7 changed files with 29 additions and 30 deletions

View File

@ -62,12 +62,12 @@ ShowTableExample={
:id => {
:name => "ID",
:size => 4,
:proc => lambda {|d,e| d["oid"] }
:proc => lambda {|d,e| d["OID"] }
},
:name => {
:name => "NAME",
:size => 8,
:proc => lambda {|d,e| d["deploy_id"] }
:proc => lambda {|d,e| d["DEPLOY_ID"] }
},
:stat => {
:name => "STAT",
@ -294,11 +294,11 @@ def get_cluster_id(name)
end
def str_running_time(data)
stime=Time.at(data["stime"].to_i)
if data["etime"]=="0"
stime=Time.at(data["STIME"].to_i)
if data["ETIME"]=="0"
etime=Time.now
else
etime=Time.at(data["etime"].to_i)
etime=Time.at(data["ETIME"].to_i)
end
dtime=Time.at(etime-stime).getgm

View File

@ -15,7 +15,6 @@
#--------------------------------------------------------------------------- #
require 'optparse'
require 'pp'
class CommandParse

View File

@ -42,14 +42,14 @@ ShowTableHost={
:name => {
:name => "NAME",
:desc => "Hostname",
:size => 25,
:size => 15,
:left => true,
:proc => lambda {|d,e| d.name }
},
:cluster => {
:name => "CLUSTER",
:desc => "Clustername",
:size => 25,
:size => 15,
:left => true,
:proc => lambda {|d,e| d.cluster }
},
@ -216,7 +216,7 @@ def vms_in_host?(host_id)
exit -1
end
host['host_share/running_vms'].to_i
host['HOST_SHARE/RUNNING_VMS'].to_i
end

View File

@ -51,7 +51,7 @@ ShowTableUP={
:desc => "password of the user",
:size => 50,
:left => true,
:proc => lambda {|d,e| d[:password] }
:proc => lambda {|d,e| d['PASSWORD'] }
},
:default => [:id, :user, :password]

View File

@ -68,14 +68,14 @@ ShowTableVM={
:desc => "CPU percentage used by the VM",
:size => 3,
:proc => lambda {|d,e|
d["cpu"]
d["CPU"]
}
},
:mem => {
:name => "MEM",
:desc => "Memory used by the VM",
:size => 7,
:proc => lambda {|d,e| d["memory"] }
:proc => lambda {|d,e| d["MEMORY"] }
},
:hostname => {
:name => "HOSTNAME",
@ -100,26 +100,26 @@ ShowTableHistory={
:name => "ID",
:desc => "ONE identifier for the VM",
:size => 4,
:proc => lambda {|d,e| d["id"] }
:proc => lambda {|d,e| d["ID"] }
},
:seq => {
:name => "SEQ",
:desc => "Sequence number",
:size => 3,
:proc => lambda {|d,e| d["seq"] }
:proc => lambda {|d,e| d["SEQ"] }
},
:hostname => {
:name => "HOSTNAME",
:desc => "Name of the host where the VM was submited",
:size => 15,
:proc => lambda {|d,e| d["host_name"] }
:proc => lambda {|d,e| d["HOST_NAME"] }
},
:stime => {
:name => "STIME",
:desc => "Start time",
:size => 14,
:proc => lambda {|d,e|
t=Time.at(d["stime"].to_i)
t=Time.at(d["STIME"].to_i)
t.strftime("%m/%d %H:%M:%S")
}
},
@ -128,10 +128,10 @@ ShowTableHistory={
:desc => "End time",
:size => 14,
:proc => lambda {|d,e|
if d["etime"].to_i==0
if d["ETIME"].to_i==0
"--"
else
t=Time.at(d["etime"].to_i)
t=Time.at(d["ETIME"].to_i)
t.strftime("%m/%d %H:%M:%S")
end
}
@ -141,7 +141,7 @@ ShowTableHistory={
:desc => "Total time",
:size => 11,
:proc => lambda {|d,e|
d["time"]
d["TIME"]
}
},
:reason => {
@ -149,7 +149,7 @@ ShowTableHistory={
:desc => "Reason for state change",
:size => "6",
:proc => lambda {|d,e|
OpenNebula::VirtualMachine.get_reason(d["reason"])
OpenNebula::VirtualMachine.get_reason(d["REASON"])
}
},
@ -234,12 +234,12 @@ class VmShow
def get_vm_history(vm)
{
'id' => vm.id,
'seq' => vm['history/seq'],
'host_name' => vm['history/hostname'],
'stime' => vm['history/stime'],
'etime' => vm['history/etime'],
'seq' => vm['HISTORY/SEQ'],
'host_name' => vm['HISTORY/HOSTNAME'],
'stime' => vm['HISTORY/STIME'],
'etime' => vm['HISTORY/ETIME'],
'time' => str_running_time(vm),
'reason' => vm['history/reason']
'reason' => vm['HISTORY/REASON']
}
end
@ -274,7 +274,7 @@ class VmShow
def list_vm_history_array(ids, options=nil)
get_vms_history(ids).each {|vm|
puts "History for VM #{vm['id']}"
puts "History for VM #{vm['ID']}"
puts
list_vm_history(vm, options)
puts

View File

@ -58,10 +58,10 @@ ShowTableVN={
:desc => "NType of virtual network",
:size => 6,
:proc => lambda {|d,e|
if(d["type"] == "0")
if(d["TYPE"] == "0")
return "Ranged"
else
if (d["type"] == "1")
if (d["TYPE"] == "1")
return "Fixed"
end
end
@ -77,7 +77,7 @@ ShowTableVN={
:name => "BRIDGE",
:desc => "Bridge associated to the virtual network",
:size => 6,
:proc => lambda {|d,e| d["bridge"] }
:proc => lambda {|d,e| d["BRIDGE"] }
},
:public => {
:name => "PUBLIC",

View File

@ -2,7 +2,7 @@
module OpenNebula
# The Pool class represents a generic OpenNebula Pool in XML format
# and provides the basic functionality to handle the Pool elements
require 'pp'
class Pool < XMLPool
include Enumerable