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

Allow creation of persistent or non persistent volumes

This commit is contained in:
Patrick Debois 2011-08-01 15:33:25 +02:00
parent 75b6acbee7
commit b2d5207fba

View file

@ -10,6 +10,7 @@ module Fog
attribute :poolname
attribute :xml
attribute :create_persistent
# Can be created by passing in :xml => "<xml to create volume>"
# A volume always belongs to a pool, :pool => "<name of pool>"
@ -18,6 +19,7 @@ module Fog
def initialize(attributes={} )
self.xml ||= nil unless attributes[:xml]
self.poolname ||= nil unless attributes[:poolname]
self.create_persistent ||=true unless attribues[:create_persistent]
super
end
@ -30,7 +32,11 @@ module Fog
volume=nil
unless poolname.nil?
pool=connection.lookup_storage_pool_by_name(poolname)
volume=pool.create_volume_xml(xml)
if create_persistent
volume=pool.define_volume_xml(xml)
else
volume=pool.create_volume_xml(xml)
end
self.raw=volume
true
else