Class: CloudstackSpec::Resource::SystemVm
- Inherits:
-
Base
- Object
- Base
- CloudstackSpec::Resource::SystemVm
show all
- Defined in:
- lib/cloudstack_spec/resource/system_vm.rb
Instance Attribute Summary
Attributes inherited from Base
#name
Instance Method Summary
collapse
Methods inherited from Base
#get_zone, #inspect, #job_status?, #to_ary, #to_s
Constructor Details
#initialize(name = nil, zonename = nil) ⇒ SystemVm
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/cloudstack_spec/resource/system_vm.rb', line 5
def initialize(name=nil, zonename=nil)
@name = name
@connection = CloudstackSpec::Helper::Api.new.connection
case @name
when 'cpvm' && 'consoleproxy'
@systemvmtype = 'consoleproxy'
when 'ssvm' && 'secondarystoragevm'
@systemvmtype = 'secondarystoragevm'
else
@systemvmtype = nil
end
@zone = get_zone(zonename)
@sysvm = @connection.list_system_vms(:systemvmtype => @systemvmtype, zoneid: @zone['id'])
@vmcount = @sysvm['count']
@sysvm = @sysvm['systemvm'].first
@runner = Specinfra::Runner
end
|
Instance Method Details
#exist? ⇒ Boolean
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/cloudstack_spec/resource/system_vm.rb', line 25
def exist?
begin
if @vmcount.nil?
return false
else
return true
end
rescue Exception => e
return false
end
end
|
#reachable?(port, proto, timeout) ⇒ Boolean
49
50
51
52
|
# File 'lib/cloudstack_spec/resource/system_vm.rb', line 49
def reachable?(port, proto, timeout)
ip = @sysvm['publicip']
@runner.check_host_is_reachable(ip, port, proto, timeout)
end
|
#running? ⇒ Boolean
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/cloudstack_spec/resource/system_vm.rb', line 37
def running?
begin
if @sysvm['state'] == 'Running'
return true
else
return false
end
rescue
return false
end
end
|