1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

fix(instances): a shut-off clone into a volume name its pool has is refused before it begins

libvirt refused the copy only after the job had begun; recovery then
found a volume of the planned name and ended the job uncertain, holding
the VM. The names are checked when the job is queued and before it runs,
as a live clone did; that check now refreshes the pool first, so a live
clone's free space is read current too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-07 23:42:21 +03:00
parent 018ca69a3b
commit 4ee88d6767
4 changed files with 52 additions and 10 deletions

View file

@ -129,6 +129,19 @@ class LiveCloneTargetsTestCase(unittest.TestCase):
def test_an_existing_target_volume_is_refused(self):
self.refused(proxy(existing=True), "copy-vda.qcow2 already exists in storage pool default")
def test_the_pool_is_refreshed_before_its_names_and_free_space_are_read(self):
p = proxy()
p.live_clone_targets(FORM, 10, 5)
calls = [call[0] for call in p.pool.method_calls]
self.assertLess(calls.index("refresh"), calls.index("storageVolLookupByName"))
self.assertLess(calls.index("refresh"), calls.index("info"))
def test_a_shut_off_clone_into_an_existing_name_is_refused_before_it_begins(self):
p = proxy(existing=True)
with self.assertRaisesRegex(util.OperationError, "copy-vda.qcow2 already exists in storage pool default"):
p.check_clone_volumes(FORM)
proxy().check_clone_volumes(FORM) # a free name
def test_a_lookup_error_other_than_missing_is_raised(self):
p = proxy()
p.pool.storageVolLookupByName.side_effect = error(libvirt.VIR_ERR_INTERNAL_ERROR)