2007-07-17 13:27:26 +00:00
|
|
|
/*
|
|
|
|
* openvz_driver.c: core driver methods for managing OpenVZ VEs
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006, 2007 Binary Karma
|
|
|
|
* Copyright (C) 2006 Shuveb Hussain
|
2007-09-03 15:37:07 +00:00
|
|
|
* Copyright (C) 2007 Anoop Joe Cyriac
|
2007-07-17 13:27:26 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
2008-02-05 19:27:37 +00:00
|
|
|
* Authors:
|
2007-09-03 15:37:07 +00:00
|
|
|
* Shuveb Hussain <shuveb@binarykarma.com>
|
|
|
|
* Anoop Joe Cyriac <anoop@binarykarma.com>
|
|
|
|
*
|
2007-07-17 13:27:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef WITH_OPENVZ
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/poll.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <strings.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <paths.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c,
qemud/remote.c, src/internal.h, src/openvz_conf.c,
src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c,
src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c,
src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c,
tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c,
tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c,
tests/xmconfigtest.c, tests/xml2sexprtest.c:
Change #include <> to #include "" for local includes.
Removed many includes from src/internal.h and put them in
the C files which actually use them.
Removed <ansidecl.h> - unused.
Added a comment around __func__.
Removed a clashing redefinition of VERSION symbol.
All limits (PATH_MAX etc) now done in src/internal.h, so we
don't need to include those headers in other files.
2007-12-05 13:56:22 +00:00
|
|
|
#include "libvirt/virterror.h"
|
2007-07-17 13:27:26 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
#include "openvz_driver.h"
|
2007-07-17 13:27:26 +00:00
|
|
|
#include "event.h"
|
|
|
|
#include "buf.h"
|
2007-07-19 16:22:40 +00:00
|
|
|
#include "util.h"
|
2007-07-17 13:27:26 +00:00
|
|
|
#include "openvz_conf.h"
|
2007-07-25 23:16:30 +00:00
|
|
|
#include "nodeinfo.h"
|
2007-07-17 13:27:26 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
#define OPENVZ_MAX_ARG 28
|
|
|
|
#define CMDBUF_LEN 1488
|
|
|
|
#define CMDOP_LEN 288
|
2007-07-17 13:27:26 +00:00
|
|
|
|
|
|
|
static virDomainPtr openvzDomainLookupByID(virConnectPtr conn, int id);
|
|
|
|
static char *openvzGetOSType(virDomainPtr dom);
|
2007-07-25 23:16:30 +00:00
|
|
|
static int openvzGetNodeInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo);
|
2007-07-17 13:27:26 +00:00
|
|
|
static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid);
|
|
|
|
static virDomainPtr openvzDomainLookupByName(virConnectPtr conn, const char *name);
|
|
|
|
static int openvzDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info);
|
|
|
|
static int openvzDomainShutdown(virDomainPtr dom);
|
|
|
|
static int openvzDomainReboot(virDomainPtr dom, unsigned int flags);
|
|
|
|
static int openvzDomainCreate(virDomainPtr dom);
|
2007-12-26 05:41:05 +00:00
|
|
|
static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
|
|
|
xmlURIPtr uri,
|
|
|
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
|
|
|
int flags ATTRIBUTE_UNUSED);
|
2007-07-17 13:27:26 +00:00
|
|
|
static int openvzClose(virConnectPtr conn);
|
|
|
|
static const char *openvzGetType(virConnectPtr conn ATTRIBUTE_UNUSED);
|
|
|
|
static int openvzListDomains(virConnectPtr conn, int *ids, int nids);
|
|
|
|
static int openvzNumDomains(virConnectPtr conn);
|
|
|
|
static int openvzListDefinedDomains(virConnectPtr conn, char **const names, int nnames);
|
|
|
|
static int openvzNumDefinedDomains(virConnectPtr conn);
|
|
|
|
static int openvzStartup(void);
|
|
|
|
static int openvzShutdown(void);
|
|
|
|
static int openvzReload(void);
|
|
|
|
static int openvzActive(void);
|
2007-09-03 15:37:07 +00:00
|
|
|
|
|
|
|
static virDomainPtr openvzDomainDefineXML(virConnectPtr conn, const char *xml);
|
2008-02-05 19:27:37 +00:00
|
|
|
static virDomainPtr openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
|
2007-09-03 15:37:07 +00:00
|
|
|
unsigned int flags ATTRIBUTE_UNUSED);
|
|
|
|
|
|
|
|
static int openvzDomainUndefine(virDomainPtr dom);
|
|
|
|
static int convCmdbufExec(char cmdbuf[], char *cmdExec[]);
|
|
|
|
static void cmdExecFree(char *cmdExec[]);
|
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
struct openvz_driver ovz_driver;
|
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
static int convCmdbufExec(char cmdbuf[], char *cmdExec[])
|
|
|
|
{
|
|
|
|
int i=0, limit = OPENVZ_MAX_ARG - 1;
|
|
|
|
char cmdWord[CMDOP_LEN];
|
|
|
|
while(*cmdbuf)
|
|
|
|
{
|
|
|
|
if(i >= limit)
|
|
|
|
{
|
|
|
|
cmdExec[i] = NULL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
sscanf(cmdbuf, "%s", cmdWord);
|
|
|
|
cmdbuf += strlen(cmdWord);
|
|
|
|
while(*cmdbuf == ' ') cmdbuf++;
|
|
|
|
cmdExec[i++] = strdup(cmdWord);
|
|
|
|
}
|
|
|
|
cmdExec[i] = NULL;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cmdExecFree(char *cmdExec[])
|
|
|
|
{
|
|
|
|
int i=-1;
|
|
|
|
while(cmdExec[++i])
|
|
|
|
{
|
|
|
|
free(cmdExec[i]);
|
|
|
|
cmdExec[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
/* For errors internal to this library. */
|
|
|
|
static void
|
|
|
|
error (virConnectPtr conn, virErrorNumber code, const char *info)
|
|
|
|
{
|
|
|
|
const char *errmsg;
|
|
|
|
|
|
|
|
errmsg = __virErrorMsg (code, info);
|
2007-11-20 10:15:38 +00:00
|
|
|
__virRaiseError (conn, NULL, NULL, VIR_FROM_OPENVZ,
|
2007-07-17 13:27:26 +00:00
|
|
|
code, VIR_ERR_ERROR, errmsg, info, NULL, 0, 0,
|
|
|
|
errmsg, info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
|
|
|
|
int id) {
|
|
|
|
struct openvz_driver *driver = (struct openvz_driver *)conn->privateData;
|
|
|
|
struct openvz_vm *vm = openvzFindVMByID(driver, id);
|
|
|
|
virDomainPtr dom;
|
|
|
|
|
|
|
|
if (!vm) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "no domain with matching id");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
dom = virGetDomain(conn, vm->vmdef->name, vm->vmdef->uuid);
|
|
|
|
if (!dom) {
|
|
|
|
error(conn, VIR_ERR_NO_MEMORY, "virDomainPtr");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
dom->id = vm->vpsid;
|
|
|
|
return dom;
|
|
|
|
}
|
|
|
|
|
2007-09-03 16:30:00 +00:00
|
|
|
static char *openvzGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED)
|
2007-07-17 13:27:26 +00:00
|
|
|
{
|
|
|
|
/* OpenVZ runs on Linux and runs only Linux */
|
2007-09-03 15:37:07 +00:00
|
|
|
return strdup("linux");
|
2007-07-17 13:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
|
|
|
|
const unsigned char *uuid) {
|
|
|
|
struct openvz_driver *driver = (struct openvz_driver *)conn->privateData;
|
|
|
|
struct openvz_vm *vm = openvzFindVMByUUID(driver, uuid);
|
|
|
|
virDomainPtr dom;
|
|
|
|
|
|
|
|
if (!vm) {
|
2007-09-03 15:37:07 +00:00
|
|
|
error(conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
|
2007-07-17 13:27:26 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
dom = virGetDomain(conn, vm->vmdef->name, vm->vmdef->uuid);
|
|
|
|
if (!dom) {
|
|
|
|
error(conn, VIR_ERR_NO_MEMORY, "virDomainPtr");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
dom->id = vm->vpsid;
|
|
|
|
return dom;
|
|
|
|
}
|
|
|
|
|
|
|
|
static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
|
|
|
|
const char *name) {
|
|
|
|
struct openvz_driver *driver = (struct openvz_driver *)conn->privateData;
|
|
|
|
struct openvz_vm *vm = openvzFindVMByName(driver, name);
|
|
|
|
virDomainPtr dom;
|
|
|
|
|
|
|
|
if (!vm) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "no domain with matching name");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
dom = virGetDomain(conn, vm->vmdef->name, vm->vmdef->uuid);
|
|
|
|
if (!dom) {
|
|
|
|
error(conn, VIR_ERR_NO_MEMORY, "virDomainPtr");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
dom->id = vm->vpsid;
|
|
|
|
return dom;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int openvzDomainGetInfo(virDomainPtr dom,
|
|
|
|
virDomainInfoPtr info) {
|
|
|
|
struct openvz_driver *driver = (struct openvz_driver *)dom->conn->privateData;
|
|
|
|
struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
|
2007-09-03 15:37:07 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
if (!vm) {
|
|
|
|
error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
info->state = vm->status;
|
|
|
|
|
|
|
|
/* TODO These need to be calculated differently for OpenVZ */
|
2008-02-05 19:27:37 +00:00
|
|
|
//info->cpuTime =
|
2007-07-17 13:27:26 +00:00
|
|
|
//info->maxMem = vm->def->maxmem;
|
|
|
|
//info->memory = vm->def->memory;
|
|
|
|
//info->nrVirtCpu = vm->def->vcpus;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int openvzDomainShutdown(virDomainPtr dom) {
|
2007-09-03 15:37:07 +00:00
|
|
|
char cmdbuf[CMDBUF_LEN];
|
2007-07-17 13:27:26 +00:00
|
|
|
int ret;
|
2007-09-03 15:37:07 +00:00
|
|
|
char *cmdExec[OPENVZ_MAX_ARG];
|
|
|
|
int pid, outfd, errfd;
|
2007-07-17 13:27:26 +00:00
|
|
|
struct openvz_driver *driver = (struct openvz_driver *)dom->conn->privateData;
|
|
|
|
struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);
|
|
|
|
|
|
|
|
if (!vm) {
|
|
|
|
error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
|
|
|
|
return -1;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
if (vm->status != VIR_DOMAIN_RUNNING) {
|
|
|
|
error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in running state");
|
|
|
|
return -1;
|
|
|
|
}
|
2007-09-03 15:37:07 +00:00
|
|
|
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " stop %d ", dom->id);
|
2008-02-05 19:27:37 +00:00
|
|
|
|
|
|
|
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
|
2007-09-03 15:37:07 +00:00
|
|
|
{
|
|
|
|
openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
|
|
|
|
goto bail_out;
|
2008-02-05 19:27:37 +00:00
|
|
|
}
|
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
|
|
|
if(ret == -1) {
|
|
|
|
error(dom->conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
2007-07-17 13:27:26 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
vm->vpsid = -1;
|
|
|
|
vm->status = VIR_DOMAIN_SHUTOFF;
|
|
|
|
ovz_driver.num_inactive ++;
|
|
|
|
ovz_driver.num_active --;
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
bail_out:
|
|
|
|
cmdExecFree(cmdExec);
|
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-09-03 16:30:00 +00:00
|
|
|
static int openvzDomainReboot(virDomainPtr dom,
|
|
|
|
unsigned int flags ATTRIBUTE_UNUSED) {
|
2007-09-03 15:37:07 +00:00
|
|
|
char cmdbuf[CMDBUF_LEN];
|
2007-07-17 13:27:26 +00:00
|
|
|
int ret;
|
2007-09-03 15:37:07 +00:00
|
|
|
char *cmdExec[OPENVZ_MAX_ARG];
|
|
|
|
int pid, outfd, errfd;
|
2007-07-17 13:27:26 +00:00
|
|
|
struct openvz_driver *driver = (struct openvz_driver *)dom->conn->privateData;
|
|
|
|
struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);
|
|
|
|
|
|
|
|
if (!vm) {
|
|
|
|
error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
|
|
|
|
return -1;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
if (vm->status != VIR_DOMAIN_RUNNING) {
|
|
|
|
error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in running state");
|
|
|
|
return -1;
|
|
|
|
}
|
2007-09-03 15:37:07 +00:00
|
|
|
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " restart %d ", dom->id);
|
2008-02-05 19:27:37 +00:00
|
|
|
|
|
|
|
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
|
2007-09-03 15:37:07 +00:00
|
|
|
{
|
|
|
|
openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
|
|
|
|
goto bail_out1;
|
|
|
|
}
|
|
|
|
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
|
|
|
if(ret == -1) {
|
|
|
|
error(dom->conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
2007-07-17 13:27:26 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
|
|
|
bail_out1:
|
2007-09-03 15:37:07 +00:00
|
|
|
cmdExecFree(cmdExec);
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
static virDomainPtr
|
|
|
|
openvzDomainDefineXML(virConnectPtr conn, const char *xml)
|
|
|
|
{
|
|
|
|
struct openvz_driver *driver = (struct openvz_driver *) conn->privateData;
|
|
|
|
struct openvz_vm_def *vmdef = NULL;
|
|
|
|
struct openvz_vm *vm = NULL;
|
|
|
|
virDomainPtr dom;
|
|
|
|
char cmdbuf[CMDBUF_LEN], cmdOption[CMDOP_LEN], *cmdExec[OPENVZ_MAX_ARG];
|
|
|
|
int ret, pid, outfd, errfd;
|
|
|
|
|
|
|
|
if (!(vmdef = openvzParseVMDef(conn, xml, NULL)))
|
|
|
|
goto bail_out2;
|
|
|
|
|
|
|
|
vm = openvzFindVMByID(driver, strtoI(vmdef->name));
|
|
|
|
if (vm) {
|
2008-02-05 19:27:37 +00:00
|
|
|
openvzLog(OPENVZ_ERR, "Already an OPENVZ VM active with the id '%s'",
|
2007-09-03 15:37:07 +00:00
|
|
|
vmdef->name);
|
|
|
|
goto bail_out2;
|
|
|
|
}
|
|
|
|
if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) {
|
|
|
|
openvzFreeVMDef(vmdef);
|
|
|
|
openvzLog(OPENVZ_ERR, "Error creating OPENVZ VM");
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " create %s", vmdef->name);
|
|
|
|
if ((vmdef->fs.tmpl && *(vmdef->fs.tmpl))) {
|
|
|
|
snprintf(cmdOption, CMDOP_LEN - 1, " --ostemplate %s", vmdef->fs.tmpl);
|
|
|
|
strcat(cmdbuf, cmdOption);
|
|
|
|
}
|
|
|
|
if ((vmdef->profile && *(vmdef->profile))) {
|
|
|
|
snprintf(cmdOption, CMDOP_LEN - 1, " --config %s", vmdef->profile);
|
|
|
|
strcat(cmdbuf, cmdOption);
|
|
|
|
}
|
|
|
|
if ((vmdef->net.ips->ip && *(vmdef->net.ips->ip))) {
|
|
|
|
snprintf(cmdOption, CMDOP_LEN - 1, " --ipadd %s", vmdef->net.ips->ip);
|
|
|
|
strcat(cmdbuf, cmdOption);
|
|
|
|
}
|
|
|
|
if ((vmdef->net.hostname && *(vmdef->net.hostname))) {
|
|
|
|
snprintf(cmdOption, CMDOP_LEN - 1, " --hostname %s", vmdef->net.hostname);
|
|
|
|
strcat(cmdbuf, cmdOption);
|
|
|
|
}
|
|
|
|
|
2008-02-05 19:27:37 +00:00
|
|
|
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
|
2007-09-03 15:37:07 +00:00
|
|
|
{
|
|
|
|
openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
|
|
|
|
goto bail_out2;
|
|
|
|
}
|
|
|
|
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
|
|
|
if(ret == -1) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
|
|
|
goto bail_out2;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
waitpid(pid, NULL, 0);
|
|
|
|
cmdExecFree(cmdExec);
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
dom = virGetDomain(conn, vm->vmdef->name, vm->vmdef->uuid);
|
|
|
|
if (dom)
|
|
|
|
dom->id = vm->vpsid;
|
|
|
|
return dom;
|
|
|
|
bail_out2:
|
|
|
|
cmdExecFree(cmdExec);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static virDomainPtr
|
|
|
|
openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
|
|
|
|
unsigned int flags ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
struct openvz_vm_def *vmdef = NULL;
|
|
|
|
struct openvz_vm *vm = NULL;
|
|
|
|
virDomainPtr dom;
|
|
|
|
struct openvz_driver *driver = (struct openvz_driver *) conn->privateData;
|
|
|
|
char cmdbuf[CMDBUF_LEN], cmdOption[CMDOP_LEN], *cmdExec[OPENVZ_MAX_ARG];
|
|
|
|
int ret, pid, outfd, errfd;
|
|
|
|
|
|
|
|
if (!(vmdef = openvzParseVMDef(conn, xml, NULL)))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
vm = openvzFindVMByID(driver, strtoI(vmdef->name));
|
|
|
|
if (vm) {
|
|
|
|
openvzFreeVMDef(vmdef);
|
2008-02-05 19:27:37 +00:00
|
|
|
openvzLog(OPENVZ_ERR, "Already an OPENVZ VM defined with the id '%d'",
|
2007-09-03 15:37:07 +00:00
|
|
|
strtoI(vmdef->name));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) {
|
|
|
|
openvzLog(OPENVZ_ERR, "Error creating OPENVZ VM");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " create %s", vmdef->name);
|
|
|
|
if ((vmdef->fs.tmpl && *(vmdef->fs.tmpl))) {
|
|
|
|
snprintf(cmdOption, CMDOP_LEN - 1, " --ostemplate %s", vmdef->fs.tmpl);
|
|
|
|
strcat(cmdbuf, cmdOption);
|
|
|
|
}
|
|
|
|
if ((vmdef->profile && *(vmdef->profile))) {
|
|
|
|
snprintf(cmdOption, CMDOP_LEN - 1, " --config %s", vmdef->profile);
|
|
|
|
strcat(cmdbuf, cmdOption);
|
|
|
|
}
|
|
|
|
if ((vmdef->net.ips->ip && *(vmdef->net.ips->ip))) {
|
|
|
|
snprintf(cmdOption, CMDOP_LEN - 1, " --ipadd %s", vmdef->net.ips->ip);
|
|
|
|
strcat(cmdbuf, cmdOption);
|
|
|
|
}
|
|
|
|
if ((vmdef->net.hostname && *(vmdef->net.hostname))) {
|
|
|
|
snprintf(cmdOption, CMDOP_LEN - 1, " --hostname %s", vmdef->net.hostname);
|
|
|
|
strcat(cmdbuf, cmdOption);
|
|
|
|
}
|
|
|
|
|
2008-02-05 19:27:37 +00:00
|
|
|
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
|
2007-09-03 15:37:07 +00:00
|
|
|
{
|
|
|
|
openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
|
|
|
|
goto bail_out3;
|
|
|
|
}
|
|
|
|
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
|
|
|
if(ret == -1) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
waitpid(pid, NULL, 0);
|
|
|
|
cmdExecFree(cmdExec);
|
|
|
|
|
|
|
|
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " start %s ", vmdef->name);
|
|
|
|
|
2008-02-05 19:27:37 +00:00
|
|
|
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
|
2007-09-03 15:37:07 +00:00
|
|
|
{
|
|
|
|
openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
|
|
|
|
goto bail_out3;
|
|
|
|
}
|
|
|
|
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
|
|
|
if(ret == -1) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
sscanf(vmdef->name, "%d", &vm->vpsid);
|
|
|
|
vm->status = VIR_DOMAIN_RUNNING;
|
|
|
|
ovz_driver.num_inactive--;
|
|
|
|
ovz_driver.num_active++;
|
|
|
|
|
|
|
|
waitpid(pid, NULL, 0);
|
|
|
|
cmdExecFree(cmdExec);
|
|
|
|
|
|
|
|
dom = virGetDomain(conn, vm->vmdef->name, vm->vmdef->uuid);
|
|
|
|
if (dom)
|
|
|
|
dom->id = vm->vpsid;
|
|
|
|
return dom;
|
|
|
|
bail_out3:
|
2008-02-05 19:27:37 +00:00
|
|
|
cmdExecFree(cmdExec);
|
2007-09-03 15:37:07 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
openvzDomainCreate(virDomainPtr dom)
|
|
|
|
{
|
|
|
|
char cmdbuf[CMDBUF_LEN];
|
2007-07-17 13:27:26 +00:00
|
|
|
int ret;
|
2007-09-03 15:37:07 +00:00
|
|
|
char *cmdExec[OPENVZ_MAX_ARG] ;
|
|
|
|
int pid, outfd, errfd;
|
2007-07-17 13:27:26 +00:00
|
|
|
struct openvz_driver *driver = (struct openvz_driver *)dom->conn->privateData;
|
2007-09-03 15:37:07 +00:00
|
|
|
struct openvz_vm *vm = openvzFindVMByName(driver, dom->name);
|
2007-07-17 13:27:26 +00:00
|
|
|
struct openvz_vm_def *vmdef;
|
|
|
|
|
|
|
|
if (!vm) {
|
|
|
|
error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
|
|
|
|
return -1;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
if (vm->status != VIR_DOMAIN_SHUTOFF) {
|
|
|
|
error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in shutoff state");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
vmdef = vm->vmdef;
|
2007-09-03 15:37:07 +00:00
|
|
|
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " start %s ", vmdef->name);
|
2008-02-05 19:27:37 +00:00
|
|
|
|
|
|
|
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
|
2007-09-03 15:37:07 +00:00
|
|
|
{
|
|
|
|
openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
|
|
|
|
goto bail_out4;
|
|
|
|
}
|
|
|
|
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
|
|
|
if(ret == -1) {
|
|
|
|
error(dom->conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
2007-07-17 13:27:26 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
|
|
|
sscanf(vmdef->name, "%d", &vm->vpsid);
|
2007-07-17 13:27:26 +00:00
|
|
|
vm->status = VIR_DOMAIN_RUNNING;
|
|
|
|
ovz_driver.num_inactive --;
|
|
|
|
ovz_driver.num_active ++;
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
waitpid(pid, NULL, 0);
|
2008-02-05 19:27:37 +00:00
|
|
|
bail_out4:
|
2007-09-03 15:37:07 +00:00
|
|
|
cmdExecFree(cmdExec);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
openvzDomainUndefine(virDomainPtr dom)
|
|
|
|
{
|
|
|
|
char cmdbuf[CMDBUF_LEN], *cmdExec[OPENVZ_MAX_ARG];
|
|
|
|
int ret, pid, outfd, errfd;
|
|
|
|
virConnectPtr conn= dom->conn;
|
|
|
|
struct openvz_driver *driver = (struct openvz_driver *) conn->privateData;
|
|
|
|
struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
|
|
|
|
|
|
|
|
if (!vm) {
|
|
|
|
error(conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
|
|
|
|
return -1;
|
|
|
|
}
|
2007-07-17 13:27:26 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
if (openvzIsActiveVM(vm)) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " destroy %s ", vm->vmdef->name);
|
2008-02-05 19:27:37 +00:00
|
|
|
|
|
|
|
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
|
2007-09-03 15:37:07 +00:00
|
|
|
{
|
|
|
|
openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
|
|
|
|
goto bail_out5;
|
|
|
|
}
|
|
|
|
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
|
|
|
|
if(ret == -1) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
|
|
|
return -1;
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-09-03 15:37:07 +00:00
|
|
|
waitpid(pid, NULL, 0);
|
|
|
|
openvzRemoveInactiveVM(driver, vm);
|
2008-02-05 19:27:37 +00:00
|
|
|
bail_out5:
|
2007-09-03 15:37:07 +00:00
|
|
|
cmdExecFree(cmdExec);
|
2007-07-17 13:27:26 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
2007-12-26 05:41:05 +00:00
|
|
|
xmlURIPtr uri,
|
|
|
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
|
|
|
int flags ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
struct openvz_vm *vms;
|
|
|
|
|
|
|
|
/*Just check if the user is root. Nothing really to open for OpenVZ */
|
|
|
|
if (getuid()) { // OpenVZ tools can only be used by r00t
|
|
|
|
return VIR_DRV_OPEN_DECLINED;
|
|
|
|
} else {
|
|
|
|
if (uri == NULL || uri->scheme == NULL || uri->path == NULL)
|
|
|
|
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;
|
|
|
|
}
|
2007-07-19 16:22:40 +00:00
|
|
|
/* See if we are running an OpenVZ enabled kernel */
|
2007-12-26 05:41:05 +00:00
|
|
|
if(access("/proc/vz/veinfo", F_OK) == -1 ||
|
|
|
|
access("/proc/user_beancounters", F_OK) == -1) {
|
|
|
|
return VIR_DRV_OPEN_DECLINED;
|
|
|
|
}
|
2007-07-17 13:27:26 +00:00
|
|
|
|
2007-12-26 05:41:05 +00:00
|
|
|
conn->privateData = &ovz_driver;
|
2007-07-17 13:27:26 +00:00
|
|
|
|
2007-12-26 05:41:05 +00:00
|
|
|
virStateInitialize();
|
|
|
|
vms = openvzGetVPSInfo(conn);
|
|
|
|
ovz_driver.vms = vms;
|
2007-07-17 13:27:26 +00:00
|
|
|
|
2007-12-26 05:41:05 +00:00
|
|
|
return VIR_DRV_OPEN_SUCCESS;
|
|
|
|
};
|
2007-07-17 13:27:26 +00:00
|
|
|
|
|
|
|
static int openvzClose(virConnectPtr conn) {
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
struct openvz_driver *driver = (struct openvz_driver *)conn->privateData;
|
|
|
|
struct openvz_vm *vm = driver->vms;
|
|
|
|
|
|
|
|
while(vm) {
|
|
|
|
openvzFreeVMDef(vm->vmdef);
|
|
|
|
vm = vm->next;
|
|
|
|
}
|
|
|
|
vm = driver->vms;
|
|
|
|
while (vm) {
|
|
|
|
struct openvz_vm *prev = vm;
|
|
|
|
vm = vm->next;
|
|
|
|
free(prev);
|
|
|
|
}
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
conn->privateData = NULL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *openvzGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
|
|
|
return strdup("OpenVZ");
|
|
|
|
}
|
|
|
|
|
2007-07-25 23:16:30 +00:00
|
|
|
static int openvzGetNodeInfo(virConnectPtr conn,
|
|
|
|
virNodeInfoPtr nodeinfo) {
|
|
|
|
return virNodeInfoPopulate(conn, nodeinfo);
|
|
|
|
}
|
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
static int openvzListDomains(virConnectPtr conn, int *ids, int nids) {
|
|
|
|
int got = 0;
|
2007-07-19 16:22:40 +00:00
|
|
|
int veid, pid, outfd, errfd;
|
|
|
|
int ret;
|
|
|
|
char buf[32];
|
|
|
|
const char *cmd[] = {VZLIST, "-ovpsid", "-H" , NULL};
|
2007-07-17 13:27:26 +00:00
|
|
|
|
2007-08-14 01:23:59 +00:00
|
|
|
ret = virExec(conn, (char **)cmd, &pid, -1, &outfd, &errfd);
|
2007-07-19 16:22:40 +00:00
|
|
|
if(ret == -1) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
2007-07-17 13:27:26 +00:00
|
|
|
return (int)NULL;
|
|
|
|
}
|
|
|
|
|
2007-07-19 16:22:40 +00:00
|
|
|
while(got < nids){
|
|
|
|
ret = openvz_readline(outfd, buf, 32);
|
|
|
|
if(!ret) break;
|
|
|
|
sscanf(buf, "%d", &veid);
|
2007-07-17 13:27:26 +00:00
|
|
|
ids[got] = veid;
|
|
|
|
got ++;
|
|
|
|
}
|
2007-07-19 16:22:40 +00:00
|
|
|
waitpid(pid, NULL, 0);
|
2007-07-17 13:27:26 +00:00
|
|
|
|
|
|
|
return got;
|
|
|
|
}
|
|
|
|
|
2007-09-03 16:30:00 +00:00
|
|
|
static int openvzNumDomains(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
2007-07-17 13:27:26 +00:00
|
|
|
return ovz_driver.num_active;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int openvzListDefinedDomains(virConnectPtr conn,
|
|
|
|
char **const names, int nnames) {
|
|
|
|
int got = 0;
|
2007-07-19 16:22:40 +00:00
|
|
|
int veid, pid, outfd, errfd, ret;
|
2007-07-17 13:27:26 +00:00
|
|
|
char vpsname[OPENVZ_NAME_MAX];
|
2007-07-19 16:22:40 +00:00
|
|
|
char buf[32];
|
2007-09-03 15:37:07 +00:00
|
|
|
const char *cmd[] = {VZLIST, "-ovpsid", "-H", "-S", NULL};
|
2007-07-17 13:27:26 +00:00
|
|
|
|
|
|
|
/* the -S options lists only stopped domains */
|
2007-08-14 01:23:59 +00:00
|
|
|
ret = virExec(conn, (char **)cmd, &pid, -1, &outfd, &errfd);
|
2007-07-19 16:22:40 +00:00
|
|
|
if(ret == -1) {
|
|
|
|
error(conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
|
2007-07-17 13:27:26 +00:00
|
|
|
return (int)NULL;
|
|
|
|
}
|
|
|
|
|
2007-07-19 16:22:40 +00:00
|
|
|
while(got < nnames){
|
|
|
|
ret = openvz_readline(outfd, buf, 32);
|
|
|
|
if(!ret) break;
|
|
|
|
sscanf(buf, "%d\n", &veid);
|
2007-07-17 13:27:26 +00:00
|
|
|
sprintf(vpsname, "%d", veid);
|
|
|
|
names[got] = strdup(vpsname);
|
|
|
|
got ++;
|
|
|
|
}
|
2007-07-19 16:22:40 +00:00
|
|
|
waitpid(pid, NULL, 0);
|
2007-07-17 13:27:26 +00:00
|
|
|
return got;
|
|
|
|
}
|
|
|
|
|
2007-09-03 16:30:00 +00:00
|
|
|
static int openvzNumDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
2008-02-05 19:27:37 +00:00
|
|
|
return ovz_driver.num_inactive;
|
2007-07-17 13:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int openvzStartup(void) {
|
|
|
|
openvzAssignUUIDs();
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-07-17 13:27:26 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int openvzShutdown(void) {
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int openvzReload(void) {
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int openvzActive(void) {
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static virDriver openvzDriver = {
|
|
|
|
VIR_DRV_OPENVZ,
|
|
|
|
"OPENVZ",
|
|
|
|
LIBVIR_VERSION_NUMBER,
|
|
|
|
openvzOpen, /* open */
|
|
|
|
openvzClose, /* close */
|
2007-09-03 15:37:07 +00:00
|
|
|
NULL, /* supports_feature */
|
2007-07-17 13:27:26 +00:00
|
|
|
openvzGetType, /* type */
|
|
|
|
NULL, /* version */
|
|
|
|
NULL, /* hostname */
|
|
|
|
NULL, /* uri */
|
|
|
|
NULL, /* getMaxVcpus */
|
2007-07-25 23:16:30 +00:00
|
|
|
openvzGetNodeInfo, /* nodeGetInfo */
|
2007-07-17 13:27:26 +00:00
|
|
|
NULL, /* getCapabilities */
|
|
|
|
openvzListDomains, /* listDomains */
|
|
|
|
openvzNumDomains, /* numOfDomains */
|
2007-09-03 15:37:07 +00:00
|
|
|
openvzDomainCreateLinux, /* domainCreateLinux */
|
2007-07-17 13:27:26 +00:00
|
|
|
openvzDomainLookupByID, /* domainLookupByID */
|
|
|
|
openvzDomainLookupByUUID, /* domainLookupByUUID */
|
|
|
|
openvzDomainLookupByName, /* domainLookupByName */
|
|
|
|
NULL, /* domainSuspend */
|
|
|
|
NULL, /* domainResume */
|
|
|
|
openvzDomainShutdown, /* domainShutdown */
|
|
|
|
openvzDomainReboot, /* domainReboot */
|
|
|
|
openvzDomainShutdown, /* domainDestroy */
|
|
|
|
openvzGetOSType, /* domainGetOSType */
|
|
|
|
NULL, /* domainGetMaxMemory */
|
|
|
|
NULL, /* domainSetMaxMemory */
|
|
|
|
NULL, /* domainSetMemory */
|
|
|
|
openvzDomainGetInfo, /* domainGetInfo */
|
|
|
|
NULL, /* domainSave */
|
|
|
|
NULL, /* domainRestore */
|
|
|
|
NULL, /* domainCoreDump */
|
|
|
|
NULL, /* domainSetVcpus */
|
|
|
|
NULL, /* domainPinVcpu */
|
|
|
|
NULL, /* domainGetVcpus */
|
|
|
|
NULL, /* domainGetMaxVcpus */
|
|
|
|
NULL, /* domainDumpXML */
|
|
|
|
openvzListDefinedDomains, /* listDomains */
|
|
|
|
openvzNumDefinedDomains, /* numOfDomains */
|
|
|
|
openvzDomainCreate, /* domainCreate */
|
2007-09-03 15:37:07 +00:00
|
|
|
openvzDomainDefineXML, /* domainDefineXML */
|
|
|
|
openvzDomainUndefine, /* domainUndefine */
|
2007-07-17 13:27:26 +00:00
|
|
|
NULL, /* domainAttachDevice */
|
|
|
|
NULL, /* domainDetachDevice */
|
|
|
|
NULL, /* domainGetAutostart */
|
|
|
|
NULL, /* domainSetAutostart */
|
|
|
|
NULL, /* domainGetSchedulerType */
|
|
|
|
NULL, /* domainGetSchedulerParameters */
|
|
|
|
NULL, /* domainSetSchedulerParameters */
|
2007-09-03 16:30:00 +00:00
|
|
|
NULL, /* domainMigratePrepare */
|
|
|
|
NULL, /* domainMigratePerform */
|
|
|
|
NULL, /* domainMigrateFinish */
|
|
|
|
NULL, /* domainBlockStats */
|
|
|
|
NULL, /* domainInterfaceStats */
|
2007-09-28 14:28:12 +00:00
|
|
|
NULL, /* nodeGetCellsFreeMemory */
|
2007-09-30 13:09:07 +00:00
|
|
|
NULL, /* nodeGetFreeMemory */
|
2007-07-17 13:27:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static virStateDriver openvzStateDriver = {
|
|
|
|
openvzStartup,
|
|
|
|
openvzShutdown,
|
|
|
|
openvzReload,
|
|
|
|
openvzActive,
|
|
|
|
};
|
|
|
|
|
|
|
|
int openvzRegister(void) {
|
|
|
|
virRegisterDriver(&openvzDriver);
|
|
|
|
virRegisterStateDriver(&openvzStateDriver);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* WITH_OPENVZ */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* c-indent-level: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 4
|
|
|
|
* End:
|
|
|
|
*/
|