deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 2/2] CIMI: fix issue with (mock driver) opaque hardware_profile conversion
Date Wed, 07 Mar 2012 11:27:41 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/cimi/model/machine.rb |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/server/lib/cimi/model/machine.rb b/server/lib/cimi/model/machine.rb
index 88c9f73..2e31065 100644
--- a/server/lib/cimi/model/machine.rb
+++ b/server/lib/cimi/model/machine.rb
@@ -136,15 +136,16 @@ class CIMI::Model::Machine < CIMI::Model::Base
   private
 
   def self.from_instance(instance, context)
+    cpu =  memory = disks = (instance.instance_profile.id == "opaque")? "n/a" : nil
     self.new(
       :name => instance.id,
       :description => instance.name,
       :created => instance.launch_time,
       :uri => context.machine_url(instance.id),
       :state => convert_instance_state(instance.state),
-      :cpu => convert_instance_cpu(instance.instance_profile, context),
-      :memory => convert_instance_memory(instance.instance_profile, context),
-      :disks => convert_instance_storage(instance.instance_profile, context),
+      :cpu => cpu || convert_instance_cpu(instance.instance_profile, context),
+      :memory => memory || convert_instance_memory(instance.instance_profile, context),
+      :disks => disks || convert_instance_storage(instance.instance_profile, context),
       :network_interfaces => convert_instance_addresses(instance),
       :operations => convert_instance_actions(instance, context),
       :volumes=>convert_storage_volumes(instance, context),
-- 
1.7.6.5


Mime
View raw message