You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:16:23 UTC
svn commit: r962006 -
/incubator/deltacloud/trunk/framework/lib/drivers/mock.rb
Author: lutter
Date: Thu Jul 8 23:16:23 2010
New Revision: 962006
URL: http://svn.apache.org/viewvc?rev=962006&view=rev
Log:
Stub in mock driver for testing clients.
Added:
incubator/deltacloud/trunk/framework/lib/drivers/mock.rb
Added: incubator/deltacloud/trunk/framework/lib/drivers/mock.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/drivers/mock.rb?rev=962006&view=auto
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/drivers/mock.rb (added)
+++ incubator/deltacloud/trunk/framework/lib/drivers/mock.rb Thu Jul 8 23:16:23 2010
@@ -0,0 +1,100 @@
+
+load 'drivers.rb'
+
+module Drivers
+
+ class Mock < BaseDriver
+
+ #
+ # Flavors
+ #
+
+ FLAVORS = [
+ {
+ :id=>'m1-small',
+ :memory=>1.7,
+ :storage=>160,
+ :architecture=>'i386',
+ },
+ {
+ :id=>'m1-large',
+ :memory=>7.5,
+ :storage=>850,
+ :architecture=>'x86_64',
+ },
+ {
+ :id=>'m1-xlarge',
+ :memory=>15,
+ :storage=>1690,
+ :architecture=>'x86_64',
+ },
+ {
+ :id=>'c1-medium',
+ :memory=>1.7,
+ :storage=>350,
+ :architecture=>'x86_64',
+ },
+ {
+ :id=>'c1-xlarge',
+ :memory=>7,
+ :storage=>1690,
+ :architecture=>'x86_64',
+ },
+ ]
+
+ def flavors(credentials, ids=nil)
+ return FLAVORS if ( ids.nil? )
+ FLAVORS.select{|f| ids.include?(f[:id])}
+ end
+
+ #
+ # Images
+ #
+
+ def images(credentials, ids_or_owner=nil )
+ images = []
+ images.sort_by{|e| [e[:owner_id],e[:description]]}
+ end
+
+ #
+ # Instances
+ #
+
+ def instances(credentials, ids=nil)
+ instances = []
+ instances
+ end
+
+ def create_instance(credentials, image_id, flavor_id)
+ end
+
+ def reboot_instance(credentials, id)
+ end
+
+ def delete_instance(credentials, id)
+ end
+
+ #
+ # Storage Volumes
+ #
+
+ def volumes(credentials, ids=nil)
+ volumes = []
+ volumes
+ end
+
+ #
+ # Storage Snapshots
+ #
+
+ def snapshots(credentials, ids=nil)
+ snapshots = []
+ snapshots
+ end
+
+ private
+
+
+ end
+
+end