Sandro Bonazzola has uploaded a new change for review.

Change subject: storage: iscsi: ensure service directory exists
......................................................................

storage: iscsi: ensure service directory exists

while creating symlink to the device, a check on existing directory
was missing, causing symlink to fail.
Added missing directory creation and some debug code.

Change-Id: Ia1d4783437236b495b2ca5424185aeac9eb8ba72
Bug-Url: https://bugzilla.redhat.com/1099882
Signed-off-by: Sandro Bonazzola <sbona...@redhat.com>
---
M ovirt_hosted_engine_ha/lib/storage_backends.py
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha 
refs/changes/94/27994/1

diff --git a/ovirt_hosted_engine_ha/lib/storage_backends.py 
b/ovirt_hosted_engine_ha/lib/storage_backends.py
index b6c1305..9b2f952 100644
--- a/ovirt_hosted_engine_ha/lib/storage_backends.py
+++ b/ovirt_hosted_engine_ha/lib/storage_backends.py
@@ -143,7 +143,18 @@
                     # If the file is not there it is not a failure,
                     # but if anything else happened, raise it again
                     raise
-            os.symlink(os.path.join("/dev", uuid, lv), service_link)
+            try:
+                if not os.path.exists(self._storage_path):
+                    os.mkdir(self._storage_path)
+                os.symlink(os.path.join("/dev", uuid, lv), service_link)
+            except OSError as e:
+                raise Exception(
+                    "%s -> %s failed: %s" % (
+                        os.path.join("/dev", uuid, lv),
+                        service_link,
+                        str(e)
+                    )
+                )
 
     def disconnect(self):
         pass


-- 
To view, visit http://gerrit.ovirt.org/27994
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1d4783437236b495b2ca5424185aeac9eb8ba72
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to