Re: [libvirt] [PATCH 2/8] Define remote wire protocol impls for virDomainQemuAttach
On Tue, Jul 05, 2011 at 01:07:45PM +0200, Matthias Bolte wrote: 2011/7/4 Daniel P. Berrange berra...@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 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/8] Define remote wire protocol impls for virDomainQemuAttach
2011/7/4 Daniel P. Berrange berra...@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 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/8] Define remote wire protocol impls for virDomainQemuAttach
* 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| 35 +++ src/remote/qemu_protocol.x | 13 - src/remote/remote_driver.c | 30 ++ 3 files changed, 77 insertions(+), 1 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 37fbed0..9b2c619 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -2778,6 +2778,41 @@ cleanup: } +static int +qemuDispatchDomainAttach(struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_message_header *hdr ATTRIBUTE_UNUSED, + remote_error *rerr, + qemu_domain_attach_args *args, + qemu_domain_attach_ret *ret) +{ +virDomainPtr dom = NULL; +int rv = -1; + +if (!conn) { +virNetError(VIR_ERR_INTERNAL_ERROR, %s, _(connection not open)); +goto cleanup; +} + +if (!(dom = virDomainQemuAttach(conn, +args-pid, +args-flags))) +goto cleanup; + +make_nonnull_domain(ret-dom, dom); + +rv = 0; + +cleanup: +if (rv 0) +remoteDispatchError(rerr); +if (dom) +virDomainFree(dom); +return rv; +} + + #include remote_dispatch_bodies.h #include qemu_dispatch_bodies.h diff --git a/src/remote/qemu_protocol.x b/src/remote/qemu_protocol.x index fa453f4..4d510ff 100644 --- a/src/remote/qemu_protocol.x +++ b/src/remote/qemu_protocol.x @@ -37,6 +37,16 @@ struct qemu_monitor_command_ret { remote_nonnull_string result; }; + +struct qemu_domain_attach_args { +unsigned hyper pid; +unsigned int flags; +}; + +struct qemu_domain_attach_ret { +remote_nonnull_domain dom; +}; + /* Define the program number, protocol version and procedure numbers here. */ const QEMU_PROGRAM = 0x20008087; const QEMU_PROTOCOL_VERSION = 1; @@ -45,5 +55,6 @@ enum qemu_procedure { /* Each function must have a two-word comment. The first word is * whether remote_generator.pl handles daemon, the second whether * it handles src/remote. */ -QEMU_PROC_MONITOR_COMMAND = 1 /* skipgen skipgen */ +QEMU_PROC_MONITOR_COMMAND = 1, /* skipgen skipgen */ +QEMU_PROC_DOMAIN_ATTACH = 2 /* skipgen skipgen */ }; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 13f8820..43dfdaa 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -4644,6 +4644,35 @@ done: } +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; +} + + static char * remoteDomainMigrateBegin3(virDomainPtr domain, const char *xmlin, @@ -6525,6 +6554,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 */ .domainOpenConsole = remoteDomainOpenConsole, /* 0.8.6 */ .domainInjectNMI = remoteDomainInjectNMI, /* 0.9.2 */ .domainMigrateBegin3 = remoteDomainMigrateBegin3, /* 0.9.2 */ -- 1.7.4.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list