提交 d455b407 编写于 作者: D Daniel Veillard

* src/xen_internal.c src/xen_internal.h src/xs_internal.c: fix

  a TODO in xs_internal.c pointed out by Philippe Berthault
Daniel
上级 15b40d29
Fri Jun 16 15:08:42 EDT 2006 Daniel Veillard <veillard@redhat.com>
* src/xen_internal.c src/xen_internal.h src/xs_internal.c: fix
a TODO in xs_internal.c pointed out by Philippe Berthault
Fri Jun 16 12:44:02 EDT 2006 Daniel Veillard <veillard@redhat.com>
* src/libvirt.c src/xen_internal.c src/xend_internal.c: more driver
......
......@@ -639,3 +639,52 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory)
return (-1);
return (0);
}
/**
* xenHypervisorCheckID:
* @domain: pointer to the domain block
* @info: the place where informations should be stored
*
* Do an hypervisor call to verify the domain ID is valid
*
* Returns 0 in case of success, -1 in case of error.
*/
int
xenHypervisorCheckID(virConnectPtr conn, int id)
{
dom0_op_t op;
dom0_getdomaininfo_t dominfo;
int ret;
if ((conn->handle < 0) || (id < 0))
return (-1);
memset(&dominfo, 0, sizeof(dom0_getdomaininfo_t));
if (mlock(&dominfo, sizeof(dom0_getdomaininfo_t)) < 0) {
virXenError(VIR_ERR_XEN_CALL, " locking",
sizeof(dom0_getdomaininfo_t));
return (-1);
}
op.cmd = DOM0_GETDOMAININFOLIST;
op.u.getdomaininfolist.first_domain = (domid_t) id;
op.u.getdomaininfolist.max_domains = 1;
op.u.getdomaininfolist.buffer = &dominfo;
op.u.getdomaininfolist.num_domains = 1;
dominfo.domain = id;
ret = xenHypervisorDoOp(conn->handle, &op);
if (munlock(&dominfo, sizeof(dom0_getdomaininfo_t)) < 0) {
virXenError(VIR_ERR_XEN_CALL, " release",
sizeof(dom0_getdomaininfo_t));
ret = -1;
}
if (ret < 0)
return (-1);
return (0);
}
......@@ -36,7 +36,8 @@ int xenHypervisorGetDomainInfo (virDomainPtr domain,
virDomainInfoPtr info);
int xenHypervisorSetMaxMemory (virDomainPtr domain,
unsigned long memory);
int xenHypervisorCheckID (virConnectPtr conn,
int id);
#ifdef __cplusplus
}
#endif
......
......@@ -27,6 +27,7 @@
#include "internal.h"
#include "driver.h"
#include "xs_internal.h"
#include "xen_internal.h" /* for xenHypervisorCheckID */
#define XEN_HYPERVISOR_SOCKET "/proc/xen/privcmd"
......@@ -256,16 +257,11 @@ static int
virConnectCheckStoreID(virConnectPtr conn, int id)
{
if (conn->handle >= 0) {
TODO
/*
dom0_getdomaininfo_t dominfo;
int tmp;
dominfo.domain = id;
tmp = xenHypervisorGetDomainInfo(conn->handle, id, &dominfo);
tmp = xenHypervisorCheckID(conn, id);
if (tmp < 0)
return (-1);
*/
}
return (0);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册