Revision 469ff036 src/vmm_mad/remotes/vcenter/snapshot_create
src/vmm_mad/remotes/vcenter/snapshot_create | ||
---|---|---|
30 | 30 |
require 'vcenter_driver2' |
31 | 31 |
|
32 | 32 |
vm_ref = ARGV[0] |
33 |
snapshot_name = ARGV[1]
|
|
33 |
snap_id = ARGV[1]
|
|
34 | 34 |
vc_cluster_name = ARGV[3] |
35 | 35 |
|
36 |
drv_action = OpenNebula::XMLElement.new |
|
37 |
drv_action.initialize_xml(Base64.decode64(STDIN.read), 'VMM_DRIVER_ACTION_DATA') |
|
38 |
|
|
36 | 39 |
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name) |
37 | 40 |
host_id = host['ID'] |
38 | 41 |
|
42 |
snap_name = drv_action["VM/TEMPLATE/SNAPSHOT[ACTIVE='YES']/NAME"] |
|
43 |
|
|
39 | 44 |
begin |
40 | 45 |
vi_client = VCenterDriver::VIClient.new_from_host(host_id) |
41 | 46 |
|
42 | 47 |
vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client) |
43 | 48 |
|
44 |
vm.create_snapshot(snapshot_name, vm_ref)
|
|
49 |
vm.create_snapshot(snap_id, snap_name)
|
|
45 | 50 |
|
46 | 51 |
rescue Exception => e |
47 | 52 |
STDERR.puts "Snapshot of VM #{vm_ref} on vCenter cluster "\ |
Also available in: Unified diff