cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [50/50] [abbrv] git commit: updated refs/heads/kvm-vnc-listen to 3890860
Date Wed, 03 Apr 2013 10:33:58 GMT
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/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/38908605
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/38908605
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/38908605

Branch: refs/heads/kvm-vnc-listen
Commit: 3890860576a69117dfa9c2c7569b7ba5a8cadda2
Parents: 8bb28fd
Author: Wido den Hollander <wido@widodh.nl>
Authored: Mon Feb 4 12:29:41 2013 +0100
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Wed Apr 3 12:31:26 2013 +0200

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java     |   20 +++++++++++++-
 1 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38908605/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 526107f..e253cb5 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
@@ -2630,18 +2630,34 @@ ServerResource {
         Connect dconn = null;
         Domain destDomain = null;
         Connect conn = null;
+        String xmlDesc = null;
         try {
             conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
             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());
@@ -3168,7 +3184,7 @@ ServerResource {
         ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0);
         devices.addDevice(console);
 
-        GraphicDef grap = new GraphicDef("vnc", (short) 0, true, null, null,
+        GraphicDef grap = new GraphicDef("vnc", (short) 0, true, vmTO.getVncAddr(), null,
                 null);
         devices.addDevice(grap);
 


Mime
View raw message