mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
Clarify semantics of virDomainMigrate2
Explicitly disallow conflicts between domain name from dxml and dname.
This commit is contained in:
parent
24b8be890d
commit
5d784bd6d7
@ -4854,6 +4854,9 @@ error:
|
||||
* in accessing the underlying storage. The migration will fail
|
||||
* if @dxml would cause any guest-visible changes. Pass NULL
|
||||
* if no changes are needed to the XML between source and destination.
|
||||
* @dxml cannot be used to rename the domain during migration (use
|
||||
* @dname for that purpose). Domain name in @dxml must either match the
|
||||
* original domain name or @dname if it was specified.
|
||||
*
|
||||
* Returns the new domain object if the migration was successful,
|
||||
* or NULL in case of error. Note that the new domain object
|
||||
|
@ -8043,7 +8043,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
|
||||
char **cookieout,
|
||||
int *cookieoutlen,
|
||||
unsigned long flags,
|
||||
const char *dname ATTRIBUTE_UNUSED,
|
||||
const char *dname,
|
||||
unsigned long resource ATTRIBUTE_UNUSED)
|
||||
{
|
||||
struct qemud_driver *driver = domain->conn->privateData;
|
||||
@ -8083,7 +8083,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
|
||||
if (qemuDomainCheckEjectableMedia(driver, vm) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!(xml = qemuMigrationBegin(driver, vm, xmlin,
|
||||
if (!(xml = qemuMigrationBegin(driver, vm, xmlin, dname,
|
||||
cookieout, cookieoutlen)))
|
||||
goto endjob;
|
||||
|
||||
|
@ -993,6 +993,7 @@ qemuDomainMigrateGraphicsRelocate(struct qemud_driver *driver,
|
||||
char *qemuMigrationBegin(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *xmlin,
|
||||
const char *dname,
|
||||
char **cookieout,
|
||||
int *cookieoutlen)
|
||||
{
|
||||
@ -1001,8 +1002,10 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
|
||||
virDomainDefPtr def = NULL;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
VIR_DEBUG("driver=%p, vm=%p, xmlin=%s, cookieout=%p, cookieoutlen=%p",
|
||||
driver, vm, NULLSTR(xmlin), cookieout, cookieoutlen);
|
||||
VIR_DEBUG("driver=%p, vm=%p, xmlin=%s, dname=%s,"
|
||||
" cookieout=%p, cookieoutlen=%p",
|
||||
driver, vm, NULLSTR(xmlin), NULLSTR(dname),
|
||||
cookieout, cookieoutlen);
|
||||
|
||||
/* Only set the phase if we are inside QEMU_ASYNC_JOB_MIGRATION_OUT.
|
||||
* Otherwise we will start the async job later in the perform phase losing
|
||||
@ -1028,6 +1031,14 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
if (STRNEQ(def->name, vm->def->name) &&
|
||||
STRNEQ_NULLABLE(def->name, dname)) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("target domain name doesn't match source name"
|
||||
" nor destination name"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virDomainDefCheckABIStability(vm->def, def))
|
||||
goto cleanup;
|
||||
|
||||
@ -2012,7 +2023,7 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver,
|
||||
* bit here, because we are already running inside the context of
|
||||
* a single job. */
|
||||
|
||||
dom_xml = qemuMigrationBegin(driver, vm, xmlin,
|
||||
dom_xml = qemuMigrationBegin(driver, vm, xmlin, dname,
|
||||
&cookieout, &cookieoutlen);
|
||||
if (!dom_xml)
|
||||
goto cleanup;
|
||||
|
@ -79,6 +79,7 @@ int qemuMigrationSetOffline(struct qemud_driver *driver,
|
||||
char *qemuMigrationBegin(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *xmlin,
|
||||
const char *dname,
|
||||
char **cookieout,
|
||||
int *cookieoutlen);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user