[libvirt] [PATCH 2/8] Define remote wire protocol & impls for virDomainQemuAttach
Daniel P. Berrange
berrange at redhat.com
Fri Jul 8 12:21:59 UTC 2011
On Tue, Jul 05, 2011 at 01:07:45PM +0200, Matthias Bolte wrote:
> 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?
I couldn't, but it turns out the changes were fairly easy.
> > +#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.
Yep, totally bogus line.
>
> > +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.
It did after some changes
I'm reposting this one patch since its the only one that needed
non-trivial fixups
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list