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

Re: [libvirt] [PATCH 2/7] Add virDomainBlockPull support to the remote driver. The generator can handle DomainBlockPullAll and DomainBlockPullAbort. DomainBlockPull and DomainBlockPullInfo must be written by hand.



2011/6/1 Adam Litke <agl us ibm com>:
> On 06/01/2011 12:13 PM, Matthias Bolte wrote:
>> 2011/6/1 Adam Litke <agl us ibm com>:
>>
>> This commit has a pretty long summary line.
>
> Fixed.
>
>>> * src/remote/remote_protocol.x: provide defines for the new entry points
>>> * src/remote/remote_driver.c daemon/remote.c: implement the client and
>>>  server side
>>> * daemon/remote_generator.pl: Specify the manually-written functions
>>>
>>> Signed-off-by: Adam Litke <agl us ibm com>
>>> ---
>>>  daemon/remote.c              |   71 +++++++++++++++++++++++++++++++++++++++++
>>>  daemon/remote_generator.pl   |    8 +++-
>>>  src/remote/remote_driver.c   |   72 +++++++++++++++++++++++++++++++++++++++--
>>>  src/remote/remote_protocol.x |   44 +++++++++++++++++++++++++-
>>>  4 files changed, 188 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/daemon/remote.c b/daemon/remote.c
>>> index 2220655..f6aa78e 100644
>>> --- a/daemon/remote.c
>>> +++ b/daemon/remote.c
>>> @@ -1692,6 +1692,77 @@ no_memory:
>>>     goto cleanup;
>>>  }
>>>
>>> +static int
>>> +remoteDispatchDomainBlockPull(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_block_pull_args *args,
>>> +                              remote_domain_block_pull_ret *ret)
>>> +{
>>> +    virDomainPtr dom = NULL;
>>> +    virDomainBlockPullInfo tmp;
>>> +    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 (virDomainBlockPull(dom, args->path, &tmp, args->flags) < 0)
>>> +        goto cleanup;
>>> +    rv = 0;
>>> +    ret->info.cur = tmp.cur;
>>> +    ret->info.end = tmp.end;
>>> +
>>> +cleanup:
>>> +    if (rv < 0)
>>> +        remoteDispatchError(rerr);
>>> +    if (dom)
>>> +        virDomainFree(dom);
>>> +    return rv;
>>> +}
>>> +
>>> +static int
>>> +remoteDispatchDomainGetBlockPullInfo(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_get_block_pull_info_args *args,
>>> +                                     remote_domain_get_block_pull_info_ret *ret)
>>> +{
>>> +    virDomainPtr dom = NULL;
>>> +    virDomainBlockPullInfo tmp;
>>> +    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 (virDomainGetBlockPullInfo(dom, args->path, &tmp, args->flags) < 0)
>>> +        goto cleanup;
>>> +    rv = 0;
>>> +    ret->info.cur = tmp.cur;
>>> +    ret->info.end = tmp.end;
>>> +
>>> +cleanup:
>>> +    if (rv < 0)
>>> +        remoteDispatchError(rerr);
>>> +    if (dom)
>>> +        virDomainFree(dom);
>>> +    return rv;
>>> +}
>>
>> The generator should be able to deal with this. I might have to tweak
>> it to handle multi-return-value procedures more general.
>
> That would be excellent.  I am not doing anything particularly special.

Yes works almost fine. I've attached a patch for the generator to deal
with the placement of the struct in the signature.

>>>  struct remote_num_of_networks_ret {
>>> @@ -2176,7 +2213,12 @@ enum remote_procedure {
>>>     REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206,
>>>     REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
>>>     REMOTE_PROC_STORAGE_VOL_UPLOAD = 208,
>>> -    REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209
>>> +    REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209,
>>> +    REMOTE_PROC_DOMAIN_BLOCK_PULL = 210,
>>> +
>>> +    REMOTE_PROC_DOMAIN_BLOCK_PULL_ALL = 211,
>>> +    REMOTE_PROC_DOMAIN_BLOCK_PULL_ABORT = 212,
>>> +    REMOTE_PROC_DOMAIN_GET_BLOCK_PULL_INFO = 213
>>
>> Annotations for the generator go here.
>
> I am not sure what you mean by annotations for the generator.  Could you
> explain further?

Instead of the blacklist in the generator each procedure has a comment
that tells the generator how to handle it. It's explained in the .x
file.

>> I also miss corresponding updates to src/remote_protocol-structs.
>
> Isn't this file generated from remote-protocol.x?  It seems to have
> exactly the same information.

This file is not generated, it is used to verify that the existing XDR
protocol is not changed, but only extended. When you have pdwtags
installed the make check will verify this.

Matthias
From 2c3c6e3bf72b5db6e01e4b333d000bb051a7019d Mon Sep 17 00:00:00 2001
From: Matthias Bolte <matthias bolte googlemail com>
Date: Wed, 1 Jun 2011 20:33:05 +0200
Subject: [PATCH] remote generator: Handle virDomainGetBlockPullInfo

---
 daemon/remote_generator.pl |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index e204b76..2120e27 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -668,9 +668,10 @@ elsif ($opt_b) {
             my $struct_name = $call->{ProcName};
             $struct_name =~ s/Get//;
 
-            if ($call->{ProcName} eq "DomainGetBlockInfo") {
-                # SPECIAL: virDomainGetBlockInfo has flags parameter after
-                #          the struct parameter in its signature
+            if ($call->{ProcName} eq "DomainGetBlockInfo" ||
+                $call->{ProcName} eq "DomainGetBlockPullInfo") {
+                # SPECIAL: virDomainGetBlockInfo and DomainGetBlockPullInfo have
+                #          flags parameter after the struct parameter in the signature
                 my $flags = pop(@args_list);
                 push(@args_list, "&tmp");
                 push(@args_list, $flags);
@@ -1203,9 +1204,10 @@ elsif ($opt_k) {
             my $struct_name = $call->{ProcName};
             $struct_name =~ s/Get//;
 
-            if ($call->{ProcName} eq "DomainGetBlockInfo") {
-                # SPECIAL: virDomainGetBlockInfo has flags parameter after
-                #          the struct parameter in its signature
+            if ($call->{ProcName} eq "DomainGetBlockInfo" ||
+                $call->{ProcName} eq "DomainGetBlockPullInfo") {
+                # SPECIAL: virDomainGetBlockInfo and DomainGetBlockPullInfo have
+                #          flags parameter after the struct parameter in the signature
                 $last_arg = pop(@args_list);
             }
 
-- 
1.7.0.4


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