mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-15 00:55:17 +00:00
qemu_driver.c: modernize qemuDomainMigratePrepare3()
Use g_autoptr() on pointers and remove the unneeded 'cleanup' label. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
6c4a3e43e7
commit
b2aefee3ef
@ -12397,10 +12397,9 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
|
|||||||
const char *dom_xml)
|
const char *dom_xml)
|
||||||
{
|
{
|
||||||
virQEMUDriverPtr driver = dconn->privateData;
|
virQEMUDriverPtr driver = dconn->privateData;
|
||||||
virDomainDefPtr def = NULL;
|
g_autoptr(virDomainDef) def = NULL;
|
||||||
g_autofree char *origname = NULL;
|
g_autofree char *origname = NULL;
|
||||||
qemuMigrationParamsPtr migParams = NULL;
|
g_autoptr(qemuMigrationParams) migParams = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||||
|
|
||||||
@ -12411,30 +12410,25 @@ qemuDomainMigratePrepare3(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 (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
|
if (!(migParams = qemuMigrationParamsFromFlags(NULL, 0, flags,
|
||||||
QEMU_MIGRATION_DESTINATION)))
|
QEMU_MIGRATION_DESTINATION)))
|
||||||
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 (virDomainMigratePrepare3EnsureACL(dconn, def) < 0)
|
if (virDomainMigratePrepare3EnsureACL(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, NULL, 0, NULL, 0,
|
&def, origname, NULL, 0, NULL, 0,
|
||||||
migParams, flags);
|
migParams, flags);
|
||||||
|
|
||||||
cleanup:
|
|
||||||
qemuMigrationParamsFree(migParams);
|
|
||||||
virDomainDefFree(def);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user