LGTM, thanks.

On Wed, Jul 17, 2013 at 4:20 PM, Helga Velroyen <[email protected]> wrote:

> This patch makes an FileStorageError to be risen with a
> proper error message instead of just an assertion in case
> the given disk template is not a valid disk template at
> all.
>
> Signed-off-by: Helga Velroyen <[email protected]>
> ---
>  lib/cmdlib/common.py | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/lib/cmdlib/common.py b/lib/cmdlib/common.py
> index 8ea6f76..2d6b234 100644
> --- a/lib/cmdlib/common.py
> +++ b/lib/cmdlib/common.py
> @@ -1079,7 +1079,11 @@ def CheckDiskTemplateEnabled(cluster,
> disk_template):
>
>    """
>    assert disk_template is not None
> -  assert disk_template in constants.DISK_TEMPLATES
> +  if disk_template not in constants.DISK_TEMPLATES:
> +    raise errors.OpPrereqError("'%s' is not a valid disk template."
> +                               " Valid disk templates are: %s" %
> +                               (disk_template,
> +                                ",".join(constants.DISK_TEMPLATES)))
>    if not disk_template in cluster.enabled_disk_templates:
>      raise errors.OpPrereqError("Disk template '%s' is not enabled in
> cluster."
>                                 " Enabled disk templates are: %s" %
> --
> 1.8.3
>
>


-- 
Thomas Thrainer | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to