[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



On Mon, Jun 13, 2011 at 11:16:41AM +0900, Taku Izumi wrote:
> 
> I updated according to Hu Tao's comment. Thanks.
> 
> ---
> This patch implements the remote protocol to address the new API
> (virDomainPinVcpuFlags).
> 
> Signd-off-by: Taku Izumi <izumi taku jp fujitsu com>
> ---
>  daemon/remote.c              |   42 ++++++++++++++++++++++++++++++++++++++++++
>  daemon/remote_generator.pl   |    3 +++
>  src/remote/remote_driver.c   |    1 +
>  src/remote/remote_protocol.x |   10 +++++++++-
>  src/remote_protocol-structs  |    9 +++++++++
>  5 files changed, 64 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;
> +    unsigned 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;
> +        u_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.3 */
>      .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,
> +                                 struct qemud_client *client ATTRIBUTE_UNUSED,
> +                                 virConnectPtr conn,
> +                                 remote_message_header *hdr ATTRIBUTE_UNUSED,
> +                                 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"));
> +        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"));
> +        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
> Index: libvirt/daemon/remote_generator.pl
> ===================================================================
> --- libvirt.orig/daemon/remote_generator.pl
> +++ libvirt/daemon/remote_generator.pl
> @@ -977,6 +977,9 @@ elsif ($opt_k) {
>                      } elsif ($call->{ProcName} eq "DomainPinVcpu") {
>                          push(@args_list, "unsigned char *$arg_name");
>                          push(@args_list, "int ${arg_name}len");
> +                    } elsif ($call->{ProcName} eq "DomainPinVcpuFlags") {
> +                        push(@args_list, "unsigned char *$arg_name");
> +                        push(@args_list, "int ${arg_name}len");
>                      } else {
>                          push(@args_list, "const char *$arg_name");
>                          push(@args_list, "int ${arg_name}len");

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]