You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/12/10 13:42:51 UTC

[1/4] git commit: Openstack volumes - catch case where volume attachment unset - thanks Ian Main.

Updated Branches:
  refs/heads/master da8e09c0c -> 75dc613f6


Openstack volumes - catch case where volume attachment unset - thanks Ian Main.


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

Branch: refs/heads/master
Commit: 75dc613f6e3ba8111a2a344412311b02b491ffb6
Parents: 2bcf0bd
Author: marios <ma...@redhat.com>
Authored: Mon Dec 10 14:41:45 2012 +0200
Committer: marios <ma...@redhat.com>
Committed: Mon Dec 10 14:41:45 2012 +0200

----------------------------------------------------------------------
 .../drivers/openstack/openstack_driver.rb          |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/75dc613f/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
index f9317c9..bfec12e 100644
--- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
+++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
@@ -597,8 +597,8 @@ private
                               :created => vol.created_at,
                               :state => (vol.attachments.inject([]){|res, cur| res << cur if cur.size > 0 ; res}.empty?) ? "AVAILABLE" : "IN-USE",
                               :capacity => vol.size,
-                              :instance_id => vol.attachments.first["serverId"],
-                              :device =>vol.attachments.first["device"],
+                              :instance_id => (vol.attachments.first["serverId"] unless vol.attachments.empty?),
+                              :device => (vol.attachments.first["device"] unless vol.attachments.empty?),
                               :realm_id => vol.availability_zone,
                               :description => vol.display_description # openstack volumes have a display_description attr
           })