[libvirt] [PATCH] Define remote wire protocol impls for virDomainQemuAttach

2011-07-08 Thread Daniel P. Berrange
From: Daniel P. Berrange berra...@redhat.com

This tweaks the RPC generator to cope with some naming
conventions used for the QEMU specific APIs

* daemon/remote.c: Server side dispatcher
* src/remote/remote_driver.c: Client side dispatcher
* src/remote/qemu_protocol.x: Wire protocol definition
* src/rpc/gendispatch.pl: Use '$structprefix' in method
  names, fix QEMU flags and fix dispatcher method names
---
 src/remote/qemu_protocol.x |   13 -
 src/remote/remote_driver.c |1 +
 src/rpc/gendispatch.pl |   11 +--
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/remote/qemu_protocol.x b/src/remote/qemu_protocol.x
index fa453f4..c6a5648 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 /* autogen autogen */
 };
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index f318740..4eea3a4 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -4222,6 +4222,7 @@ static virDriver remote_driver = {
 .domainRevertToSnapshot = remoteDomainRevertToSnapshot, /* 0.8.0 */
 .domainSnapshotDelete = remoteDomainSnapshotDelete, /* 0.8.0 */
 .qemuDomainMonitorCommand = remoteQemuDomainMonitorCommand, /* 0.8.3 */
+.qemuDomainAttach = qemuDomainAttach, /* 0.9.4 */
 .domainOpenConsole = remoteDomainOpenConsole, /* 0.8.6 */
 .domainInjectNMI = remoteDomainInjectNMI, /* 0.9.2 */
 .domainMigrateBegin3 = remoteDomainMigrateBegin3, /* 0.9.2 */
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 027560c..56841c8 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -821,6 +821,8 @@ elsif ($opt_b) {
 $proc_name = ConnectBaselineCPU
 } elsif ($call-{ProcName} eq CPUCompare) {
 $proc_name = ConnectCompareCPU
+} elsif ($structprefix eq qemu  $call-{ProcName} =~ 
/^Domain/) {
+$proc_name =~ s/^(Domain)/${1}Qemu/;
 }
 
 if ($single_ret_as_list) {
@@ -1323,7 +1325,7 @@ elsif ($opt_k) {
 # print function
 print \n;
 print static $single_ret_type\n;
-print remote$call-{ProcName}(;
+print $structprefix$call-{ProcName}(;
 
 print join(, , @args_list);
 
@@ -1417,8 +1419,13 @@ elsif ($opt_k) {
 print memset(ret, 0, sizeof ret);\n;
 }
 
+my $callflags = 0;
+if ($structprefix eq qemu) {
+$callflags = REMOTE_CALL_QEMU;
+}
+
 print \n;
-print if (call($priv_src, priv, 0, 
${procprefix}_PROC_$call-{UC_NAME},\n;
+print if (call($priv_src, priv, $callflags, 
${procprefix}_PROC_$call-{UC_NAME},\n;
 print  (xdrproc_t)xdr_$argtype, (char *)$call_args,\n;
 print  (xdrproc_t)xdr_$rettype, (char *)$call_ret) == -1) 
{\n;
 
-- 
1.7.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] Define remote wire protocol impls for virDomainQemuAttach

2011-07-08 Thread Matthias Bolte
2011/7/8 Daniel P. Berrange berra...@redhat.com:
 From: Daniel P. Berrange berra...@redhat.com

 This tweaks the RPC generator to cope with some naming
 conventions used for the QEMU specific APIs

 * daemon/remote.c: Server side dispatcher
 * src/remote/remote_driver.c: Client side dispatcher
 * src/remote/qemu_protocol.x: Wire protocol definition
 * src/rpc/gendispatch.pl: Use '$structprefix' in method
  names, fix QEMU flags and fix dispatcher method names
 ---
  src/remote/qemu_protocol.x |   13 -
  src/remote/remote_driver.c |    1 +
  src/rpc/gendispatch.pl     |   11 +--
  3 files changed, 22 insertions(+), 3 deletions(-)


ACK.

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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Define remote wire protocol impls for virDomainQemuAttach

2011-07-08 Thread Eric Blake
On 07/08/2011 06:20 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com
 
 This tweaks the RPC generator to cope with some naming
 conventions used for the QEMU specific APIs
 
 * daemon/remote.c: Server side dispatcher
 * src/remote/remote_driver.c: Client side dispatcher
 * src/remote/qemu_protocol.x: Wire protocol definition
 * src/rpc/gendispatch.pl: Use '$structprefix' in method
   names, fix QEMU flags and fix dispatcher method names
 ---
  src/remote/qemu_protocol.x |   13 -
  src/remote/remote_driver.c |1 +
  src/rpc/gendispatch.pl |   11 +--
  3 files changed, 22 insertions(+), 3 deletions(-)

Hmm.  We have src/remote_protocol-structs to catch any incompatible
on-the-wire changes to remote_protocol.x, but nothing to track changes
to qemu_protocol.x.  Is this something that needs fixing to help us
avoid unintended wire breakage?

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Define remote wire protocol impls for virDomainQemuAttach

2011-07-08 Thread Eric Blake
On 07/08/2011 07:40 AM, Eric Blake wrote:
 On 07/08/2011 06:20 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com

 This tweaks the RPC generator to cope with some naming
 conventions used for the QEMU specific APIs

 * daemon/remote.c: Server side dispatcher
 * src/remote/remote_driver.c: Client side dispatcher
 * src/remote/qemu_protocol.x: Wire protocol definition
 * src/rpc/gendispatch.pl: Use '$structprefix' in method
   names, fix QEMU flags and fix dispatcher method names
 ---
  src/remote/qemu_protocol.x |   13 -
  src/remote/remote_driver.c |1 +
  src/rpc/gendispatch.pl |   11 +--
  3 files changed, 22 insertions(+), 3 deletions(-)
 
 Hmm.  We have src/remote_protocol-structs to catch any incompatible
 on-the-wire changes to remote_protocol.x, but nothing to track changes
 to qemu_protocol.x.  Is this something that needs fixing to help us
 avoid unintended wire breakage?

Answering my own question:
https://www.redhat.com/archives/libvir-list/2011-July/msg00463.html

We'll have a merge commit for whichever of these two patches goes in
second :)

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list