--- daemon/remote.c | 33 +++++++++++++++++++++++++++++++++ daemon/remote_dispatch_prototypes.h | 8 ++++++++ daemon/remote_dispatch_table.h | 5 +++++ src/remote/remote_protocol.c | 20 ++++++++++++++++++++ src/remote/remote_protocol.h | 16 ++++++++++++++++ src/remote/remote_protocol.x | 12 +++++++++++- src/remote_protocol-structs | 7 +++++++ 7 files changed, 100 insertions(+), 1 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index eedbc77..0136318 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -8738,6 +8738,39 @@ cleanup: return rv; } +static int +remoteDispatchDomainGetState(struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_message_header *hdr ATTRIBUTE_UNUSED, + remote_error *rerr, + remote_domain_get_state_args *args, + remote_domain_get_state_ret *ret) +{ + virDomainPtr dom = NULL; + int rv = -1; + + if (!conn) { + virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + if (!(dom = get_nonnull_domain(conn, args->dom))) + goto cleanup; + + if (virDomainGetState(dom, &ret->state, &ret->reason) < 0) + goto cleanup; + + rv = 0; + +cleanup: + if (rv < 0) + remoteDispatchError(rerr); + if (dom) + virDomainFree(dom); + return rv; +} + /*----- Helpers. -----*/ diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h index cf2f38c..73d810d 100644 --- a/daemon/remote_dispatch_prototypes.h +++ b/daemon/remote_dispatch_prototypes.h @@ -306,6 +306,14 @@ static int remoteDispatchDomainGetSecurityLabel( remote_error *rerr, remote_domain_get_security_label_args *args, remote_domain_get_security_label_ret *ret); +static int remoteDispatchDomainGetState( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_message_header *hdr, + remote_error *rerr, + remote_domain_get_state_args *args, + remote_domain_get_state_ret *ret); static int remoteDispatchDomainGetVcpus( struct qemud_server *server, struct qemud_client *client, diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h index b39f7c2..07ffd5e 100644 --- a/daemon/remote_dispatch_table.h +++ b/daemon/remote_dispatch_table.h @@ -1052,3 +1052,8 @@ .args_filter = (xdrproc_t) xdr_remote_storage_vol_download_args, .ret_filter = (xdrproc_t) xdr_void, }, +{ /* DomainGetState => 210 */ + .fn = (dispatch_fn) remoteDispatchDomainGetState, + .args_filter = (xdrproc_t) xdr_remote_domain_get_state_args, + .ret_filter = (xdrproc_t) xdr_remote_domain_get_state_ret, +}, diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c index 5604371..eb68c79 100644 --- a/src/remote/remote_protocol.c +++ b/src/remote/remote_protocol.c @@ -3902,6 +3902,26 @@ xdr_remote_storage_vol_download_args (XDR *xdrs, remote_storage_vol_download_arg } bool_t +xdr_remote_domain_get_state_args (XDR *xdrs, remote_domain_get_state_args *objp) +{ + + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_domain_get_state_ret (XDR *xdrs, remote_domain_get_state_ret *objp) +{ + + if (!xdr_int (xdrs, &objp->state)) + return FALSE; + if (!xdr_int (xdrs, &objp->reason)) + return FALSE; + return TRUE; +} + +bool_t xdr_remote_procedure (XDR *xdrs, remote_procedure *objp) { diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h index d9bf151..fc68ca5 100644 --- a/src/remote/remote_protocol.h +++ b/src/remote/remote_protocol.h @@ -2200,6 +2200,17 @@ struct remote_storage_vol_download_args { u_int flags; }; typedef struct remote_storage_vol_download_args remote_storage_vol_download_args; + +struct remote_domain_get_state_args { + remote_nonnull_domain dom; +}; +typedef struct remote_domain_get_state_args remote_domain_get_state_args; + +struct remote_domain_get_state_ret { + int state; + int reason; +}; +typedef struct remote_domain_get_state_ret remote_domain_get_state_ret; #define REMOTE_PROGRAM 0x20008086 #define REMOTE_PROTOCOL_VERSION 1 @@ -2413,6 +2424,7 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207, REMOTE_PROC_STORAGE_VOL_UPLOAD = 208, REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209, + REMOTE_PROC_DOMAIN_GET_STATE = 210, }; typedef enum remote_procedure remote_procedure; @@ -2796,6 +2808,8 @@ extern bool_t xdr_remote_domain_snapshot_delete_args (XDR *, remote_domain_snap extern bool_t xdr_remote_domain_open_console_args (XDR *, remote_domain_open_console_args*); extern bool_t xdr_remote_storage_vol_upload_args (XDR *, remote_storage_vol_upload_args*); extern bool_t xdr_remote_storage_vol_download_args (XDR *, remote_storage_vol_download_args*); +extern bool_t xdr_remote_domain_get_state_args (XDR *, remote_domain_get_state_args*); +extern bool_t xdr_remote_domain_get_state_ret (XDR *, remote_domain_get_state_ret*); extern bool_t xdr_remote_procedure (XDR *, remote_procedure*); extern bool_t xdr_remote_message_type (XDR *, remote_message_type*); extern bool_t xdr_remote_message_status (XDR *, remote_message_status*); @@ -3153,6 +3167,8 @@ extern bool_t xdr_remote_domain_snapshot_delete_args (); extern bool_t xdr_remote_domain_open_console_args (); extern bool_t xdr_remote_storage_vol_upload_args (); extern bool_t xdr_remote_storage_vol_download_args (); +extern bool_t xdr_remote_domain_get_state_args (); +extern bool_t xdr_remote_domain_get_state_ret (); extern bool_t xdr_remote_procedure (); extern bool_t xdr_remote_message_type (); extern bool_t xdr_remote_message_status (); diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 675eccd..2f65bfd 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -1940,6 +1940,15 @@ struct remote_storage_vol_download_args { unsigned int flags; }; +struct remote_domain_get_state_args { + remote_nonnull_domain dom; +}; + +struct remote_domain_get_state_ret { + int state; + int reason; +}; + /*----- Protocol. -----*/ @@ -2176,7 +2185,8 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 206, REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207, REMOTE_PROC_STORAGE_VOL_UPLOAD = 208, - REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209 + REMOTE_PROC_STORAGE_VOL_DOWNLOAD = 209, + REMOTE_PROC_DOMAIN_GET_STATE = 210 /* * Notice how the entries are grouped in sets of 10 ? diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 944553c..84859c6 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1427,6 +1427,13 @@ struct remote_storage_vol_download_args { uint64_t length; u_int flags; }; +struct remote_domain_get_state_args { + remote_nonnull_domain dom; +}; +struct remote_domain_get_state_ret { + int state; + int reason; +}; struct remote_message_header { u_int prog; u_int vers; -- 1.7.5.rc3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list