Class: SystemVm
Constant Summary
CloudstackCli::Helper::ASYNC_STATES
Instance Attribute Summary
#config
Instance Method Summary
collapse
exit_on_failure?, start
#resolve_account, #resolve_compute_offering, #resolve_disk_offering, #resolve_domain, #resolve_host, #resolve_iso, #resolve_networks, #resolve_project, #resolve_snapshot, #resolve_template, #resolve_virtual_machine, #resolve_zone, #vm_options_to_params
#ask_number, #bootstrap_server, #bootstrap_server_interactive, #create_port_rules, #create_server, #get_server_default_nic, #get_server_fqdn, #get_server_public_ip, #get_ssh_port_forwarding_rule, #print_job_status, #print_options, #run_background_jobs, #update_job_status, #update_jobs, #watch_jobs
Instance Method Details
#list ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 8
def list
resolve_zone
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
60
61
62
63
64
65
66
67
68
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 60
def reboot(name)
unless vm = client.list_system_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(id: vm['id'])
say " OK.", :green
end
end
|
#show(name) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 26
def show(name)
unless vm = client.list_system_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
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 38
def start(name)
unless vm = client.list_system_vms(name: name).first
say "No system vm with name #{name} found."
else
say("Starting system VM #{name}", :magenta)
client.start_system_vm(id: vm['id'])
say " OK.", :green
end
end
|
#stop(name) ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/cloudstack-cli/commands/system_vm.rb', line 49
def stop(name)
unless vm = client.list_system_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(id: vm['id'])
say " OK.", :green
end
end
|