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 <rraja@redhat.com>
This commit is contained in:
Ramana Raja 2016-10-11 13:40:43 +05:30
parent c5bd611d33
commit 91c74f4778

View 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)