[libvirt] [PATCH v3 6/7] virsh: add function to get the CPU models for an arch

Eric Blake eblake at redhat.com
Fri Sep 13 20:58:45 UTC 2013


On 09/11/2013 08:13 AM, Giuseppe Scrivano wrote:
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
>  tools/virsh-host.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tools/virsh.pod    |  5 +++++
>  2 files changed, 59 insertions(+)
> 
> +
> +static bool
> +cmdCPUModelNames(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
> +{
> +    char **models;
> +    size_t i;
> +    int nmodels;
> +    const char *arch = NULL;
> +
> +    if (vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0)

ATTRIBUTE_UNUSED is a lie - we just used it :)

> +        return false;
> +
> +    nmodels = virConnectGetCPUModelNames(ctl->conn, arch, &models, 0);

I tweaked this some during my testing of NULL models; but don't think we
need to make virsh expose NULL models to the command line, so I'm not
changing this.

ACK with this squashed in (oh, I just noticed my emacs'
copyright-checker kicked in for my edits; I wonder how many other files
you touched that could use an updated copyright):

diff --git i/tools/virsh-host.c w/tools/virsh-host.c
index 5d47428..30940ad 100644
--- i/tools/virsh-host.c
+++ w/tools/virsh-host.c
@@ -1,7 +1,7 @@
 /*
  * virsh-host.c: Commands in "Host and Hypervisor" group.
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2013 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -649,7 +649,7 @@ static const vshCmdOptDef opts_cpu_models[] = {
 };

 static bool
-cmdCPUModelNames(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
+cmdCPUModelNames(vshControl *ctl, const vshCmd *cmd)
 {
     char **models;
     size_t i;


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list