From c03712e86ac9f36d9cf8522807583969eef2ea70 Mon Sep 17 00:00:00 2001 From: Hiroaki Kawai Date: Mon, 29 Oct 2012 11:36:25 -0700 Subject: [PATCH] CLOUDSTACK-423 : During VM migration on KVM, VifDriver.unplug is not called. VifDriver.unplug must be called in MigrateCommand which hooks VM migration in source host, because plug will be called in PrepareForMigration in destination host. But that operation is missing in current LibvirtComputingResources. Signed-off-by: Edison Su --- .../hypervisor/kvm/resource/LibvirtComputingResource.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index fe2c83af8a9..be22c505fa6 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -2320,12 +2320,15 @@ public class LibvirtComputingResource extends ServerResourceBase implements _vms.put(vmName, State.Stopping); } + List ifaces = null; + Domain dm = null; Connect dconn = null; Domain destDomain = null; Connect conn = null; try { conn = LibvirtConnection.getConnection(); + ifaces = getInterfaces(conn, vmName); dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName .getBytes())); dconn = new Connect("qemu+tcp://" + cmd.getDestinationIp() @@ -2364,6 +2367,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements } } else { destroy_network_rules_for_vm(conn, vmName); + for (InterfaceDef iface : ifaces) { + _vifDriver.unplug(iface); + } cleanupVM(conn, vmName, getVnetId(VirtualMachineName.getVnet(vmName))); }