[libvirt] [PATCH 1/3] qemu: XMLToNative: Don't show -S

Laine Stump laine at laine.org
Thu Mar 13 21:11:04 UTC 2014


On 03/13/2014 01:13 PM, Cole Robinson wrote:
> -S causes qemu to start in the paused state. Since XML2Native is intended
> to generate something that users can run directly, this will trip them up.
> ---
>  src/qemu/qemu_command.c  | 8 ++++++--
>  src/qemu/qemu_command.h  | 3 ++-
>  src/qemu/qemu_driver.c   | 6 ++++--
>  src/qemu/qemu_process.c  | 2 +-
>  tests/qemuxml2argvtest.c | 2 +-
>  tests/qemuxmlnstest.c    | 2 +-
>  6 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index aa1a3db..755a72a 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7711,7 +7711,8 @@ qemuBuildCommandLine(virConnectPtr conn,
>                       int migrateFd,
>                       virDomainSnapshotObjPtr snapshot,
>                       enum virNetDevVPortProfileOp vmop,
> -                     qemuBuildCommandLineCallbacksPtr callbacks)
> +                     qemuBuildCommandLineCallbacksPtr callbacks,
> +                     bool forXMLToArgv)
>  {
>      virErrorPtr originalError = NULL;
>      size_t i, j;
> @@ -7820,7 +7821,10 @@ qemuBuildCommandLine(virConnectPtr conn,
>              virCommandAddArg(cmd, def->name);
>          }
>      }
> -    virCommandAddArg(cmd, "-S"); /* freeze CPU */
> +
> +    if (!forXMLToArgv)
> +        virCommandAddArg(cmd, "-S"); /* freeze CPU */
> +
>      if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_FIPS))
>          virCommandAddArg(cmd, "-enable-fips");
>  
> diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
> index ebb0b1d..50dc4a0 100644
> --- a/src/qemu/qemu_command.h
> +++ b/src/qemu/qemu_command.h
> @@ -76,7 +76,8 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
>                                     int migrateFd,
>                                     virDomainSnapshotObjPtr current_snapshot,
>                                     enum virNetDevVPortProfileOp vmop,

(I would dearly love to get rid of this ugly vmop thing everywhere it
lives. Such blatant overstepping of bounds! But that's irrelevant to
your patch, so ignore my rant...)

> -                                   qemuBuildCommandLineCallbacksPtr callbacks)
> +                                   qemuBuildCommandLineCallbacksPtr callbacks,
> +                                   bool forXMLToArgv)

Maybe call this "startPaused" or something like that to indicate what it
does rather than who uses it (I first said to myself "startStopped", but
that didn't really work well :-)

Or if you wanted to make it more complicated, you could have an
"extraArgs" arg instead; but I guess we shouldn't bother with anything
like that until/unless we have more than one arg that we need to be
optional.

So, pending a rename to something that indicates what it does rather
than what it will be used for, ACK.


>      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(11);
>  
>  /* Generate '-device' string for chardev device */
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index ba470a1..a01739c 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -5956,8 +5956,10 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
>  
>      if (!(cmd = qemuBuildCommandLine(conn, driver, def,
>                                       &monConfig, monitor_json, qemuCaps,
> -                                     NULL, -1, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
> -                                     &buildCommandLineCallbacks)))
> +                                     NULL, -1, NULL,
> +                                     VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
> +                                     &buildCommandLineCallbacks,
> +                                     true)))
>          goto cleanup;
>  
>      ret = virCommandToString(cmd);
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 809ab37..35ad62a 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3856,7 +3856,7 @@ int qemuProcessStart(virConnectPtr conn,
>      if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
>                                       priv->monJSON, priv->qemuCaps,
>                                       migrateFrom, stdin_fd, snapshot, vmop,
> -                                     &buildCommandLineCallbacks)))
> +                                     &buildCommandLineCallbacks, false)))
>          goto cleanup;
>  
>      /* now that we know it is about to start call the hook if present */
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 5d6a64b..8d7d9e5 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -357,7 +357,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
>                                       (flags & FLAG_JSON), extraFlags,
>                                       migrateFrom, migrateFd, NULL,
>                                       VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
> -                                     &testCallbacks))) {
> +                                     &testCallbacks, false))) {
>          if (!virtTestOOMActive() &&
>              (flags & FLAG_EXPECT_FAILURE)) {
>              ret = 0;
> diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
> index 20a5ccd..81d496e 100644
> --- a/tests/qemuxmlnstest.c
> +++ b/tests/qemuxmlnstest.c
> @@ -119,7 +119,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
>                                       vmdef, &monitor_chr, json, extraFlags,
>                                       migrateFrom, migrateFd, NULL,
>                                       VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
> -                                     &testCallbacks)))
> +                                     &testCallbacks, false)))
>          goto fail;
>  
>      if (!virtTestOOMActive()) {




More information about the libvir-list mailing list