1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Ruben S. Montero 2011-09-01 17:20:12 +02:00
commit db784373db
3 changed files with 50 additions and 32 deletions

View File

@ -330,10 +330,11 @@ IMAGE_MAD = [
# - STOP, after the VM is stopped (including VM image transfers)
# - DONE, after the VM is deleted or shutdown
# - FAILED, when the VM enters the failed state
# command : path is relative to $ONE_LOCATION/var/remotes/hook (self-contained)
# or to /var/lib/one/remotes (system-wide). That directory will be copied
# on the hosts under SCRIPTS_REMOTE_DIR. It can be an absolute path
# that must exists on the target host.
# command : path is relative to $ONE_LOCATION/var/remotes/hook
# (self-contained) or to /var/lib/one/remotes/hook (system-wide).
# That directory will be copied on the hosts under
# SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist
# on the target host
# arguments : for the hook. You can access to VM information with $
# - $VMID, the ID of the virtual machine
# - $TEMPLATE, the VM template in xml and base64 encoded
@ -349,10 +350,11 @@ IMAGE_MAD = [
# - CREATE, when the Host is created (onehost create)
# - ERROR, when the Host enters the error state
# - DISABLE, when the Host is disabled
# command : path is relative to $ONE_LOCATION/var/remotes/hook (self-contained)
# or to /var/lib/one/remotes (system-wide). That directory will be copied
# on the hosts under SCRIPTS_REMOTE_DIR. It can be an absolute path
# that must exists on the target host.
# command : path is relative to $ONE_LOCATION/var/remotes/hook
# (self-contained) or to /var/lib/one/remotes/hook (system-wide).
# That directory will be copied on the hosts under
# SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist
# on the target host.
# arguments : for the hook. You can use the following Host information:
# - $HID, the ID of the host
# - $TEMPLATE, the Host template in xml and base64 encoded

View File

@ -32,15 +32,24 @@ exit(-1) if $?!=0
xm_text=`sudo #{XM_PATH} info`
exit(-1) if $?!=0
xentop_text.gsub!(/^xentop.*^xentop.*?$/m, "") # Strip first top output
#xentop_text.gsub!(/^xentop.*^xentop.*?$/m, "") # Strip first top output
xentop_text.gsub!("no limit", "no_limit")
xentop_text=xentop_text.split("\n")
xentop_text.reject! {|l| l.strip=="" } # Take out empty lines
lines=xentop_text.split("\n")
block_size=lines.length/2
valid_lines=lines.last(block_size)
first_domain = 4
valid_lines.each_with_index{ |l,i|
if l.match 'NAME STATE'
first_domain=i+1
break
end
}
domain_info_line=xentop_text[0]
memory_info_line=xentop_text[1]
domains_info=xentop_text[3..-1]
domains_info=valid_lines[first_domain..-1]
# Getting information from xm info

View File

@ -199,7 +199,15 @@ module XEN
block_size=lines.length/2
valid_lines=lines.last(block_size)
domain_lines=valid_lines[4..-1]
first_domain = 4
valid_lines.each_with_index{ |l,i|
if l.match 'NAME STATE'
first_domain=i+1
break
end
}
domain_lines=valid_lines[first_domain..-1]
domains=Hash.new
@ -345,4 +353,3 @@ if vm_id
else
print_all_vm_info(hypervisor)
end