mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu_driver.c: modernize qemuDomainMigratePrepare3Params()
Use variable autocleanup and remove the now obsolete 'cleanup' label. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
b2aefee3ef
commit
e200803f45
@ -12444,21 +12444,20 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
|
|||||||
{
|
{
|
||||||
virQEMUDriverPtr driver = dconn->privateData;
|
virQEMUDriverPtr driver = dconn->privateData;
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||||
virDomainDefPtr def = NULL;
|
g_autoptr(virDomainDef) def = NULL;
|
||||||
const char *dom_xml = NULL;
|
const char *dom_xml = NULL;
|
||||||
const char *dname = NULL;
|
const char *dname = NULL;
|
||||||
const char *uri_in = NULL;
|
const char *uri_in = NULL;
|
||||||
const char *listenAddress = cfg->migrationAddress;
|
const char *listenAddress = cfg->migrationAddress;
|
||||||
int nbdPort = 0;
|
int nbdPort = 0;
|
||||||
int nmigrate_disks;
|
int nmigrate_disks;
|
||||||
const char **migrate_disks = NULL;
|
g_autofree const char **migrate_disks = NULL;
|
||||||
g_autofree char *origname = NULL;
|
g_autofree char *origname = NULL;
|
||||||
qemuMigrationParamsPtr migParams = NULL;
|
g_autoptr(qemuMigrationParams) migParams = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virCheckFlagsGoto(QEMU_MIGRATION_FLAGS, cleanup);
|
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||||
if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS) < 0)
|
if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virTypedParamsGetString(params, nparams,
|
if (virTypedParamsGetString(params, nparams,
|
||||||
VIR_MIGRATE_PARAM_DEST_XML,
|
VIR_MIGRATE_PARAM_DEST_XML,
|
||||||
@ -12475,18 +12474,18 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
|
|||||||
virTypedParamsGetInt(params, nparams,
|
virTypedParamsGetInt(params, nparams,
|
||||||
VIR_MIGRATE_PARAM_DISKS_PORT,
|
VIR_MIGRATE_PARAM_DISKS_PORT,
|
||||||
&nbdPort) < 0)
|
&nbdPort) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
nmigrate_disks = virTypedParamsGetStringList(params, nparams,
|
nmigrate_disks = virTypedParamsGetStringList(params, nparams,
|
||||||
VIR_MIGRATE_PARAM_MIGRATE_DISKS,
|
VIR_MIGRATE_PARAM_MIGRATE_DISKS,
|
||||||
&migrate_disks);
|
&migrate_disks);
|
||||||
|
|
||||||
if (nmigrate_disks < 0)
|
if (nmigrate_disks < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
|
if (!(migParams = qemuMigrationParamsFromFlags(params, nparams, flags,
|
||||||
QEMU_MIGRATION_DESTINATION)))
|
QEMU_MIGRATION_DESTINATION)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_TUNNELLED) {
|
if (flags & VIR_MIGRATE_TUNNELLED) {
|
||||||
/* this is a logical error; we never should have gotten here with
|
/* this is a logical error; we never should have gotten here with
|
||||||
@ -12495,28 +12494,22 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Tunnelled migration requested but invalid "
|
_("Tunnelled migration requested but invalid "
|
||||||
"RPC method called"));
|
"RPC method called"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
|
if (!(def = qemuMigrationAnyPrepareDef(driver, NULL, dom_xml, dname, &origname)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
|
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = qemuMigrationDstPrepareDirect(driver, dconn,
|
return qemuMigrationDstPrepareDirect(driver, dconn,
|
||||||
cookiein, cookieinlen,
|
cookiein, cookieinlen,
|
||||||
cookieout, cookieoutlen,
|
cookieout, cookieoutlen,
|
||||||
uri_in, uri_out,
|
uri_in, uri_out,
|
||||||
&def, origname, listenAddress,
|
&def, origname, listenAddress,
|
||||||
nmigrate_disks, migrate_disks, nbdPort,
|
nmigrate_disks, migrate_disks, nbdPort,
|
||||||
migParams, flags);
|
migParams, flags);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
qemuMigrationParamsFree(migParams);
|
|
||||||
VIR_FREE(migrate_disks);
|
|
||||||
virDomainDefFree(def);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user