From 8745591457ac175df8793349f41c2e84f5022696 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Wed, 30 Nov 2022 15:47:15 +0100 Subject: [PATCH] qemu: Reorder qemuMigrationCookieParse arguments When an internal API takes a vm pointer, it's usually just after the driver argument. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_migration.c | 30 ++++++++++++++---------------- src/qemu/qemu_migration_cookie.c | 4 ++-- src/qemu/qemu_migration_cookie.h | 4 ++-- tests/qemumigrationcookiexmltest.c | 4 ++-- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 6d3810c79c..64c656ef2f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3316,7 +3316,7 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver, /* Parse cookie earlier than adding the domain onto the * domain list. Parsing/validation may fail and there's no * point in having the domain in the list at that point. */ - if (!(mig = qemuMigrationCookieParse(driver, *def, origname, NULL, + if (!(mig = qemuMigrationCookieParse(driver, NULL, *def, origname, NULL, cookiein, cookieinlen, QEMU_MIGRATION_COOKIE_LOCKSTATE | QEMU_MIGRATION_COOKIE_NBD | @@ -3324,8 +3324,7 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver, QEMU_MIGRATION_COOKIE_CPU_HOTPLUG | QEMU_MIGRATION_COOKIE_CPU | QEMU_MIGRATION_COOKIE_CAPS | - QEMU_MIGRATION_COOKIE_BLOCK_DIRTY_BITMAPS, - NULL))) + QEMU_MIGRATION_COOKIE_BLOCK_DIRTY_BITMAPS))) goto cleanup; if (!(vm = virDomainObjListAdd(driver->domains, def, @@ -3466,9 +3465,9 @@ qemuMigrationDstPrepareResume(virQEMUDriver *driver, goto cleanup; } - if (!(mig = qemuMigrationCookieParse(driver, def, origname, NULL, + if (!(mig = qemuMigrationCookieParse(driver, vm, def, origname, NULL, cookiein, cookieinlen, - QEMU_MIGRATION_COOKIE_CAPS, vm))) + QEMU_MIGRATION_COOKIE_CAPS))) goto cleanup; priv->origname = g_strdup(origname); @@ -3936,9 +3935,9 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver, if (qemuMigrationJobStartPhase(vm, phase) < 0) return -1; - if (!(mig = qemuMigrationCookieParse(driver, vm->def, priv->origname, priv, + if (!(mig = qemuMigrationCookieParse(driver, vm, vm->def, priv->origname, priv, cookiein, cookieinlen, - QEMU_MIGRATION_COOKIE_STATS, vm))) + QEMU_MIGRATION_COOKIE_STATS))) return -1; if (retcode == 0) @@ -4769,13 +4768,12 @@ qemuMigrationSrcRun(virQEMUDriver *driver, } } - mig = qemuMigrationCookieParse(driver, vm->def, priv->origname, priv, + mig = qemuMigrationCookieParse(driver, vm, vm->def, priv->origname, priv, cookiein, cookieinlen, cookieFlags | QEMU_MIGRATION_COOKIE_GRAPHICS | QEMU_MIGRATION_COOKIE_CAPS | - QEMU_MIGRATION_COOKIE_BLOCK_DIRTY_BITMAPS, - vm); + QEMU_MIGRATION_COOKIE_BLOCK_DIRTY_BITMAPS); if (!mig) goto error; @@ -5060,9 +5058,9 @@ qemuMigrationSrcResume(virDomainObj *vm, VIR_DEBUG("vm=%p", vm); - mig = qemuMigrationCookieParse(driver, vm->def, priv->origname, priv, + mig = qemuMigrationCookieParse(driver, vm, vm->def, priv->origname, priv, cookiein, cookieinlen, - QEMU_MIGRATION_COOKIE_CAPS, vm); + QEMU_MIGRATION_COOKIE_CAPS); if (!mig) return -1; @@ -6458,8 +6456,8 @@ qemuMigrationDstFinishOffline(virQEMUDriver *driver, qemuDomainObjPrivate *priv = vm->privateData; g_autoptr(qemuMigrationCookie) mig = NULL; - if (!(mig = qemuMigrationCookieParse(driver, vm->def, priv->origname, priv, - cookiein, cookieinlen, cookie_flags, vm))) + if (!(mig = qemuMigrationCookieParse(driver, vm, vm->def, priv->origname, priv, + cookiein, cookieinlen, cookie_flags))) return NULL; if (qemuMigrationDstPersist(driver, vm, mig, false) < 0) @@ -6654,8 +6652,8 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver, VIR_DEBUG("vm=%p, flags=0x%lx, retcode=%d", vm, flags, retcode); - if (!(mig = qemuMigrationCookieParse(driver, vm->def, priv->origname, priv, - cookiein, cookieinlen, cookie_flags, vm))) + if (!(mig = qemuMigrationCookieParse(driver, vm, vm->def, priv->origname, priv, + cookiein, cookieinlen, cookie_flags))) goto error; if (retcode != 0) { diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index 4d070e438d..da12f58bda 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -1490,13 +1490,13 @@ qemuMigrationCookieFormat(qemuMigrationCookie *mig, qemuMigrationCookie * qemuMigrationCookieParse(virQEMUDriver *driver, + virDomainObj *vm, const virDomainDef *def, const char *origname, qemuDomainObjPrivate *priv, const char *cookiein, int cookieinlen, - unsigned int flags, - virDomainObj *vm) + unsigned int flags) { g_autoptr(qemuMigrationCookie) mig = NULL; diff --git a/src/qemu/qemu_migration_cookie.h b/src/qemu/qemu_migration_cookie.h index 07776aaa8b..f9927175fa 100644 --- a/src/qemu/qemu_migration_cookie.h +++ b/src/qemu/qemu_migration_cookie.h @@ -189,13 +189,13 @@ qemuMigrationCookieFormat(qemuMigrationCookie *mig, qemuMigrationCookie * qemuMigrationCookieParse(virQEMUDriver *driver, + virDomainObj *vm, const virDomainDef *def, const char *origname, qemuDomainObjPrivate *priv, const char *cookiein, int cookieinlen, - unsigned int flags, - virDomainObj *vm); + unsigned int flags); void qemuMigrationCookieFree(qemuMigrationCookie *mig); diff --git a/tests/qemumigrationcookiexmltest.c b/tests/qemumigrationcookiexmltest.c index 6f650213e2..bb19baad54 100644 --- a/tests/qemumigrationcookiexmltest.c +++ b/tests/qemumigrationcookiexmltest.c @@ -141,13 +141,13 @@ testQemuMigrationCookieParse(const void *opaque) g_auto(virBuffer) actual = VIR_BUFFER_INITIALIZER; if (!(data->cookie = qemuMigrationCookieParse(&driver, + data->vm, data->vm->def, NULL, priv, data->xmlstr, data->xmlstrlen, - data->cookieParseFlags, - data->vm))) { + data->cookieParseFlags))) { VIR_TEST_DEBUG("\nfailed to parse qemu migration cookie:\n%s\n", data->xmlstr); return -1; }