Federico Simoncelli has uploaded a new change for review.

Change subject: sp: _refreshDomainLinks must not change the metadata
......................................................................

sp: _refreshDomainLinks must not change the metadata

Change-Id: I2ecf801d58b34c1c811e311e3779887a406af5f0
Signed-off-by: Federico Simoncelli <fsimo...@redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 17 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/22131/1

diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index f35ea4b..4e08154 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -212,6 +212,20 @@
                     except KeyError:
                         pass
 
+    def _updateDomainsRole(self):
+        for sdUUID in self.getDomains(activeOnly=True):
+            if sdUUID == self.masterDomain.sdUUID:
+                continue
+
+            domain = sdCache.produce(sdUUID)
+            if domain.getDomainRole() == sd.REGULAR_DOMAIN:
+                continue
+
+            try:
+                self.setDomainMasterRole(domain, sd.REGULAR_DOMAIN, 0)
+            except:
+                self.log.exception('Unable to set role for domain %s', sdUUID)
+
     @unsecured
     def startSpm(self, prevID, prevLVER, scsiFencing, maxHostID,
                  expectedDomVersion=None):
@@ -304,6 +318,7 @@
 
                 # Once setSafe completes we are running as SPM
                 self._setSafe()
+                self._updateDomainsRole()
 
                 # Mailbox issues SPM commands, therefore we start it AFTER spm
                 # commands are allowed to run to prevent a race between the
@@ -1111,6 +1126,8 @@
 
         # Domain conversion requires the links to be present
         self._refreshDomainLinks(dom)
+        self.setDomainMasterRole(dom, sd.REGULAR_DOMAIN, 0)
+
         if dom.getDomainClass() == sd.DATA_DOMAIN:
             self._convertDomain(dom)
 
@@ -1217,8 +1234,6 @@
         if self.masterDomain.sdUUID == domain.sdUUID:
             masterName = os.path.join(self.poolPath, POOL_MASTER_DOMAIN)
             self._linkStorageDomain(domain.domaindir, masterName)
-        else:
-            self.setDomainMasterRole(domain, sd.MASTER_DOMAIN, 0)
 
     @unsecured
     def __rebuild(self, msdUUID, masterVersion):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ecf801d58b34c1c811e311e3779887a406af5f0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimo...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to