[Kimchi-devel] [PATCH V4 (rebase) ] Bug fix: Kimchi will try to create directory for 'DIR' storagepool

Aline Manera alinefm at linux.vnet.ibm.com
Mon Dec 23 11:26:30 UTC 2013


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 12/20/2013 05:14 PM, Rodrigo Trujillo wrote:
> When you create a 'DIR' storagepool, kimchi does not check if the
> path exists, returning errors when you try to activate the SP.
> This path makes kimchi check the path and created the directory,
> if it does not exist.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   src/kimchi/model.py                | 8 ++++----
>   ui/pages/storagepool-add.html.tmpl | 4 +++-
>   2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/kimchi/model.py b/src/kimchi/model.py
> index d5d0dd8..a6790b8 100644
> --- a/src/kimchi/model.py
> +++ b/src/kimchi/model.py
> @@ -1009,16 +1009,16 @@ class Model(object):
>                   return name
>
>               pool = conn.storagePoolDefineXML(xml, 0)
> -            if params['type'] == 'logical':
> -                pool.setAutostart(1)
> +            if params['type'] in ['logical', 'dir']:
>                   pool.build(libvirt.VIR_STORAGE_POOL_BUILD_NEW)
> -            if params['type'] == 'dir':
> -                # autostart dir storage pool created from kimchi
> +                # autostart dir and logical storage pool created from kimchi
>                   pool.setAutostart(1)
>               else:
>                   # disable autostart for others
>                   pool.setAutostart(0)
>           except libvirt.libvirtError as e:
> +            msg = "Problem creating Storage Pool: %s"
> +            kimchi_log.error(msg, e)
>               raise OperationFailed(e.get_error_message())
>           return name
>
> diff --git a/ui/pages/storagepool-add.html.tmpl b/ui/pages/storagepool-add.html.tmpl
> index 3ab9ae5..5a2dd45 100644
> --- a/ui/pages/storagepool-add.html.tmpl
> +++ b/ui/pages/storagepool-add.html.tmpl
> @@ -63,6 +63,8 @@
>                           <div class="field">
>                               <p class="text-help">
>                                   $_("The path of the Storage Pool. Each Storage Pool must have a unique path.")</p>
> +                            <p class="text-help">
> +                                $_("Kimchi will try to create the directory when it does not already exist in your system.")</p>
>                               <input id="pathId" type="text" class="text" style="width: 300px">
>                           </div>
>                           <div class="clear"></div>
> @@ -116,4 +118,4 @@
>           </div>
>       </script>
>   </body>
> -</html>
> \ No newline at end of file
> +</html>




More information about the Kimchi-devel mailing list