Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: check access rights on storage
......................................................................

packaging: setup: check access rights on storage

during customization also check for access permissions
on storage location avoiding to fail storage domain
creation in a later stage.

Change-Id: I5c97ee7a8b98d0f41a906dd9507ace88d44da38d
Bug-Url:https://bugzilla.redhat.com/999865
Signed-off-by: Sandro Bonazzola <sbona...@redhat.com>
---
M src/plugins/ovirt-hosted-engine-setup/storage/storage.py
1 file changed, 27 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/21/18421/1

diff --git a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py 
b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
index 2af9d3f..72b7178 100644
--- a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
+++ b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
@@ -183,11 +183,37 @@
                             _('Invalid value for Host ID: must be integer')
                         )
 
+    def _check_domain_rights(self, path):
+        rc, _stdout, _stderr = self.execute(
+            (
+                self.command.get('sudo'),
+                '-u', 'vdsm',
+                '-g', 'kvm',
+                'test',
+                '-r', path,
+                '-a',
+                '-w', path,
+                '-a',
+                '-x', path,
+            ),
+            raiseOnError=False
+        )
+        if rc != 0:
+            raise RuntimeError(
+                _(
+                    'permission settings on the specified storage do not '
+                    'allow access to the storage to vdsm user and kvm group. '
+                    'Verify permission settings on the specified storage '
+                    'or specify another location'
+                )
+            )
+
     def _validateDomain(self, connection, domain_type):
         path = tempfile.mkdtemp()
         try:
             self._mount(path, connection, domain_type)
             self._checker.check_valid_path(path)
+            self._check_domain_rights(path)
             self._checker.check_base_writable(path)
             self._checker.check_available_space(
                 path,
@@ -471,6 +497,7 @@
         self.command.detect('mount')
         self.command.detect('umount')
         self.command.detect('lsof')
+        self.command.detect('sudo')
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c97ee7a8b98d0f41a906dd9507ace88d44da38d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
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