mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 10:03:49 +03: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,
|
char *qemuDomainDefFormatXML(struct qemud_driver *driver,
|
||||||
virDomainObjPtr vm,
|
virDomainDefPtr def,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
virCPUDefPtr cpu = NULL;
|
virCPUDefPtr cpu = NULL;
|
||||||
virDomainDefPtr def;
|
|
||||||
virCPUDefPtr def_cpu;
|
virCPUDefPtr def_cpu;
|
||||||
|
|
||||||
if ((flags & VIR_DOMAIN_XML_INACTIVE) && vm->newDef)
|
|
||||||
def = vm->newDef;
|
|
||||||
else
|
|
||||||
def = vm->def;
|
|
||||||
def_cpu = def->cpu;
|
def_cpu = def->cpu;
|
||||||
|
|
||||||
/* Update guest CPU requirements according to host CPU */
|
/* Update guest CPU requirements according to host CPU */
|
||||||
@ -737,6 +732,21 @@ cleanup:
|
|||||||
return ret;
|
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,
|
void qemuDomainObjTaint(struct qemud_driver *driver,
|
||||||
virDomainObjPtr obj,
|
virDomainObjPtr obj,
|
||||||
enum virDomainTaintFlags taint,
|
enum virDomainTaintFlags taint,
|
||||||
|
@ -120,6 +120,10 @@ void qemuDomainObjEnterRemoteWithDriver(struct qemud_driver *driver,
|
|||||||
void qemuDomainObjExitRemoteWithDriver(struct qemud_driver *driver,
|
void qemuDomainObjExitRemoteWithDriver(struct qemud_driver *driver,
|
||||||
virDomainObjPtr obj);
|
virDomainObjPtr obj);
|
||||||
|
|
||||||
|
char *qemuDomainDefFormatXML(struct qemud_driver *driver,
|
||||||
|
virDomainDefPtr vm,
|
||||||
|
int flags);
|
||||||
|
|
||||||
char *qemuDomainFormatXML(struct qemud_driver *driver,
|
char *qemuDomainFormatXML(struct qemud_driver *driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
int flags);
|
int flags);
|
||||||
|
@ -914,15 +914,10 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
|
|||||||
{
|
{
|
||||||
char *rv = NULL;
|
char *rv = NULL;
|
||||||
qemuMigrationCookiePtr mig = NULL;
|
qemuMigrationCookiePtr mig = NULL;
|
||||||
|
virDomainDefPtr def = NULL;
|
||||||
VIR_DEBUG("driver=%p, vm=%p, xmlin=%s, cookieout=%p, cookieoutlen=%p",
|
VIR_DEBUG("driver=%p, vm=%p, xmlin=%s, cookieout=%p, cookieoutlen=%p",
|
||||||
driver, vm, NULLSTR(xmlin), cookieout, cookieoutlen);
|
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)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
@ -940,13 +935,27 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
|
|||||||
0) < 0)
|
0) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
rv = qemuDomainFormatXML(driver, vm,
|
if (xmlin) {
|
||||||
VIR_DOMAIN_XML_SECURE |
|
if (!(def = virDomainDefParseString(driver->caps, xmlin,
|
||||||
VIR_DOMAIN_XML_UPDATE_CPU);
|
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:
|
cleanup:
|
||||||
virDomainObjUnlock(vm);
|
virDomainObjUnlock(vm);
|
||||||
qemuMigrationCookieFree(mig);
|
qemuMigrationCookieFree(mig);
|
||||||
|
virDomainDefFree(def);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user