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

Deleting unused code

git-svn-id: http://svn.opennebula.org/one/trunk@680 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Javier Fontán Muiños 2009-07-13 15:13:54 +00:00
parent 68c118e1c2
commit ce0ccfb76d
4 changed files with 17 additions and 110 deletions

View File

@ -25,9 +25,9 @@ else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << RUBY_LIB_LOCATION
$: << './lib'
require 'OpenNebula'
require 'client_utilities'
@ -63,7 +63,9 @@ ShowTableHost={
:name => "FCPU",
:desc => "Free cpu percentage",
:size => 6,
:proc => lambda {|d,e| d["HOST_SHARE/MAX_CPU"].to_i-d["HOST_SHARE/USED_CPU"].to_i }
:proc => lambda {|d,e|
d["HOST_SHARE/MAX_CPU"].to_i-d["HOST_SHARE/USED_CPU"].to_i
}
},
:acpu => {
:name => "ACPU",
@ -106,9 +108,6 @@ class HostShow
@table=ShowTable.new(ShowTableHost)
end
def close
end
def header_host_small
scr_bold
scr_underline

View File

@ -27,13 +27,12 @@ end
$: << RUBY_LIB_LOCATION
$: << "./lib"
#require 'one'
require 'OpenNebula'
require 'client_utilities'
require 'command_parse'
ShowTableUP={
:uid => {
:name => "UID",
@ -71,9 +70,6 @@ class UPShow
@table=ShowTable.new(ShowTableUP)
end
def close
end
def header_up_small
scr_bold
scr_underline
@ -185,7 +181,6 @@ when "list"
uplist=UPShow.new
ops[:columns]=ops[:list] if ops[:list]
result=uplist.list_short(ops)
uplist.close
else
userpool=OpenNebula::UserPool.new(get_one_client)
userpool.info

View File

@ -25,17 +25,13 @@ else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << './lib'
$: << RUBY_LIB_LOCATION
#require 'one'
require 'OpenNebula'
require 'client_utilities'
require 'command_parse'
require 'profiler'
ShowTableVM={
:id => {
@ -169,9 +165,6 @@ class VmShow
@table_history=ShowTable.new(ShowTableHistory)
end
def close
end
def header_vm_small
scr_bold
scr_underline
@ -187,24 +180,6 @@ class VmShow
scr_restore
puts ""
end
def print_vm_long(data)
str="%-10s: %-20s"
puts str % ["ID", data["oid"]]
puts str % ["NAME", data["deploy_id"]]
puts str % ["STATE", ONE::VM_STATE[data["state"].to_i]]
puts str % ["LCM_STATE", ONE::LCM_STATE[data["lcm_state"].to_i]]
puts str % ["MEMORY", data["memory"]]
puts str % ["CPU", data["cpu"]]
puts
str=" %-20s: %-20s"
data.each {|key,value|
puts str % [key, value] if !%w{oid deploy_id state lcm_state memory cpu template_id}.include? key
}
end
def list_short(options=nil)
res=@vmpool.info()
@ -595,7 +570,6 @@ when "list"
ops[:columns]=ops[:list] if ops[:list]
result=vmlist.list_short(ops)
vmlist.close
else
vmpool=OpenNebula::VirtualMachinePool.new(get_one_client,
filter_flag.to_i)
@ -607,24 +581,9 @@ when "top"
vmlist=VmShow.new(get_one_client)
ops[:columns]=ops[:list] if ops[:list]
result=vmlist.top(ops)
vmlist.close
when "show_db"
# TODO: delete?
check_parameters("show", 1)
vmlist=VmShow.new(vm)
if ARGV[0]
vm_id=get_vm_id(vm, ARGV[0])
result=vmlist.list_long(vm_id)
vmlist.close
else
result=[false, "You must provide a VM id."]
end
when "history"
# TODO: change this to new API
vmlist=VmShow.new(get_one_client)
ops[:columns]=ops[:list] if ops[:list]
if ARGV[0]
@ -634,7 +593,6 @@ when "history"
else
result=vmlist.list_vm_history_all(ops)
end
vmlist.close
when "delete"
check_parameters("delete", 1)
@ -649,7 +607,6 @@ when "delete"
end
when "show"
# TODO: change this to the new API
check_parameters("get_info", 1)
vm_id=get_vm_id(ARGV[0])
@ -695,43 +652,6 @@ when "show"
puts vm.to_xml
end
=begin
result = res = vm.get_info(vm_id)
if res[0]
res[1].gsub!(/^\n/, '')
(normal, template)=res[1].split("Template")
str="%-15s: %-20s"
normal.each{|line|
(key, value)=line.split(":").collect{|v| v.strip }
case key
when "STATE"
value = ONE::VM_STATE[value.to_i]
when "LCM STATE"
value = ONE::LCM_STATE[value.to_i]
when "START TIME","STOP TIME"
value=Time.at(value.to_i).strftime("%m/%d %H:%M:%S")
end
puts str % [key, value]
}
puts
puts "....: Template :...."
str=" %-16s: %-20s"
template.gsub!(/\@\^\_\^\@/,',')
template.scan(/^\t*(.*?)=(.*)$/).each{|line|
(key, value)=line
puts str % [key, value]
}
command_exit 0
end
=end
else
onevm_opts.print_help
exit -1
@ -745,6 +665,3 @@ if OpenNebula.is_error?(result)
end
#command_exit 0

View File

@ -27,13 +27,12 @@ end
$: << RUBY_LIB_LOCATION
$: << "./lib"
#require 'one'
require 'OpenNebula'
require 'client_utilities'
require 'command_parse'
ShowTableVN={
:nid => {
:name => "NID",
@ -93,13 +92,11 @@ ShowTableVN={
class VNShow
def initialize(filter_flag="-2")
@vnpool=OpenNebula::VirtualNetworkPool.new(get_one_client,filter_flag.to_i)
@vnpool=OpenNebula::VirtualNetworkPool.new(get_one_client,
filter_flag.to_i)
@table=ShowTable.new(ShowTableVN)
end
def close
end
def header_vn_small
scr_bold
scr_underline
@ -258,18 +255,18 @@ when "delete"
when "list"
if ARGV[0]
case ARGV[0]
when "a", "all"
when "a", "all"
filter_flag="-2"
when "m", "mine"
filter_flag="-1"
else
if !ARGV[0].match(/^[0123456789]+$/)
filter_flag="-2"
when "m", "mine"
filter_flag="-1"
ops[:filter_flag]=ARGV[0]
else
if !ARGV[0].match(/^[0123456789]+$/)
filter_flag="-2"
ops[:filter_flag]=ARGV[0]
else
filter_flag=ARGV[0]
end
filter_flag=ARGV[0]
end
end
else
filter_flag="-2"
end
@ -278,7 +275,6 @@ when "list"
vnlist=VNShow.new(filter_flag)
ops[:columns]=ops[:list] if ops[:list]
result=vnlist.list_short(ops)
vnlist.close
else
vnpool=OpenNebula::VirtualNetworkPool.new(get_one_client,
filter_flag.to_i)