mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Support live migration on older version of Libvirt
This commit is contained in:
parent
1bbd23e664
commit
c5a0d5e01c
@ -87,8 +87,12 @@ public final class LibvirtMigrateCommandWrapper extends CommandWrapper<MigrateCo
|
||||
CVE-2015-3252: Get XML with sensitive information suitable for migration by using
|
||||
VIR_DOMAIN_XML_MIGRATABLE flag (value = 8)
|
||||
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainXMLFlags
|
||||
|
||||
Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0.
|
||||
*/
|
||||
xmlDesc = dm.getXMLDesc(8).replace(libvirtComputingResource.getPrivateIp(), command.getDestinationIp());
|
||||
int xmlFlag = conn.getLibVirVersion() >= 1000000 ? 8 : 1; // 1000000 equals v1.0.0
|
||||
|
||||
xmlDesc = dm.getXMLDesc(xmlFlag).replace(libvirtComputingResource.getPrivateIp(), command.getDestinationIp());
|
||||
|
||||
dconn = libvirtUtilitiesHelper.retrieveQemuConnection("qemu+tcp://" + command.getDestinationIp() + "/system");
|
||||
|
||||
|
||||
@ -1246,6 +1246,7 @@ public class LibvirtComputingResourceTest {
|
||||
|
||||
when(libvirtComputingResource.getPrivateIp()).thenReturn("127.0.0.1");
|
||||
when(dm.getXMLDesc(8)).thenReturn("host_domain");
|
||||
when(dm.getXMLDesc(1)).thenReturn("host_domain");
|
||||
when(dm.isPersistent()).thenReturn(1);
|
||||
doNothing().when(dm).undefine();
|
||||
|
||||
@ -1273,10 +1274,20 @@ public class LibvirtComputingResourceTest {
|
||||
verify(libvirtComputingResource, times(1)).getDisks(conn, vmName);
|
||||
try {
|
||||
verify(conn, times(1)).domainLookupByName(vmName);
|
||||
verify(dm, times(1)).getXMLDesc(8);
|
||||
} catch (final LibvirtException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
verify(dm, times(1)).getXMLDesc(8);
|
||||
} catch (final Throwable t) {
|
||||
try {
|
||||
verify(dm, times(1)).getXMLDesc(1);
|
||||
}
|
||||
catch (final LibvirtException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user