On Mar 21, 2011, at 9:06 PM, [email protected] wrote:

> From: Felipe Cardoso Martins <[email protected]>
> 
> ---
> server/lib/deltacloud/drivers/mock/mock_driver.rb |   38 +++++++++++++++++++++
> 1 files changed, 38 insertions(+), 0 deletions(-)
> 
> diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb 
> b/server/lib/deltacloud/drivers/mock/mock_driver.rb
> index 7d229c4..b18b5c9 100644
> --- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
> +++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
> @@ -282,6 +282,44 @@ class MockDriver < Deltacloud::BaseDriver
>     volumes
>   end
> 
> +  def create_storage_volume(credentials, opts=nil)
> +    check_credentials(credentials)
> +
> +    ids = Dir[ "#{@storage_root}/storage_volumes/*.yml" ].collect{|e| 
> File.basename( e, ".yml" )}
> +
> +    count = 0 
> +    while true
> +      next_id = "vol" + count.to_s
> +      if not ids.include?(next_id)
> +        break
> +      end 
> +      count = count + 1 
> +    end 
> +
> +    opts ||= {}
> +    opts[:capacity] ||= "1"
> +    opts[:realm_id] ||= realms(credentials).first.id
> +
> +    volume = {
> +      :owner_id => credentials.user,
> +      :created => Time.now,
> +      :state => 'AVAILABLE',
> +      :capacity => opts[:capacity],
> +      :realm_id => opts[:realm_id],
> +      :device => '',
> +      :instance_id => '',
> +      :actions => [:attach, :detach, :destroy]
> +     }
> +
> +     File.open( "#{@storage_root}/storage_volumes/#{next_id}.yml", 'w' ) {|f|
> +       YAML.dump( volume, f ) 
> +     }
> +
> +     volume[:id] = next_id
> +
> +     StorageVolume.new( volume )
> +  end
> +

ACK. It work's for me.
Btw. Did you have send CLA signed and scanned as PDF document to 
[email protected]?
Once you will do this, I'll commit this patch to SVN.

  -- Michal

>   #
>   # Storage Snapshots
>   #
> -- 
> 1.7.1
> 

------------------------------------------------------
Michal Fojtik, [email protected]
Deltacloud API: http://deltacloud.org

Reply via email to