1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

* proxy/libvirt_proxy.c src/proxy_internal.[ch] src/xend_internal.[ch]:

finished the last entry point missing for the proxy code.
Daniel
This commit is contained in:
Daniel Veillard 2006-07-03 11:12:12 +00:00
parent f14093e509
commit 5995e2428c
6 changed files with 54 additions and 7 deletions

View File

@ -1,3 +1,8 @@
Mon Jul 3 11:21:10 EDT 2006 Daniel Veillard <veillard@redhat.com>
* proxy/libvirt_proxy.c src/proxy_internal.[ch] src/xend_internal.[ch]:
finished the last entry point missing for the proxy code.
Fri Jun 30 16:31:47 EDT 2006 Daniel Veillard <veillard@redhat.com>
* proxy/libvirt_proxy.c src/proxy_internal.c: more bug fixes,

View File

@ -560,8 +560,22 @@ retry2:
break;
}
case VIR_PROXY_NODE_INFO:
TODO;
req->data.arg = -1;
if (req->len != sizeof(virProxyPacket))
goto comm_error;
/*
* Hum, could we expect those informations to be unmutable and
* cache them ? Since it's probably an unfrequent call better
* not make assumption and do the xend RPC each call.
*/
ret = xenDaemonNodeGetInfo(conn, &request.extra.ninfo);
if (ret < 0) {
req->data.arg = -1;
req->len = sizeof(virProxyPacket);
} else {
req->data.arg = 0;
req->len = sizeof(virProxyPacket) + sizeof(virNodeInfo);
}
break;
default:
goto comm_error;

View File

@ -49,7 +49,7 @@ static virDriver xenProxyDriver = {
xenProxyClose, /* close */
NULL, /* type */
xenProxyGetVersion, /* version */
NULL, /* nodeGetInfo */
xenProxyNodeGetInfo, /* nodeGetInfo */
xenProxyListDomains, /* listDomains */
xenProxyNumOfDomains, /* numOfDomains */
NULL, /* domainCreateLinux */
@ -889,7 +889,34 @@ xenProxyDomainLookupByName(virConnectPtr conn, const char *name)
*/
static int
xenProxyNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
TODO
return(-1);
virProxyPacket req;
virProxyFullPacket ans;
int ret;
if (!VIR_IS_CONNECT(conn)) {
virProxyError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if (info == NULL) {
virProxyError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
memset(&req, 0, sizeof(req));
req.command = VIR_PROXY_NODE_INFO;
req.data.arg = 0;
req.len = sizeof(req);
ret = xenProxyCommand(conn, &req, &ans);
if (ret < 0) {
xenProxyClose(conn);
return(-1);
}
if (ans.data.arg == -1) {
return(-1);
}
if (ans.len != sizeof(virProxyPacket) + sizeof(virNodeInfo)) {
return(-1);
}
memcpy(info, &ans.extra.ninfo, sizeof(virNodeInfo));
return(0);
}

View File

@ -77,6 +77,7 @@ struct _virProxyFullPacket {
char str[4080]; /* extra char array */
int arg[1020]; /* extra int array */
virDomainInfo dinfo; /* domain informations */
virNodeInfo ninfo; /* node informations */
} extra;
};
typedef struct _virProxyFullPacket virProxyFullPacket;

View File

@ -37,7 +37,6 @@
#include "xen_internal.h" /* for DOM0_INTERFACE_VERSION */
static const char * xenDaemonGetType(virConnectPtr conn);
static int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
static int xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids);
static int xenDaemonNumOfDomains(virConnectPtr conn);
static virDomainPtr xenDaemonLookupByID(virConnectPtr conn, int id);
@ -2072,7 +2071,7 @@ error:
*
* Returns 0 in case of success and -1 in case of failure.
*/
static int
int
xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
int ret = -1;
struct sexpr *root;

View File

@ -601,6 +601,7 @@ void xenDaemonRegister(void);
int xenDaemonOpen(virConnectPtr conn, const char *name, int flags);
int xenDaemonClose(virConnectPtr conn);
int xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer);
int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
int xenDaemonDomainSuspend(virDomainPtr domain);
int xenDaemonDomainResume(virDomainPtr domain);
int xenDaemonDomainShutdown(virDomainPtr domain);