From 91c74f4778ce5433968226345ffe26e876eb56a7 Mon Sep 17 00:00:00 2001 From: Ramana Raja Date: Tue, 11 Oct 2016 13:40:43 +0530 Subject: [PATCH 1/2] 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 --- tasks/cephfs/test_volume_client.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tasks/cephfs/test_volume_client.py b/tasks/cephfs/test_volume_client.py index e4a30d85533..ad4b102bc39 100644 --- a/tasks/cephfs/test_volume_client.py +++ b/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) From bb60e01904187db417e8c7d6e57401823a0072fd Mon Sep 17 00:00:00 2001 From: Ramana Raja Date: Tue, 11 Oct 2016 14:18:29 +0530 Subject: [PATCH 2/2] test_volume_client: remove superfluous arguments Signed-off-by: Ramana Raja --- tasks/cephfs/test_volume_client.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tasks/cephfs/test_volume_client.py b/tasks/cephfs/test_volume_client.py index ad4b102bc39..f3725a7e20a 100644 --- a/tasks/cephfs/test_volume_client.py +++ b/tasks/cephfs/test_volume_client.py @@ -146,7 +146,6 @@ vc.disconnect() def test_default_prefix(self): group_id = "grpid" volume_id = "volid" - guest_entity = "guest" DEFAULT_VOL_PREFIX = "volumes" DEFAULT_NS_PREFIX = "fsvolumens_" @@ -160,7 +159,6 @@ vc.disconnect() """.format( group_id=group_id, volume_id=volume_id, - guest_entity=guest_entity ))) # The dir should be created @@ -304,7 +302,6 @@ vc.disconnect() """.format( group_id=group_id, volume_id=volume_id, - guest_entity=guest_entity )), volume_prefix, namespace_prefix) def test_idempotency(self): @@ -384,7 +381,6 @@ vc.disconnect() pools_a = json.loads(self.fs.mon_manager.raw_cluster_cmd("osd", "dump", "--format=json-pretty"))['pools'] - guest_entity = "guest" group_id = "grpid" volume_id = "volid" self._volume_client_python(self.mount_b, dedent(""" @@ -393,7 +389,6 @@ vc.disconnect() """.format( group_id=group_id, volume_id=volume_id, - guest_entity=guest_entity ))) pools_b = json.loads(self.fs.mon_manager.raw_cluster_cmd("osd", "dump", "--format=json-pretty"))['pools'] @@ -594,7 +589,6 @@ vc.disconnect() """.format( group_id=group_id, volume_id=volume_id, - guest_entity=guest_entity ))) # Authorize and configure credentials for the guest to mount the