This must be also fixed for MachineConfiguration:
<MachineConfiguration>
<id>http://localhost:3001/cimi/machine_configurations/m1-small</id>
<name>m1-small</name>
<description>Machine Configuration with 1782579.2 KiB of memory and 1
CPU</description>
<created>2012-11-09T01:15:37+01:00</created>
<memory>1782579.2</memory>
<cpu>1</cpu>
<disk>
<capacity>167772160</capacity>
</disk>
</MachineConfiguration>
F.
On Nov 8, 2012, at 5:05 AM, <[email protected]> <[email protected]> wrote:
> From: David Lutterkort <[email protected]>
>
> ---
> server/lib/cimi/models/machine.rb | 2 +-
> tests/cimi/machine_collection_test.rb | 6 ++++++
> 2 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/server/lib/cimi/models/machine.rb
> b/server/lib/cimi/models/machine.rb
> index fbf25dd..9358c18 100644
> --- a/server/lib/cimi/models/machine.rb
> +++ b/server/lib/cimi/models/machine.rb
> @@ -157,7 +157,7 @@ class CIMI::Model::Machine < CIMI::Model::Base
> def self.convert_instance_memory(profile, context)
> machine_conf = CIMI::Model::MachineConfiguration.find(profile.name,
> context)
> memory_override = profile.overrides.find { |p, v| p == :memory }
> - memory_override.nil? ? machine_conf.memory :
> context.to_kibibyte(memory_override[1].to_i,"MB")
> + memory_override.nil? ? machine_conf.memory.to_i :
> context.to_kibibyte(memory_override[1].to_i,"MB")
> end
>
> def self.convert_instance_addresses(instance)
> diff --git a/tests/cimi/machine_collection_test.rb
> b/tests/cimi/machine_collection_test.rb
> index a5ad3f4..c6b5b7b 100644
> --- a/tests/cimi/machine_collection_test.rb
> +++ b/tests/cimi/machine_collection_test.rb
> @@ -33,4 +33,10 @@ class MachineCollectionBehavior < CIMI::Test::Spec
> machines.wont_be_nil # Make sure we talk to the server
> last_response.json["resourceURI"].must_equal RESOURCE_URI
> end
> +
> + it "should report integer values for memory" do
> + machines.entries.each do |machine|
> + machine.memory.to_s.must_match /^[0-9]+$/
> + end
> + end
> end
> --
> 1.7.7.6
>