Saggi Mizrahi has uploaded a new change for review.

Change subject: Check that underlying filesystem supports direct IO before 
creating a domain on it
......................................................................

Check that underlying filesystem supports direct IO before creating a domain on 
it

Change-Id: Icf14d1c4737a88e693e5bebb896aef382b8b424c
Signed-off-by: Saggi Mizrahi <[email protected]>
---
M vdsm/storage/fileSD.py
1 file changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/9749/1

diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index c4415da..ac516ac 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -122,7 +122,6 @@
 FileSDMetadata = lambda metafile: DictValidator(
     PersistentDict(FileMetadataRW(metafile)), FILE_SD_MD_FIELDS)
 
-
 class FileStorageDomain(sd.StorageDomain):
     def __init__(self, domainPath):
         # Using glob might look like the simplest thing to do but it isn't
@@ -134,6 +133,8 @@
         self.metafile = os.path.join(domainPath, sd.DOMAIN_META_DATA,
                                      sd.METADATA)
 
+        self.validateFileSystemFeatures()
+
         metadata = FileSDMetadata(self.metafile)
         sdUUID = metadata[sd.DMDK_SDUUID]
         domaindir = os.path.join(self.mountpoint, sdUUID)
@@ -144,6 +145,20 @@
         self.imageGarbageCollector()
         self._registerResourceNamespaces()
 
+    def validateFileSystemFeatures(self):
+        testFilePath = os.path.join(self.mountpoint, "__DIRECTIO_TEST__")
+        try:
+            oop.getProcessPool(self.sdUUID).directWriteLines(testFilePath)
+        except OSError as e:
+            if e.errno == errno.EINVAL:
+                self.log.error("Underlying file system doesn't support"
+                               "direct IO")
+                raise se.StorageDomainCreationError()
+
+            raise
+        finally:
+            oop.getProcessPool(self.sdUUID).os.unlink(testFilePath)
+
     def setMetadataPermissions(self):
         procPool = oop.getProcessPool(self.sdUUID)
         for metaFile in (sd.LEASES, sd.IDS, sd.INBOX, sd.OUTBOX):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf14d1c4737a88e693e5bebb896aef382b8b424c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to