1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Introduce disk-snapshot and VM shutdown functionality.

This commit is contained in:
Evgeny Yurchenko 2015-03-11 17:04:05 +00:00 committed by eyurchenko
parent dc4929dfb8
commit 754c663cb5
4 changed files with 54 additions and 0 deletions

View file

@ -28,6 +28,8 @@ module Fog
request :vm_resume
request :vm_stop
request :template_pool
request :vm_disk_snapshot
request :vm_shutdown
class Mock
include Collections

View file

@ -19,6 +19,10 @@ module Fog
new data.first unless data.empty?
end
def shutdown(id)
service.vm_shutdown(id)
end
end
end
end

View file

@ -0,0 +1,25 @@
module Fog
module Compute
class OpenNebula
class Real
def vm_disk_snapshot(id, disk_id, image_name)
vmpool = ::OpenNebula::VirtualMachinePool.new(client)
vmpool.info!(-2,id,id,-1)
rc = 0
vmpool.each do |vm|
rc = vm.disk_snapshot(disk_id, image_name)
if(rc.is_a? ::OpenNebula::Error)
raise(rc)
end
end
rc
end #def vm_disk_snapshot
class Mock
end
end
end
end
end

View file

@ -0,0 +1,23 @@
module Fog
module Compute
class OpenNebula
class Real
def vm_shutdown(id)
vmpool = ::OpenNebula::VirtualMachinePool.new(client)
vmpool.info!(-2,id,id,-1)
vmpool.each do |vm|
vm.shutdown()
end
end #def vm_disk_snapshot
end
class Mock
def vm_shutdown(id)
true
end
end
end
end
end