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/03/07 12:46:43 UTC
[2/2] git commit: Fix CIMI::MachineConfiguration - wasn't grabbing
cpu/memory when the Deltacloud hardware_profile was using range
Fix CIMI::MachineConfiguration - wasn't grabbing cpu/memory when the
Deltacloud hardware_profile was using range
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/4a4b1798
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/4a4b1798
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/4a4b1798
Branch: refs/heads/master
Commit: 4a4b179839fbb1998390e19098aecf7a737d910b
Parents: f2fe244
Author: marios <ma...@redhat.com>
Authored: Tue Mar 6 18:20:33 2012 +0200
Committer: marios <ma...@redhat.com>
Committed: Tue Mar 6 18:20:33 2012 +0200
----------------------------------------------------------------------
server/lib/cimi/model/machine_configuration.rb | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/4a4b1798/server/lib/cimi/model/machine_configuration.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/machine_configuration.rb b/server/lib/cimi/model/machine_configuration.rb
index feab4e8..07f5429 100644
--- a/server/lib/cimi/model/machine_configuration.rb
+++ b/server/lib/cimi/model/machine_configuration.rb
@@ -51,14 +51,17 @@ class CIMI::Model::MachineConfiguration < CIMI::Model::Base
def self.from_hardware_profile(profile, context)
# We accept just profiles with all properties set
return unless profile.memory or profile.cpu or profile.storage
+ memory = profile.memory.value || profile.memory.default
+ cpu = profile.cpu.value || profile.cpu.default
+ storage = profile.storage.value || profile.storage.default
machine_hash = {
:name => profile.name,
- :description => "Machine Configuration with #{profile.memory.value} #{profile.memory.unit} "+
- "of memory and #{profile.cpu.value} CPU",
- :cpu => profile.cpu.value,
+ :description => "Machine Configuration with #{memory} #{profile.memory.unit} "+
+ "of memory and #{cpu} CPU",
+ :cpu => cpu,
:created => Time.now.to_s, # FIXME: DC hardware_profile has no mention about created_at
- :memory => { :quantity => profile.memory.value || profile.memory.default, :units => profile.memory.unit },
- :disks => [ { :capacity => { :quantity => profile.storage.value || profile.storage.default, :units => profile.storage.unit } } ],
+ :memory => { :quantity => memory, :units => profile.memory.unit },
+ :disks => [ { :capacity => { :quantity => storage, :units => profile.storage.unit } } ],
:uri => context.machine_configuration_url(profile.name)
}
self.new(machine_hash)