[PATCH 04/12] Domain Events - rpc changes Changes to the RPC protocol remote_dispatch_localvars.h | 3 +++ remote_dispatch_proc_switch.h | 18 ++++++++++++++++++ remote_dispatch_prototypes.h | 3 +++ remote_protocol.c | 29 +++++++++++++++++++++++++++++ remote_protocol.h | 25 +++++++++++++++++++++++++ remote_protocol.x | 25 ++++++++++++++++++++++++- 6 files changed, 102 insertions(+), 1 deletion(-)
diff --git a/qemud/remote_dispatch_localvars.h b/qemud/remote_dispatch_localvars.h index f46b493..505fb30 100644 --- a/qemud/remote_dispatch_localvars.h +++ b/qemud/remote_dispatch_localvars.h @@ -6,6 +6,7 @@ remote_domain_lookup_by_uuid_args lv_remote_domain_lookup_by_uuid_args; remote_domain_lookup_by_uuid_ret lv_remote_domain_lookup_by_uuid_ret; remote_storage_pool_list_volumes_args lv_remote_storage_pool_list_volumes_args; remote_storage_pool_list_volumes_ret lv_remote_storage_pool_list_volumes_ret; +remote_domain_events_deregister_ret lv_remote_domain_events_deregister_ret; remote_domain_shutdown_args lv_remote_domain_shutdown_args; remote_list_defined_domains_args lv_remote_list_defined_domains_args; remote_list_defined_domains_ret lv_remote_list_defined_domains_ret; @@ -20,6 +21,7 @@ remote_domain_get_autostart_args lv_remote_domain_get_autostart_args; remote_domain_get_autostart_ret lv_remote_domain_get_autostart_ret; remote_domain_set_vcpus_args lv_remote_domain_set_vcpus_args; remote_get_hostname_ret lv_remote_get_hostname_ret; +remote_domain_events_register_ret lv_remote_domain_events_register_ret; remote_network_undefine_args lv_remote_network_undefine_args; remote_domain_create_args lv_remote_domain_create_args; remote_network_destroy_args lv_remote_network_destroy_args; @@ -121,6 +123,7 @@ remote_num_of_defined_storage_pools_ret lv_remote_num_of_defined_storage_pools_r remote_domain_core_dump_args lv_remote_domain_core_dump_args; remote_list_defined_storage_pools_args lv_remote_list_defined_storage_pools_args; remote_list_defined_storage_pools_ret lv_remote_list_defined_storage_pools_ret; +remote_domain_event_ret lv_remote_domain_event_ret; remote_domain_get_max_memory_args lv_remote_domain_get_max_memory_args; remote_domain_get_max_memory_ret lv_remote_domain_get_max_memory_ret; remote_num_of_domains_ret lv_remote_num_of_domains_ret; diff --git a/qemud/remote_dispatch_proc_switch.h b/qemud/remote_dispatch_proc_switch.h index 89296d7..3cd5d78 100644 --- a/qemud/remote_dispatch_proc_switch.h +++ b/qemud/remote_dispatch_proc_switch.h @@ -116,6 +116,24 @@ case REMOTE_PROC_DOMAIN_DUMP_XML: ret = (char *) &lv_remote_domain_dump_xml_ret; memset (&lv_remote_domain_dump_xml_ret, 0, sizeof lv_remote_domain_dump_xml_ret); break; +case REMOTE_PROC_DOMAIN_EVENT: + fn = (dispatch_fn) remoteDispatchDomainEvent; + ret_filter = (xdrproc_t) xdr_remote_domain_event_ret; + ret = (char *) &lv_remote_domain_event_ret; + memset (&lv_remote_domain_event_ret, 0, sizeof lv_remote_domain_event_ret); + break; +case REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER: + fn = (dispatch_fn) remoteDispatchDomainEventsDeregister; + ret_filter = (xdrproc_t) xdr_remote_domain_events_deregister_ret; + ret = (char *) &lv_remote_domain_events_deregister_ret; + memset (&lv_remote_domain_events_deregister_ret, 0, sizeof lv_remote_domain_events_deregister_ret); + break; +case REMOTE_PROC_DOMAIN_EVENTS_REGISTER: + fn = (dispatch_fn) remoteDispatchDomainEventsRegister; + ret_filter = (xdrproc_t) xdr_remote_domain_events_register_ret; + ret = (char *) &lv_remote_domain_events_register_ret; + memset (&lv_remote_domain_events_register_ret, 0, sizeof lv_remote_domain_events_register_ret); + break; case REMOTE_PROC_DOMAIN_GET_AUTOSTART: fn = (dispatch_fn) remoteDispatchDomainGetAutostart; args_filter = (xdrproc_t) xdr_remote_domain_get_autostart_args; diff --git a/qemud/remote_dispatch_prototypes.h b/qemud/remote_dispatch_prototypes.h index 3f4eb9f..4b27a9f 100644 --- a/qemud/remote_dispatch_prototypes.h +++ b/qemud/remote_dispatch_prototypes.h @@ -18,6 +18,9 @@ static int remoteDispatchDomainDefineXml (struct qemud_server *server, struct qe static int remoteDispatchDomainDestroy (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_destroy_args *args, void *ret); static int remoteDispatchDomainDetachDevice (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_detach_device_args *args, void *ret); static int remoteDispatchDomainDumpXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_dump_xml_args *args, remote_domain_dump_xml_ret *ret); +static int remoteDispatchDomainEvent (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_domain_event_ret *ret); +static int remoteDispatchDomainEventsDeregister (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_domain_events_deregister_ret *ret); +static int remoteDispatchDomainEventsRegister (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_domain_events_register_ret *ret); static int remoteDispatchDomainGetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_autostart_args *args, remote_domain_get_autostart_ret *ret); static int remoteDispatchDomainGetInfo (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_info_args *args, remote_domain_get_info_ret *ret); static int remoteDispatchDomainGetMaxMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_max_memory_args *args, remote_domain_get_max_memory_ret *ret); diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c index 33a25e1..5ef80e5 100644 --- a/qemud/remote_protocol.c +++ b/qemud/remote_protocol.c @@ -1943,6 +1943,35 @@ xdr_remote_storage_vol_get_path_ret (XDR *xdrs, remote_storage_vol_get_path_ret } bool_t +xdr_remote_domain_events_register_ret (XDR *xdrs, remote_domain_events_register_ret *objp) +{ + + if (!xdr_int (xdrs, &objp->cb_registered)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_domain_events_deregister_ret (XDR *xdrs, remote_domain_events_deregister_ret *objp) +{ + + if (!xdr_int (xdrs, &objp->cb_registered)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_domain_event_ret (XDR *xdrs, remote_domain_event_ret *objp) +{ + + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom)) + return FALSE; + if (!xdr_int (xdrs, &objp->event)) + return FALSE; + return TRUE; +} + +bool_t xdr_remote_procedure (XDR *xdrs, remote_procedure *objp) { diff --git a/qemud/remote_protocol.h b/qemud/remote_protocol.h index 0bf8b79..e43514d 100644 --- a/qemud/remote_protocol.h +++ b/qemud/remote_protocol.h @@ -1081,6 +1081,22 @@ struct remote_storage_vol_get_path_ret { remote_nonnull_string name; }; typedef struct remote_storage_vol_get_path_ret remote_storage_vol_get_path_ret; + +struct remote_domain_events_register_ret { + int cb_registered; +}; +typedef struct remote_domain_events_register_ret remote_domain_events_register_ret; + +struct remote_domain_events_deregister_ret { + int cb_registered; +}; +typedef struct remote_domain_events_deregister_ret remote_domain_events_deregister_ret; + +struct remote_domain_event_ret { + remote_nonnull_domain dom; + int event; +}; +typedef struct remote_domain_event_ret remote_domain_event_ret; #define REMOTE_PROGRAM 0x20008086 #define REMOTE_PROTOCOL_VERSION 1 @@ -1189,6 +1205,9 @@ enum remote_procedure { REMOTE_PROC_NODE_GET_FREE_MEMORY = 102, REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103, REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104, + REMOTE_PROC_DOMAIN_EVENTS_REGISTER = 105, + REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER = 106, + REMOTE_PROC_DOMAIN_EVENT = 107, }; typedef enum remote_procedure remote_procedure; @@ -1394,6 +1413,9 @@ extern bool_t xdr_remote_storage_vol_get_info_args (XDR *, remote_storage_vol_g extern bool_t xdr_remote_storage_vol_get_info_ret (XDR *, remote_storage_vol_get_info_ret*); extern bool_t xdr_remote_storage_vol_get_path_args (XDR *, remote_storage_vol_get_path_args*); extern bool_t xdr_remote_storage_vol_get_path_ret (XDR *, remote_storage_vol_get_path_ret*); +extern bool_t xdr_remote_domain_events_register_ret (XDR *, remote_domain_events_register_ret*); +extern bool_t xdr_remote_domain_events_deregister_ret (XDR *, remote_domain_events_deregister_ret*); +extern bool_t xdr_remote_domain_event_ret (XDR *, remote_domain_event_ret*); extern bool_t xdr_remote_procedure (XDR *, remote_procedure*); extern bool_t xdr_remote_message_direction (XDR *, remote_message_direction*); extern bool_t xdr_remote_message_status (XDR *, remote_message_status*); @@ -1575,6 +1597,9 @@ extern bool_t xdr_remote_storage_vol_get_info_args (); extern bool_t xdr_remote_storage_vol_get_info_ret (); extern bool_t xdr_remote_storage_vol_get_path_args (); extern bool_t xdr_remote_storage_vol_get_path_ret (); +extern bool_t xdr_remote_domain_events_register_ret (); +extern bool_t xdr_remote_domain_events_deregister_ret (); +extern bool_t xdr_remote_domain_event_ret (); extern bool_t xdr_remote_procedure (); extern bool_t xdr_remote_message_direction (); extern bool_t xdr_remote_message_status (); diff --git a/qemud/remote_protocol.x b/qemud/remote_protocol.x index f1bd9ff..b7e41aa 100644 --- a/qemud/remote_protocol.x +++ b/qemud/remote_protocol.x @@ -965,6 +965,25 @@ struct remote_storage_vol_get_path_ret { remote_nonnull_string name; }; +/** + * Events Register/Deregister: + * It would seem rpcgen does not like both args, and ret + * to be null. It will not generate the prototype otherwise. + * Pass back a redundant boolean to force prototype generation. + */ +struct remote_domain_events_register_ret { + int cb_registered; +}; + +struct remote_domain_events_deregister_ret { + int cb_registered; +}; + +struct remote_domain_event_ret { + remote_nonnull_domain dom; + int event; +}; + /*----- Protocol. -----*/ /* Define the program number, protocol version and procedure numbers here. */ @@ -1086,7 +1105,11 @@ enum remote_procedure { REMOTE_PROC_NODE_GET_FREE_MEMORY = 102, REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103, - REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104 + REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104, + + REMOTE_PROC_DOMAIN_EVENTS_REGISTER = 105, + REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER = 106, + REMOTE_PROC_DOMAIN_EVENT = 107 }; /* Custom RPC structure. */
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list