diff options
author | 2010-11-15 11:23:34 +0800 | |
---|---|---|
committer | 2010-11-23 15:04:42 -0700 | |
commit | 313215e15fd53590ed48baf1a611eb3522938a68 (patch) | |
tree | 92b2323197073f356169646bce5a7cddde1dda14 | |
parent | implement public API virDomainIsUpdated (diff) | |
download | libvirt-313215e15fd53590ed48baf1a611eb3522938a68.tar.gz libvirt-313215e15fd53590ed48baf1a611eb3522938a68.tar.bz2 libvirt-313215e15fd53590ed48baf1a611eb3522938a68.zip |
implement the remote protocol
* daemon/remote.c
* daemon/remote_dispatch_args.h
* daemon/remote_dispatch_prototypes.h
* daemon/remote_dispatch_ret.h
* daemon/remote_dispatch_table.h
* src/remote/remote_driver.c
* src/remote/remote_protocol.c
* src/remote/remote_protocol.h
* src/remote/remote_protocol.x
* src/remote_protocol-structs
-rw-r--r-- | daemon/remote.c | 28 | ||||
-rw-r--r-- | daemon/remote_dispatch_args.h | 1 | ||||
-rw-r--r-- | daemon/remote_dispatch_prototypes.h | 8 | ||||
-rw-r--r-- | daemon/remote_dispatch_ret.h | 1 | ||||
-rw-r--r-- | daemon/remote_dispatch_table.h | 5 | ||||
-rw-r--r-- | src/remote/remote_driver.c | 26 | ||||
-rw-r--r-- | src/remote/remote_protocol.c | 18 | ||||
-rw-r--r-- | src/remote/remote_protocol.h | 15 | ||||
-rw-r--r-- | src/remote/remote_protocol.x | 10 | ||||
-rw-r--r-- | src/remote_protocol-structs | 6 |
10 files changed, 116 insertions, 2 deletions
diff --git a/daemon/remote.c b/daemon/remote.c index 16608156d..9dba3255c 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -5965,6 +5965,34 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT return 0; } +static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_message_header *hdr ATTRIBUTE_UNUSED, + remote_error *err, + remote_domain_is_updated_args *args, + remote_domain_is_updated_ret *ret) +{ + virDomainPtr domain; + + domain = get_nonnull_domain(conn, args->dom); + if (domain == NULL) { + remoteDispatchConnError(err, conn); + return -1; + } + + ret->updated = virDomainIsUpdated(domain); + + if (ret->updated < 0) { + virDomainFree(domain); + remoteDispatchConnError(err, conn); + return -1; + } + + virDomainFree(domain); + return 0; +} + static int remoteDispatchInterfaceIsActive(struct qemud_server *server ATTRIBUTE_UNUSED, struct qemud_client *client ATTRIBUTE_UNUSED, virConnectPtr conn, diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h index 971af8000..221af88d9 100644 --- a/daemon/remote_dispatch_args.h +++ b/daemon/remote_dispatch_args.h @@ -170,3 +170,4 @@ remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args; remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args; remote_domain_open_console_args val_remote_domain_open_console_args; + remote_domain_is_updated_args val_remote_domain_is_updated_args; diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h index 15c7ec792..4a5246f28 100644 --- a/daemon/remote_dispatch_prototypes.h +++ b/daemon/remote_dispatch_prototypes.h @@ -354,6 +354,14 @@ static int remoteDispatchDomainIsPersistent( remote_error *err, remote_domain_is_persistent_args *args, remote_domain_is_persistent_ret *ret); +static int remoteDispatchDomainIsUpdated( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_message_header *hdr, + remote_error *err, + remote_domain_is_updated_args *args, + remote_domain_is_updated_ret *ret); static int remoteDispatchDomainLookupById( struct qemud_server *server, struct qemud_client *client, diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h index 3723b003e..c01f3ba34 100644 --- a/daemon/remote_dispatch_ret.h +++ b/daemon/remote_dispatch_ret.h @@ -137,3 +137,4 @@ remote_domain_create_with_flags_ret val_remote_domain_create_with_flags_ret; remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret; remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret; + remote_domain_is_updated_ret val_remote_domain_is_updated_ret; diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h index 4cfa1b154..3e55424f5 100644 --- a/daemon/remote_dispatch_table.h +++ b/daemon/remote_dispatch_table.h @@ -1012,3 +1012,8 @@ .args_filter = (xdrproc_t) xdr_remote_domain_open_console_args, .ret_filter = (xdrproc_t) xdr_void, }, +{ /* DomainIsUpdated => 202 */ + .fn = (dispatch_fn) remoteDispatchDomainIsUpdated, + .args_filter = (xdrproc_t) xdr_remote_domain_is_updated_args, + .ret_filter = (xdrproc_t) xdr_remote_domain_is_updated_ret, +}, diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 73a0132cd..e6eb9b5d4 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1983,6 +1983,30 @@ done: return rv; } +static int +remoteDomainIsUpdated(virDomainPtr domain) +{ + int rv = -1; + remote_domain_is_updated_args args; + remote_domain_is_updated_ret ret; + struct private_data *priv = domain->conn->privateData; + + remoteDriverLock(priv); + + make_nonnull_domain (&args.dom, domain); + + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_IS_UPDATED, + (xdrproc_t) xdr_remote_domain_is_updated_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_is_updated_ret, (char *) &ret) == -1) + goto done; + + rv = ret.updated; + +done: + remoteDriverUnlock(priv); + return rv; +} + static virDomainPtr remoteDomainCreateXML (virConnectPtr conn, const char *xmlDesc, @@ -10734,7 +10758,7 @@ static virDriver remote_driver = { remoteIsSecure, /* isSecure */ remoteDomainIsActive, /* domainIsActive */ remoteDomainIsPersistent, /* domainIsPersistent */ - NULL, /* domainIsUpdated */ + remoteDomainIsUpdated, /* domainIsUpdated */ remoteCPUCompare, /* cpuCompare */ remoteCPUBaseline, /* cpuBaseline */ remoteDomainGetJobInfo, /* domainGetJobInfo */ diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c index 41f5e7d7f..6e07b70cb 100644 --- a/src/remote/remote_protocol.c +++ b/src/remote/remote_protocol.c @@ -3177,6 +3177,24 @@ xdr_remote_domain_is_persistent_ret (XDR *xdrs, remote_domain_is_persistent_ret } bool_t +xdr_remote_domain_is_updated_args (XDR *xdrs, remote_domain_is_updated_args *objp) +{ + + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_domain_is_updated_ret (XDR *xdrs, remote_domain_is_updated_ret *objp) +{ + + if (!xdr_int (xdrs, &objp->updated)) + return FALSE; + return TRUE; +} + +bool_t xdr_remote_network_is_active_args (XDR *xdrs, remote_network_is_active_args *objp) { diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h index 8dc89a50f..4240963ca 100644 --- a/src/remote/remote_protocol.h +++ b/src/remote/remote_protocol.h @@ -1801,6 +1801,16 @@ struct remote_domain_is_persistent_ret { }; typedef struct remote_domain_is_persistent_ret remote_domain_is_persistent_ret; +struct remote_domain_is_updated_args { + remote_nonnull_domain dom; +}; +typedef struct remote_domain_is_updated_args remote_domain_is_updated_args; + +struct remote_domain_is_updated_ret { + int updated; +}; +typedef struct remote_domain_is_updated_ret remote_domain_is_updated_ret; + struct remote_network_is_active_args { remote_nonnull_network net; }; @@ -2309,6 +2319,7 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199, REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200, REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201, + REMOTE_PROC_DOMAIN_IS_UPDATED = 202, }; typedef enum remote_procedure remote_procedure; @@ -2630,6 +2641,8 @@ extern bool_t xdr_remote_domain_is_active_args (XDR *, remote_domain_is_active_ extern bool_t xdr_remote_domain_is_active_ret (XDR *, remote_domain_is_active_ret*); extern bool_t xdr_remote_domain_is_persistent_args (XDR *, remote_domain_is_persistent_args*); extern bool_t xdr_remote_domain_is_persistent_ret (XDR *, remote_domain_is_persistent_ret*); +extern bool_t xdr_remote_domain_is_updated_args (XDR *, remote_domain_is_updated_args*); +extern bool_t xdr_remote_domain_is_updated_ret (XDR *, remote_domain_is_updated_ret*); extern bool_t xdr_remote_network_is_active_args (XDR *, remote_network_is_active_args*); extern bool_t xdr_remote_network_is_active_ret (XDR *, remote_network_is_active_ret*); extern bool_t xdr_remote_network_is_persistent_args (XDR *, remote_network_is_persistent_args*); @@ -2974,6 +2987,8 @@ extern bool_t xdr_remote_domain_is_active_args (); extern bool_t xdr_remote_domain_is_active_ret (); extern bool_t xdr_remote_domain_is_persistent_args (); extern bool_t xdr_remote_domain_is_persistent_ret (); +extern bool_t xdr_remote_domain_is_updated_args (); +extern bool_t xdr_remote_domain_is_updated_ret (); extern bool_t xdr_remote_network_is_active_args (); extern bool_t xdr_remote_network_is_active_ret (); extern bool_t xdr_remote_network_is_persistent_args (); diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index e84afe52c..e1981fd8b 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -1600,6 +1600,13 @@ struct remote_domain_is_persistent_ret { int persistent; }; +struct remote_domain_is_updated_args { + remote_nonnull_domain dom; +}; + +struct remote_domain_is_updated_ret { + int updated; +}; struct remote_network_is_active_args { remote_nonnull_network net; @@ -2086,7 +2093,8 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199, REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200, - REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201 + REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201, + REMOTE_PROC_DOMAIN_IS_UPDATED = 202 /* * Notice how the entries are grouped in sets of 10 ? diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 3054bbf7d..7ca968f03 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1152,6 +1152,12 @@ struct remote_domain_is_persistent_args { struct remote_domain_is_persistent_ret { int persistent; }; +struct remote_domain_is_updated_args { + remote_nonnull_domain dom; +}; +struct remote_domain_is_updated_ret { + int updated; +}; struct remote_network_is_active_args { remote_nonnull_network net; }; |