You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by di...@fast.au.fujitsu.com on 2013/04/22 22:32:26 UTC

[PATCH] CIMI: add model to service object conversion logic to system subcollections, use helpers to generate add urls

From: Dies Koper <di...@fast.au.fujitsu.com>

---
 server/lib/cimi/service/system_address.rb          | 5 +++--
 server/lib/cimi/service/system_credential.rb       | 5 +++--
 server/lib/cimi/service/system_forwarding_group.rb | 5 +++--
 server/lib/cimi/service/system_machine.rb          | 5 +++--
 server/lib/cimi/service/system_network.rb          | 5 +++--
 server/lib/cimi/service/system_network_port.rb     | 5 +++--
 server/lib/cimi/service/system_system.rb           | 5 +++--
 server/lib/cimi/service/system_template.rb         | 5 +++--
 server/lib/cimi/service/system_volume.rb           | 5 +++--
 9 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/server/lib/cimi/service/system_address.rb b/server/lib/cimi/service/system_address.rb
index 2afaf4f..83ac075 100644
--- a/server/lib/cimi/service/system_address.rb
+++ b/server/lib/cimi/service/system_address.rb
@@ -18,16 +18,17 @@ class CIMI::Service::SystemAddress < CIMI::Service::Base
   def self.find(system_id, context, id=:all)
     if id == :all
       addresses = context.driver.system_addresses(context.credentials, {:env=>context, :system_id=>system_id})
+      addresses.collect {|e| CIMI::Service::SystemAddress.new(context, :model => e)}
     else
       addresses = context.driver.system_addresses(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
       raise CIMI::Model::NotFound if addresses.empty?
-      addresses.first
+      CIMI::Service::SystemAddress.new(context, :model => addresses.first)
     end
   end
 
   def self.collection_for_system(system_id, context)
     system_addresses = self.find(system_id, context)
-    addresses_url = context.url("/system/#{system_id}/addresses") if context.driver.has_capability? :add_addresses_to_system
+    addresses_url = context.system_addresses_url(system_id) if context.driver.has_capability? :add_addresses_to_system
     CIMI::Model::SystemAddress.list(addresses_url, system_addresses, :add_url => addresses_url)
   end
 
diff --git a/server/lib/cimi/service/system_credential.rb b/server/lib/cimi/service/system_credential.rb
index 3ff256b..d3de64b 100644
--- a/server/lib/cimi/service/system_credential.rb
+++ b/server/lib/cimi/service/system_credential.rb
@@ -18,16 +18,17 @@ class CIMI::Service::SystemCredential < CIMI::Service::Base
   def self.find(system_id, context, id=:all)
     if id == :all
       credentials = context.driver.system_credentials(context.credentials, {:env=>context, :system_id=>system_id})
+      credentials.collect {|e| CIMI::Service::SystemCredential.new(context, :model => e)}
     else
       credentials = context.driver.system_credentials(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
       raise CIMI::Model::NotFound if credentials.empty?
-      credentials.first
+      CIMI::Service::SystemCredential.new(context, :model => credentials.first)
     end
   end
 
   def self.collection_for_system(system_id, context)
     system_credentials = self.find(system_id, context)
-    credentials_url = context.url("/system/#{system_id}/credentials") if context.driver.has_capability? :add_credentials_to_system
+    credentials_url = context.system_credentials_url(system_id) if context.driver.has_capability? :add_credentials_to_system
     CIMI::Model::SystemCredential.list(credentials_url, system_credentials, :add_url => credentials_url)
   end
 
diff --git a/server/lib/cimi/service/system_forwarding_group.rb b/server/lib/cimi/service/system_forwarding_group.rb
index e7c269c..69012d8 100644
--- a/server/lib/cimi/service/system_forwarding_group.rb
+++ b/server/lib/cimi/service/system_forwarding_group.rb
@@ -18,16 +18,17 @@ class CIMI::Service::SystemForwardingGroup < CIMI::Service::Base
   def self.find(system_id, context, id=:all)
     if id == :all
       groups = context.driver.system_forwarding_groups(context.credentials, {:env=>context, :system_id=>system_id})
+      groups.collect {|e| CIMI::Service::SystemForwardingGroup.new(context, :model => e)}
     else
       groups = context.driver.system_forwarding_groups(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
       raise CIMI::Model::NotFound if groups.empty?
-      groups.first
+      CIMI::Service::SystemForwardingGroup.new(context, :model => groups.first)
     end
   end
 
   def self.collection_for_system(system_id, context)
     system_forwarding_groups = self.find(system_id, context)
-    forwarding_groups_url = context.url("/system/#{system_id}/forwarding_groups") if context.driver.has_capability? :add_forwarding_groups_to_system
+    forwarding_groups_url = context.system_forwarding_groups_url(system_id) if context.driver.has_capability? :add_forwarding_groups_to_system
     CIMI::Model::SystemForwardingGroup.list(forwarding_groups_url, system_forwarding_groups, :add_url => forwarding_groups_url)
   end
 
diff --git a/server/lib/cimi/service/system_machine.rb b/server/lib/cimi/service/system_machine.rb
index d19026a..cdf515e 100644
--- a/server/lib/cimi/service/system_machine.rb
+++ b/server/lib/cimi/service/system_machine.rb
@@ -18,16 +18,17 @@ class CIMI::Service::SystemMachine < CIMI::Service::Base
   def self.find(system_id, context, id=:all)
     if id == :all
       machines = context.driver.system_machines(context.credentials, {:env=>context, :system_id=>system_id})
+      machines.collect {|e| CIMI::Service::SystemMachine.new(context, :model => e)}
     else
       machines = context.driver.system_machines(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
       raise CIMI::Model::NotFound if machines.empty?
-      machines.first
+      CIMI::Service::SystemMachine.new(context, :model => machines.first)
     end
   end
 
   def self.collection_for_system(system_id, context)
     system_machines = self.find(system_id, context)
-    machines_url = context.url("/system/#{system_id}/machines") if context.driver.has_capability? :add_machines_to_system
+    machines_url = context.system_machines_url(system_id) if context.driver.has_capability? :add_machines_to_system
     CIMI::Model::SystemMachine.list(machines_url, system_machines, :add_url => machines_url)
   end
 
diff --git a/server/lib/cimi/service/system_network.rb b/server/lib/cimi/service/system_network.rb
index 5ff9323..a921910 100644
--- a/server/lib/cimi/service/system_network.rb
+++ b/server/lib/cimi/service/system_network.rb
@@ -18,16 +18,17 @@ class CIMI::Service::SystemNetwork < CIMI::Service::Base
   def self.find(system_id, context, id=:all)
     if id == :all
       networks = context.driver.system_networks(context.credentials, {:env=>context, :system_id=>system_id})
+      networks.collect {|e| CIMI::Service::SystemNetwork.new(context, :model => e)}
     else
       networks = context.driver.system_networks(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
       raise CIMI::Model::NotFound if networks.empty?
-      networks.first
+      CIMI::Service::SystemNetwork.new(context, :model => networks.first)
     end
   end
 
   def self.collection_for_system(system_id, context)
     system_networks = self.find(system_id, context)
-    networks_url = context.url("/system/#{system_id}/networks") if context.driver.has_capability? :add_networks_to_system
+    networks_url = context.system_networks_url(system_id) if context.driver.has_capability? :add_networks_to_system
     CIMI::Model::SystemNetwork.list(networks_url, system_networks, :add_url => networks_url)
   end
 
diff --git a/server/lib/cimi/service/system_network_port.rb b/server/lib/cimi/service/system_network_port.rb
index f7b3e69..3811e67 100644
--- a/server/lib/cimi/service/system_network_port.rb
+++ b/server/lib/cimi/service/system_network_port.rb
@@ -18,16 +18,17 @@ class CIMI::Service::SystemNetworkPort < CIMI::Service::Base
   def self.find(system_id, context, id=:all)
     if id == :all
       ports = context.driver.system_network_ports(context.credentials, {:env=>context, :system_id=>system_id})
+      ports.collect {|e| CIMI::Service::SystemNetworkPort.new(context, :model => e)}
     else
       ports = context.driver.system_network_ports(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
       raise CIMI::Model::NotFound if ports.empty?
-      ports.first
+      CIMI::Service::SystemNetworkPort.new(context, :model => ports.first)
     end
   end
 
   def self.collection_for_system(system_id, context)
     system_network_ports = self.find(system_id, context)
-    network_ports_url = context.url("/system/#{system_id}/network_ports") if context.driver.has_capability? :add_network_ports_to_system
+    network_ports_url = context.system_network_ports_url(system_id) if context.driver.has_capability? :add_network_ports_to_system
     CIMI::Model::SystemNetworkPort.list(network_ports_url, system_network_ports, :add_url => network_ports_url)
   end
 
diff --git a/server/lib/cimi/service/system_system.rb b/server/lib/cimi/service/system_system.rb
index 233825c..0787f26 100644
--- a/server/lib/cimi/service/system_system.rb
+++ b/server/lib/cimi/service/system_system.rb
@@ -18,16 +18,17 @@ class CIMI::Service::SystemSystem < CIMI::Service::Base
   def self.find(system_id, context, id=:all)
     if id == :all
       systems = context.driver.system_systems(context.systems, {:env=>context, :system_id=>system_id})
+      systems.collect {|e| CIMI::Service::SystemSystem.new(context, :model => e)}
     else
       systems = context.driver.system_systems(context.systems, {:env=>context, :system_id=>system_id, :id=>id})
       raise CIMI::Model::NotFound if systems.empty?
-      systems.first
+      CIMI::Service::SystemSystem.new(context, :model => systems.first)
     end
   end
 
   def self.collection_for_system(system_id, context)
     system_systems = self.find(system_id, context)
-    systems_url = context.url("/system/#{system_id}/systems") if context.driver.has_capability? :add_systems_to_system
+    systems_url = context.system_systems_url(system_id) if context.driver.has_capability? :add_systems_to_system
     CIMI::Model::SystemSystem.list(systems_url, system_systems, :add_url => systems_url)
   end
 
diff --git a/server/lib/cimi/service/system_template.rb b/server/lib/cimi/service/system_template.rb
index 785f79d..90a55b8 100644
--- a/server/lib/cimi/service/system_template.rb
+++ b/server/lib/cimi/service/system_template.rb
@@ -18,10 +18,11 @@ class CIMI::Service::SystemTemplate < CIMI::Service::Base
   def self.find(id, context)
     if id == :all
       templates = context.driver.system_templates(context.credentials, {:env=>context})
+      templates.collect {|e| CIMI::Service::SystemTemplate.new(context, :model => e)}
     else
       templates = context.driver.system_templates(context.credentials, {:env=>context, :id=>id})
-      raise CIMI::Model::NotFound unless templates.first
-      templates.first
+      raise CIMI::Model::NotFound if templates.empty?
+      CIMI::Service::SystemTemplate.new(context, :model => templates.first)
     end
   end
 
diff --git a/server/lib/cimi/service/system_volume.rb b/server/lib/cimi/service/system_volume.rb
index 7f4306b..431c7a0 100644
--- a/server/lib/cimi/service/system_volume.rb
+++ b/server/lib/cimi/service/system_volume.rb
@@ -18,16 +18,17 @@ class CIMI::Service::SystemVolume < CIMI::Service::Base
   def self.find(system_id, context, id=:all)
     if id == :all
       vols = context.driver.system_volumes(context.credentials, {:env=>context, :system_id=>system_id})
+      vols.collect {|e| CIMI::Service::SystemVolume.new(context, :model => e)}
     else
       vols = context.driver.system_volumes(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
       raise CIMI::Model::NotFound if vols.empty?
-      vols.first
+      CIMI::Service::SystemVolume.new(context, :model => vols.first)
     end
   end
 
   def self.collection_for_system(system_id, context)
     system_volumes = self.find(system_id, context)
-    volumes_url = context.url("/system/#{system_id}/volumes") if context.driver.has_capability? :add_volumes_to_system
+    volumes_url = context.system_volumes_url(system_id) if context.driver.has_capability? :add_volumes_to_system
     CIMI::Model::SystemVolume.list(volumes_url, system_volumes, :add_url => volumes_url)
   end
 
-- 
1.8.0.msysgit.0



Re: [PATCH] CIMI: add model to service object conversion logic to system subcollections, use helpers to generate add urls

Posted by "marios@redhat.com" <ma...@redhat.com>.
ACK - thanks for doing that Dies - sorry I missed it earlier

On 22/04/13 23:32, diesk@fast.au.fujitsu.com wrote:
> From: Dies Koper <di...@fast.au.fujitsu.com>
> 
> ---
>  server/lib/cimi/service/system_address.rb          | 5 +++--
>  server/lib/cimi/service/system_credential.rb       | 5 +++--
>  server/lib/cimi/service/system_forwarding_group.rb | 5 +++--
>  server/lib/cimi/service/system_machine.rb          | 5 +++--
>  server/lib/cimi/service/system_network.rb          | 5 +++--
>  server/lib/cimi/service/system_network_port.rb     | 5 +++--
>  server/lib/cimi/service/system_system.rb           | 5 +++--
>  server/lib/cimi/service/system_template.rb         | 5 +++--
>  server/lib/cimi/service/system_volume.rb           | 5 +++--
>  9 files changed, 27 insertions(+), 18 deletions(-)
> 
> diff --git a/server/lib/cimi/service/system_address.rb b/server/lib/cimi/service/system_address.rb
> index 2afaf4f..83ac075 100644
> --- a/server/lib/cimi/service/system_address.rb
> +++ b/server/lib/cimi/service/system_address.rb
> @@ -18,16 +18,17 @@ class CIMI::Service::SystemAddress < CIMI::Service::Base
>    def self.find(system_id, context, id=:all)
>      if id == :all
>        addresses = context.driver.system_addresses(context.credentials, {:env=>context, :system_id=>system_id})
> +      addresses.collect {|e| CIMI::Service::SystemAddress.new(context, :model => e)}
>      else
>        addresses = context.driver.system_addresses(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
>        raise CIMI::Model::NotFound if addresses.empty?
> -      addresses.first
> +      CIMI::Service::SystemAddress.new(context, :model => addresses.first)
>      end
>    end
>  
>    def self.collection_for_system(system_id, context)
>      system_addresses = self.find(system_id, context)
> -    addresses_url = context.url("/system/#{system_id}/addresses") if context.driver.has_capability? :add_addresses_to_system
> +    addresses_url = context.system_addresses_url(system_id) if context.driver.has_capability? :add_addresses_to_system
>      CIMI::Model::SystemAddress.list(addresses_url, system_addresses, :add_url => addresses_url)
>    end
>  
> diff --git a/server/lib/cimi/service/system_credential.rb b/server/lib/cimi/service/system_credential.rb
> index 3ff256b..d3de64b 100644
> --- a/server/lib/cimi/service/system_credential.rb
> +++ b/server/lib/cimi/service/system_credential.rb
> @@ -18,16 +18,17 @@ class CIMI::Service::SystemCredential < CIMI::Service::Base
>    def self.find(system_id, context, id=:all)
>      if id == :all
>        credentials = context.driver.system_credentials(context.credentials, {:env=>context, :system_id=>system_id})
> +      credentials.collect {|e| CIMI::Service::SystemCredential.new(context, :model => e)}
>      else
>        credentials = context.driver.system_credentials(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
>        raise CIMI::Model::NotFound if credentials.empty?
> -      credentials.first
> +      CIMI::Service::SystemCredential.new(context, :model => credentials.first)
>      end
>    end
>  
>    def self.collection_for_system(system_id, context)
>      system_credentials = self.find(system_id, context)
> -    credentials_url = context.url("/system/#{system_id}/credentials") if context.driver.has_capability? :add_credentials_to_system
> +    credentials_url = context.system_credentials_url(system_id) if context.driver.has_capability? :add_credentials_to_system
>      CIMI::Model::SystemCredential.list(credentials_url, system_credentials, :add_url => credentials_url)
>    end
>  
> diff --git a/server/lib/cimi/service/system_forwarding_group.rb b/server/lib/cimi/service/system_forwarding_group.rb
> index e7c269c..69012d8 100644
> --- a/server/lib/cimi/service/system_forwarding_group.rb
> +++ b/server/lib/cimi/service/system_forwarding_group.rb
> @@ -18,16 +18,17 @@ class CIMI::Service::SystemForwardingGroup < CIMI::Service::Base
>    def self.find(system_id, context, id=:all)
>      if id == :all
>        groups = context.driver.system_forwarding_groups(context.credentials, {:env=>context, :system_id=>system_id})
> +      groups.collect {|e| CIMI::Service::SystemForwardingGroup.new(context, :model => e)}
>      else
>        groups = context.driver.system_forwarding_groups(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
>        raise CIMI::Model::NotFound if groups.empty?
> -      groups.first
> +      CIMI::Service::SystemForwardingGroup.new(context, :model => groups.first)
>      end
>    end
>  
>    def self.collection_for_system(system_id, context)
>      system_forwarding_groups = self.find(system_id, context)
> -    forwarding_groups_url = context.url("/system/#{system_id}/forwarding_groups") if context.driver.has_capability? :add_forwarding_groups_to_system
> +    forwarding_groups_url = context.system_forwarding_groups_url(system_id) if context.driver.has_capability? :add_forwarding_groups_to_system
>      CIMI::Model::SystemForwardingGroup.list(forwarding_groups_url, system_forwarding_groups, :add_url => forwarding_groups_url)
>    end
>  
> diff --git a/server/lib/cimi/service/system_machine.rb b/server/lib/cimi/service/system_machine.rb
> index d19026a..cdf515e 100644
> --- a/server/lib/cimi/service/system_machine.rb
> +++ b/server/lib/cimi/service/system_machine.rb
> @@ -18,16 +18,17 @@ class CIMI::Service::SystemMachine < CIMI::Service::Base
>    def self.find(system_id, context, id=:all)
>      if id == :all
>        machines = context.driver.system_machines(context.credentials, {:env=>context, :system_id=>system_id})
> +      machines.collect {|e| CIMI::Service::SystemMachine.new(context, :model => e)}
>      else
>        machines = context.driver.system_machines(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
>        raise CIMI::Model::NotFound if machines.empty?
> -      machines.first
> +      CIMI::Service::SystemMachine.new(context, :model => machines.first)
>      end
>    end
>  
>    def self.collection_for_system(system_id, context)
>      system_machines = self.find(system_id, context)
> -    machines_url = context.url("/system/#{system_id}/machines") if context.driver.has_capability? :add_machines_to_system
> +    machines_url = context.system_machines_url(system_id) if context.driver.has_capability? :add_machines_to_system
>      CIMI::Model::SystemMachine.list(machines_url, system_machines, :add_url => machines_url)
>    end
>  
> diff --git a/server/lib/cimi/service/system_network.rb b/server/lib/cimi/service/system_network.rb
> index 5ff9323..a921910 100644
> --- a/server/lib/cimi/service/system_network.rb
> +++ b/server/lib/cimi/service/system_network.rb
> @@ -18,16 +18,17 @@ class CIMI::Service::SystemNetwork < CIMI::Service::Base
>    def self.find(system_id, context, id=:all)
>      if id == :all
>        networks = context.driver.system_networks(context.credentials, {:env=>context, :system_id=>system_id})
> +      networks.collect {|e| CIMI::Service::SystemNetwork.new(context, :model => e)}
>      else
>        networks = context.driver.system_networks(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
>        raise CIMI::Model::NotFound if networks.empty?
> -      networks.first
> +      CIMI::Service::SystemNetwork.new(context, :model => networks.first)
>      end
>    end
>  
>    def self.collection_for_system(system_id, context)
>      system_networks = self.find(system_id, context)
> -    networks_url = context.url("/system/#{system_id}/networks") if context.driver.has_capability? :add_networks_to_system
> +    networks_url = context.system_networks_url(system_id) if context.driver.has_capability? :add_networks_to_system
>      CIMI::Model::SystemNetwork.list(networks_url, system_networks, :add_url => networks_url)
>    end
>  
> diff --git a/server/lib/cimi/service/system_network_port.rb b/server/lib/cimi/service/system_network_port.rb
> index f7b3e69..3811e67 100644
> --- a/server/lib/cimi/service/system_network_port.rb
> +++ b/server/lib/cimi/service/system_network_port.rb
> @@ -18,16 +18,17 @@ class CIMI::Service::SystemNetworkPort < CIMI::Service::Base
>    def self.find(system_id, context, id=:all)
>      if id == :all
>        ports = context.driver.system_network_ports(context.credentials, {:env=>context, :system_id=>system_id})
> +      ports.collect {|e| CIMI::Service::SystemNetworkPort.new(context, :model => e)}
>      else
>        ports = context.driver.system_network_ports(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
>        raise CIMI::Model::NotFound if ports.empty?
> -      ports.first
> +      CIMI::Service::SystemNetworkPort.new(context, :model => ports.first)
>      end
>    end
>  
>    def self.collection_for_system(system_id, context)
>      system_network_ports = self.find(system_id, context)
> -    network_ports_url = context.url("/system/#{system_id}/network_ports") if context.driver.has_capability? :add_network_ports_to_system
> +    network_ports_url = context.system_network_ports_url(system_id) if context.driver.has_capability? :add_network_ports_to_system
>      CIMI::Model::SystemNetworkPort.list(network_ports_url, system_network_ports, :add_url => network_ports_url)
>    end
>  
> diff --git a/server/lib/cimi/service/system_system.rb b/server/lib/cimi/service/system_system.rb
> index 233825c..0787f26 100644
> --- a/server/lib/cimi/service/system_system.rb
> +++ b/server/lib/cimi/service/system_system.rb
> @@ -18,16 +18,17 @@ class CIMI::Service::SystemSystem < CIMI::Service::Base
>    def self.find(system_id, context, id=:all)
>      if id == :all
>        systems = context.driver.system_systems(context.systems, {:env=>context, :system_id=>system_id})
> +      systems.collect {|e| CIMI::Service::SystemSystem.new(context, :model => e)}
>      else
>        systems = context.driver.system_systems(context.systems, {:env=>context, :system_id=>system_id, :id=>id})
>        raise CIMI::Model::NotFound if systems.empty?
> -      systems.first
> +      CIMI::Service::SystemSystem.new(context, :model => systems.first)
>      end
>    end
>  
>    def self.collection_for_system(system_id, context)
>      system_systems = self.find(system_id, context)
> -    systems_url = context.url("/system/#{system_id}/systems") if context.driver.has_capability? :add_systems_to_system
> +    systems_url = context.system_systems_url(system_id) if context.driver.has_capability? :add_systems_to_system
>      CIMI::Model::SystemSystem.list(systems_url, system_systems, :add_url => systems_url)
>    end
>  
> diff --git a/server/lib/cimi/service/system_template.rb b/server/lib/cimi/service/system_template.rb
> index 785f79d..90a55b8 100644
> --- a/server/lib/cimi/service/system_template.rb
> +++ b/server/lib/cimi/service/system_template.rb
> @@ -18,10 +18,11 @@ class CIMI::Service::SystemTemplate < CIMI::Service::Base
>    def self.find(id, context)
>      if id == :all
>        templates = context.driver.system_templates(context.credentials, {:env=>context})
> +      templates.collect {|e| CIMI::Service::SystemTemplate.new(context, :model => e)}
>      else
>        templates = context.driver.system_templates(context.credentials, {:env=>context, :id=>id})
> -      raise CIMI::Model::NotFound unless templates.first
> -      templates.first
> +      raise CIMI::Model::NotFound if templates.empty?
> +      CIMI::Service::SystemTemplate.new(context, :model => templates.first)
>      end
>    end
>  
> diff --git a/server/lib/cimi/service/system_volume.rb b/server/lib/cimi/service/system_volume.rb
> index 7f4306b..431c7a0 100644
> --- a/server/lib/cimi/service/system_volume.rb
> +++ b/server/lib/cimi/service/system_volume.rb
> @@ -18,16 +18,17 @@ class CIMI::Service::SystemVolume < CIMI::Service::Base
>    def self.find(system_id, context, id=:all)
>      if id == :all
>        vols = context.driver.system_volumes(context.credentials, {:env=>context, :system_id=>system_id})
> +      vols.collect {|e| CIMI::Service::SystemVolume.new(context, :model => e)}
>      else
>        vols = context.driver.system_volumes(context.credentials, {:env=>context, :system_id=>system_id, :id=>id})
>        raise CIMI::Model::NotFound if vols.empty?
> -      vols.first
> +      CIMI::Service::SystemVolume.new(context, :model => vols.first)
>      end
>    end
>  
>    def self.collection_for_system(system_id, context)
>      system_volumes = self.find(system_id, context)
> -    volumes_url = context.url("/system/#{system_id}/volumes") if context.driver.has_capability? :add_volumes_to_system
> +    volumes_url = context.system_volumes_url(system_id) if context.driver.has_capability? :add_volumes_to_system
>      CIMI::Model::SystemVolume.list(volumes_url, system_volumes, :add_url => volumes_url)
>    end
>  
>