From 07d3089049b1ac81a3efbc14856679c4aa82b412 Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Mon, 29 May 2023 15:52:28 +0200 Subject: [PATCH] volume: change extend skip condition Consider format also on the skip condition for extending volumes. Only COW sparse volumes shall be skipped. Fixes: c9d6da4 Bug-Url: https://bugzilla.redhat.com/2210036 Signed-off-by: Albert Esteve --- lib/vdsm/storage/volume.py | 7 ++++--- tests/storage/filevolume_test.py | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/vdsm/storage/volume.py b/lib/vdsm/storage/volume.py index ff8deffd3f..066fc69eb9 100644 --- a/lib/vdsm/storage/volume.py +++ b/lib/vdsm/storage/volume.py @@ -1380,9 +1380,10 @@ def extendSize(self, new_capacity): if self.isShared(): raise se.VolumeNonWritable(self.volUUID) - if self.getType() == sc.SPARSE_VOL: - self.log.debug("skipping sparse size extension for volume %s to " - "capacity %s", self.volUUID, new_capacity) + if (self.getFormat() == sc.COW_FORMAT and + self.getType() == sc.SPARSE_VOL): + self.log.debug("skipping cow sparse size extension for volume %s " + "to capacity %s", self.volUUID, new_capacity) return # Note: This function previously prohibited extending non-leaf volumes. diff --git a/tests/storage/filevolume_test.py b/tests/storage/filevolume_test.py index ad749cb451..9b9f455707 100644 --- a/tests/storage/filevolume_test.py +++ b/tests/storage/filevolume_test.py @@ -157,7 +157,6 @@ def test_volume_size_unaligned(monkeypatch, tmpdir, tmp_repo, fake_access, assert vol.getCapacity() == expected_vol_capacity -@pytest.mark.xfail(reason='Raw sparse volumes are not extended.') def test_extend_volume(tmp_repo, fake_access, fake_task): """ Test added to verify fix for https://bugzilla.redhat.com/2210036.