You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2013/03/05 10:36:44 UTC

Restore network creation with config/forwarding_group reference

also at http://tracker.deltacloud.org/set/

the NetworkCreate model only handles creation with template by reference - this restores
the ability to create with config/forwarding_group by reference. Still outstanding is to
deal with config by value (inline/overrides),

marios

Re: [PATCH] CIMI: Restore create Network with config/forwarding_group by reference

Posted by Martha Chumo <ma...@gmail.com>.
ACK.

On Tue, Mar 5, 2013 at 12:36 PM, <ma...@redhat.com> wrote:

> From: marios <ma...@redhat.com>
>
>
> Signed-off-by: marios <ma...@redhat.com>
> ---
>  server/lib/cimi/models/network_create.rb | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/server/lib/cimi/models/network_create.rb
> b/server/lib/cimi/models/network_create.rb
> index 006a064..2496269 100644
> --- a/server/lib/cimi/models/network_create.rb
> +++ b/server/lib/cimi/models/network_create.rb
> @@ -13,25 +13,27 @@
>  # License for the specific language governing permissions and limitations
>  # under the License.
>
> -class CIMI::Model::Network < CIMI::Model::Base
> +class CIMI::Model::NetworkCreate < CIMI::Model::Base
>
>    ref :network_template, :required => true
>
>    def create(context)
>      validate!
> -
>      if network_template.href?
>        template = network_template.find(context)
> +      network_config = template.network_config.find(context)
> +      forwarding_group = template.forwarding_group.find(context)
> +    else
> +      network_config =
> CIMI::Model::NetworkConfiguration.find(context.href_id(network_template.network_config.href,
> :network_configurations), context)
> +      forwarding_group =
> CIMI::Model::ForwardingGroup.find(context.href_id(network_template.forwarding_group.href,
> :forwarding_groups), context)
>      end
> -
>      params = {
> -      :network_config => template.network_config.find(context),
> -      :forwarding_group => template.forwarding_group.find(context),
> +      :network_config => network_config,
> +      :forwarding_group => forwarding_group,
>        :name => name,
>        :description => description,
>        :env => context # FIXME: We should not pass the context to the
> driver (!)
>      }
> -
>      network = context.driver.create_network(context.credentials, params)
>      network.property = property if property
>      network.save
> --
> 1.8.1.4
>
>


-- 
{ email : "martha.c.chumo@gmail.com" ,
  social : [ { twitter : "@NjeriChelimo" } , {facebook : "Njeri Chelimo" }
],
  code : [ { github : "Njeri Chelimo"}, { bitbucket : "nchelimo" } ],
  skype : "martha.chumo"
}

[PATCH] CIMI: Restore create Network with config/forwarding_group by reference

Posted by ma...@redhat.com.
From: marios <ma...@redhat.com>


Signed-off-by: marios <ma...@redhat.com>
---
 server/lib/cimi/models/network_create.rb | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/server/lib/cimi/models/network_create.rb b/server/lib/cimi/models/network_create.rb
index 006a064..2496269 100644
--- a/server/lib/cimi/models/network_create.rb
+++ b/server/lib/cimi/models/network_create.rb
@@ -13,25 +13,27 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-class CIMI::Model::Network < CIMI::Model::Base
+class CIMI::Model::NetworkCreate < CIMI::Model::Base
 
   ref :network_template, :required => true
 
   def create(context)
     validate!
-
     if network_template.href?
       template = network_template.find(context)
+      network_config = template.network_config.find(context)
+      forwarding_group = template.forwarding_group.find(context)
+    else
+      network_config = CIMI::Model::NetworkConfiguration.find(context.href_id(network_template.network_config.href, :network_configurations), context)
+      forwarding_group = CIMI::Model::ForwardingGroup.find(context.href_id(network_template.forwarding_group.href, :forwarding_groups), context)
     end
-
     params = {
-      :network_config => template.network_config.find(context),
-      :forwarding_group => template.forwarding_group.find(context),
+      :network_config => network_config,
+      :forwarding_group => forwarding_group,
       :name => name,
       :description => description,
       :env => context # FIXME: We should not pass the context to the driver (!)
     }
-
     network = context.driver.create_network(context.credentials, params)
     network.property = property if property
     network.save
-- 
1.8.1.4


Re: Restore network creation with config/forwarding_group reference

Posted by "marios@redhat.com" <ma...@redhat.com>.
On 05/03/13 11:36, marios@redhat.com wrote:
> also at http://tracker.deltacloud.org/set/
> 
> the NetworkCreate model only handles creation with template by reference - this restores
> the ability to create with config/forwarding_group by reference. Still outstanding is to
> deal with config by value (inline/overrides),
> 
> marios
> 


sorry - that should have been http://tracker.deltacloud.org/set/365