Re: [PATCH RESEND] qemuProcessStart: Switch to flags instead of bunch booleans

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

 



On Mon, Apr 16, 2012 at 04:55:41PM +0200, Michal Privoznik wrote:
> Currently, we have 3 boolean arguments we have to pass
> to qemuProcessStart(). As libvirt grows it is harder and harder
> to remember them and their position. Therefore we should
> switch to flags instead.
> ---
> This is just rebased version of:
>     http://www.redhat.com/archives/libvir-list/2012-March/msg00331.html
> 
>  src/qemu/qemu_driver.c    |   45 +++++++++++++++++++++++++++++----------------
>  src/qemu/qemu_migration.c |    7 ++++---
>  src/qemu/qemu_process.c   |   21 +++++++++++++--------
>  src/qemu/qemu_process.h   |   12 ++++++++----
>  4 files changed, 54 insertions(+), 31 deletions(-)

> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 692fc32..d18d721 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3633,7 +3638,7 @@ int qemuProcessStart(virConnectPtr conn,
>      VIR_DEBUG("Handshake complete, child running");
>  
>      if (migrateFrom)
> -        start_paused = true;
> +        flags |= VIR_QEMU_PROCESS_START_PAUSED;
>  
>      if (ret == -1) /* The VM failed to start; tear filters before taps */
>          virDomainConfVMNWFilterTeardown(vm);
> @@ -3708,7 +3713,7 @@ int qemuProcessStart(virConnectPtr conn,
>      }
>      qemuDomainObjExitMonitorWithDriver(driver, vm);
>  
> -    if (!start_paused) {
> +    if (flags & ~VIR_QEMU_PROCESS_START_PAUSED) {

Those are different semantics. What you have requires that at least
one flag is set that isn't  START_PAUSED, which is not the same as
requiring that START_PAUSED is not set. You want:

   if (!(flags & VIR_QEMU_PROCESS_START_PAUSED))

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]