server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
# Create a new image from the given instance, with optionally provided name and description
Create a new image from the given instance, with optionally provided name and description
Create a new image from the given instance with optionally provided name and description
def create_image(credentials, opts={})
    safely do
      client = new_client(credentials)
      if opts[:name].nil?
        instance = client.get_vserver_attributes(opts[:id])
        opts[:name] = instance['vserver'][0]['vserverName']
        opts[:description] ||= opts[:name]
      end
      client.register_private_disk_image(opts[:id], opts[:name], opts[:description])
      hwps = hardware_profiles(credentials)
      Image.new(
        :id                => "PENDING-#{opts[:name]}", 
        :name              => opts[:name],
        :description       => opts[:description],
        :state             => 'PENDING',
        :hardware_profiles => hwps
      )
    end
  end
def create_image ( credentials , opts = { } ) safely do client = new_client ( credentials ) if opts [ :name ] . nil? instance = client . get_vserver_attributes ( opts [ :id ] ) opts [ :name ] = instance [ 'vserver' ] [ 0 ] [ 'vserverName' ] opts [ :description ] ||= opts [ :name ] end client . register_private_disk_image ( opts [ :id ] , opts [ :name ] , opts [ :description ] ) hwps = hardware_profiles ( credentials ) Image . new ( :id => "PENDING-#{opts[:name]}" , :name => opts [ :name ] , :description => opts [ :description ] , :state => 'PENDING' , :hardware_profiles => hwps ) end end
Create a new image from the given instance, with optionally provided name and description
Create a new image from the given instance with optionally provided name and description
# default to instance name #can't retrieve image info until it's completed #TODO: add check to create_instance to raise error for this image ID?
credentials
<not_specific>
opts
<not_specific>