mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(computes): a VM migrates to its host's panel address when it has no migration address
Without a migration address libvirt sends a migrating VM to the
destination's own host name, which the source host often cannot resolve:
a live migration to a host added without one failed ("Unable to resolve
address ..."), also when the other host had one. The destination's
address on the Computes page, which the panel reaches it at, is now the
default; the migration address stays for another network. A host the
panel reaches on its loopback keeps libvirt's default.
This commit is contained in:
parent
940e639149
commit
cf991adad5
8 changed files with 74 additions and 23 deletions
|
|
@ -169,6 +169,26 @@ class MigrateJobTestCase(TransactionTestCase):
|
|||
get_kind(op.kind).run(op, ctx)
|
||||
self.assertIn("Unable to resolve address 'kvm2.example.com'", public_error_text(raised.exception))
|
||||
|
||||
def test_each_way_goes_to_the_destination_s_migration_address_or_its_panel_address(self):
|
||||
# one host with a migration address, the other without: no name resolution either way
|
||||
self.dest.migration_address = ""
|
||||
self.dest.save()
|
||||
self.source.migration_address = "198.51.100.50"
|
||||
self.source.save()
|
||||
for target, uri, key in ((self.dest, "tcp://192.0.2.51", "key-mig00011"), (self.source, "tcp://198.51.100.50", "key-mig00012")):
|
||||
with self.subTest(target=target.name):
|
||||
self.vm.compute = self.source if target == self.dest else self.dest
|
||||
self.vm.save()
|
||||
self.client.post(reverse("instances:migrate", args=[self.vm.pk]),
|
||||
{"compute_id": target.pk, "submission_key": key, "live_migrate": "true"})
|
||||
op = Operation.objects.latest("created_at")
|
||||
ctx = self.start(op)
|
||||
get_kind(op.kind).precheck(op, ctx)
|
||||
get_kind(op.kind).run(op, ctx)
|
||||
self.assertEqual(self.dest_conn.moveto.call_args.kwargs["uri"], uri)
|
||||
Operation.objects.all().delete()
|
||||
Claim.objects.all().delete()
|
||||
|
||||
def test_cancel_and_progress_ask_the_source_vm(self):
|
||||
op = self.queue(live_migrate="true")
|
||||
with patch("instances.jobs.wvmInstance") as proxy:
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ def record_migration(instance, new_compute):
|
|||
|
||||
def migration_target(compute):
|
||||
"""The destination for the log: its host name, and the migration address
|
||||
when one is set and differs."""
|
||||
when one is set and differs (else the migration goes to the host name)."""
|
||||
if compute.migration_address not in ("", compute.hostname):
|
||||
return _("%(hostname)s via %(address)s") % {"hostname": compute.hostname, "address": compute.migration_address}
|
||||
return compute.hostname
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue