Can be created by passing in :xml => "<xml to create volume>" A volume always belongs to a pool, :pool_name => "<name of pool>"
# File lib/fog/libvirt/models/compute/volume.rb, line 26 def initialize(attributes={ }) @xml = attributes.delete(:xml) super(defaults.merge(attributes)) # We need a connection to calculate the pool_name # This is why we do this after super self.pool_name ||= default_pool_name end
Clones this volume to the name provided
# File lib/fog/libvirt/models/compute/volume.rb, line 55 def clone(name) new_volume = self.dup new_volume.key = nil new_volume.name = name new_volume.save new_volume.reload end
Destroy a volume
# File lib/fog/libvirt/models/compute/volume.rb, line 45 def destroy service.volume_action key, :delete end
Takes a pool and either :xml or other settings
# File lib/fog/libvirt/models/compute/volume.rb, line 36 def save requires :pool_name raise Fog::Errors::Error.new('Reserving an existing volume may create a duplicate') if key @xml ||= to_xml self.path = service.create_volume(pool_name, xml).path end
Generated with the Darkfish Rdoc Generator 2.