Class: SystemVm
Constant Summary
CloudstackCli::Helper::ASYNC_STATES
Instance Attribute Summary
#config
Instance Method Summary
collapse
exit_on_failure?
#ask_number, #bootstrap_server, #bootstrap_server_interactive, #create_port_rules, #create_server, #print_job_status, #print_options, #update_job_status, #watch_jobs
Instance Method Details
#list ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 8
def list
vms = client.list_system_vms(options)
if vms.size < 1
say "No system VM's found."
else
table = [%w(Name Zone State Type)]
vms.each do |vm|
table << [
vm['name'], vm['zonename'], vm['state'], vm['systemvmtype']
]
end
print_table table
say "Total number of system VM's: #{vms.size}"
end
end
|
#reboot(name) ⇒ Object
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 62
def reboot(name)
vms = client.list_system_vms(options)
unless vm = filter_by(vms, 'name', name).first
say "No system vm with name #{name} found."
else
exit unless options[:force] || yes?("Reboot system VM #{name}? [y/N]:", :magenta)
client.reboot_system_vm(vm['id'])
puts
end
end
|
#show(name) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 25
def show(name)
vms = client.list_system_vms
unless vm = filter_by(vms, 'name', name).first
say "No system vm with name #{name} found."
else
table = vm.map do |key, value|
[ set_color("#{key}:", :yellow), "#{value}" ]
end
print_table table
end
end
|
#start(name) ⇒ Object
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 38
def start(name)
vms = client.list_system_vms
unless vm = filter_by(vms, 'name', name).first
say "No system vm with name #{name} found."
else
say("Starting system VM #{name}", :magenta)
client.start_system_vm(vm['id'])
puts
end
end
|
#stop(name) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 50
def stop(name)
vms = client.list_system_vms(options)
unless vm = filter_by(vms, 'name', name).first
say "No system vm with name #{name} found."
else
exit unless options[:force] || yes?("Stop system VM #{name}? [y/N]:", :magenta)
client.stop_system_vm(vm['id'])
puts
end
end
|