Oved Ourfali has uploaded a new change for review.
Change subject: wip - vdsm: improve message when trying to attach import domain with wrong permissions (#842146) ......................................................................
wip - vdsm: improve message when trying to attach import domain with wrong permissions (#842146)
https://bugzilla.redhat.com/842146
When a storage domain is attached, and there is something wrong with the directory permissions, then the operation fails with "Cannot obtain lock" error. This patch improves the error in this case, by performing pre-attach validations, which, on file domains, include checking the permissions of the domain directory, printing a suitable error message.
Change-Id: I76880b1445f259431d7aa691eda676e1210308e4 Signed-off-by: Oved Ourfali oourfali@redhat.com --- M vdsm/storage/fileSD.py M vdsm/storage/sd.py M vdsm/storage/sp.py 3 files changed, 19 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/7339/1
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index ea817b7..2df10c3 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -217,6 +217,18 @@ return fileVolume.FileVolume
+ def preAttachValidations(self): + """ + Check that we have access to the domain directory + """ + try: + validateDirAccess(self.domaindir) + except OSError as e: + if e.errno == errno.EACCES: + raise se.StorageServerAccessPermissionError(self.domaindir) + raise + return + def volumeExists(self, imgPath, volUUID): """ Return True if the volume volUUID exists diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py index 174adee..2eb7349 100644 --- a/vdsm/storage/sd.py +++ b/vdsm/storage/sd.py @@ -365,6 +365,12 @@ """ pass
+ def preAttachValidations(self): + """ + Do all validataion checks relevant when attaching storage domain + """ + return + @classmethod def validateCreateVolumeParams(cls, volFormat, preallocate, srcVolUUID): """ diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index ee45151..0ff39ed 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -921,6 +921,7 @@ raise se.TooManyDomainsInStoragePoolError()
dom = sdCache.produce(sdUUID) + dom.preAttachValidations() dom.acquireHostId(self.id)
try:
-- To view, visit http://gerrit.ovirt.org/7339 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I76880b1445f259431d7aa691eda676e1210308e4 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Oved Ourfali oourfali@redhat.com