Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: better handling of preexisting storage domain
......................................................................

packaging: setup: better handling of preexisting storage domain

Better handling of preexisting storage domain validating it

Change-Id: I622e0540ca21eea5ebddbfa4361bfb6537ca42d8
Bug-Url: https://bugzilla.redhat.com/1155637
Signed-off-by: Simone Tiraboschi <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/storage/storage.py
1 file changed, 16 insertions(+), 3 deletions(-)


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

diff --git a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py 
b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
index d6275c8..a083e0a 100644
--- a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
+++ b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
@@ -364,9 +364,13 @@
             ):
                 self._storageServerConnection(disconnect=True)
         else:
-            self.environment[
-                ohostedcons.CoreEnv.ADDITIONAL_HOST_ENABLED
-            ] = True
+            valid = self._validateStorageDomain(
+                self.environment[
+                    ohostedcons.StorageEnv.SD_UUID
+                ]
+            )
+            if valid[0] != 0:
+                raise RuntimeError(_('Invalid Storage Domain'))
 
     def _getStorageDomainsList(self, spUUID=None):
         if not spUUID:
@@ -379,6 +383,14 @@
             for entry in response['domlist']:
                 domains.append(entry)
         return domains
+
+    def _validateStorageDomain(self, sdUUID):
+        self.logger.debug('validateStorageDomain')
+        response = self.serv.s.validateStorageDomain(sdUUID)
+        self.logger.debug(response)
+        if response['status']['code']:
+            return response['status']['code'], response['status']['message']
+        return 0, ''
 
     def _getStorageDomainInfo(self, sdUUID):
         self.logger.debug('getStorageDomainInfo')
@@ -576,6 +588,7 @@
             method_args += [
                 master,
                 master_ver,
+                sdUUID+'=active',
             ]
         self.logger.debug(debug_msg)
         status, message = method(args=method_args)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I622e0540ca21eea5ebddbfa4361bfb6537ca42d8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to