diff --git a/docs/en-US/hypervisor-host-install-libvirt.xml b/docs/en-US/hypervisor-host-install-libvirt.xml index c4be67e643f..d3d6b9b4e80 100644 --- a/docs/en-US/hypervisor-host-install-libvirt.xml +++ b/docs/en-US/hypervisor-host-install-libvirt.xml @@ -46,11 +46,6 @@ so it looks like: libvirtd_opts="-d -l" - - In order to have the VNC Console work we have to make sure it will bind on 0.0.0.0. We do this by editing /etc/libvirt/qemu.conf - Make sure this parameter is set: - vnc_listen = "0.0.0.0" - Restart libvirt In RHEL or CentOS: 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 94ee9ae676e..203587a06f6 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 @@ -2878,17 +2878,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.domainLookupByName(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()); @@ -3441,7 +3458,7 @@ ServerResource { //add the VNC port passwd here, get the passwd from the vmInstance. String passwd = vmTO.getVncPassword(); - GraphicDef grap = new GraphicDef("vnc", (short) 0, true, null, passwd, + GraphicDef grap = new GraphicDef("vnc", (short) 0, true, vmTO.getVncAddr(), passwd, null); devices.addDevice(grap); diff --git a/pom.xml b/pom.xml index 4013fa63acb..6d9a30f101b 100644 --- a/pom.xml +++ b/pom.xml @@ -81,11 +81,11 @@ 0.9.8 0.10 build/replace.properties - 0.4.9 + 0.5.0 0.1.3 target 1.0.10 - 3.0.9 + 4.0.0