Re: [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.

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

 



2011/6/1 Adam Litke <agl@xxxxxxxxxx>:
> On 06/01/2011 12:13 PM, Matthias Bolte wrote:
>> 2011/6/1 Adam Litke <agl@xxxxxxxxxx>:
>>
>> 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@xxxxxxxxxx>
>>> ---
>>> Â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@xxxxxxxxxxxxxx>
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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]