Merge pull request #1202 from ajarr/wip-check-volume-size

test_volume_client: check volume size

Reviewed-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2016-10-19 15:19:14 +02:00 committed by GitHub
commit 257827012f

View File

@ -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
@ -195,15 +193,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 +214,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)
@ -294,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):
@ -374,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("""
@ -383,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']
@ -584,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