]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_volume_client: check volume size
authorRamana Raja <rraja@redhat.com>
Tue, 11 Oct 2016 08:10:43 +0000 (13:40 +0530)
committerRamana Raja <rraja@redhat.com>
Mon, 16 Jan 2017 09:43:49 +0000 (15:13 +0530)
Check that the total size shown by the df output of a mounted volume
is same as the volume size and the quota set on the volume.

Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit 91c74f4778ce5433968226345ffe26e876eb56a7)

qa/tasks/cephfs/test_volume_client.py

index 9201724b00a876772a12bf2adc5521e1290bf0b2..3f5eae4946c74561a5c1ea40af7fad28d97d6dbf 100644 (file)
@@ -195,15 +195,16 @@ vc.disconnect()
         volume_prefix = "/myprefix"
         namespace_prefix = "mynsprefix_"
 
-        # Create
+        # Create a 100MB volume
+        volume_size = 100
         mount_path = self._volume_client_python(self.mount_b, dedent("""
             vp = VolumePath("{group_id}", "{volume_id}")
-            create_result = vc.create_volume(vp, 1024*1024*100)
+            create_result = vc.create_volume(vp, 1024*1024*{volume_size})
             print create_result['mount_path']
         """.format(
             group_id=group_id,
             volume_id=volume_id,
-            guest_entity=guest_entity
+            volume_size=volume_size
         )), volume_prefix, namespace_prefix)
 
         # The dir should be created
@@ -215,6 +216,15 @@ vc.disconnect()
                                    mount_path, namespace_prefix)
         self.mounts[2].mount(mount_path=mount_path)
 
+        # df should see volume size, same as the quota set on volume's dir
+        self.assertEqual(self.mounts[2].df()['total'],
+                         volume_size * 1024 * 1024)
+        self.assertEqual(
+                self.mount_a.getfattr(
+                    os.path.join(volume_prefix.strip("/"), group_id, volume_id),
+                    "ceph.quota.max_bytes"),
+                "%s" % (volume_size * 1024 * 1024))
+
         # df granularity is 4MB block so have to write at least that much
         data_bin_mb = 4
         self.mounts[2].write_n_mb("data.bin", data_bin_mb)