[PATCH V3] Bug fix: Kimchi will try to create directory for 'DIR' storagepool

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@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 73c18ac..3a4e20e 100644 --- a/src/kimchi/model.py +++ b/src/kimchi/model.py @@ -1006,16 +1006,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 d7b046d..792744c 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> -- 1.8.1.4

Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> Tested-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 12/19/2013 03:34 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@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 73c18ac..3a4e20e 100644 --- a/src/kimchi/model.py +++ b/src/kimchi/model.py @@ -1006,16 +1006,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 d7b046d..792744c 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>

it needs rebase. On 12/20/2013 11:09 AM, Aline Manera wrote:
Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> Tested-by: Aline Manera <alinefm@linux.vnet.ibm.com>
On 12/19/2013 03:34 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@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 73c18ac..3a4e20e 100644 --- a/src/kimchi/model.py +++ b/src/kimchi/model.py @@ -1006,16 +1006,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 d7b046d..792744c 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>
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (2)
-
Aline Manera
-
Rodrigo Trujillo