[Kimchi-devel] [PATCH 1/6] Re-raise the original exception when creating a new Template

Daniel Henrique Barboza danielhb at linux.vnet.ibm.com
Thu Nov 13 15:49:06 UTC 2014


Reviewed-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>

On 11/11/2014 06:46 PM, Aline Manera wrote:
> To avoid problems with full disks, all the objectstore operations are
> made in a try/except block - so in any problem we can properly inform
> the user. But an exception is also expected for duplicated entries.
> In that case we should raise the original exception.
> Fix it.
>
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
>   src/kimchi/model/templates.py | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
> index ff1070d..6e1a571 100644
> --- a/src/kimchi/model/templates.py
> +++ b/src/kimchi/model/templates.py
> @@ -74,6 +74,7 @@ class TemplatesModel(object):
>               except Exception:
>                   raise InvalidParameter("KCHTMPL0004E", {'pool': pool_name,
>                                                           'template': name})
> +
>               tmp_volumes = [disk['volume'] for disk in params.get('disks', [])
>                              if 'volume' in disk]
>               self.template_volume_validate(tmp_volumes, pool)
> @@ -94,7 +95,9 @@ class TemplatesModel(object):
>                   if name in session.get_list('template'):
>                       raise InvalidOperation("KCHTMPL0001E", {'name': name})
>                   session.store('template', name, t.info)
> -        except Exception as e:
> +        except InvalidOperation:
> +            raise
> +        except Exception, e:
>               raise OperationFailed('KCHTMPL0020E', {'err': e.message})
>
>           return name




More information about the Kimchi-devel mailing list