Re: [PATCH 1/5] qemuMigrationDstFinishFresh: Avoid multi-line ternary operator in function call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/25/22 14:45, Peter Krempa wrote:
> Rewrite the code using a temporary variable.
> 
> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> ---
>  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.

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;


Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux