Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

volume: allow extend cow preallocated #379

Merged
merged 4 commits into from
Feb 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
aesteve-rh marked this conversation as resolved.
Show resolved Hide resolved


@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
aesteve-rh marked this conversation as resolved.
Show resolved Hide resolved


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

LVM_TAGS = [
Expand Down