From 75496812dc3d35a1737bc091b588ea7ad533ca54 Mon Sep 17 00:00:00 2001 From: Ramana Raja Date: Tue, 11 Oct 2016 13:40:43 +0530 Subject: [PATCH] test_volume_client: check volume size 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 (cherry picked from commit 91c74f4778ce5433968226345ffe26e876eb56a7) --- qa/tasks/cephfs/test_volume_client.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/qa/tasks/cephfs/test_volume_client.py b/qa/tasks/cephfs/test_volume_client.py index 9201724b00a87..3f5eae4946c74 100644 --- a/qa/tasks/cephfs/test_volume_client.py +++ b/qa/tasks/cephfs/test_volume_client.py @@ -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) -- 2.39.5