[libvirt] [PATCHv3 04/12] remote: implement remote protocol for virConnectListAllDomains()

Eric Blake eblake at redhat.com
Mon Jun 11 22:26:36 UTC 2012


On 06/11/2012 04:33 AM, Peter Krempa wrote:
> This patch wires up the RPC protocol handlers for
> virConnectListAllDomains(). The RPC generator has no support for the way
> how virConnectListAllDomains() returns the results so the handler code
> had to be done manually.
> 
> The new api is handled by REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS, with
> number 271 and marked with high priority.

271 is already claimed <evil_laugh>MuaaHaHa</evil_laugh>

You'll have to tweak this to apply onto the latest libvirt.git, but the
conflict resolution should be trivial.

> ---
> Diff to v2:
> - fixed spelling and style nits
> - changed the boolean flag that tells the remote side if the list is needed to ing

s/ing/int/

>  static int
> +remoteDispatchConnectListAllDomains(virNetServerPtr server ATTRIBUTE_UNUSED,
> +                                    virNetServerClientPtr client,
> +                                    virNetMessagePtr msg ATTRIBUTE_UNUSED,
> +                                    virNetMessageErrorPtr rerr,
> +                                    remote_connect_list_all_domains_args *args,
> +                                    remote_connect_list_all_domains_ret *ret)
> +{
> +    virDomainPtr *doms = NULL;
> +    int ndomains = 0;
> +    int i;
> +    int rv = -1;
> +    struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
> +
> +    if (!priv->conn) {
> +        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
> +        goto cleanup;
> +    }
> +
> +    if ((ndomains = virConnectListAllDomains(priv->conn,
> +                                             args->need_results ? &doms : NULL,
> +                                             args->flags)) < 0)
> +        goto cleanup;
> +
> +    if (doms) {

if (doms && ndomains) {

to avoid a pointless alloc.


> @@ -5111,6 +5174,7 @@ static virDriver remote_driver = {
>      .domainGetDiskErrors = remoteDomainGetDiskErrors, /* 0.9.10 */
>      .domainSetMetadata = remoteDomainSetMetadata, /* 0.9.10 */
>      .domainGetMetadata = remoteDomainGetMetadata, /* 0.9.10 */
> +    .listAllDomains = remoteConnectListAllDomains, /* 0.9.13 */

I would have listed this earlier, next to the remoteConnectListDomains
entry, but no big deal.

ACK with the rebase and nit fixed.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120611/2fc043af/attachment-0001.sig>


More information about the libvir-list mailing list