1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 04:06:47 +00:00

feat(computes): a compute names the address migrations reach it on

Migration is client-driven: libvirt sends the VM's memory to the
destination's own host name unless a migration URI is given, and the
app never gave one. Where the hosts cannot resolve each other's names
(or the names point at a management network) every migration failed
with "Unable to resolve address '<host name>' service '49152'".

A compute now has an optional migration address (an IP address or a
host name, no scheme or port), editable in the compute form and the
API. A VM migrating to that compute is sent to tcp://<address>
(bracketed for IPv6). Empty, the default for existing computes, keeps
the previous behavior. The compute's host name is not reused, because
for SSH computes it can be an ssh_config alias.

The migration log entry names the address when one is set.
This commit is contained in:
catborise 2026-10-06 12:08:04 +03:00
parent 25b3671c33
commit 5a523befbd
10 changed files with 158 additions and 3 deletions

View file

@ -117,7 +117,10 @@ class wvmInstances(wvmConnect):
autoconverge=False,
compress=False,
postcopy=False,
uri=None,
):
"""uri: the native migration URI (tcp://address) on the destination;
None lets libvirt use the destination's own hostname."""
# The source definition always goes: one left behind points at the
# same (shared) disks as the migrated VM and could be started again.
flags = VIR_MIGRATE_PERSIST_DEST | VIR_MIGRATE_UNDEFINE_SOURCE
@ -144,7 +147,7 @@ class wvmInstances(wvmConnect):
"Destination host emulator is different. Cannot be migrated"
)
dom.migrate(self.wvm, flags, None, None, 0)
dom.migrate(self.wvm, flags, None, uri, 0)
def graphics_type(self, name):
inst = self.get_instance(name)

View file

@ -50,3 +50,11 @@ class MigrationFlagsTestCase(unittest.TestCase):
flags = source.instance.calls[0][0]
self.assertTrue(flags & libvirt.VIR_MIGRATE_UNDEFINE_SOURCE)
self.assertTrue(flags & libvirt.VIR_MIGRATE_PERSIST_DEST)
def test_the_migration_uri_is_passed_on(self):
source = FakeSource(1)
destination().moveto(source, "vm", live=True, unsafe=False, offline=False, uri="tcp://192.0.2.12")
self.assertEqual(source.instance.calls[0][1], "tcp://192.0.2.12")
source = FakeSource(1)
destination().moveto(source, "vm", live=True, unsafe=False, offline=False)
self.assertIsNone(source.instance.calls[0][1])