incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject git commit: kvm: During migrate change the VNC listen address
Date Sat, 05 Jan 2013 11:22:17 GMT
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 <wido@widodh.nl>
Authored: Sat Jan 5 12:15:21 2013 +0100
Committer: Wido den Hollander <wido@widodh.nl>
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());


Mime
View raw message