2011/6/1 Adam Litke <agl@xxxxxxxxxx>: This commit has a pretty long summary line. > * 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. > > Âstatic int > diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl > index 062ccc1..d7e0383 100755 > --- a/daemon/remote_generator.pl > +++ b/daemon/remote_generator.pl > @@ -278,7 +278,9 @@ elsif ($opt_b) { >              "GetType", >              "NodeDeviceGetParent", >              "NodeGetSecurityModel", > -             Â"SecretGetValue"); > +             Â"SecretGetValue", > +             Â"DomainBlockPull", > +             Â"DomainGetBlockPullInfo"); >   } elsif ($structprefix eq "qemu") { >     @ungeneratable = ("MonitorCommand"); >   } > @@ -779,7 +781,9 @@ elsif ($opt_k) { >              "GetType", >              "NodeDeviceGetParent", >              "NodeGetSecurityModel", > -             Â"SecretGetValue"); > +             Â"SecretGetValue", > +             Â"DomainBlockPull", > +             Â"DomainGetBlockPullInfo"); >   } elsif ($structprefix eq "qemu") { >     @ungeneratable = ("MonitorCommand"); >   } You need to rebase your series to git head as the generator has changed much recently. > diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c > index 07bc629..0a885a9 100644 > --- a/src/remote/remote_driver.c > +++ b/src/remote/remote_driver.c > @@ -2844,6 +2844,70 @@ done: >   return rv; > Â} > > +static int remoteDomainBlockPull(virDomainPtr domain, > +                 const char *path, > +                 virDomainBlockPullInfoPtr info, > +                 unsigned int flags) > +{ > +  Âint rv = -1; > +  Âremote_domain_block_pull_args args; > +  Âremote_domain_block_pull_ret ret; > +  Âstruct private_data *priv = domain->conn->privateData; > + > +  ÂremoteDriverLock(priv); > + > +  Âmake_nonnull_domain(&args.dom, domain); > +  Âargs.path = (char *)path; > +  Âargs.flags = flags; > + > +  Âif (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_PULL, > +       (xdrproc_t)xdr_remote_domain_block_pull_args, (char *)&args, > +       (xdrproc_t)xdr_remote_domain_block_pull_ret, (char *)&ret) == -1) > +    Âgoto done; > + > +  Âif (info) { > +    Âinfo->cur = ret.info.cur; > +    Âinfo->end = ret.info.end; > +  Â} > +  Ârv = 0; > + > +done: > +  ÂremoteDriverUnlock(priv); > +  Âreturn rv; > +} > + > +static int remoteDomainGetBlockPullInfo(virDomainPtr domain, > +                    Âconst char *path, > +                    ÂvirDomainBlockPullInfoPtr info, > +                    Âunsigned int flags) > +{ > +  Âint rv = -1; > +  Âremote_domain_get_block_pull_info_args args; > +  Âremote_domain_get_block_pull_info_ret ret; > +  Âstruct private_data *priv = domain->conn->privateData; > + > +  ÂremoteDriverLock(priv); > + > +  Âmake_nonnull_domain(&args.dom, domain); > +  Âargs.path = (char *)path; > +  Âargs.flags = flags; > + > +  Âif (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLOCK_PULL_INFO, > +       (xdrproc_t)xdr_remote_domain_get_block_pull_info_args, > +        (char *)&args, > +       (xdrproc_t)xdr_remote_domain_get_block_pull_info_ret, > +        (char *)&ret) == -1) > +    Âgoto done; > + > +  Âinfo->cur = ret.info.cur; > +  Âinfo->end = ret.info.end; > +  Ârv = 0; > + > +done: > +  ÂremoteDriverUnlock(priv); > +  Âreturn rv; > +} This should be generatable as well. > > Âstatic virDrvOpenStatus ATTRIBUTE_NONNULL (1) > @@ -6493,10 +6557,10 @@ static virDriver remote_driver = { >   remoteDomainSnapshotDelete, /* domainSnapshotDelete */ >   remoteQemuDomainMonitorCommand, /* qemuDomainMonitorCommand */ >   remoteDomainOpenConsole, /* domainOpenConsole */ > -  ÂNULL, /* domainBlockPull */ > -  ÂNULL, /* domainBlockPullAll */ > -  ÂNULL, /* domainBlockPullAbort */ > -  ÂNULL, /* domainGetBlockPullInfo */ > +  ÂremoteDomainBlockPull, /* domainBlockPull */ > +  ÂremoteDomainBlockPullAll, /* domainBlockPullAll */ > +  ÂremoteDomainBlockPullAbort, /* domainBlockPullAbort */ > +  ÂremoteDomainGetBlockPullInfo, /* domainGetBlockPullInfo */ > Â}; Again, you need to rebase this, this was changed to named C99 initializers recently. Yes, libvirt is a fast moving target :) > Âstatic virNetworkDriver network_driver = { > diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x > index c706c36..2f52ceb 100644 > --- a/src/remote/remote_protocol.x > +++ b/src/remote/remote_protocol.x > @@ -917,6 +917,43 @@ struct remote_domain_set_autostart_args { >   int autostart; > Â}; > > +struct remote_domain_block_pull_info { > +  Âunsigned hyper cur; > +  Âunsigned hyper end; > +}; > + > +struct remote_domain_block_pull_args { > +  Âremote_nonnull_domain dom; > +  Âremote_nonnull_string path; > +  Âunsigned int flags; > +}; > + > +struct remote_domain_block_pull_ret { > +  Âremote_domain_block_pull_info info; > +}; > + > +struct remote_domain_block_pull_all_args { > +  Âremote_nonnull_domain dom; > +  Âremote_nonnull_string path; > +  Âunsigned int flags; > +}; > + > +struct remote_domain_block_pull_abort_args { > +  Âremote_nonnull_domain dom; > +  Âremote_nonnull_string path; > +  Âunsigned int flags; > +}; > + > +struct remote_domain_get_block_pull_info_args { > +  Âremote_nonnull_domain dom; > +  Âremote_nonnull_string path; > +  Âunsigned int flags; > +}; > + > +struct remote_domain_get_block_pull_info_ret { > +  Âremote_domain_block_pull_info info; > +}; > + > Â/* Network calls: */ > > Â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 also miss corresponding updates to src/remote_protocol-structs. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list