mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
* src/openvz.c: patch from Mikhail Pokidko to fix the OpenVZ
compilation error #426385 Daniel
This commit is contained in:
parent
52601c33ab
commit
7b40fcd11f
@ -1,3 +1,8 @@
|
|||||||
|
Wed Dec 26 06:38:53 CET 2007 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/openvz.c: patch from Mikhail Pokidko to fix the OpenVZ
|
||||||
|
compilation error #426385
|
||||||
|
|
||||||
Tue Dec 18 00:18:33 CET 2007 Daniel Veillard <veillard@redhat.com>
|
Tue Dec 18 00:18:33 CET 2007 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* configure.in docs/libvir.html docs/news.html po/*:
|
* configure.in docs/libvir.html docs/news.html po/*:
|
||||||
|
@ -72,9 +72,10 @@ static int openvzDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info);
|
|||||||
static int openvzDomainShutdown(virDomainPtr dom);
|
static int openvzDomainShutdown(virDomainPtr dom);
|
||||||
static int openvzDomainReboot(virDomainPtr dom, unsigned int flags);
|
static int openvzDomainReboot(virDomainPtr dom, unsigned int flags);
|
||||||
static int openvzDomainCreate(virDomainPtr dom);
|
static int openvzDomainCreate(virDomainPtr dom);
|
||||||
static virDrvOpenStatus openvzOpen(virConnectPtr conn, const char *name,
|
static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
||||||
int flags ATTRIBUTE_UNUSED);
|
xmlURIPtr uri,
|
||||||
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
|
int flags ATTRIBUTE_UNUSED);
|
||||||
static int openvzClose(virConnectPtr conn);
|
static int openvzClose(virConnectPtr conn);
|
||||||
static const char *openvzGetType(virConnectPtr conn ATTRIBUTE_UNUSED);
|
static const char *openvzGetType(virConnectPtr conn ATTRIBUTE_UNUSED);
|
||||||
static int openvzListDomains(virConnectPtr conn, int *ids, int nids);
|
static int openvzListDomains(virConnectPtr conn, int *ids, int nids);
|
||||||
@ -554,35 +555,37 @@ bail_out5:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
||||||
const char *name,
|
xmlURIPtr uri,
|
||||||
int *credtype ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
int ncredtype ATTRIBUTE_UNUSED,
|
int flags ATTRIBUTE_UNUSED)
|
||||||
virConnectAuthCallbackPtr cb ATTRIBUTE_UNUSED,
|
{
|
||||||
void *cbdata ATTRIBUTE_UNUSED,
|
struct openvz_vm *vms;
|
||||||
int flags ATTRIBUTE_UNUSED) {
|
|
||||||
struct openvz_vm *vms;
|
|
||||||
|
|
||||||
/* Just check if the guy is root. Nothing really to open for OpenVZ */
|
/*Just check if the user is root. Nothing really to open for OpenVZ */
|
||||||
if (getuid()) { // OpenVZ tools can only be used by r00t
|
if (getuid()) { // OpenVZ tools can only be used by r00t
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (strcmp(name, "openvz:///system"))
|
if (uri == NULL || uri->scheme == NULL || uri->path == NULL)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
if (STRNEQ (uri->scheme, "openvz"))
|
||||||
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
if (STRNEQ (uri->path, "/system"))
|
||||||
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
}
|
||||||
/* See if we are running an OpenVZ enabled kernel */
|
/* See if we are running an OpenVZ enabled kernel */
|
||||||
if(access("/proc/vz/veinfo", F_OK) == -1 ||
|
if(access("/proc/vz/veinfo", F_OK) == -1 ||
|
||||||
access("/proc/user_beancounters", F_OK) == -1) {
|
access("/proc/user_beancounters", F_OK) == -1) {
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->privateData = &ovz_driver;
|
conn->privateData = &ovz_driver;
|
||||||
|
|
||||||
virStateInitialize();
|
virStateInitialize();
|
||||||
vms = openvzGetVPSInfo(conn);
|
vms = openvzGetVPSInfo(conn);
|
||||||
ovz_driver.vms = vms;
|
ovz_driver.vms = vms;
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
}
|
};
|
||||||
|
|
||||||
static int openvzClose(virConnectPtr conn) {
|
static int openvzClose(virConnectPtr conn) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user