]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/cephfs: check data written to NS.
authorXiaoxi Chen <xiaoxchen@ebay.com>
Tue, 12 Apr 2016 09:12:25 +0000 (17:12 +0800)
committerXiaoxi Chen <xiaoxchen@ebay.com>
Sun, 17 Apr 2016 09:27:57 +0000 (17:27 +0800)
NS is always used for security isolation.

Signed-off-by: Xiaoxi Chen <xiaoxchen@ebay.com>
tasks/cephfs/filesystem.py
tasks/cephfs/test_volume_client.py

index c29fb8651e19cae0d59e41b7b3ab0329694fe34f..f9ad1488aa9b30a62ed5c286031750831409250c 100644 (file)
@@ -723,7 +723,7 @@ class Filesystem(MDSCluster):
             log.info("All objects for ino {0} size {1} are absent".format(ino, size))
             return True
 
-    def rados(self, args, pool=None, stdin_data=None):
+    def rados(self, args, pool=None, namespace=None, stdin_data=None):
         """
         Call into the `rados` CLI from an MDS
         """
@@ -738,7 +738,9 @@ class Filesystem(MDSCluster):
 
         # NB we could alternatively use librados pybindings for this, but it's a one-liner
         # using the `rados` CLI
-        args = [os.path.join(self._prefix, "rados"), "-p", pool] + args
+        args = ([os.path.join(self._prefix, "rados"), "-p", pool] +
+                (["--namespace", namespace] if namespace else []) +
+                args)
         p = remote.run(
             args=args,
             stdin=stdin_data,
index e537488bd556e016a0f400bff02b3c957eee0ddf..ec672371744bcee1593a4e2e217c900e71acd815 100644 (file)
@@ -131,6 +131,19 @@ vc.disconnect()
         self.mounts[2].mount(mount_path=mount_path)
         self.mounts[2].write_n_mb("data.bin", 1)
 
+        #sync so that file data are persist to rados
+        self.mounts[2].run_shell(["sync"])
+
+        # Our data should stay in particular rados namespace
+        pool_name = self.mount_a.getfattr(os.path.join("volumes", group_id, volume_id), "ceph.dir.layout.pool")
+        NS_PREFIX = "fsvolumens_"
+        namespace = "{0}{1}".format(NS_PREFIX, volume_id)
+        ns_in_attr = self.mount_a.getfattr(os.path.join("volumes", group_id, volume_id), "ceph.dir.layout.pool_namespace")
+        self.assertEqual(namespace, ns_in_attr)
+
+        objects_in_ns = set(self.fs.rados(["ls"], pool=pool_name, namespace=namespace).split("\n"))
+        self.assertNotEqual(objects_in_ns, set())
+
         # De-authorize the guest
         self._volume_client_python(self.mount_b, dedent("""
             vp = VolumePath("{group_id}", "{volume_id}")