[Kimchi-devel] [PATCH V5 5/7] template supports networks: update model

Shu Ming shuming at linux.vnet.ibm.com
Thu Jan 2 02:32:23 UTC 2014


Reviewed-by: Shu Ming <shuming at linux.vnet.ibm.com>
2013/12/31 21:45, shaohef at linux.vnet.ibm.com:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> check all networks exist
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   src/kimchi/model.py | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/src/kimchi/model.py b/src/kimchi/model.py
> index 572b316..1c49a25 100644
> --- a/src/kimchi/model.py
> +++ b/src/kimchi/model.py
> @@ -678,6 +678,9 @@ class Model(object):
>
>       def templates_create(self, params):
>           name = params['name']
> +        for net_name in params.get(u'networks', []):
> +            self._get_network(net_name)
> +
>           with self.objstore as session:
>               if name in session.get_list('template'):
>                   raise InvalidOperation("Template already exists")
> @@ -698,6 +701,9 @@ class Model(object):
>           except Exception as e:
>               raise InvalidParameter("Storagepool specified is not valid: %s." % e.message)
>
> +        for net_name in params.get(u'networks', []):
> +            self._get_network(net_name)
> +
>           self.template_delete(name)
>           try:
>               ident = self.templates_create(new_t)




More information about the Kimchi-devel mailing list