2011-02-10 15:42:34 -07:00
|
|
|
/*---------------------------------------------------------------------------*/
|
2013-01-21 10:09:05 -07:00
|
|
|
/* Copyright (C) 2011-2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2011-05-30 11:53:02 +02:00
|
|
|
* Copyright (C) 2011 Univention GmbH.
|
2011-02-10 15:42:34 -07: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
|
2012-09-20 16:30:55 -06:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 18:06:23 +08:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2011-03-29 20:24:05 +08:00
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Jim Fehlig <jfehlig@novell.com>
|
2011-05-30 11:53:02 +02:00
|
|
|
* Markus Groß <gross@univention.de>
|
2011-02-10 15:42:34 -07:00
|
|
|
*/
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#ifndef LIBXL_CONF_H
|
|
|
|
# define LIBXL_CONF_H
|
|
|
|
|
|
|
|
# include <config.h>
|
|
|
|
|
|
|
|
# include <libxl.h>
|
|
|
|
|
|
|
|
# include "internal.h"
|
|
|
|
# include "domain_conf.h"
|
2011-03-29 20:18:24 +08:00
|
|
|
# include "domain_event.h"
|
2011-02-10 15:42:34 -07:00
|
|
|
# include "capabilities.h"
|
|
|
|
# include "configmake.h"
|
2013-01-11 12:09:53 +00:00
|
|
|
# include "virportallocator.h"
|
2013-01-21 10:09:05 -07:00
|
|
|
# include "virobject.h"
|
2011-02-10 15:42:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
# define LIBXL_VNC_PORT_MIN 5900
|
|
|
|
# define LIBXL_VNC_PORT_MAX 65535
|
|
|
|
|
|
|
|
# define LIBXL_CONFIG_DIR SYSCONFDIR "/libvirt/libxl"
|
|
|
|
# define LIBXL_AUTOSTART_DIR LIBXL_CONFIG_DIR "/autostart"
|
|
|
|
# define LIBXL_STATE_DIR LOCALSTATEDIR "/run/libvirt/libxl"
|
|
|
|
# define LIBXL_LOG_DIR LOCALSTATEDIR "/log/libvirt/libxl"
|
|
|
|
# define LIBXL_LIB_DIR LOCALSTATEDIR "/lib/libvirt/libxl"
|
|
|
|
# define LIBXL_SAVE_DIR LIBXL_LIB_DIR "/save"
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _libxlDriverPrivate libxlDriverPrivate;
|
|
|
|
typedef libxlDriverPrivate *libxlDriverPrivatePtr;
|
|
|
|
struct _libxlDriverPrivate {
|
|
|
|
virMutex lock;
|
|
|
|
virCapsPtr caps;
|
2013-03-31 20:03:42 +02:00
|
|
|
virDomainXMLOptionPtr xmlopt;
|
2011-02-10 15:42:34 -07:00
|
|
|
unsigned int version;
|
|
|
|
|
|
|
|
FILE *logger_file;
|
|
|
|
xentoollog_logger *logger;
|
|
|
|
/* libxl ctx for driver wide ops; getVersion, getNodeInfo, ... */
|
2012-11-26 09:28:56 -07:00
|
|
|
libxl_ctx *ctx;
|
2011-02-10 15:42:34 -07:00
|
|
|
|
2013-01-11 12:09:53 +00:00
|
|
|
virPortAllocatorPtr reservedVNCPorts;
|
2012-10-31 19:03:55 +00:00
|
|
|
|
|
|
|
size_t nactive;
|
|
|
|
virStateInhibitCallback inhibitCallback;
|
|
|
|
void *inhibitOpaque;
|
|
|
|
|
2013-01-11 16:04:47 +00:00
|
|
|
virDomainObjListPtr domains;
|
2011-02-10 15:42:34 -07:00
|
|
|
|
2011-05-12 10:47:08 -04:00
|
|
|
virDomainEventStatePtr domainEventState;
|
2011-03-29 20:18:24 +08:00
|
|
|
|
2011-02-10 15:42:34 -07:00
|
|
|
char *configDir;
|
|
|
|
char *autostartDir;
|
|
|
|
char *logDir;
|
|
|
|
char *stateDir;
|
|
|
|
char *libDir;
|
|
|
|
char *saveDir;
|
|
|
|
};
|
|
|
|
|
2013-01-21 10:30:29 -07:00
|
|
|
typedef struct _libxlEventHookInfo libxlEventHookInfo;
|
|
|
|
typedef libxlEventHookInfo *libxlEventHookInfoPtr;
|
|
|
|
|
2011-02-10 15:42:34 -07:00
|
|
|
typedef struct _libxlDomainObjPrivate libxlDomainObjPrivate;
|
|
|
|
typedef libxlDomainObjPrivate *libxlDomainObjPrivatePtr;
|
|
|
|
struct _libxlDomainObjPrivate {
|
2013-01-21 10:09:05 -07:00
|
|
|
virObjectLockable parent;
|
|
|
|
|
2011-02-10 15:42:34 -07:00
|
|
|
/* per domain libxl ctx */
|
2012-11-26 09:28:56 -07:00
|
|
|
libxl_ctx *ctx;
|
|
|
|
libxl_evgen_domain_death *deathW;
|
2013-01-21 10:30:29 -07:00
|
|
|
|
|
|
|
/* list of libxl timeout registrations */
|
|
|
|
libxlEventHookInfoPtr timerRegistrations;
|
2011-02-10 15:42:34 -07:00
|
|
|
};
|
|
|
|
|
2011-05-30 11:53:02 +02:00
|
|
|
# define LIBXL_SAVE_MAGIC "libvirt-xml\n \0 \r"
|
|
|
|
# define LIBXL_SAVE_VERSION 1
|
|
|
|
|
|
|
|
typedef struct _libxlSavefileHeader libxlSavefileHeader;
|
|
|
|
typedef libxlSavefileHeader *libxlSavefileHeaderPtr;
|
|
|
|
struct _libxlSavefileHeader {
|
|
|
|
char magic[sizeof(LIBXL_SAVE_MAGIC)-1];
|
|
|
|
uint32_t version;
|
|
|
|
uint32_t xmlLen;
|
|
|
|
/* 24 bytes used, pad up to 64 bytes */
|
|
|
|
uint32_t unused[10];
|
|
|
|
};
|
2011-02-10 15:42:34 -07:00
|
|
|
|
|
|
|
virCapsPtr
|
|
|
|
libxlMakeCapabilities(libxl_ctx *ctx);
|
|
|
|
|
2011-05-26 23:09:01 +08:00
|
|
|
int
|
2012-11-26 09:28:56 -07:00
|
|
|
libxlMakeDisk(virDomainDiskDefPtr l_dev, libxl_device_disk *x_dev);
|
2011-05-26 23:09:01 +08:00
|
|
|
int
|
2012-11-26 09:28:56 -07:00
|
|
|
libxlMakeNic(virDomainNetDefPtr l_nic, libxl_device_nic *x_nic);
|
2011-05-26 23:09:01 +08:00
|
|
|
int
|
2012-11-26 09:28:56 -07:00
|
|
|
libxlMakeVfb(libxlDriverPrivatePtr driver,
|
2011-05-30 11:53:00 +02:00
|
|
|
virDomainGraphicsDefPtr l_vfb, libxl_device_vfb *x_vfb);
|
2011-05-26 23:09:01 +08:00
|
|
|
|
2011-02-10 15:42:34 -07:00
|
|
|
int
|
|
|
|
libxlBuildDomainConfig(libxlDriverPrivatePtr driver,
|
|
|
|
virDomainDefPtr def, libxl_domain_config *d_config);
|
|
|
|
|
|
|
|
#endif /* LIBXL_CONF_H */
|