mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 06:25:19 +00:00
Allow custom XML to be passed in during migration
Update the qemuDomainMigrateBegin method so that it accepts an optional incoming XML document. This will be validated for ABI compatibility against the current domain config, and if this check passes, will be passed back out for use by the qemuDomainMigratePrepare method on the target * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h, src/qemu/qemu_migration.c: Allow custom XML to be passed
This commit is contained in:
parent
ec5301cb85
commit
44924615ce
@ -700,19 +700,14 @@ void qemuDomainObjExitRemoteWithDriver(struct qemud_driver *driver,
|
||||
}
|
||||
|
||||
|
||||
char *qemuDomainFormatXML(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
int flags)
|
||||
char *qemuDomainDefFormatXML(struct qemud_driver *driver,
|
||||
virDomainDefPtr def,
|
||||
int flags)
|
||||
{
|
||||
char *ret = NULL;
|
||||
virCPUDefPtr cpu = NULL;
|
||||
virDomainDefPtr def;
|
||||
virCPUDefPtr def_cpu;
|
||||
|
||||
if ((flags & VIR_DOMAIN_XML_INACTIVE) && vm->newDef)
|
||||
def = vm->newDef;
|
||||
else
|
||||
def = vm->def;
|
||||
def_cpu = def->cpu;
|
||||
|
||||
/* Update guest CPU requirements according to host CPU */
|
||||
@ -737,6 +732,21 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *qemuDomainFormatXML(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
int flags)
|
||||
{
|
||||
virDomainDefPtr def;
|
||||
|
||||
if ((flags & VIR_DOMAIN_XML_INACTIVE) && vm->newDef)
|
||||
def = vm->newDef;
|
||||
else
|
||||
def = vm->def;
|
||||
|
||||
return qemuDomainDefFormatXML(driver, def, flags);
|
||||
}
|
||||
|
||||
|
||||
void qemuDomainObjTaint(struct qemud_driver *driver,
|
||||
virDomainObjPtr obj,
|
||||
enum virDomainTaintFlags taint,
|
||||
|
@ -120,6 +120,10 @@ void qemuDomainObjEnterRemoteWithDriver(struct qemud_driver *driver,
|
||||
void qemuDomainObjExitRemoteWithDriver(struct qemud_driver *driver,
|
||||
virDomainObjPtr obj);
|
||||
|
||||
char *qemuDomainDefFormatXML(struct qemud_driver *driver,
|
||||
virDomainDefPtr vm,
|
||||
int flags);
|
||||
|
||||
char *qemuDomainFormatXML(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
int flags);
|
||||
|
@ -914,15 +914,10 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
|
||||
{
|
||||
char *rv = NULL;
|
||||
qemuMigrationCookiePtr mig = NULL;
|
||||
virDomainDefPtr def = NULL;
|
||||
VIR_DEBUG("driver=%p, vm=%p, xmlin=%s, cookieout=%p, cookieoutlen=%p",
|
||||
driver, vm, NULLSTR(xmlin), cookieout, cookieoutlen);
|
||||
|
||||
if (xmlin) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Passing XML for the target VM is not yet supported"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
@ -940,13 +935,27 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
|
||||
0) < 0)
|
||||
goto cleanup;
|
||||
|
||||
rv = qemuDomainFormatXML(driver, vm,
|
||||
VIR_DOMAIN_XML_SECURE |
|
||||
VIR_DOMAIN_XML_UPDATE_CPU);
|
||||
if (xmlin) {
|
||||
if (!(def = virDomainDefParseString(driver->caps, xmlin,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (!virDomainDefCheckABIStability(def, vm->def))
|
||||
goto cleanup;
|
||||
|
||||
rv = qemuDomainDefFormatXML(driver, def,
|
||||
VIR_DOMAIN_XML_SECURE |
|
||||
VIR_DOMAIN_XML_UPDATE_CPU);
|
||||
} else {
|
||||
rv = qemuDomainFormatXML(driver, vm,
|
||||
VIR_DOMAIN_XML_SECURE |
|
||||
VIR_DOMAIN_XML_UPDATE_CPU);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
virDomainObjUnlock(vm);
|
||||
qemuMigrationCookieFree(mig);
|
||||
virDomainDefFree(def);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user