[libvirt] [PATCH 2/8] Define remote wire protocol & impls for virDomainQemuAttach

Matthias Bolte matthias.bolte at googlemail.com
Tue Jul 5 11:07:45 UTC 2011


2011/7/4 Daniel P. Berrange <berrange at redhat.com>:
> * daemon/remote.c: Server side dispatcher
> * src/remote/remote_driver.c: Client side dispatcher
> * src/remote/qemu_protocol.x: Wire protocol definition
> ---
>  daemon/remote.c            |   41 +++++++++++++++++++++++++++++++++++++++++
>  src/remote/qemu_protocol.x |   13 ++++++++++++-
>  src/remote/remote_driver.c |   30 ++++++++++++++++++++++++++++++
>  3 files changed, 83 insertions(+), 1 deletions(-)
>
> diff --git a/daemon/remote.c b/daemon/remote.c
> index 2889908..85fc978 100644
> --- a/daemon/remote.c
> +++ b/daemon/remote.c
> @@ -2645,6 +2645,47 @@ cleanup:
>
>
>  static int
> +qemuDispatchDomainAttach(virNetServerPtr server ATTRIBUTE_UNUSED,
> +                         virNetServerClientPtr client ATTRIBUTE_UNUSED,
> +                         virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
> +                         virNetMessageErrorPtr rerr,
> +                         qemu_domain_attach_args *args,
> +                         qemu_domain_attach_ret *ret)
> +{
> +    virDomainPtr dom = NULL;
> +    int rv = -1;
> +    struct daemonClientPrivate *priv =
> +        virNetServerClientGetPrivateData(client);
> +
> +    if (!priv->conn) {
> +        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
> +        goto cleanup;
> +    }
> +
> +    if (!(dom = virDomainQemuAttach(priv->conn,
> +                                    args->pid,
> +                                    args->flags)))
> +        goto cleanup;
> +
> +    make_nonnull_domain(&ret->dom, dom);
> +
> +    rv = 0;
> +
> +cleanup:
> +    if (rv < 0)
> +        virNetMessageSaveError(rerr);
> +    if (dom)
> +        virDomainFree(dom);
> +    return rv;
> +}

The generator should be able to deal with this, did you try?

> +
> +#include "remote_dispatch_bodies.h"
> +#include "qemu_dispatch_bodies.h"
> +
> +
> +>>>>>>> Define remote wire protocol & impls for virDomainQemuAttach

The includes and this line looks bogus, probably a rebase problem.

> +static virDomainPtr
> +remoteQemuDomainAttach(virConnectPtr conn, unsigned long long pid, unsigned int flags)
> +{
> +    virDomainPtr rv = NULL;
> +    struct private_data *priv = conn->privateData;
> +    qemu_domain_attach_args args;
> +    qemu_domain_attach_ret ret;
> +
> +    remoteDriverLock(priv);
> +
> +    args.pid = pid;
> +    args.flags = flags;
> +
> +    memset(&ret, 0, sizeof ret);
> +
> +    if (call(conn, priv, REMOTE_CALL_QEMU, QEMU_PROC_DOMAIN_ATTACH,
> +             (xdrproc_t)xdr_qemu_domain_attach_args, (char *)&args,
> +             (xdrproc_t)xdr_qemu_domain_attach_ret, (char *)&ret) == -1)
> +        goto done;
> +
> +    rv = get_nonnull_domain(conn, ret.dom);
> +    xdr_free((xdrproc_t)xdr_qemu_domain_attach_ret, (char *)&ret);
> +
> +done:
> +    remoteDriverUnlock(priv);
> +    return rv;
> +}

The generator should also be able to deal with this one.

>  static char *
>  remoteDomainMigrateBegin3(virDomainPtr domain,
>                           const char *xmlin,
> @@ -4222,6 +4251,7 @@ static virDriver remote_driver = {
>     .domainRevertToSnapshot = remoteDomainRevertToSnapshot, /* 0.8.0 */
>     .domainSnapshotDelete = remoteDomainSnapshotDelete, /* 0.8.0 */
>     .qemuDomainMonitorCommand = remoteQemuDomainMonitorCommand, /* 0.8.3 */
> +    .qemuDomainAttach = remoteQemuDomainAttach, /* 0.9.3 */

s/0.9.3/0.9.4/

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvir-list mailing list