Class: Chef::Knife::Cloud::OvirtVolumeCreate
Instance Method Summary
collapse
included
included
#create_service_instance, #humanize, #validate!, #volume_ready
Instance Method Details
#before_exec_command ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/chef/knife/ovirt_volume_create.rb', line 26
def before_exec_command
super
@create_options = {
size_gb: locate_config_value('volume_size'),
active: 'true',
}
[:storage_domain, :interface, :bootable, :alias].each do |opt|
@create_options[opt] = locate_config_value("volume_#{opt}") if locate_config_value("volume_#{opt}")
end
@columns_with_info = [
{ label: 'Name', key: 'name' },
{ label: 'Status', key: 'status' },
]
end
|
#execute_command ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/chef/knife/ovirt_volume_create.rb', line 43
def execute_command
result = service.connection.add_volume(locate_config_value(:vm_id), @create_options)
name = (result / 'disk/name').first.text
id = (result / 'disk').first['id']
print "\nWaiting For Volume(#{name}) to become available"
Fog.wait_for(120) do
print '.'
volume_ready(locate_config_value(:vm_id), id)
end
print "\nActivating Volume"
service.connection.activate_volume(locate_config_value(:vm_id), id: id)
end
|