deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dko...@apache.org
Subject git commit: Related to DMTF cimi mantis 1974:
Date Tue, 05 Feb 2013 03:16:40 GMT
Updated Branches:
  refs/heads/master 152247911 -> 5f168e089


Related to DMTF cimi mantis 1974:

The state of a volume being created in fgcp is called "DEPLOYING", the
Deltacloud API documentation seems to leave it to the provider, with
examples of what ec2 returns. Ec2 (and cimi) define "CREATING". Aligning
what the fgcp driver returns with that. Same for snapshot "PENDING",
volume "NORMAL" and "BACKING_UP" states.
Cimi intended we use their state names for same states. Deltacloud has
"IN-USE" for volumes that are "AVAILABLE". Aligning this state with CIMI
for all providers. Whether a volume has been attached can be retrieved
through other attributes/apis.
Also, for fgcp, generate volume name if empty string specified (happens
with GUI), and align with cimi CREATING/AVAILABLE for snapshot states.


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/5f168e08
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/5f168e08
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/5f168e08

Branch: refs/heads/master
Commit: 5f168e0898ad36a27eab51d2a3f36d4cc830976e
Parents: 1522479
Author: Dies Koper <diesk@fast.au.fujitsu.com>
Authored: Wed Jan 30 23:55:39 2013 +1100
Committer: Dies Koper <diesk@fast.au.fujitsu.com>
Committed: Tue Feb 5 14:16:23 2013 +1100

----------------------------------------------------------------------
 server/lib/cimi/models/volume.rb                  |    2 +-
 server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb |   21 ++++++++++-----
 2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5f168e08/server/lib/cimi/models/volume.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume.rb b/server/lib/cimi/models/volume.rb
index 26b757e..b4503fc 100644
--- a/server/lib/cimi/models/volume.rb
+++ b/server/lib/cimi/models/volume.rb
@@ -119,7 +119,7 @@ class CIMI::Model::Volume < CIMI::Model::Base
                 :bootable => "false", #fixme ... will vary... ec2 doesn't expose this
                 :snapshots => [], #fixme...
                 :type => 'http://schemas.dmtf.org/cimi/1/mapped',
-                :state => volume.state,
+                :state => volume.state == 'IN-USE' ? 'AVAILABLE' : volume.state,
                 :meters => [],
                 :operations => [{:href=> context.volume_url(volume.id), :rel =>
"delete"}]
             } )

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5f168e08/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
index 6b749c9..5cf957a 100644
--- a/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
+++ b/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
@@ -457,7 +457,9 @@ class FgcpDriver < Deltacloud::BaseDriver
         end
         state = client.get_vdisk_status(opts[:id])['vdiskStatus'][0]
         actions = []
-        if state == 'NORMAL'
+        #align with EC2, cimi
+        case state
+        when 'NORMAL'
           if vdisk['attachedTo'].nil?
             state = 'AVAILABLE'
             actions = [:attach, :destroy]
@@ -465,6 +467,10 @@ class FgcpDriver < Deltacloud::BaseDriver
             state = 'IN-USE'
             actions = [:detach]
           end
+        when 'DEPLOYING'
+          state = 'CREATING'
+        when 'BACKUP_ING'
+          state = 'CAPTURING'
         end
 
         volumes << StorageVolume.new(
@@ -498,7 +504,7 @@ class FgcpDriver < Deltacloud::BaseDriver
                 :realm_id    => client.extract_vsys_id(vdisk['vdiskId'][0]),
                 # aligning with rhevm, which returns 'system' or 'data'
                 :kind        => determine_storage_type(vdisk['vdiskId'][0]),
-                :state       => vdisk['attachedTo'].nil? ? nil : 'IN-USE'
+                :state       => vdisk['attachedTo'].nil? ? 'AVAILABLE' : 'IN-USE'
               )
             end
           end
@@ -510,7 +516,7 @@ class FgcpDriver < Deltacloud::BaseDriver
 
   def create_storage_volume(credentials, opts={})
     opts ||= {}
-    opts[:name]     ||= Time.now.to_s
+    opts[:name] = Time.now.to_s unless opts[:name] and not opts[:name].empty?
     opts[:capacity] ||= '1' # DC default
     #size has to be a multiple of 10: round up.
     opts[:capacity] = ((opts[:capacity].to_f / 10.0).ceil * 10.0).to_s
@@ -536,7 +542,8 @@ class FgcpDriver < Deltacloud::BaseDriver
         :capacity    => opts[:capacity],
         :realm_id    => client.extract_vsys_id(opts[:realm_id]),
         :instance_id => nil,
-        :state       => 'DEPLOYING',
+        # aligning with ec2, cimi (instead of fgcp's DEPLOYING)
+        :state       => 'CREATING',
         # aligning with rhevm, which returns 'system' or 'data'
         :kind        => 'data',
         :actions     => []
@@ -585,7 +592,7 @@ class FgcpDriver < Deltacloud::BaseDriver
 
               snapshots << StorageSnapshot.new(
                 :id => opts[:id],
-                #:state => ?,
+                :state => 'AVAILABLE',
                 :storage_volume_id => vdisk_id,
                 :created => backup['backupTime'][0]
               ) if backup_id = backup['backupId'][0]
@@ -611,7 +618,7 @@ class FgcpDriver < Deltacloud::BaseDriver
 
                   snapshots << StorageSnapshot.new(
                     :id => generate_snapshot_id(vdisk['vdiskId'][0], backup['backupId'][0]),
-                    #:state => ?,
+                    :state => 'AVAILABLE',
                     :storage_volume_id => vdisk['vdiskId'][0],
                     :created => backup['backupTime'][0]
                   )
@@ -634,7 +641,7 @@ class FgcpDriver < Deltacloud::BaseDriver
 
     StorageSnapshot.new(
       :id                 => "PENDING-#{opts[:volume_id]}", # don't know id until backup
completed
-      :state              => 'PENDING', # OK to make up a state like that?
+      :state              => 'CREATING',
       :storage_volume_id  => opts[:volume_id],
       :created            => Time.now.to_s
     )


Mime
View raw message