mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
* 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
This commit is contained in:
parent
15b40d295d
commit
d455b40712
@ -1,3 +1,8 @@
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user