[libvirt] [PATCH v2 01/10] qemu: Make basic upfront checks before create command

Peter Krempa pkrempa at redhat.com
Thu Feb 18 07:06:12 UTC 2016


On Wed, Feb 17, 2016 at 21:25:34 -0500, John Ferlan wrote:
> Create qemuBuildCommandLineValidate to make some checks before trying
> to build the command. This will move some logic from much later to much
> earlier - we shouldn't be adjusting any data so that shouldn't matter.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/qemu/qemu_command.c | 174 ++++++++++++++++++++++++++++--------------------
>  1 file changed, 102 insertions(+), 72 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 7c1a457..f68509d 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -6608,6 +6608,98 @@ qemuBuildTPMCommandLine(virDomainDefPtr def,
>  }
>  
>  
> +/*
> + * qemuBuildCommandLineValidate:

These kinds of comments use two stars on the first line of the comment.

> + *
> + * Prior to taking the plunge and building a long command line only
> + * to find some configuration option isn't valid, let's do a couple
> + * of checks and fail early.
> + *
> + * Returns 0 on success, returns -1 and messages what the issue is.
> + */

[...]

> @@ -7814,11 +7845,17 @@ qemuBuildCommandLine(virConnectPtr conn,
>          virCommandAddArgBuffer(cmd, &opt);
>      }
>  
> +    if (def->nserials) {
> +        for (i = 0; i < def->ngraphics && !havespice; i++) {

Fair enough, but we usually use break from the next condition.

> +            if (def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
> +                havespice = true;
> +        }
> +    }

ACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160218/bdabe681/attachment-0001.sig>


More information about the libvir-list mailing list