mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
migrate: v2: use VIR_DOMAIN_XML_MIGRATABLE when available
In v2 migration protocol, XML is obtained by calling domainGetXMLDesc.
This includes the default USB controller in XML, which breaks migration
to older libvirt (before 0.9.2).
Commit 409b5f5495
qemu: Emit compatible XML when migrating a domain
only fixed this for v3 migration.
This patch uses the new VIR_DOMAIN_XML_MIGRATABLE flag (detected by
VIR_DRV_FEATURE_XML_MIGRATABLE) to obtain XML without the default controller,
enabling backward v2 migration.
This commit is contained in:
parent
508451e4ad
commit
b6ab7a067f
@ -4620,6 +4620,7 @@ virDomainMigrateVersion2 (virDomainPtr domain,
|
||||
int cookielen = 0, ret;
|
||||
virDomainInfo info;
|
||||
virErrorPtr orig_err = NULL;
|
||||
unsigned int getxml_flags = 0;
|
||||
int cancelled;
|
||||
VIR_DOMAIN_DEBUG(domain,
|
||||
"dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu",
|
||||
@ -4646,9 +4647,15 @@ virDomainMigrateVersion2 (virDomainPtr domain,
|
||||
virDispatchError(domain->conn);
|
||||
return NULL;
|
||||
}
|
||||
dom_xml = domain->conn->driver->domainGetXMLDesc(domain,
|
||||
VIR_DOMAIN_XML_SECURE |
|
||||
VIR_DOMAIN_XML_UPDATE_CPU);
|
||||
|
||||
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
|
||||
VIR_DRV_FEATURE_XML_MIGRATABLE)) {
|
||||
getxml_flags |= VIR_DOMAIN_XML_MIGRATABLE;
|
||||
} else {
|
||||
getxml_flags |= VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_UPDATE_CPU;
|
||||
}
|
||||
|
||||
dom_xml = domain->conn->driver->domainGetXMLDesc(domain, getxml_flags);
|
||||
if (!dom_xml)
|
||||
return NULL;
|
||||
|
||||
|
@ -95,6 +95,11 @@ enum {
|
||||
* messages).
|
||||
*/
|
||||
VIR_DRV_FEATURE_PROGRAM_KEEPALIVE = 10,
|
||||
|
||||
/*
|
||||
* Support for VIR_DOMAIN_XML_MIGRATABLE flag in domainGetXMLDesc
|
||||
*/
|
||||
VIR_DRV_FEATURE_XML_MIGRATABLE = 11,
|
||||
};
|
||||
|
||||
|
||||
|
@ -1130,6 +1130,7 @@ qemudSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
||||
case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION:
|
||||
case VIR_DRV_FEATURE_FD_PASSING:
|
||||
case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
|
||||
case VIR_DRV_FEATURE_XML_MIGRATABLE:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user