mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 03:36:48 +00:00
fix(migrate): a copied disk's source file is deleted only when no compute may use it
The source host alone was asked: a file on storage the computes share, used by a VM or volume of another compute, was deleted under it. The check the disk move makes, every compute and a host that cannot tell counting as using it, moves to instances.utils and serves both. The destination is not asked when its copy has the source's path: its VM uses that copy, another file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
c2c255a866
commit
826eaac813
6 changed files with 66 additions and 54 deletions
|
|
@ -129,7 +129,8 @@ class wvmInstances(wvmConnect):
|
|||
destination's own hostname. pools: {target: pool here} of the disks
|
||||
libvirt copies into those pools during the migration (disk_copies);
|
||||
the other disks must be on storage both hosts share. Returns the mode
|
||||
and options used, for the log, and the paths of the copied disks."""
|
||||
and options used, for the log, and each copied disk's path and the
|
||||
path of its copy here."""
|
||||
state = conn.get_status()
|
||||
if state == 5:
|
||||
mode = ["offline"]
|
||||
|
|
@ -203,7 +204,7 @@ class wvmInstances(wvmConnect):
|
|||
self.move_definition(dom, conn)
|
||||
else:
|
||||
dom.migrate(self.wvm, flags, None, uri, 0)
|
||||
return ", ".join(mode), [copy["path"] for copy in copies]
|
||||
return ", ".join(mode), [(copy["path"], copy["dest"]) for copy in copies]
|
||||
|
||||
def migrate_running(self, conn, state, flags, uri, copies):
|
||||
"""Migrates the VM of conn as a running VM, which carries its TPM
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class DiskCopyTestCase(unittest.TestCase):
|
|||
dest = destination(Pool("default", IMAGES), Pool("fast", FAST))
|
||||
mode, copied = migrate(dest, source, {"vda": "fast", "vdb": "default"})
|
||||
self.assertEqual(mode, "live, disks copied: vda to fast, vdb to default")
|
||||
self.assertEqual(copied, [f"{IMAGES}/vm.qcow2", f"{IMAGES}/data.raw"])
|
||||
self.assertEqual(copied, [(f"{IMAGES}/vm.qcow2", f"{FAST}/vm.qcow2"), (f"{IMAGES}/data.raw", f"{IMAGES}/data.raw")])
|
||||
params, flags = source.instance.migrate3.call_args.args[1:]
|
||||
self.assertEqual(params[libvirt.VIR_MIGRATE_PARAM_MIGRATE_DISKS], ["vda", "vdb"])
|
||||
self.assertEqual(params[libvirt.VIR_MIGRATE_PARAM_URI], "tcp://192.0.2.9")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue