[libvirt] [PATCH RFC 07/22] qemu_process: Use qemuProcess struct for a single process

Michal Privoznik mprivozn at redhat.com
Mon Nov 12 15:53:31 UTC 2018


On 11/11/2018 08:59 PM, Chris Venteicher wrote:
> In new process code, move from model where qemuProcess struct can be
> used to activate a series of Qemu processes to model where one
> qemuProcess struct is used for one and only one Qemu process.
> 
> The forceTCG parameter (use / don't use KVM) will be passed when the
> qemuProcess struct is initialized since the qemuProcess struct won't be
> reused.
> 
> Signed-off-by: Chris Venteicher <cventeic at redhat.com>
> ---
>  src/qemu/qemu_capabilities.c | 16 ++++++++++++----
>  src/qemu/qemu_process.c      | 11 +++++++----
>  src/qemu/qemu_process.h      |  6 ++++--
>  3 files changed, 23 insertions(+), 10 deletions(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 082874082b..a957c3bdbd 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -4220,14 +4220,16 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
>                     char **qmperr)
>  {
>      qemuProcessPtr proc = NULL;
> +    qemuProcessPtr proc_kvm = NULL;
>      int ret = -1;
>      int rc;
> +    bool forceTCG = false;
>  
>      if (!(proc = qemuProcessNew(qemuCaps->binary, libDir,
> -                                runUid, runGid, qmperr)))
> +                                runUid, runGid, qmperr, forceTCG)))
>          goto cleanup;
>  
> -    if ((rc = qemuProcessRun(proc, false)) != 0) {
> +    if ((rc = qemuProcessRun(proc)) != 0) {
>          if (rc == 1)
>              ret = 0;
>          goto cleanup;
> @@ -4238,13 +4240,17 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
>  
>      if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
>          qemuProcessStopQmp(proc);
> -        if ((rc = qemuProcessRun(proc, true)) != 0) {
> +
> +        forceTCG = true;
> +        proc_kvm = qemuProcessNew(qemuCaps->binary, libDir, runUid, runGid, NULL, forceTCG);

This is a very long line. There's this limit of 80 characters per line
(although it's a soft limit).

> +
> +        if ((rc = qemuProcessRun(proc_kvm)) != 0) {
>              if (rc == 1)
>                  ret = 0;
>              goto cleanup;
>          }
>  
> -        if (virQEMUCapsInitQMPMonitorTCG(qemuCaps, proc->mon) < 0)
> +        if (virQEMUCapsInitQMPMonitorTCG(qemuCaps, proc_kvm->mon) < 0)
>              goto cleanup;
>      }
>  

Michal




More information about the libvir-list mailing list