On Mon, Jul 25, 2022 at 15:51:28 +0200, Michal Prívozník wrote:
On 7/25/22 14:45, Peter Krempa wrote:
> Rewrite the code using a temporary variable.
>
> Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
> ---
> src/qemu/qemu_migration.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 20dc91f1ce..800f66349d 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -6601,9 +6601,14 @@ qemuMigrationDstFinishFresh(virQEMUDriver *driver,
> *inPostCopy = true;
>
> if (!(flags & VIR_MIGRATE_PAUSED)) {
> - if (qemuProcessStartCPUs(driver, vm,
> - *inPostCopy ? VIR_DOMAIN_RUNNING_POSTCOPY
> - : VIR_DOMAIN_RUNNING_MIGRATED,
> + virDomainRunningReason runningReason;
> +
> + if (inPostCopy)
This needs to dereference the variable, just like the original did.
Oops, indeed.
And what is your opinion on initializing the newly introduced variable
to _MIGRATED and then having this if() to overwrite it to _POSTCOPY?
virDomainRunningReason runningReason = VIR_DOMAIN_RUNNING_MIGRATED;
if (*inPostCopy)
runningReason = VIR_DOMAIN_RUNNING_POSTCOPY;
I actually had it like this at first, but decided to change it after
the same change in patch 2/5. I wanted to have both assignments close to
the usage place to make it obvious what the value is.
In this case the initialization assignment is close enough, though.