[libvirt] [PATCH 05/10] Handle arbitrary qemu command-lines in qemuParseCommandLine.

Eric Blake eblake at redhat.com
Wed Apr 21 17:31:48 UTC 2010


On 04/21/2010 10:01 AM, Chris Lalancette wrote:
> Now that we have the ability to specify arbitrary qemu
> command-line parameters in the XML, use it to handle unknown
> command-line parameters when doing a native-to-xml conversion.
> 
> +++ b/src/conf/domain_conf.c
> @@ -3719,6 +3719,14 @@ static char *virDomainDefDefaultEmulator(virDomainDefPtr def,
>      return retemu;
>  }
>  
> +void virDomainDefAssignNamespace(virCapsPtr caps, virDomainDefPtr def)
> +{
> +    def->ns.parse = caps->ns->parse;
> +    def->ns.free = caps->ns->free;
> +    def->ns.format = caps->ns->format;
> +    def->ns.href = caps->ns->href;

My comments for 03/10 still apply; can this be simplified?
def->ns = *caps->ns;

> @@ -6203,6 +6211,13 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
>      if (virDomainDefAddImplicitControllers(def) < 0)
>          goto error;
>  
> +    if (cmd->num_extra || cmd->num_env) {
> +        virDomainDefAssignNamespace(caps, def);
> +        def->namespaceData = cmd;
> +    }
> +    else
> +        VIR_FREE(cmd);

Per Jim's recent request to update the style guidelines, this should be
rewritten as either:

if (cond) {
    ...
} else {
    VIR_FREE(cmd);
}

or:

if (!(cond))
    VIR_FREE(cmd);
else {
    ...
}

ACK, once nits are resolved.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100421/588f26ac/attachment-0001.sig>


More information about the libvir-list mailing list