Skip to content

Commit

Permalink
blocksd_test: add test for skip extend
Browse files Browse the repository at this point in the history
Add a test to ensure that extendSize is correctly
skipped for cow sparse volumes.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
  • Loading branch information
aesteve-rh committed Feb 21, 2023
1 parent f664fe9 commit a558d52
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/storage/blocksd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,38 @@ def test_extend_volume(domain_factory, fake_task, fake_sanlock):
assert vol_size.apparentsize == new_capacity


@requires_root
@pytest.mark.root
def test_extend_volume_skipped(domain_factory, fake_task, fake_sanlock):
sd_uuid = str(uuid.uuid4())
dom = domain_factory.create_domain(sd_uuid=sd_uuid, version=5)

img_uuid = str(uuid.uuid4())
vol_id = str(uuid.uuid4())
vol_capacity = 10 * GiB
new_capacity = 15 * GiB

dom.createVolume(
imgUUID=img_uuid,
capacity=vol_capacity,
volFormat=sc.COW_FORMAT,
preallocate=sc.SPARSE_VOL,
diskType=sc.DATA_DISKTYPE,
volUUID=vol_id,
desc="Base volume",
srcImgUUID=sc.BLANK_UUID,
srcVolUUID=sc.BLANK_UUID)

# Produce and extend volume to the new capacity, but we skip extends for
# cow sparse volumes.
vol = dom.produceVolume(img_uuid, vol_id)
vol.extendSize(new_capacity)

# Check that volume size has not changed.
assert dom.getVolumeSize(img_uuid, vol_id).truesize <= vol_capacity
assert dom.getVolumeSize(img_uuid, vol_id).apparentsize <= vol_capacity


LVM_TAG_CHARS = string.ascii_letters + "0123456789_+.-/=!:#"

LVM_TAGS = [
Expand Down

0 comments on commit a558d52

Please sign in to comment.