[libvirt] [PATCH v4 3/4] vcpupin: implement the remote protocol to address the new API

Hu Tao hutao at cn.fujitsu.com
Thu Jun 9 08:37:50 UTC 2011


On Thu, Jun 09, 2011 at 12:39:47PM +0900, Taku Izumi wrote:
> 
> This patch implements the remote protocol to address the new API
> (virDomainPinVcpuFlags).
> 
> Signd-off-by: Taku Izumi <izumi.taku at jp.fujitsu.com>
> ---
>  daemon/remote.c              |   42
> ++++++++++++++++++++++++++++++++++++++++++
>  src/remote/remote_driver.c   |    1 +
>  src/remote/remote_protocol.x |   10 +++++++++-
>  src/remote_protocol-structs  |    9 +++++++++
>  4 files changed, 61 insertions(+), 1 deletion(-)
> 
> Index: libvirt/src/remote/remote_protocol.x
> ===================================================================
> --- libvirt.orig/src/remote/remote_protocol.x
> +++ libvirt/src/remote/remote_protocol.x
> @@ -837,6 +837,13 @@ struct remote_domain_pin_vcpu_args {
>      opaque cpumap<REMOTE_CPUMAP_MAX>;
>  };
>  
> +struct remote_domain_pin_vcpu_flags_args {
> +    remote_nonnull_domain dom;
> +    int vcpu;
> +    opaque cpumap<REMOTE_CPUMAP_MAX>;
> +    unsigned int flags;
> +};
> +
>  struct remote_domain_get_vcpus_args {
>      remote_nonnull_domain dom;
>      int maxinfo;
> @@ -2297,7 +2304,8 @@ enum remote_procedure {
>      REMOTE_PROC_INTERFACE_CHANGE_COMMIT = 221, /* autogen autogen */
>      REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK = 222, /* autogen autogen */
>      REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS = 223, /* skipgen
> autogen */
> -    REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR = 224 /* skipgen skipgen */
> +    REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR = 224, /* skipgen skipgen */
> +    REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS = 225 /* skipgen autogen */
>  
>      /*
>       * Notice how the entries are grouped in sets of 10 ?
> Index: libvirt/src/remote_protocol-structs
> ===================================================================
> --- libvirt.orig/src/remote_protocol-structs
> +++ libvirt/src/remote_protocol-structs
> @@ -529,6 +529,15 @@ struct remote_domain_pin_vcpu_args {
>                  char *             cpumap_val;
>          } cpumap;
>  };
> +struct remote_domain_pin_vcpu_flags_args {
> +        remote_nonnull_domain      dom;
> +        int                        vcpu;
> +        struct {
> +                u_int              cpumap_len;
> +                char *             cpumap_val;
> +        } cpumap;
> +        u_int                      flags;
> +};
>  struct remote_domain_get_vcpus_args {
>          remote_nonnull_domain      dom;
>          int                        maxinfo;
> Index: libvirt/src/remote/remote_driver.c
> ===================================================================
> --- libvirt.orig/src/remote/remote_driver.c
> +++ libvirt/src/remote/remote_driver.c
> @@ -6259,6 +6259,7 @@ static virDriver remote_driver = {
>      .domainSetVcpusFlags = remoteDomainSetVcpusFlags, /* 0.8.5 */
>      .domainGetVcpusFlags = remoteDomainGetVcpusFlags, /* 0.8.5 */
>      .domainPinVcpu = remoteDomainPinVcpu, /* 0.3.0 */
> +    .domainPinVcpuFlags = remoteDomainPinVcpuFlags, /* 0.9.2 */
>      .domainGetVcpus = remoteDomainGetVcpus, /* 0.3.0 */
>      .domainGetMaxVcpus = remoteDomainGetMaxVcpus, /* 0.3.0 */
>      .domainGetSecurityLabel = remoteDomainGetSecurityLabel, /* 0.6.1 */
> Index: libvirt/daemon/remote.c
> ===================================================================
> --- libvirt.orig/daemon/remote.c
> +++ libvirt/daemon/remote.c
> @@ -1277,6 +1277,48 @@ cleanup:
>  }
>  
>  static int
> +remoteDispatchDomainPinVcpuFlags(struct qemud_server *server
> ATTRIBUTE_UNUSED,

There are many lines auto-wrapped by your mail client,

> +                                 struct qemud_client *client
> ATTRIBUTE_UNUSED,

here,

> +                                 virConnectPtr conn,
> +                                 remote_message_header *hdr
> ATTRIBUTE_UNUSED,

here,

> +                                 remote_error *rerr,
> +                                 remote_domain_pin_vcpu_flags_args *args,
> +                                 void *ret ATTRIBUTE_UNUSED)
> +{
> +    virDomainPtr dom = NULL;
> +    int rv = -1;
> +
> +    if (!conn) {
> +        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
> open"));

here,

> +        goto cleanup;
> +    }
> +
> +    if (!(dom = get_nonnull_domain(conn, args->dom)))
> +        goto cleanup;
> +
> +    if (args->cpumap.cpumap_len > REMOTE_CPUMAP_MAX) {
> +        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("cpumap_len >
> REMOTE_CPUMAP_MAX"));

and here.

> +        goto cleanup;
> +    }
> +
> +    if (virDomainPinVcpuFlags(dom,
> +                              args->vcpu,
> +                              (unsigned char *) args->cpumap.cpumap_val,
> +                              args->cpumap.cpumap_len,
> +                              args->flags) < 0)
> +        goto cleanup;
> +
> +    rv = 0;
> +
> +cleanup:
> +    if (rv < 0)
> +        remoteDispatchError(rerr);
> +    if (dom)
> +        virDomainFree(dom);
> +    return rv;
> +}
> +
> +static int
>  remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
>                                          ATTRIBUTE_UNUSED,
>                                          struct qemud_client *client
> 
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list