Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C363DDC4F for ; Sat, 5 Jan 2013 11:22:18 +0000 (UTC) Received: (qmail 86498 invoked by uid 500); 5 Jan 2013 11:22:18 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 86480 invoked by uid 500); 5 Jan 2013 11:22:18 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 86472 invoked by uid 99); 5 Jan 2013 11:22:18 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Jan 2013 11:22:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BF00682361D; Sat, 5 Jan 2013 11:22:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: widodh@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: kvm: During migrate change the VNC listen address Message-Id: <20130105112217.BF00682361D@tyr.zones.apache.org> Date: Sat, 5 Jan 2013 11:22:17 +0000 (UTC) Updated Branches: refs/heads/kvm-vnc-listen [created] 75b658d47 kvm: During migrate change the VNC listen address Commit 7240204a507cce8143c248e6aa635da6dad60ed0 re-added the functionality that the VNC on KVM hypervisors would listen on the private IP address of the hypervisor. This broke migrations since Qemu on the target hypervisor would try to bind to the IP address of the old hypervisor. The migrate method from libvirt supports passing down a different XML for running the instance of the target hypervisor. A modification in libvirt-java was required for this. Without this modification in libvirt-java this code won't compile. The assumption is that libvirt-java 0.50.0 will have the required fixes. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/75b658d4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/75b658d4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/75b658d4 Branch: refs/heads/kvm-vnc-listen Commit: 75b658d4793ac9956b23c07db1aeb4fd63821e73 Parents: f1c15f0 Author: Wido den Hollander Authored: Sat Jan 5 12:15:21 2013 +0100 Committer: Wido den Hollander Committed: Sat Jan 5 12:16:14 2013 +0100 ---------------------------------------------------------------------- .../kvm/resource/LibvirtComputingResource.java | 18 ++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/75b658d4/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java ---------------------------------------------------------------------- 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 b52e2d8..fd3e7f8 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 @@ -2412,18 +2412,34 @@ public class LibvirtComputingResource extends ServerResourceBase implements Connect dconn = null; Domain destDomain = null; Connect conn = null; + String xmlDesc = null; try { conn = LibvirtConnection.getConnection(); ifaces = getInterfaces(conn, vmName); dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName .getBytes())); + /* + We replace the private IP address with the address of the destination host. + This is because the VNC listens on the private IP address of the hypervisor, + but that address is ofcourse different on the target host. + + MigrateCommand.getDestinationIp() returns the private IP address of the target + hypervisor. So it's safe to use. + + The Domain.migrate method from libvirt supports passing a different XML + description for the instance to be used on the target host. + + This is supported by libvirt-java from version 0.50.0 + */ + xmlDesc = dm.getXMLDesc(0).replace(_privateIp, cmd.getDestinationIp()); + dconn = new Connect("qemu+tcp://" + cmd.getDestinationIp() + "/system"); /* * Hard code lm flags: VIR_MIGRATE_LIVE(1<<0) and * VIR_MIGRATE_PERSIST_DEST(1<<3) */ - destDomain = dm.migrate(dconn, (1 << 0) | (1 << 3), vmName, "tcp:" + destDomain = dm.migrate(dconn, (1 << 0) | (1 << 3), xmlDesc, vmName, "tcp:" + cmd.getDestinationIp(), _migrateSpeed); } catch (LibvirtException e) { s_logger.debug("Can't migrate domain: " + e.getMessage());