2008-07-11 16:23:36 +00:00
|
|
|
/*
|
|
|
|
* domain_conf.h: domain XML processing
|
|
|
|
*
|
domain_conf: split source data out from ChrDef
This opens up the possibility of reusing the smaller ChrSourceDef
for both qemu monitor and a passthrough smartcard device.
* src/conf/domain_conf.h (_virDomainChrDef): Factor host
details...
(_virDomainChrSourceDef): ...into new struct.
(virDomainChrSourceDefFree): New prototype.
* src/conf/domain_conf.c (virDomainChrDefFree)
(virDomainChrDefParseXML, virDomainChrDefFormat): Split...
(virDomainChrSourceDefClear, virDomainChrSourceDefFree)
(virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
...into new functions.
(virDomainChrDefParseTargetXML): Update clients to reflect type
split.
* src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
(virVMXFormatSerial, virVMXFormatParallel): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
* src/xen/xend_internal.c (xenDaemonParseSxprChar)
(xenDaemonFormatSxprChr): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
(vboxAttachParallel): Likewise.
* src/security/security_dac.c (virSecurityDACSetChardevLabel)
(virSecurityDACSetChardevCallback)
(virSecurityDACRestoreChardevLabel)
(virSecurityDACRestoreChardevCallback): Likewise.
* src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback)
(SELinuxRestoreSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback): Likewise.
* src/security/virt-aa-helper.c (get_files): Likewise.
* src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
Likewise.
* src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
* src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
(umlDomainOpenConsole): Likewise.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildChrArgStr, qemuBuildCommandLine)
(qemuParseCommandLineChr): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
(qemuDomainObjPrivateXMLParse): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
(qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
(qemuPrepareMonitorChr, qemudShutdownVMDaemon)
(qemuDomainOpenConsole): Likewise.
* src/qemu/qemu_command.h (qemuBuildChrChardevStr)
(qemuBuildChrArgStr): Delete, now that they are static.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): Update list.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
tests.
2011-01-07 22:45:01 +00:00
|
|
|
* Copyright (C) 2006-2011 Red Hat, Inc.
|
2008-07-11 16:23:36 +00:00
|
|
|
* Copyright (C) 2006-2008 Daniel P. Berrange
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DOMAIN_CONF_H
|
2010-03-09 18:22:22 +00:00
|
|
|
# define __DOMAIN_CONF_H
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include <libxml/parser.h>
|
|
|
|
# include <libxml/tree.h>
|
|
|
|
# include <libxml/xpath.h>
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
|
|
|
# include "capabilities.h"
|
|
|
|
# include "storage_encryption_conf.h"
|
|
|
|
# include "cpu_conf.h"
|
|
|
|
# include "util.h"
|
|
|
|
# include "threads.h"
|
|
|
|
# include "hash.h"
|
|
|
|
# include "network.h"
|
2010-03-25 17:46:07 +00:00
|
|
|
# include "nwfilter_params.h"
|
|
|
|
# include "nwfilter_conf.h"
|
2010-05-25 21:37:00 +00:00
|
|
|
# include "macvtap.h"
|
2010-11-05 14:22:13 +00:00
|
|
|
# include "sysinfo.h"
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2009-07-17 21:08:33 +00:00
|
|
|
/* Private component of virDomainXMLFlags */
|
|
|
|
typedef enum {
|
|
|
|
VIR_DOMAIN_XML_INTERNAL_STATUS = (1<<16), /* dump internal domain status information */
|
|
|
|
} virDomainXMLInternalFlags;
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* Different types of hypervisor */
|
|
|
|
/* NB: Keep in sync with virDomainVirtTypeToString impl */
|
|
|
|
enum virDomainVirtType {
|
|
|
|
VIR_DOMAIN_VIRT_QEMU,
|
|
|
|
VIR_DOMAIN_VIRT_KQEMU,
|
|
|
|
VIR_DOMAIN_VIRT_KVM,
|
|
|
|
VIR_DOMAIN_VIRT_XEN,
|
|
|
|
VIR_DOMAIN_VIRT_LXC,
|
|
|
|
VIR_DOMAIN_VIRT_UML,
|
|
|
|
VIR_DOMAIN_VIRT_OPENVZ,
|
|
|
|
VIR_DOMAIN_VIRT_VSERVER,
|
|
|
|
VIR_DOMAIN_VIRT_LDOM,
|
|
|
|
VIR_DOMAIN_VIRT_TEST,
|
|
|
|
VIR_DOMAIN_VIRT_VMWARE,
|
|
|
|
VIR_DOMAIN_VIRT_HYPERV,
|
2009-04-17 16:09:07 +00:00
|
|
|
VIR_DOMAIN_VIRT_VBOX,
|
2009-05-25 11:56:00 +00:00
|
|
|
VIR_DOMAIN_VIRT_ONE,
|
2009-07-24 14:17:06 +00:00
|
|
|
VIR_DOMAIN_VIRT_PHYP,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_VIRT_LAST,
|
|
|
|
};
|
|
|
|
|
2009-11-30 18:35:58 +00:00
|
|
|
enum virDomainDeviceAddressType {
|
|
|
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
|
|
|
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
|
2009-12-01 16:56:24 +00:00
|
|
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE,
|
2010-02-18 16:52:03 +00:00
|
|
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL,
|
2011-01-10 16:41:33 +00:00
|
|
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID,
|
2009-11-30 18:35:58 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainDevicePCIAddress virDomainDevicePCIAddress;
|
|
|
|
typedef virDomainDevicePCIAddress *virDomainDevicePCIAddressPtr;
|
|
|
|
struct _virDomainDevicePCIAddress {
|
|
|
|
unsigned int domain;
|
|
|
|
unsigned int bus;
|
|
|
|
unsigned int slot;
|
|
|
|
unsigned int function;
|
|
|
|
};
|
|
|
|
|
2009-12-01 16:56:24 +00:00
|
|
|
typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
|
|
|
|
typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
|
|
|
|
struct _virDomainDeviceDriveAddress {
|
|
|
|
unsigned int controller;
|
|
|
|
unsigned int bus;
|
|
|
|
unsigned int unit;
|
|
|
|
};
|
|
|
|
|
2010-02-18 16:52:03 +00:00
|
|
|
typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress;
|
|
|
|
typedef virDomainDeviceVirtioSerialAddress *virDomainDeviceVirtioSerialAddressPtr;
|
|
|
|
struct _virDomainDeviceVirtioSerialAddress {
|
|
|
|
unsigned int controller;
|
|
|
|
unsigned int bus;
|
2010-06-02 15:58:39 +00:00
|
|
|
unsigned int port;
|
2010-02-18 16:52:03 +00:00
|
|
|
};
|
|
|
|
|
2011-01-10 16:41:33 +00:00
|
|
|
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
|
|
|
|
typedef virDomainDeviceCcidAddress *virDomainDeviceCcidAddressPtr;
|
|
|
|
struct _virDomainDeviceCcidAddress {
|
|
|
|
unsigned int controller;
|
|
|
|
unsigned int slot;
|
|
|
|
};
|
|
|
|
|
2009-11-30 18:35:58 +00:00
|
|
|
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
|
|
|
|
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
|
|
|
|
struct _virDomainDeviceInfo {
|
2010-01-08 15:53:53 +00:00
|
|
|
char *alias;
|
2009-11-30 18:35:58 +00:00
|
|
|
int type;
|
|
|
|
union {
|
|
|
|
virDomainDevicePCIAddress pci;
|
2009-12-01 16:56:24 +00:00
|
|
|
virDomainDeviceDriveAddress drive;
|
2010-02-18 16:52:03 +00:00
|
|
|
virDomainDeviceVirtioSerialAddress vioserial;
|
2011-01-10 16:41:33 +00:00
|
|
|
virDomainDeviceCcidAddress ccid;
|
2009-11-30 18:35:58 +00:00
|
|
|
} addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* Two types of disk backends */
|
|
|
|
enum virDomainDiskType {
|
|
|
|
VIR_DOMAIN_DISK_TYPE_BLOCK,
|
|
|
|
VIR_DOMAIN_DISK_TYPE_FILE,
|
2009-11-16 18:08:29 +00:00
|
|
|
VIR_DOMAIN_DISK_TYPE_DIR,
|
2010-12-06 07:24:09 +00:00
|
|
|
VIR_DOMAIN_DISK_TYPE_NETWORK,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_DISK_TYPE_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Three types of disk frontend */
|
|
|
|
enum virDomainDiskDevice {
|
|
|
|
VIR_DOMAIN_DISK_DEVICE_DISK,
|
|
|
|
VIR_DOMAIN_DISK_DEVICE_CDROM,
|
|
|
|
VIR_DOMAIN_DISK_DEVICE_FLOPPY,
|
|
|
|
|
|
|
|
VIR_DOMAIN_DISK_DEVICE_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainDiskBus {
|
|
|
|
VIR_DOMAIN_DISK_BUS_IDE,
|
|
|
|
VIR_DOMAIN_DISK_BUS_FDC,
|
|
|
|
VIR_DOMAIN_DISK_BUS_SCSI,
|
|
|
|
VIR_DOMAIN_DISK_BUS_VIRTIO,
|
|
|
|
VIR_DOMAIN_DISK_BUS_XEN,
|
2008-08-08 15:03:00 +00:00
|
|
|
VIR_DOMAIN_DISK_BUS_USB,
|
2008-11-19 16:58:23 +00:00
|
|
|
VIR_DOMAIN_DISK_BUS_UML,
|
2009-11-12 14:45:18 +00:00
|
|
|
VIR_DOMAIN_DISK_BUS_SATA,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_DISK_BUS_LAST
|
|
|
|
};
|
|
|
|
|
2009-01-30 17:15:39 +00:00
|
|
|
enum virDomainDiskCache {
|
|
|
|
VIR_DOMAIN_DISK_CACHE_DEFAULT,
|
|
|
|
VIR_DOMAIN_DISK_CACHE_DISABLE,
|
|
|
|
VIR_DOMAIN_DISK_CACHE_WRITETHRU,
|
|
|
|
VIR_DOMAIN_DISK_CACHE_WRITEBACK,
|
|
|
|
|
|
|
|
VIR_DOMAIN_DISK_CACHE_LAST
|
|
|
|
};
|
|
|
|
|
2010-03-24 15:32:10 +00:00
|
|
|
enum virDomainDiskErrorPolicy {
|
|
|
|
VIR_DOMAIN_DISK_ERROR_POLICY_DEFAULT,
|
|
|
|
VIR_DOMAIN_DISK_ERROR_POLICY_STOP,
|
|
|
|
VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE,
|
2010-04-08 20:05:50 +00:00
|
|
|
VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE,
|
2010-03-24 15:32:10 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_DISK_ERROR_POLICY_LAST
|
|
|
|
};
|
|
|
|
|
2010-12-06 07:24:09 +00:00
|
|
|
enum virDomainDiskProtocol {
|
|
|
|
VIR_DOMAIN_DISK_PROTOCOL_NBD,
|
|
|
|
VIR_DOMAIN_DISK_PROTOCOL_RBD,
|
|
|
|
VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG,
|
|
|
|
|
|
|
|
VIR_DOMAIN_DISK_PROTOCOL_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainDiskHostDef virDomainDiskHostDef;
|
|
|
|
typedef virDomainDiskHostDef *virDomainDiskHostDefPtr;
|
|
|
|
struct _virDomainDiskHostDef {
|
|
|
|
char *name;
|
|
|
|
char *port;
|
|
|
|
};
|
|
|
|
|
2010-04-21 14:28:21 +00:00
|
|
|
enum virDomainDiskIo {
|
|
|
|
VIR_DOMAIN_DISK_IO_DEFAULT,
|
|
|
|
VIR_DOMAIN_DISK_IO_NATIVE,
|
|
|
|
VIR_DOMAIN_DISK_IO_THREADS,
|
|
|
|
|
|
|
|
VIR_DOMAIN_DISK_IO_LAST
|
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* Stores the virtual disk configuration */
|
|
|
|
typedef struct _virDomainDiskDef virDomainDiskDef;
|
|
|
|
typedef virDomainDiskDef *virDomainDiskDefPtr;
|
|
|
|
struct _virDomainDiskDef {
|
|
|
|
int type;
|
|
|
|
int device;
|
|
|
|
int bus;
|
|
|
|
char *src;
|
|
|
|
char *dst;
|
2010-12-06 07:24:09 +00:00
|
|
|
int protocol;
|
|
|
|
int nhosts;
|
|
|
|
virDomainDiskHostDefPtr hosts;
|
2008-07-11 16:23:36 +00:00
|
|
|
char *driverName;
|
|
|
|
char *driverType;
|
2009-08-14 11:22:01 +00:00
|
|
|
char *serial;
|
2009-01-30 17:15:39 +00:00
|
|
|
int cachemode;
|
2010-03-24 15:32:10 +00:00
|
|
|
int error_policy;
|
2011-01-12 14:19:34 +00:00
|
|
|
int bootIndex;
|
2010-04-21 14:28:21 +00:00
|
|
|
int iomode;
|
2008-07-11 16:23:36 +00:00
|
|
|
unsigned int readonly : 1;
|
|
|
|
unsigned int shared : 1;
|
2009-11-30 18:35:58 +00:00
|
|
|
virDomainDeviceInfo info;
|
2009-07-21 05:23:03 +00:00
|
|
|
virStorageEncryptionPtr encryption;
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-12-02 19:15:38 +00:00
|
|
|
enum virDomainControllerType {
|
|
|
|
VIR_DOMAIN_CONTROLLER_TYPE_IDE,
|
|
|
|
VIR_DOMAIN_CONTROLLER_TYPE_FDC,
|
|
|
|
VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
|
|
|
|
VIR_DOMAIN_CONTROLLER_TYPE_SATA,
|
2010-02-18 16:52:03 +00:00
|
|
|
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
|
2011-01-10 16:41:33 +00:00
|
|
|
VIR_DOMAIN_CONTROLLER_TYPE_CCID,
|
2009-12-02 19:15:38 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_CONTROLLER_TYPE_LAST
|
|
|
|
};
|
|
|
|
|
2010-06-17 14:39:50 +00:00
|
|
|
|
|
|
|
enum virDomainControllerModel {
|
2010-07-06 17:02:48 +00:00
|
|
|
VIR_DOMAIN_CONTROLLER_MODEL_AUTO,
|
2010-06-17 14:39:50 +00:00
|
|
|
VIR_DOMAIN_CONTROLLER_MODEL_BUSLOGIC,
|
|
|
|
VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC,
|
|
|
|
VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068,
|
2010-06-24 14:58:54 +00:00
|
|
|
VIR_DOMAIN_CONTROLLER_MODEL_VMPVSCSI,
|
2010-06-17 14:39:50 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_CONTROLLER_MODEL_LAST
|
|
|
|
};
|
|
|
|
|
2010-02-18 16:52:03 +00:00
|
|
|
typedef struct _virDomainVirtioSerialOpts virDomainVirtioSerialOpts;
|
|
|
|
typedef virDomainVirtioSerialOpts *virDomainVirtioSerialOptsPtr;
|
|
|
|
struct _virDomainVirtioSerialOpts {
|
|
|
|
int ports; /* -1 == undef */
|
|
|
|
int vectors; /* -1 == undef */
|
|
|
|
};
|
|
|
|
|
2009-12-02 19:15:38 +00:00
|
|
|
/* Stores the virtual disk controller configuration */
|
|
|
|
typedef struct _virDomainControllerDef virDomainControllerDef;
|
|
|
|
typedef virDomainControllerDef *virDomainControllerDefPtr;
|
|
|
|
struct _virDomainControllerDef {
|
|
|
|
int type;
|
|
|
|
int idx;
|
2010-06-17 14:39:50 +00:00
|
|
|
int model; /* -1 == undef */
|
2010-02-18 16:52:03 +00:00
|
|
|
union {
|
|
|
|
virDomainVirtioSerialOpts vioserial;
|
|
|
|
} opts;
|
2009-12-02 19:15:38 +00:00
|
|
|
virDomainDeviceInfo info;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-08-01 13:31:37 +00:00
|
|
|
/* Two types of disk backends */
|
|
|
|
enum virDomainFSType {
|
|
|
|
VIR_DOMAIN_FS_TYPE_MOUNT, /* Better named 'bind' */
|
|
|
|
VIR_DOMAIN_FS_TYPE_BLOCK,
|
|
|
|
VIR_DOMAIN_FS_TYPE_FILE,
|
|
|
|
VIR_DOMAIN_FS_TYPE_TEMPLATE,
|
|
|
|
|
|
|
|
VIR_DOMAIN_FS_TYPE_LAST
|
|
|
|
};
|
|
|
|
|
2010-10-14 13:08:24 +00:00
|
|
|
/* Filesystem mount access mode */
|
|
|
|
enum virDomainFSAccessMode {
|
|
|
|
VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH,
|
|
|
|
VIR_DOMAIN_FS_ACCESSMODE_MAPPED,
|
|
|
|
VIR_DOMAIN_FS_ACCESSMODE_SQUASH,
|
|
|
|
|
|
|
|
VIR_DOMAIN_FS_ACCESSMODE_LAST
|
|
|
|
};
|
|
|
|
|
2008-08-01 13:31:37 +00:00
|
|
|
typedef struct _virDomainFSDef virDomainFSDef;
|
|
|
|
typedef virDomainFSDef *virDomainFSDefPtr;
|
|
|
|
struct _virDomainFSDef {
|
|
|
|
int type;
|
2010-10-14 13:08:24 +00:00
|
|
|
int accessmode;
|
2008-08-01 13:31:37 +00:00
|
|
|
char *src;
|
|
|
|
char *dst;
|
|
|
|
unsigned int readonly : 1;
|
Add device info to serial, parallel, channel, input & fs devices
Although the serial, parallel, chanel, input & fs devices do
not have PCI address info, they can all have device aliases.
Thus it neccessary to associate the virDomainDeviceInfo data
with them all.
* src/conf/domain_conf.c, src/conf/domain_conf.h: Add hooks for
parsing / formatting device info for serial, parallel, channel
input and fs devices.
* docs/schemas/domain.rng: Associate device info with character
devices, input & fs device
2010-01-06 12:39:53 +00:00
|
|
|
virDomainDeviceInfo info;
|
2008-08-01 13:31:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* 5 different types of networking config */
|
|
|
|
enum virDomainNetType {
|
|
|
|
VIR_DOMAIN_NET_TYPE_USER,
|
|
|
|
VIR_DOMAIN_NET_TYPE_ETHERNET,
|
|
|
|
VIR_DOMAIN_NET_TYPE_SERVER,
|
|
|
|
VIR_DOMAIN_NET_TYPE_CLIENT,
|
|
|
|
VIR_DOMAIN_NET_TYPE_MCAST,
|
|
|
|
VIR_DOMAIN_NET_TYPE_NETWORK,
|
|
|
|
VIR_DOMAIN_NET_TYPE_BRIDGE,
|
2009-05-11 09:50:27 +00:00
|
|
|
VIR_DOMAIN_NET_TYPE_INTERNAL,
|
2010-02-12 17:07:06 +00:00
|
|
|
VIR_DOMAIN_NET_TYPE_DIRECT,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_NET_TYPE_LAST,
|
|
|
|
};
|
|
|
|
|
2011-01-12 04:18:49 +00:00
|
|
|
/* the backend driver used for virtio interfaces */
|
|
|
|
enum virDomainNetBackendType {
|
|
|
|
VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT, /* prefer kernel, fall back to user */
|
|
|
|
VIR_DOMAIN_NET_BACKEND_TYPE_QEMU, /* userland */
|
|
|
|
VIR_DOMAIN_NET_BACKEND_TYPE_VHOST, /* kernel */
|
|
|
|
|
|
|
|
VIR_DOMAIN_NET_BACKEND_TYPE_LAST,
|
|
|
|
};
|
2008-07-11 16:23:36 +00:00
|
|
|
|
Add txmode attribute to interface XML for virtio backend
This is in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=629662
Explanation
qemu's virtio-net-pci driver allows setting the algorithm used for tx
packets to either "bh" or "timer". This is done by adding ",tx=bh" or
",tx=timer" to the "-device virtio-net-pci" commandline option.
'bh' stands for 'bottom half'; when this is set, packet tx is all done
in an iothread in the bottom half of the driver. (In libvirt, this
option is called the more descriptive "iothread".)
'timer' means that tx work is done in qemu, and if there is more tx
data than can be sent at the present time, a timer is set before qemu
moves on to do other things; when the timer fires, another attempt is
made to send more data. (libvirt retains the name "timer" for this
option.)
The resulting difference, according to the qemu developer who added
the option is:
bh makes tx more asynchronous and reduces latency, but potentially
causes more processor bandwidth contention since the cpu doing the
tx isn't necessarily the cpu where the guest generated the
packets.
Solution
This patch provides a libvirt domain xml knob to change the option on
the qemu commandline, by adding a new attribute "txmode" to the
<driver> element that can be placed inside any <interface> element in
a domain definition. It's use would be something like this:
<interface ...>
...
<model type='virtio'/>
<driver txmode='iothread'/>
...
</interface>
I chose to put this setting as an attribute to <driver> rather than as
a sub-element to <tune> because it is specific to the virtio-net
driver, not something that is generally usable by all network drivers.
(note that this is the same placement as the "driver name=..."
attribute used to choose kernel vs. userland backend for the
virtio-net driver.)
Actually adding the tx=xxx option to the qemu commandline is only done
if the version of qemu being used advertises it in the output of
qemu -device virtio-net-pci,?
If a particular txmode is requested in the XML, and the option isn't
listed in that help output, an UNSUPPORTED_CONFIG error is logged, and
the domain fails to start.
2011-02-03 20:20:01 +00:00
|
|
|
/* the TX algorithm used for virtio interfaces */
|
|
|
|
enum virDomainNetVirtioTxModeType {
|
|
|
|
VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT, /* default for this version of qemu */
|
|
|
|
VIR_DOMAIN_NET_VIRTIO_TX_MODE_IOTHREAD,
|
|
|
|
VIR_DOMAIN_NET_VIRTIO_TX_MODE_TIMER,
|
|
|
|
|
|
|
|
VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST,
|
|
|
|
};
|
|
|
|
|
2010-02-12 17:07:06 +00:00
|
|
|
/* the mode type for macvtap devices */
|
|
|
|
enum virDomainNetdevMacvtapType {
|
|
|
|
VIR_DOMAIN_NETDEV_MACVTAP_MODE_VEPA,
|
|
|
|
VIR_DOMAIN_NETDEV_MACVTAP_MODE_PRIVATE,
|
|
|
|
VIR_DOMAIN_NETDEV_MACVTAP_MODE_BRIDGE,
|
2011-05-17 11:26:09 +00:00
|
|
|
VIR_DOMAIN_NETDEV_MACVTAP_MODE_PASSTHRU,
|
2010-02-12 17:07:06 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_NETDEV_MACVTAP_MODE_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* Stores the virtual network interface configuration */
|
|
|
|
typedef struct _virDomainNetDef virDomainNetDef;
|
|
|
|
typedef virDomainNetDef *virDomainNetDefPtr;
|
|
|
|
struct _virDomainNetDef {
|
2010-03-26 16:01:35 +00:00
|
|
|
enum virDomainNetType type;
|
2008-10-24 11:20:08 +00:00
|
|
|
unsigned char mac[VIR_MAC_BUFLEN];
|
2008-07-11 16:23:36 +00:00
|
|
|
char *model;
|
Restructure domain struct interface "driver" data for easier expansion
When the <driver> element (and its "name" attribute) was added to the
domain XML's interface element, a "backend" enum was simply added to
the toplevel of the virDomainNetDef struct.
Ignoring the naming inconsistency ("name" vs. "backend"), this is fine
when there's only a single item contained in the driver element of the
XML, but doesn't scale well as we add more attributes that apply to
the backend of the virtio-net driver, or add attributes applicable to
other drivers.
This patch changes virDomainNetDef in two ways:
1) Rename the item in the struct from "backend" to "name", so that
it's the same in the XML and in the struct, hopefully avoiding
confusion for someone unfamiliar with the function of the
attribute.
2) Create a "driver" union within virDomainNetDef, and a "virtio"
struct in that struct, which contains the "name" enum value.
3) Move around the virDomainNetParse and virDomainNetFormat functions
to allow for simple plugin of new attributes without disturbing
existing code. (you'll note that this results in a seemingly
redundant if() in the format function, but that will no longer be
the case as soon as a 2nd attribute is added).
In the future, new attributes for the virtio driver backend can be
added to the "virtio" struct, and any other network device backend that
needs an attribute will have its own struct added to the "driver"
union.
2011-02-03 18:52:08 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
enum virDomainNetBackendType name; /* which driver backend to use */
|
Add txmode attribute to interface XML for virtio backend
This is in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=629662
Explanation
qemu's virtio-net-pci driver allows setting the algorithm used for tx
packets to either "bh" or "timer". This is done by adding ",tx=bh" or
",tx=timer" to the "-device virtio-net-pci" commandline option.
'bh' stands for 'bottom half'; when this is set, packet tx is all done
in an iothread in the bottom half of the driver. (In libvirt, this
option is called the more descriptive "iothread".)
'timer' means that tx work is done in qemu, and if there is more tx
data than can be sent at the present time, a timer is set before qemu
moves on to do other things; when the timer fires, another attempt is
made to send more data. (libvirt retains the name "timer" for this
option.)
The resulting difference, according to the qemu developer who added
the option is:
bh makes tx more asynchronous and reduces latency, but potentially
causes more processor bandwidth contention since the cpu doing the
tx isn't necessarily the cpu where the guest generated the
packets.
Solution
This patch provides a libvirt domain xml knob to change the option on
the qemu commandline, by adding a new attribute "txmode" to the
<driver> element that can be placed inside any <interface> element in
a domain definition. It's use would be something like this:
<interface ...>
...
<model type='virtio'/>
<driver txmode='iothread'/>
...
</interface>
I chose to put this setting as an attribute to <driver> rather than as
a sub-element to <tune> because it is specific to the virtio-net
driver, not something that is generally usable by all network drivers.
(note that this is the same placement as the "driver name=..."
attribute used to choose kernel vs. userland backend for the
virtio-net driver.)
Actually adding the tx=xxx option to the qemu commandline is only done
if the version of qemu being used advertises it in the output of
qemu -device virtio-net-pci,?
If a particular txmode is requested in the XML, and the option isn't
listed in that help output, an UNSUPPORTED_CONFIG error is logged, and
the domain fails to start.
2011-02-03 20:20:01 +00:00
|
|
|
enum virDomainNetVirtioTxModeType txmode;
|
Restructure domain struct interface "driver" data for easier expansion
When the <driver> element (and its "name" attribute) was added to the
domain XML's interface element, a "backend" enum was simply added to
the toplevel of the virDomainNetDef struct.
Ignoring the naming inconsistency ("name" vs. "backend"), this is fine
when there's only a single item contained in the driver element of the
XML, but doesn't scale well as we add more attributes that apply to
the backend of the virtio-net driver, or add attributes applicable to
other drivers.
This patch changes virDomainNetDef in two ways:
1) Rename the item in the struct from "backend" to "name", so that
it's the same in the XML and in the struct, hopefully avoiding
confusion for someone unfamiliar with the function of the
attribute.
2) Create a "driver" union within virDomainNetDef, and a "virtio"
struct in that struct, which contains the "name" enum value.
3) Move around the virDomainNetParse and virDomainNetFormat functions
to allow for simple plugin of new attributes without disturbing
existing code. (you'll note that this results in a seemingly
redundant if() in the format function, but that will no longer be
the case as soon as a 2nd attribute is added).
In the future, new attributes for the virtio driver backend can be
added to the "virtio" struct, and any other network device backend that
needs an attribute will have its own struct added to the "driver"
union.
2011-02-03 18:52:08 +00:00
|
|
|
} virtio;
|
|
|
|
} driver;
|
2008-07-11 16:23:36 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
char *dev;
|
|
|
|
char *script;
|
|
|
|
char *ipaddr;
|
|
|
|
} ethernet;
|
|
|
|
struct {
|
|
|
|
char *address;
|
|
|
|
int port;
|
|
|
|
} socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */
|
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
} network;
|
|
|
|
struct {
|
|
|
|
char *brname;
|
2009-01-22 18:29:13 +00:00
|
|
|
char *script;
|
2009-01-23 01:48:47 +00:00
|
|
|
char *ipaddr;
|
2008-07-11 16:23:36 +00:00
|
|
|
} bridge;
|
2009-05-11 09:50:27 +00:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
} internal;
|
2010-02-12 17:07:06 +00:00
|
|
|
struct {
|
|
|
|
char *linkdev;
|
|
|
|
int mode;
|
2010-05-25 21:37:00 +00:00
|
|
|
virVirtualPortProfileParams virtPortProfile;
|
2010-02-12 17:07:06 +00:00
|
|
|
} direct;
|
2008-07-11 16:23:36 +00:00
|
|
|
} data;
|
2011-01-12 19:38:01 +00:00
|
|
|
struct {
|
|
|
|
bool sndbuf_specified;
|
|
|
|
unsigned long sndbuf;
|
|
|
|
} tune;
|
2008-07-11 16:23:36 +00:00
|
|
|
char *ifname;
|
2011-01-12 14:19:34 +00:00
|
|
|
int bootIndex;
|
2009-11-30 18:35:58 +00:00
|
|
|
virDomainDeviceInfo info;
|
2010-03-25 17:46:07 +00:00
|
|
|
char *filter;
|
|
|
|
virNWFilterHashTablePtr filterparams;
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
2010-07-13 19:05:34 +00:00
|
|
|
enum virDomainChrDeviceType {
|
2011-01-07 23:36:25 +00:00
|
|
|
VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL = 0,
|
2010-07-13 19:05:34 +00:00
|
|
|
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL,
|
|
|
|
VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE,
|
2010-07-13 20:06:38 +00:00
|
|
|
VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL,
|
2009-11-05 13:19:14 +00:00
|
|
|
|
2010-07-13 20:06:38 +00:00
|
|
|
VIR_DOMAIN_CHR_DEVICE_TYPE_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainChrChannelTargetType {
|
|
|
|
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD = 0,
|
|
|
|
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,
|
|
|
|
|
|
|
|
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
|
2009-11-05 13:19:14 +00:00
|
|
|
};
|
|
|
|
|
2010-07-22 17:56:21 +00:00
|
|
|
enum virDomainChrConsoleTargetType {
|
|
|
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL = 0,
|
|
|
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN,
|
|
|
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML,
|
2010-07-14 17:02:04 +00:00
|
|
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO,
|
2010-07-22 17:56:21 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST,
|
|
|
|
};
|
|
|
|
|
2009-11-05 13:19:14 +00:00
|
|
|
enum virDomainChrType {
|
2008-07-11 16:23:36 +00:00
|
|
|
VIR_DOMAIN_CHR_TYPE_NULL,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_VC,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_PTY,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_DEV,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_FILE,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_PIPE,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_STDIO,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_UDP,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_TCP,
|
|
|
|
VIR_DOMAIN_CHR_TYPE_UNIX,
|
2011-02-03 04:09:44 +00:00
|
|
|
VIR_DOMAIN_CHR_TYPE_SPICEVMC,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_CHR_TYPE_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainChrTcpProtocol {
|
|
|
|
VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW,
|
|
|
|
VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET,
|
2010-09-29 21:04:19 +00:00
|
|
|
VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNETS, /* secure telnet */
|
|
|
|
VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST,
|
|
|
|
};
|
|
|
|
|
2011-02-04 02:23:31 +00:00
|
|
|
enum virDomainChrSpicevmcName {
|
|
|
|
VIR_DOMAIN_CHR_SPICEVMC_VDAGENT,
|
|
|
|
VIR_DOMAIN_CHR_SPICEVMC_SMARTCARD,
|
|
|
|
|
|
|
|
VIR_DOMAIN_CHR_SPICEVMC_LAST,
|
|
|
|
};
|
|
|
|
|
domain_conf: split source data out from ChrDef
This opens up the possibility of reusing the smaller ChrSourceDef
for both qemu monitor and a passthrough smartcard device.
* src/conf/domain_conf.h (_virDomainChrDef): Factor host
details...
(_virDomainChrSourceDef): ...into new struct.
(virDomainChrSourceDefFree): New prototype.
* src/conf/domain_conf.c (virDomainChrDefFree)
(virDomainChrDefParseXML, virDomainChrDefFormat): Split...
(virDomainChrSourceDefClear, virDomainChrSourceDefFree)
(virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
...into new functions.
(virDomainChrDefParseTargetXML): Update clients to reflect type
split.
* src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
(virVMXFormatSerial, virVMXFormatParallel): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
* src/xen/xend_internal.c (xenDaemonParseSxprChar)
(xenDaemonFormatSxprChr): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
(vboxAttachParallel): Likewise.
* src/security/security_dac.c (virSecurityDACSetChardevLabel)
(virSecurityDACSetChardevCallback)
(virSecurityDACRestoreChardevLabel)
(virSecurityDACRestoreChardevCallback): Likewise.
* src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback)
(SELinuxRestoreSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback): Likewise.
* src/security/virt-aa-helper.c (get_files): Likewise.
* src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
Likewise.
* src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
* src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
(umlDomainOpenConsole): Likewise.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildChrArgStr, qemuBuildCommandLine)
(qemuParseCommandLineChr): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
(qemuDomainObjPrivateXMLParse): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
(qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
(qemuPrepareMonitorChr, qemudShutdownVMDaemon)
(qemuDomainOpenConsole): Likewise.
* src/qemu/qemu_command.h (qemuBuildChrChardevStr)
(qemuBuildChrArgStr): Delete, now that they are static.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): Update list.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
tests.
2011-01-07 22:45:01 +00:00
|
|
|
/* The host side information for a character device. */
|
|
|
|
typedef struct _virDomainChrSourceDef virDomainChrSourceDef;
|
|
|
|
typedef virDomainChrSourceDef *virDomainChrSourceDefPtr;
|
|
|
|
struct _virDomainChrSourceDef {
|
|
|
|
int type; /* virDomainChrType */
|
2008-07-11 16:23:36 +00:00
|
|
|
union {
|
2011-02-04 02:23:31 +00:00
|
|
|
/* no <source> for null, vc, stdio */
|
2008-07-11 16:23:36 +00:00
|
|
|
struct {
|
|
|
|
char *path;
|
|
|
|
} file; /* pty, file, pipe, or device */
|
|
|
|
struct {
|
|
|
|
char *host;
|
|
|
|
char *service;
|
domain_conf: split source data out from ChrDef
This opens up the possibility of reusing the smaller ChrSourceDef
for both qemu monitor and a passthrough smartcard device.
* src/conf/domain_conf.h (_virDomainChrDef): Factor host
details...
(_virDomainChrSourceDef): ...into new struct.
(virDomainChrSourceDefFree): New prototype.
* src/conf/domain_conf.c (virDomainChrDefFree)
(virDomainChrDefParseXML, virDomainChrDefFormat): Split...
(virDomainChrSourceDefClear, virDomainChrSourceDefFree)
(virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
...into new functions.
(virDomainChrDefParseTargetXML): Update clients to reflect type
split.
* src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
(virVMXFormatSerial, virVMXFormatParallel): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
* src/xen/xend_internal.c (xenDaemonParseSxprChar)
(xenDaemonFormatSxprChr): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
(vboxAttachParallel): Likewise.
* src/security/security_dac.c (virSecurityDACSetChardevLabel)
(virSecurityDACSetChardevCallback)
(virSecurityDACRestoreChardevLabel)
(virSecurityDACRestoreChardevCallback): Likewise.
* src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback)
(SELinuxRestoreSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback): Likewise.
* src/security/virt-aa-helper.c (get_files): Likewise.
* src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
Likewise.
* src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
* src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
(umlDomainOpenConsole): Likewise.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildChrArgStr, qemuBuildCommandLine)
(qemuParseCommandLineChr): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
(qemuDomainObjPrivateXMLParse): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
(qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
(qemuPrepareMonitorChr, qemudShutdownVMDaemon)
(qemuDomainOpenConsole): Likewise.
* src/qemu/qemu_command.h (qemuBuildChrChardevStr)
(qemuBuildChrArgStr): Delete, now that they are static.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): Update list.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
tests.
2011-01-07 22:45:01 +00:00
|
|
|
bool listen;
|
2008-07-11 16:23:36 +00:00
|
|
|
int protocol;
|
|
|
|
} tcp;
|
|
|
|
struct {
|
|
|
|
char *bindHost;
|
|
|
|
char *bindService;
|
|
|
|
char *connectHost;
|
|
|
|
char *connectService;
|
|
|
|
} udp;
|
|
|
|
struct {
|
|
|
|
char *path;
|
domain_conf: split source data out from ChrDef
This opens up the possibility of reusing the smaller ChrSourceDef
for both qemu monitor and a passthrough smartcard device.
* src/conf/domain_conf.h (_virDomainChrDef): Factor host
details...
(_virDomainChrSourceDef): ...into new struct.
(virDomainChrSourceDefFree): New prototype.
* src/conf/domain_conf.c (virDomainChrDefFree)
(virDomainChrDefParseXML, virDomainChrDefFormat): Split...
(virDomainChrSourceDefClear, virDomainChrSourceDefFree)
(virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
...into new functions.
(virDomainChrDefParseTargetXML): Update clients to reflect type
split.
* src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
(virVMXFormatSerial, virVMXFormatParallel): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
* src/xen/xend_internal.c (xenDaemonParseSxprChar)
(xenDaemonFormatSxprChr): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
(vboxAttachParallel): Likewise.
* src/security/security_dac.c (virSecurityDACSetChardevLabel)
(virSecurityDACSetChardevCallback)
(virSecurityDACRestoreChardevLabel)
(virSecurityDACRestoreChardevCallback): Likewise.
* src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback)
(SELinuxRestoreSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback): Likewise.
* src/security/virt-aa-helper.c (get_files): Likewise.
* src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
Likewise.
* src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
* src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
(umlDomainOpenConsole): Likewise.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildChrArgStr, qemuBuildCommandLine)
(qemuParseCommandLineChr): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
(qemuDomainObjPrivateXMLParse): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
(qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
(qemuPrepareMonitorChr, qemudShutdownVMDaemon)
(qemuDomainOpenConsole): Likewise.
* src/qemu/qemu_command.h (qemuBuildChrChardevStr)
(qemuBuildChrArgStr): Delete, now that they are static.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): Update list.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
tests.
2011-01-07 22:45:01 +00:00
|
|
|
bool listen;
|
2008-07-11 16:23:36 +00:00
|
|
|
} nix;
|
2011-02-04 02:23:31 +00:00
|
|
|
int spicevmc;
|
2008-07-11 16:23:36 +00:00
|
|
|
} data;
|
domain_conf: split source data out from ChrDef
This opens up the possibility of reusing the smaller ChrSourceDef
for both qemu monitor and a passthrough smartcard device.
* src/conf/domain_conf.h (_virDomainChrDef): Factor host
details...
(_virDomainChrSourceDef): ...into new struct.
(virDomainChrSourceDefFree): New prototype.
* src/conf/domain_conf.c (virDomainChrDefFree)
(virDomainChrDefParseXML, virDomainChrDefFormat): Split...
(virDomainChrSourceDefClear, virDomainChrSourceDefFree)
(virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
...into new functions.
(virDomainChrDefParseTargetXML): Update clients to reflect type
split.
* src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
(virVMXFormatSerial, virVMXFormatParallel): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
* src/xen/xend_internal.c (xenDaemonParseSxprChar)
(xenDaemonFormatSxprChr): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
(vboxAttachParallel): Likewise.
* src/security/security_dac.c (virSecurityDACSetChardevLabel)
(virSecurityDACSetChardevCallback)
(virSecurityDACRestoreChardevLabel)
(virSecurityDACRestoreChardevCallback): Likewise.
* src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback)
(SELinuxRestoreSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback): Likewise.
* src/security/virt-aa-helper.c (get_files): Likewise.
* src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
Likewise.
* src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
* src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
(umlDomainOpenConsole): Likewise.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildChrArgStr, qemuBuildCommandLine)
(qemuParseCommandLineChr): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
(qemuDomainObjPrivateXMLParse): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
(qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
(qemuPrepareMonitorChr, qemudShutdownVMDaemon)
(qemuDomainOpenConsole): Likewise.
* src/qemu/qemu_command.h (qemuBuildChrChardevStr)
(qemuBuildChrArgStr): Delete, now that they are static.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): Update list.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
tests.
2011-01-07 22:45:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* A complete character device, both host and domain views. */
|
|
|
|
typedef struct _virDomainChrDef virDomainChrDef;
|
|
|
|
typedef virDomainChrDef *virDomainChrDefPtr;
|
|
|
|
struct _virDomainChrDef {
|
|
|
|
int deviceType;
|
|
|
|
int targetType;
|
|
|
|
union {
|
|
|
|
int port; /* parallel, serial, console */
|
|
|
|
virSocketAddrPtr addr; /* guestfwd */
|
|
|
|
char *name; /* virtio */
|
|
|
|
} target;
|
|
|
|
|
|
|
|
virDomainChrSourceDef source;
|
Add device info to serial, parallel, channel, input & fs devices
Although the serial, parallel, chanel, input & fs devices do
not have PCI address info, they can all have device aliases.
Thus it neccessary to associate the virDomainDeviceInfo data
with them all.
* src/conf/domain_conf.c, src/conf/domain_conf.h: Add hooks for
parsing / formatting device info for serial, parallel, channel
input and fs devices.
* docs/schemas/domain.rng: Associate device info with character
devices, input & fs device
2010-01-06 12:39:53 +00:00
|
|
|
|
|
|
|
virDomainDeviceInfo info;
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
2011-01-10 16:41:33 +00:00
|
|
|
enum virDomainSmartcardType {
|
|
|
|
VIR_DOMAIN_SMARTCARD_TYPE_HOST,
|
|
|
|
VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES,
|
|
|
|
VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH,
|
|
|
|
|
|
|
|
VIR_DOMAIN_SMARTCARD_TYPE_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
# define VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES 3
|
|
|
|
# define VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE "/etc/pki/nssdb"
|
|
|
|
|
|
|
|
typedef struct _virDomainSmartcardDef virDomainSmartcardDef;
|
|
|
|
typedef virDomainSmartcardDef *virDomainSmartcardDefPtr;
|
|
|
|
struct _virDomainSmartcardDef {
|
|
|
|
int type; /* virDomainSmartcardType */
|
|
|
|
union {
|
|
|
|
/* no extra data for 'host' */
|
|
|
|
struct {
|
|
|
|
char *file[VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES];
|
|
|
|
char *database;
|
|
|
|
} cert; /* 'host-certificates' */
|
|
|
|
virDomainChrSourceDef passthru; /* 'passthrough' */
|
|
|
|
} data;
|
|
|
|
|
|
|
|
virDomainDeviceInfo info;
|
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
enum virDomainInputType {
|
|
|
|
VIR_DOMAIN_INPUT_TYPE_MOUSE,
|
|
|
|
VIR_DOMAIN_INPUT_TYPE_TABLET,
|
|
|
|
|
|
|
|
VIR_DOMAIN_INPUT_TYPE_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainInputBus {
|
|
|
|
VIR_DOMAIN_INPUT_BUS_PS2,
|
|
|
|
VIR_DOMAIN_INPUT_BUS_USB,
|
|
|
|
VIR_DOMAIN_INPUT_BUS_XEN,
|
|
|
|
|
|
|
|
VIR_DOMAIN_INPUT_BUS_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainInputDef virDomainInputDef;
|
|
|
|
typedef virDomainInputDef *virDomainInputDefPtr;
|
|
|
|
struct _virDomainInputDef {
|
|
|
|
int type;
|
|
|
|
int bus;
|
Add device info to serial, parallel, channel, input & fs devices
Although the serial, parallel, chanel, input & fs devices do
not have PCI address info, they can all have device aliases.
Thus it neccessary to associate the virDomainDeviceInfo data
with them all.
* src/conf/domain_conf.c, src/conf/domain_conf.h: Add hooks for
parsing / formatting device info for serial, parallel, channel
input and fs devices.
* docs/schemas/domain.rng: Associate device info with character
devices, input & fs device
2010-01-06 12:39:53 +00:00
|
|
|
virDomainDeviceInfo info;
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainSoundModel {
|
|
|
|
VIR_DOMAIN_SOUND_MODEL_SB16,
|
|
|
|
VIR_DOMAIN_SOUND_MODEL_ES1370,
|
|
|
|
VIR_DOMAIN_SOUND_MODEL_PCSPK,
|
2009-05-21 14:16:06 +00:00
|
|
|
VIR_DOMAIN_SOUND_MODEL_AC97,
|
2011-01-13 14:15:11 +00:00
|
|
|
VIR_DOMAIN_SOUND_MODEL_ICH6,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_SOUND_MODEL_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainSoundDef virDomainSoundDef;
|
|
|
|
typedef virDomainSoundDef *virDomainSoundDefPtr;
|
|
|
|
struct _virDomainSoundDef {
|
|
|
|
int model;
|
2009-12-10 19:19:08 +00:00
|
|
|
virDomainDeviceInfo info;
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
2009-10-21 12:26:38 +00:00
|
|
|
enum virDomainWatchdogModel {
|
|
|
|
VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB,
|
|
|
|
VIR_DOMAIN_WATCHDOG_MODEL_IB700,
|
|
|
|
|
|
|
|
VIR_DOMAIN_WATCHDOG_MODEL_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainWatchdogAction {
|
|
|
|
VIR_DOMAIN_WATCHDOG_ACTION_RESET,
|
|
|
|
VIR_DOMAIN_WATCHDOG_ACTION_SHUTDOWN,
|
|
|
|
VIR_DOMAIN_WATCHDOG_ACTION_POWEROFF,
|
|
|
|
VIR_DOMAIN_WATCHDOG_ACTION_PAUSE,
|
2010-12-08 06:19:17 +00:00
|
|
|
VIR_DOMAIN_WATCHDOG_ACTION_DUMP,
|
2009-10-21 12:26:38 +00:00
|
|
|
VIR_DOMAIN_WATCHDOG_ACTION_NONE,
|
|
|
|
|
|
|
|
VIR_DOMAIN_WATCHDOG_ACTION_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainWatchdogDef virDomainWatchdogDef;
|
|
|
|
typedef virDomainWatchdogDef *virDomainWatchdogDefPtr;
|
|
|
|
struct _virDomainWatchdogDef {
|
|
|
|
int model;
|
|
|
|
int action;
|
2009-12-10 19:19:08 +00:00
|
|
|
virDomainDeviceInfo info;
|
2009-10-21 12:26:38 +00:00
|
|
|
};
|
|
|
|
|
2009-07-06 13:54:44 +00:00
|
|
|
|
|
|
|
enum virDomainVideoType {
|
|
|
|
VIR_DOMAIN_VIDEO_TYPE_VGA,
|
|
|
|
VIR_DOMAIN_VIDEO_TYPE_CIRRUS,
|
|
|
|
VIR_DOMAIN_VIDEO_TYPE_VMVGA,
|
|
|
|
VIR_DOMAIN_VIDEO_TYPE_XEN,
|
|
|
|
VIR_DOMAIN_VIDEO_TYPE_VBOX,
|
2009-07-08 13:47:14 +00:00
|
|
|
VIR_DOMAIN_VIDEO_TYPE_QXL,
|
2009-07-06 13:54:44 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_VIDEO_TYPE_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-09-03 08:26:41 +00:00
|
|
|
typedef struct _virDomainVideoAccelDef virDomainVideoAccelDef;
|
|
|
|
typedef virDomainVideoAccelDef *virDomainVideoAccelDefPtr;
|
|
|
|
struct _virDomainVideoAccelDef {
|
2010-01-19 12:07:32 +00:00
|
|
|
unsigned int support3d :1;
|
|
|
|
unsigned int support2d :1;
|
2009-09-03 08:26:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-07-06 13:54:44 +00:00
|
|
|
typedef struct _virDomainVideoDef virDomainVideoDef;
|
|
|
|
typedef virDomainVideoDef *virDomainVideoDefPtr;
|
|
|
|
struct _virDomainVideoDef {
|
|
|
|
int type;
|
|
|
|
unsigned int vram;
|
|
|
|
unsigned int heads;
|
2009-09-03 08:26:41 +00:00
|
|
|
virDomainVideoAccelDefPtr accel;
|
2009-12-10 19:19:08 +00:00
|
|
|
virDomainDeviceInfo info;
|
2009-07-06 13:54:44 +00:00
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* 3 possible graphics console modes */
|
|
|
|
enum virDomainGraphicsType {
|
|
|
|
VIR_DOMAIN_GRAPHICS_TYPE_SDL,
|
|
|
|
VIR_DOMAIN_GRAPHICS_TYPE_VNC,
|
2009-05-15 09:43:51 +00:00
|
|
|
VIR_DOMAIN_GRAPHICS_TYPE_RDP,
|
|
|
|
VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
|
2009-08-14 09:54:14 +00:00
|
|
|
VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_GRAPHICS_TYPE_LAST,
|
|
|
|
};
|
|
|
|
|
2010-04-08 12:43:23 +00:00
|
|
|
typedef struct _virDomainGraphicsAuthDef virDomainGraphicsAuthDef;
|
|
|
|
typedef virDomainGraphicsAuthDef *virDomainGraphicsAuthDefPtr;
|
|
|
|
struct _virDomainGraphicsAuthDef {
|
|
|
|
char *passwd;
|
|
|
|
unsigned int expires: 1; /* Whether there is an expiry time set */
|
|
|
|
time_t validTo; /* seconds since epoch */
|
|
|
|
};
|
|
|
|
|
2010-04-09 16:56:00 +00:00
|
|
|
enum virDomainGraphicsSpiceChannelName {
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MAIN,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_DISPLAY,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_INPUT,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_CURSOR,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_PLAYBACK,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_RECORD,
|
2011-02-04 02:23:31 +00:00
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_SMARTCARD,
|
2010-04-09 16:56:00 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainGraphicsSpiceChannelMode {
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE,
|
|
|
|
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_LAST
|
|
|
|
};
|
2010-04-08 12:43:23 +00:00
|
|
|
|
2011-04-14 08:44:20 +00:00
|
|
|
enum virDomainGraphicsSpiceImageCompression {
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_DEFAULT = 0,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_GLZ,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_LZ,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_QUIC,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_GLZ,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_LZ,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_OFF,
|
|
|
|
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainGraphicsSpiceJpegCompression {
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_DEFAULT = 0,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_AUTO,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_NEVER,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_ALWAYS,
|
|
|
|
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainGraphicsSpiceZlibCompression {
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_DEFAULT = 0,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_AUTO,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_NEVER,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_ALWAYS,
|
|
|
|
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainGraphicsSpicePlaybackCompression {
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_DEFAULT = 0,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_ON,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_OFF,
|
|
|
|
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
|
|
|
|
};
|
|
|
|
|
2011-05-23 15:16:42 +00:00
|
|
|
enum virDomainGraphicsSpiceStreamingMode {
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_FILTER,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_ALL,
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_OFF,
|
|
|
|
|
|
|
|
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST
|
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
typedef struct _virDomainGraphicsDef virDomainGraphicsDef;
|
|
|
|
typedef virDomainGraphicsDef *virDomainGraphicsDefPtr;
|
|
|
|
struct _virDomainGraphicsDef {
|
|
|
|
int type;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
int port;
|
2010-01-19 12:07:32 +00:00
|
|
|
unsigned int autoport :1;
|
2008-07-11 16:23:36 +00:00
|
|
|
char *listenAddr;
|
|
|
|
char *keymap;
|
2011-01-07 21:03:07 +00:00
|
|
|
char *socket;
|
2010-04-08 12:43:23 +00:00
|
|
|
virDomainGraphicsAuthDef auth;
|
2008-07-11 16:23:36 +00:00
|
|
|
} vnc;
|
|
|
|
struct {
|
|
|
|
char *display;
|
|
|
|
char *xauth;
|
2008-12-11 11:44:30 +00:00
|
|
|
int fullscreen;
|
2008-07-11 16:23:36 +00:00
|
|
|
} sdl;
|
2009-05-15 09:43:51 +00:00
|
|
|
struct {
|
|
|
|
int port;
|
|
|
|
char *listenAddr;
|
2010-01-19 12:07:32 +00:00
|
|
|
unsigned int autoport :1;
|
|
|
|
unsigned int replaceUser :1;
|
|
|
|
unsigned int multiUser :1;
|
2009-05-15 09:43:51 +00:00
|
|
|
} rdp;
|
|
|
|
struct {
|
|
|
|
char *display;
|
2010-01-19 12:07:32 +00:00
|
|
|
unsigned int fullscreen :1;
|
2009-05-15 09:43:51 +00:00
|
|
|
} desktop;
|
2009-08-14 09:54:14 +00:00
|
|
|
struct {
|
|
|
|
int port;
|
|
|
|
int tlsPort;
|
|
|
|
char *listenAddr;
|
|
|
|
char *keymap;
|
2010-04-08 12:43:23 +00:00
|
|
|
virDomainGraphicsAuthDef auth;
|
2009-08-14 09:54:14 +00:00
|
|
|
unsigned int autoport :1;
|
2010-04-09 16:56:00 +00:00
|
|
|
int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
|
2011-04-14 08:44:20 +00:00
|
|
|
int image;
|
|
|
|
int jpeg;
|
|
|
|
int zlib;
|
|
|
|
int playback;
|
2011-05-23 15:16:42 +00:00
|
|
|
int streaming;
|
2009-08-14 09:54:14 +00:00
|
|
|
} spice;
|
2008-07-11 16:23:36 +00:00
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
2008-08-08 14:27:05 +00:00
|
|
|
enum virDomainHostdevMode {
|
|
|
|
VIR_DOMAIN_HOSTDEV_MODE_SUBSYS,
|
|
|
|
VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2008-08-08 14:27:05 +00:00
|
|
|
VIR_DOMAIN_HOSTDEV_MODE_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainHostdevSubsysType {
|
|
|
|
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
|
|
|
|
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
|
|
|
|
|
|
|
|
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainHostdevDef virDomainHostdevDef;
|
|
|
|
typedef virDomainHostdevDef *virDomainHostdevDefPtr;
|
|
|
|
struct _virDomainHostdevDef {
|
|
|
|
int mode; /* enum virDomainHostdevMode */
|
2009-03-02 16:40:30 +00:00
|
|
|
unsigned int managed : 1;
|
2008-08-08 14:27:05 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
int type; /* enum virDomainHostdevBusType */
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
unsigned bus;
|
|
|
|
unsigned device;
|
|
|
|
|
|
|
|
unsigned vendor;
|
|
|
|
unsigned product;
|
|
|
|
} usb;
|
2009-11-30 18:35:58 +00:00
|
|
|
virDomainDevicePCIAddress pci; /* host address */
|
2008-12-17 18:12:07 +00:00
|
|
|
} u;
|
2008-08-08 14:27:05 +00:00
|
|
|
} subsys;
|
|
|
|
struct {
|
|
|
|
/* TBD: struct capabilities see:
|
|
|
|
* https://www.redhat.com/archives/libvir-list/2008-July/msg00429.html
|
|
|
|
*/
|
2008-12-17 18:12:07 +00:00
|
|
|
int dummy;
|
2008-08-08 14:27:05 +00:00
|
|
|
} caps;
|
|
|
|
} source;
|
2011-02-03 12:06:21 +00:00
|
|
|
int bootIndex;
|
2009-11-30 18:35:58 +00:00
|
|
|
virDomainDeviceInfo info; /* Guest address */
|
2008-08-08 14:27:05 +00:00
|
|
|
};
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2010-07-15 13:02:42 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
|
|
|
|
VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
|
2010-08-11 09:28:17 +00:00
|
|
|
VIR_DOMAIN_MEMBALLOON_MODEL_NONE,
|
2010-07-15 13:02:42 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_MEMBALLOON_MODEL_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
|
|
|
|
typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;
|
|
|
|
struct _virDomainMemballoonDef {
|
|
|
|
int model;
|
|
|
|
virDomainDeviceInfo info;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-05 13:10:34 +00:00
|
|
|
enum virDomainSmbiosMode {
|
|
|
|
VIR_DOMAIN_SMBIOS_NONE,
|
|
|
|
VIR_DOMAIN_SMBIOS_EMULATE,
|
|
|
|
VIR_DOMAIN_SMBIOS_HOST,
|
|
|
|
VIR_DOMAIN_SMBIOS_SYSINFO,
|
|
|
|
|
|
|
|
VIR_DOMAIN_SMBIOS_LAST
|
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* Flags for the 'type' field in next struct */
|
|
|
|
enum virDomainDeviceType {
|
|
|
|
VIR_DOMAIN_DEVICE_DISK,
|
2008-08-01 13:31:37 +00:00
|
|
|
VIR_DOMAIN_DEVICE_FS,
|
2008-07-11 16:23:36 +00:00
|
|
|
VIR_DOMAIN_DEVICE_NET,
|
|
|
|
VIR_DOMAIN_DEVICE_INPUT,
|
|
|
|
VIR_DOMAIN_DEVICE_SOUND,
|
2009-07-06 13:54:44 +00:00
|
|
|
VIR_DOMAIN_DEVICE_VIDEO,
|
2008-08-08 14:27:05 +00:00
|
|
|
VIR_DOMAIN_DEVICE_HOSTDEV,
|
2009-10-21 12:26:38 +00:00
|
|
|
VIR_DOMAIN_DEVICE_WATCHDOG,
|
2009-12-02 19:15:38 +00:00
|
|
|
VIR_DOMAIN_DEVICE_CONTROLLER,
|
2010-03-22 13:22:48 +00:00
|
|
|
VIR_DOMAIN_DEVICE_GRAPHICS,
|
2009-03-02 17:39:43 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_DEVICE_LAST,
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainDeviceDef virDomainDeviceDef;
|
|
|
|
typedef virDomainDeviceDef *virDomainDeviceDefPtr;
|
|
|
|
struct _virDomainDeviceDef {
|
|
|
|
int type;
|
|
|
|
union {
|
|
|
|
virDomainDiskDefPtr disk;
|
2009-12-02 19:15:38 +00:00
|
|
|
virDomainControllerDefPtr controller;
|
2008-08-01 13:31:37 +00:00
|
|
|
virDomainFSDefPtr fs;
|
2008-07-11 16:23:36 +00:00
|
|
|
virDomainNetDefPtr net;
|
|
|
|
virDomainInputDefPtr input;
|
|
|
|
virDomainSoundDefPtr sound;
|
2009-07-06 13:54:44 +00:00
|
|
|
virDomainVideoDefPtr video;
|
2008-08-08 14:27:05 +00:00
|
|
|
virDomainHostdevDefPtr hostdev;
|
2009-10-21 12:26:38 +00:00
|
|
|
virDomainWatchdogDefPtr watchdog;
|
2010-03-22 13:22:48 +00:00
|
|
|
virDomainGraphicsDefPtr graphics;
|
2008-07-11 16:23:36 +00:00
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define VIR_DOMAIN_MAX_BOOT_DEVS 4
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
enum virDomainBootOrder {
|
|
|
|
VIR_DOMAIN_BOOT_FLOPPY,
|
|
|
|
VIR_DOMAIN_BOOT_CDROM,
|
|
|
|
VIR_DOMAIN_BOOT_DISK,
|
|
|
|
VIR_DOMAIN_BOOT_NET,
|
|
|
|
|
|
|
|
VIR_DOMAIN_BOOT_LAST,
|
|
|
|
};
|
|
|
|
|
2010-07-26 14:28:58 +00:00
|
|
|
enum virDomainBootMenu {
|
|
|
|
VIR_DOMAIN_BOOT_MENU_DEFAULT = 0,
|
|
|
|
VIR_DOMAIN_BOOT_MENU_ENABLED,
|
|
|
|
VIR_DOMAIN_BOOT_MENU_DISABLED,
|
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
enum virDomainFeature {
|
|
|
|
VIR_DOMAIN_FEATURE_ACPI,
|
|
|
|
VIR_DOMAIN_FEATURE_APIC,
|
|
|
|
VIR_DOMAIN_FEATURE_PAE,
|
2011-01-05 21:56:48 +00:00
|
|
|
VIR_DOMAIN_FEATURE_HAP,
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_FEATURE_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainLifecycleAction {
|
|
|
|
VIR_DOMAIN_LIFECYCLE_DESTROY,
|
|
|
|
VIR_DOMAIN_LIFECYCLE_RESTART,
|
|
|
|
VIR_DOMAIN_LIFECYCLE_RESTART_RENAME,
|
|
|
|
VIR_DOMAIN_LIFECYCLE_PRESERVE,
|
|
|
|
|
|
|
|
VIR_DOMAIN_LIFECYCLE_LAST
|
|
|
|
};
|
|
|
|
|
2010-08-12 17:15:44 +00:00
|
|
|
enum virDomainLifecycleCrashAction {
|
|
|
|
VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY,
|
|
|
|
VIR_DOMAIN_LIFECYCLE_CRASH_RESTART,
|
|
|
|
VIR_DOMAIN_LIFECYCLE_CRASH_RESTART_RENAME,
|
|
|
|
VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE,
|
|
|
|
VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY,
|
|
|
|
VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART,
|
|
|
|
|
|
|
|
VIR_DOMAIN_LIFECYCLE_CRASH_LAST
|
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* Operating system configuration data & machine / arch */
|
|
|
|
typedef struct _virDomainOSDef virDomainOSDef;
|
|
|
|
typedef virDomainOSDef *virDomainOSDefPtr;
|
|
|
|
struct _virDomainOSDef {
|
|
|
|
char *type;
|
|
|
|
char *arch;
|
|
|
|
char *machine;
|
|
|
|
int nBootDevs;
|
|
|
|
int bootDevs[VIR_DOMAIN_BOOT_LAST];
|
2010-07-26 14:28:58 +00:00
|
|
|
int bootmenu;
|
2008-08-01 13:31:37 +00:00
|
|
|
char *init;
|
2008-07-11 16:23:36 +00:00
|
|
|
char *kernel;
|
|
|
|
char *initrd;
|
|
|
|
char *cmdline;
|
|
|
|
char *root;
|
|
|
|
char *loader;
|
|
|
|
char *bootloader;
|
|
|
|
char *bootloaderArgs;
|
2010-11-05 13:10:34 +00:00
|
|
|
int smbios_mode;
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
2009-03-03 16:53:13 +00:00
|
|
|
enum virDomainSeclabelType {
|
|
|
|
VIR_DOMAIN_SECLABEL_DYNAMIC,
|
|
|
|
VIR_DOMAIN_SECLABEL_STATIC,
|
|
|
|
|
|
|
|
VIR_DOMAIN_SECLABEL_LAST,
|
|
|
|
};
|
|
|
|
|
2009-03-03 09:44:41 +00:00
|
|
|
/* Security configuration for domain */
|
|
|
|
typedef struct _virSecurityLabelDef virSecurityLabelDef;
|
|
|
|
typedef virSecurityLabelDef *virSecurityLabelDefPtr;
|
|
|
|
struct _virSecurityLabelDef {
|
|
|
|
char *model; /* name of security model */
|
|
|
|
char *label; /* security label string */
|
|
|
|
char *imagelabel; /* security image label string */
|
2009-03-03 16:53:13 +00:00
|
|
|
int type;
|
2009-03-03 09:44:41 +00:00
|
|
|
};
|
|
|
|
|
2010-03-30 11:44:22 +00:00
|
|
|
enum virDomainTimerNameType {
|
|
|
|
VIR_DOMAIN_TIMER_NAME_PLATFORM = 0,
|
|
|
|
VIR_DOMAIN_TIMER_NAME_PIT,
|
|
|
|
VIR_DOMAIN_TIMER_NAME_RTC,
|
|
|
|
VIR_DOMAIN_TIMER_NAME_HPET,
|
|
|
|
VIR_DOMAIN_TIMER_NAME_TSC,
|
|
|
|
|
|
|
|
VIR_DOMAIN_TIMER_NAME_LAST,
|
|
|
|
};
|
|
|
|
|
2010-03-31 17:03:54 +00:00
|
|
|
enum virDomainTimerTrackType {
|
|
|
|
VIR_DOMAIN_TIMER_TRACK_BOOT = 0,
|
|
|
|
VIR_DOMAIN_TIMER_TRACK_GUEST,
|
|
|
|
VIR_DOMAIN_TIMER_TRACK_WALL,
|
2010-03-30 11:44:22 +00:00
|
|
|
|
2010-03-31 17:03:54 +00:00
|
|
|
VIR_DOMAIN_TIMER_TRACK_LAST,
|
2010-03-30 11:44:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainTimerTickpolicyType {
|
|
|
|
VIR_DOMAIN_TIMER_TICKPOLICY_DELAY = 0,
|
|
|
|
VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP,
|
|
|
|
VIR_DOMAIN_TIMER_TICKPOLICY_MERGE,
|
|
|
|
VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD,
|
|
|
|
|
|
|
|
VIR_DOMAIN_TIMER_TICKPOLICY_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virDomainTimerModeType {
|
|
|
|
VIR_DOMAIN_TIMER_MODE_AUTO = 0,
|
|
|
|
VIR_DOMAIN_TIMER_MODE_NATIVE,
|
|
|
|
VIR_DOMAIN_TIMER_MODE_EMULATE,
|
|
|
|
VIR_DOMAIN_TIMER_MODE_PARAVIRT,
|
2010-03-31 17:03:54 +00:00
|
|
|
VIR_DOMAIN_TIMER_MODE_SMPSAFE,
|
2010-03-30 11:44:22 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_TIMER_MODE_LAST,
|
|
|
|
};
|
|
|
|
|
2010-03-31 17:03:54 +00:00
|
|
|
typedef struct _virDomainTimerCatchupDef virDomainTimerCatchupDef;
|
|
|
|
typedef virDomainTimerCatchupDef *virDomainTimerCatchupDefPtr;
|
|
|
|
struct _virDomainTimerCatchupDef {
|
|
|
|
unsigned long threshold;
|
|
|
|
unsigned long slew;
|
|
|
|
unsigned long limit;
|
|
|
|
};
|
|
|
|
|
2010-03-30 11:44:22 +00:00
|
|
|
typedef struct _virDomainTimerDef virDomainTimerDef;
|
|
|
|
typedef virDomainTimerDef *virDomainTimerDefPtr;
|
|
|
|
struct _virDomainTimerDef {
|
|
|
|
int name;
|
|
|
|
int present; /* unspecified = -1, no = 0, yes = 1 */
|
|
|
|
int tickpolicy; /* none|catchup|merge|discard */
|
|
|
|
|
2010-03-31 17:03:54 +00:00
|
|
|
virDomainTimerCatchupDef catchup;
|
|
|
|
|
|
|
|
/* track is only valid for name='platform|rtc' */
|
|
|
|
int track; /* host|guest */
|
2010-03-30 11:44:22 +00:00
|
|
|
|
|
|
|
/* frequency & mode are only valid for name='tsc' */
|
|
|
|
unsigned long frequency; /* in Hz, unspecified = 0 */
|
|
|
|
int mode; /* auto|native|emulate|paravirt */
|
|
|
|
};
|
|
|
|
|
2010-02-02 17:22:03 +00:00
|
|
|
enum virDomainClockOffsetType {
|
|
|
|
VIR_DOMAIN_CLOCK_OFFSET_UTC = 0,
|
|
|
|
VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME = 1,
|
2010-02-02 17:49:09 +00:00
|
|
|
VIR_DOMAIN_CLOCK_OFFSET_VARIABLE = 2,
|
2010-02-02 18:28:44 +00:00
|
|
|
VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE = 3,
|
2010-02-02 17:22:03 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_CLOCK_OFFSET_LAST,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainClockDef virDomainClockDef;
|
|
|
|
typedef virDomainClockDef *virDomainClockDefPtr;
|
|
|
|
struct _virDomainClockDef {
|
|
|
|
int offset;
|
2010-02-02 17:49:09 +00:00
|
|
|
|
2010-02-02 18:28:44 +00:00
|
|
|
union {
|
|
|
|
/* Adjustment in seconds, relative to UTC, when
|
|
|
|
* offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE */
|
|
|
|
long long adjustment;
|
|
|
|
|
|
|
|
/* Timezone name, when
|
|
|
|
* offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME */
|
|
|
|
char *timezone;
|
|
|
|
} data;
|
2010-03-30 11:44:22 +00:00
|
|
|
|
|
|
|
int ntimers;
|
|
|
|
virDomainTimerDefPtr *timers;
|
2010-02-02 17:22:03 +00:00
|
|
|
};
|
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# define VIR_DOMAIN_CPUMASK_LEN 1024
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2010-04-02 14:41:30 +00:00
|
|
|
|
|
|
|
/* Snapshot state */
|
|
|
|
typedef struct _virDomainSnapshotDef virDomainSnapshotDef;
|
|
|
|
typedef virDomainSnapshotDef *virDomainSnapshotDefPtr;
|
|
|
|
struct _virDomainSnapshotDef {
|
|
|
|
char *name;
|
|
|
|
char *description;
|
|
|
|
char *parent;
|
2011-05-13 05:07:13 +00:00
|
|
|
long long creationTime; /* in seconds */
|
2010-04-02 14:41:30 +00:00
|
|
|
int state;
|
|
|
|
|
|
|
|
long active;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainSnapshotObj virDomainSnapshotObj;
|
|
|
|
typedef virDomainSnapshotObj *virDomainSnapshotObjPtr;
|
|
|
|
struct _virDomainSnapshotObj {
|
|
|
|
virDomainSnapshotDefPtr def;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainSnapshotObjList virDomainSnapshotObjList;
|
|
|
|
typedef virDomainSnapshotObjList *virDomainSnapshotObjListPtr;
|
|
|
|
struct _virDomainSnapshotObjList {
|
|
|
|
/* name string -> virDomainSnapshotObj mapping
|
|
|
|
* for O(1), lockless lookup-by-name */
|
|
|
|
virHashTable *objs;
|
|
|
|
};
|
|
|
|
|
|
|
|
virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr,
|
|
|
|
int newSnapshot);
|
|
|
|
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def);
|
|
|
|
char *virDomainSnapshotDefFormat(char *domain_uuid,
|
|
|
|
virDomainSnapshotDefPtr def,
|
|
|
|
int internal);
|
|
|
|
virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
|
|
|
|
const virDomainSnapshotDefPtr def);
|
|
|
|
|
|
|
|
int virDomainSnapshotObjListInit(virDomainSnapshotObjListPtr objs);
|
|
|
|
int virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
|
|
|
|
char **const names, int maxnames);
|
|
|
|
int virDomainSnapshotObjListNum(virDomainSnapshotObjListPtr snapshots);
|
|
|
|
virDomainSnapshotObjPtr virDomainSnapshotFindByName(const virDomainSnapshotObjListPtr snapshots,
|
|
|
|
const char *name);
|
|
|
|
void virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
|
|
|
|
virDomainSnapshotObjPtr snapshot);
|
|
|
|
int virDomainSnapshotHasChildren(virDomainSnapshotObjPtr snap,
|
|
|
|
virDomainSnapshotObjListPtr snapshots);
|
|
|
|
|
2011-03-29 13:33:36 +00:00
|
|
|
typedef struct _virDomainVcpupinDef virDomainVcpupinDef;
|
|
|
|
typedef virDomainVcpupinDef *virDomainVcpupinDefPtr;
|
|
|
|
struct _virDomainVcpupinDef {
|
|
|
|
int vcpuid;
|
|
|
|
char *cpumask;
|
|
|
|
};
|
|
|
|
|
|
|
|
int virDomainVcpupinIsDuplicate(virDomainVcpupinDefPtr *def,
|
|
|
|
int nvcpupin,
|
|
|
|
int vcpu);
|
|
|
|
|
|
|
|
virDomainVcpupinDefPtr virDomainVcpupinFindByVcpu(virDomainVcpupinDefPtr *def,
|
|
|
|
int nvcpupin,
|
|
|
|
int vcpu);
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* Guest VM main configuration */
|
|
|
|
typedef struct _virDomainDef virDomainDef;
|
|
|
|
typedef virDomainDef *virDomainDefPtr;
|
|
|
|
struct _virDomainDef {
|
|
|
|
int virtType;
|
|
|
|
int id;
|
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
|
|
|
char *name;
|
2009-09-30 14:07:24 +00:00
|
|
|
char *description;
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2011-02-08 06:59:38 +00:00
|
|
|
struct {
|
|
|
|
unsigned int weight;
|
|
|
|
} blkio;
|
|
|
|
|
2010-10-12 14:43:39 +00:00
|
|
|
struct {
|
|
|
|
unsigned long max_balloon;
|
|
|
|
unsigned long cur_balloon;
|
|
|
|
unsigned long hugepage_backed;
|
|
|
|
unsigned long hard_limit;
|
|
|
|
unsigned long soft_limit;
|
|
|
|
unsigned long min_guarantee;
|
|
|
|
unsigned long swap_hard_limit;
|
|
|
|
} mem;
|
2010-09-29 16:20:07 +00:00
|
|
|
unsigned short vcpus;
|
|
|
|
unsigned short maxvcpus;
|
2008-07-11 16:23:36 +00:00
|
|
|
int cpumasklen;
|
|
|
|
char *cpumask;
|
|
|
|
|
2011-03-29 13:33:36 +00:00
|
|
|
struct {
|
|
|
|
unsigned long shares;
|
|
|
|
int nvcpupin;
|
|
|
|
virDomainVcpupinDefPtr *vcpupin;
|
|
|
|
} cputune;
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* These 3 are based on virDomainLifeCycleAction enum flags */
|
|
|
|
int onReboot;
|
|
|
|
int onPoweroff;
|
|
|
|
int onCrash;
|
|
|
|
|
|
|
|
virDomainOSDef os;
|
|
|
|
char *emulator;
|
|
|
|
int features;
|
|
|
|
|
2010-02-02 17:22:03 +00:00
|
|
|
virDomainClockDef clock;
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2009-05-07 07:27:49 +00:00
|
|
|
int ngraphics;
|
|
|
|
virDomainGraphicsDefPtr *graphics;
|
2008-10-10 16:08:01 +00:00
|
|
|
|
|
|
|
int ndisks;
|
|
|
|
virDomainDiskDefPtr *disks;
|
|
|
|
|
2009-12-02 19:15:38 +00:00
|
|
|
int ncontrollers;
|
|
|
|
virDomainControllerDefPtr *controllers;
|
|
|
|
|
2008-10-10 16:08:01 +00:00
|
|
|
int nfss;
|
|
|
|
virDomainFSDefPtr *fss;
|
|
|
|
|
|
|
|
int nnets;
|
|
|
|
virDomainNetDefPtr *nets;
|
|
|
|
|
|
|
|
int ninputs;
|
|
|
|
virDomainInputDefPtr *inputs;
|
|
|
|
|
|
|
|
int nsounds;
|
|
|
|
virDomainSoundDefPtr *sounds;
|
|
|
|
|
2009-07-06 13:54:44 +00:00
|
|
|
int nvideos;
|
|
|
|
virDomainVideoDefPtr *videos;
|
|
|
|
|
2008-10-10 16:08:01 +00:00
|
|
|
int nhostdevs;
|
|
|
|
virDomainHostdevDefPtr *hostdevs;
|
|
|
|
|
2011-01-10 16:41:33 +00:00
|
|
|
int nsmartcards;
|
|
|
|
virDomainSmartcardDefPtr *smartcards;
|
|
|
|
|
2008-10-10 16:08:01 +00:00
|
|
|
int nserials;
|
|
|
|
virDomainChrDefPtr *serials;
|
|
|
|
|
|
|
|
int nparallels;
|
|
|
|
virDomainChrDefPtr *parallels;
|
|
|
|
|
2009-11-05 14:31:03 +00:00
|
|
|
int nchannels;
|
|
|
|
virDomainChrDefPtr *channels;
|
|
|
|
|
2008-10-10 16:08:01 +00:00
|
|
|
/* Only 1 */
|
2008-07-11 16:23:36 +00:00
|
|
|
virDomainChrDefPtr console;
|
2009-03-03 09:44:41 +00:00
|
|
|
virSecurityLabelDef seclabel;
|
2009-10-21 12:26:38 +00:00
|
|
|
virDomainWatchdogDefPtr watchdog;
|
2010-07-15 13:02:42 +00:00
|
|
|
virDomainMemballoonDefPtr memballoon;
|
2009-12-18 13:44:55 +00:00
|
|
|
virCPUDefPtr cpu;
|
2010-11-05 10:45:44 +00:00
|
|
|
virSysinfoDefPtr sysinfo;
|
2010-04-17 03:08:29 +00:00
|
|
|
|
|
|
|
void *namespaceData;
|
|
|
|
virDomainXMLNamespace ns;
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
2011-05-04 10:40:59 +00:00
|
|
|
enum virDomainTaintFlags {
|
|
|
|
VIR_DOMAIN_TAINT_CUSTOM_ARGV, /* Custom ARGV passthrough from XML */
|
|
|
|
VIR_DOMAIN_TAINT_CUSTOM_MONITOR, /* Custom monitor commands issued */
|
|
|
|
VIR_DOMAIN_TAINT_HIGH_PRIVILEGES, /* Running with undesirably high privileges */
|
|
|
|
VIR_DOMAIN_TAINT_SHELL_SCRIPTS, /* Network configuration using opaque shell scripts */
|
|
|
|
VIR_DOMAIN_TAINT_DISK_PROBING, /* Relying on potentially unsafe disk format probing */
|
|
|
|
|
|
|
|
VIR_DOMAIN_TAINT_LAST
|
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
/* Guest VM runtime state */
|
2011-05-04 09:07:01 +00:00
|
|
|
typedef struct _virDomainStateReason virDomainStateReason;
|
|
|
|
struct _virDomainStateReason {
|
|
|
|
int state;
|
|
|
|
int reason;
|
|
|
|
};
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
typedef struct _virDomainObj virDomainObj;
|
|
|
|
typedef virDomainObj *virDomainObjPtr;
|
|
|
|
struct _virDomainObj {
|
2009-01-15 19:56:05 +00:00
|
|
|
virMutex lock;
|
2009-10-15 11:30:26 +00:00
|
|
|
int refs;
|
2008-12-04 22:00:14 +00:00
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
int pid;
|
2011-05-04 09:07:01 +00:00
|
|
|
virDomainStateReason state;
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
unsigned int autostart : 1;
|
|
|
|
unsigned int persistent : 1;
|
2010-11-15 03:23:32 +00:00
|
|
|
unsigned int updated : 1;
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
virDomainDefPtr def; /* The current definition */
|
|
|
|
virDomainDefPtr newDef; /* New definition to activate at shutdown */
|
2009-10-06 11:50:58 +00:00
|
|
|
|
2010-04-02 14:41:30 +00:00
|
|
|
virDomainSnapshotObjList snapshots;
|
|
|
|
virDomainSnapshotObjPtr current_snapshot;
|
|
|
|
|
2009-10-06 11:50:58 +00:00
|
|
|
void *privateData;
|
|
|
|
void (*privateDataFreeFunc)(void *);
|
2011-05-04 10:40:59 +00:00
|
|
|
|
|
|
|
int taint;
|
2008-07-11 16:23:36 +00:00
|
|
|
};
|
|
|
|
|
2008-10-10 14:20:37 +00:00
|
|
|
typedef struct _virDomainObjList virDomainObjList;
|
|
|
|
typedef virDomainObjList *virDomainObjListPtr;
|
|
|
|
struct _virDomainObjList {
|
Convert virDomainObjListPtr to use a hash of domain objects
The current virDomainObjListPtr object stores domain objects in
an array. This means that to find a particular objects requires
O(n) time, and more critically acquiring O(n) mutex locks.
The new impl replaces the array with a virHashTable, keyed off
UUID. Finding a object based on UUID is now O(1) time, and only
requires a single mutex lock. Finding by name/id is unchanged
in complexity.
In changing this, all code which iterates over the array had
to be updated to use a hash table iterator function callback.
Several of the functions which were identically duplicating
across all drivers were pulled into domain_conf.c
* src/conf/domain_conf.h, src/conf/domain_conf.c: Change
virDomainObjListPtr to use virHashTable. Add a initializer
method virDomainObjListInit, and rename virDomainObjListFree
to virDomainObjListDeinit, since its not actually freeing
the container, only its contents. Also add some convenient
methods virDomainObjListGetInactiveNames,
virDomainObjListGetActiveIDs and virDomainObjListNumOfDomains
which can be used to implement the correspondingly named
public API entry points in drivers
* src/libvirt_private.syms: Export new methods from domain_conf.h
* src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
src/openvz/openvz_conf.c, src/openvz/openvz_driver.c,
src/qemu/qemu_driver.c, src/test/test_driver.c,
src/uml/uml_driver.c, src/vbox/vbox_tmpl.c: Update all code
to deal with hash tables instead of arrays for domains
2009-10-09 11:33:51 +00:00
|
|
|
/* uuid string -> virDomainObj mapping
|
|
|
|
* for O(1), lockless lookup-by-uuid */
|
|
|
|
virHashTable *objs;
|
2008-10-10 14:20:37 +00:00
|
|
|
};
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2011-03-23 05:48:24 +00:00
|
|
|
static inline bool
|
Rename internal APis
Rename virDomainIsActive to virDomainObjIsActive, and
virInterfaceIsActive to virInterfaceObjIsActive and finally
virNetworkIsActive to virNetworkObjIsActive.
* src/conf/domain_conf.c, src/conf/domain_conf.h,
src/conf/interface_conf.h, src/conf/network_conf.c,
src/conf/network_conf.h, src/lxc/lxc_driver.c,
src/network/bridge_driver.c, src/opennebula/one_driver.c,
src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
src/test/test_driver.c, src/uml/uml_driver.c: Update for
renamed APIs.
2009-10-20 14:51:03 +00:00
|
|
|
virDomainObjIsActive(virDomainObjPtr dom)
|
2008-07-11 16:23:36 +00:00
|
|
|
{
|
|
|
|
return dom->def->id != -1;
|
|
|
|
}
|
|
|
|
|
2009-11-30 18:35:58 +00:00
|
|
|
|
Convert virDomainObjListPtr to use a hash of domain objects
The current virDomainObjListPtr object stores domain objects in
an array. This means that to find a particular objects requires
O(n) time, and more critically acquiring O(n) mutex locks.
The new impl replaces the array with a virHashTable, keyed off
UUID. Finding a object based on UUID is now O(1) time, and only
requires a single mutex lock. Finding by name/id is unchanged
in complexity.
In changing this, all code which iterates over the array had
to be updated to use a hash table iterator function callback.
Several of the functions which were identically duplicating
across all drivers were pulled into domain_conf.c
* src/conf/domain_conf.h, src/conf/domain_conf.c: Change
virDomainObjListPtr to use virHashTable. Add a initializer
method virDomainObjListInit, and rename virDomainObjListFree
to virDomainObjListDeinit, since its not actually freeing
the container, only its contents. Also add some convenient
methods virDomainObjListGetInactiveNames,
virDomainObjListGetActiveIDs and virDomainObjListNumOfDomains
which can be used to implement the correspondingly named
public API entry points in drivers
* src/libvirt_private.syms: Export new methods from domain_conf.h
* src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
src/openvz/openvz_conf.c, src/openvz/openvz_driver.c,
src/qemu/qemu_driver.c, src/test/test_driver.c,
src/uml/uml_driver.c, src/vbox/vbox_tmpl.c: Update all code
to deal with hash tables instead of arrays for domains
2009-10-09 11:33:51 +00:00
|
|
|
int virDomainObjListInit(virDomainObjListPtr objs);
|
|
|
|
void virDomainObjListDeinit(virDomainObjListPtr objs);
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2008-10-10 14:20:37 +00:00
|
|
|
virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms,
|
2008-07-11 16:23:36 +00:00
|
|
|
int id);
|
2008-10-10 14:20:37 +00:00
|
|
|
virDomainObjPtr virDomainFindByUUID(const virDomainObjListPtr doms,
|
2008-07-11 16:23:36 +00:00
|
|
|
const unsigned char *uuid);
|
2008-10-10 14:20:37 +00:00
|
|
|
virDomainObjPtr virDomainFindByName(const virDomainObjListPtr doms,
|
2008-07-11 16:23:36 +00:00
|
|
|
const char *name);
|
|
|
|
|
2011-05-04 10:40:59 +00:00
|
|
|
bool virDomainObjTaint(virDomainObjPtr obj,
|
|
|
|
enum virDomainTaintFlags taint);
|
2008-07-11 16:23:36 +00:00
|
|
|
|
|
|
|
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
|
|
|
|
void virDomainInputDefFree(virDomainInputDefPtr def);
|
|
|
|
void virDomainDiskDefFree(virDomainDiskDefPtr def);
|
2010-12-07 19:56:34 +00:00
|
|
|
void virDomainDiskHostDefFree(virDomainDiskHostDefPtr def);
|
2009-12-02 19:15:38 +00:00
|
|
|
void virDomainControllerDefFree(virDomainControllerDefPtr def);
|
2008-08-01 13:31:37 +00:00
|
|
|
void virDomainFSDefFree(virDomainFSDefPtr def);
|
2008-07-11 16:23:36 +00:00
|
|
|
void virDomainNetDefFree(virDomainNetDefPtr def);
|
2011-01-10 16:41:33 +00:00
|
|
|
void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def);
|
2008-07-11 16:23:36 +00:00
|
|
|
void virDomainChrDefFree(virDomainChrDefPtr def);
|
domain_conf: split source data out from ChrDef
This opens up the possibility of reusing the smaller ChrSourceDef
for both qemu monitor and a passthrough smartcard device.
* src/conf/domain_conf.h (_virDomainChrDef): Factor host
details...
(_virDomainChrSourceDef): ...into new struct.
(virDomainChrSourceDefFree): New prototype.
* src/conf/domain_conf.c (virDomainChrDefFree)
(virDomainChrDefParseXML, virDomainChrDefFormat): Split...
(virDomainChrSourceDefClear, virDomainChrSourceDefFree)
(virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
...into new functions.
(virDomainChrDefParseTargetXML): Update clients to reflect type
split.
* src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
(virVMXFormatSerial, virVMXFormatParallel): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
* src/xen/xend_internal.c (xenDaemonParseSxprChar)
(xenDaemonFormatSxprChr): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
(vboxAttachParallel): Likewise.
* src/security/security_dac.c (virSecurityDACSetChardevLabel)
(virSecurityDACSetChardevCallback)
(virSecurityDACRestoreChardevLabel)
(virSecurityDACRestoreChardevCallback): Likewise.
* src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback)
(SELinuxRestoreSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback): Likewise.
* src/security/virt-aa-helper.c (get_files): Likewise.
* src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
Likewise.
* src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
* src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
(umlDomainOpenConsole): Likewise.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildChrArgStr, qemuBuildCommandLine)
(qemuParseCommandLineChr): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
(qemuDomainObjPrivateXMLParse): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
(qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
(qemuPrepareMonitorChr, qemudShutdownVMDaemon)
(qemuDomainOpenConsole): Likewise.
* src/qemu/qemu_command.h (qemuBuildChrChardevStr)
(qemuBuildChrArgStr): Delete, now that they are static.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): Update list.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
tests.
2011-01-07 22:45:01 +00:00
|
|
|
void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def);
|
2008-07-11 16:23:36 +00:00
|
|
|
void virDomainSoundDefFree(virDomainSoundDefPtr def);
|
2010-07-15 13:02:42 +00:00
|
|
|
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
|
2009-10-21 12:26:38 +00:00
|
|
|
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
|
2009-07-06 13:54:44 +00:00
|
|
|
void virDomainVideoDefFree(virDomainVideoDefPtr def);
|
2008-08-08 14:27:05 +00:00
|
|
|
void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
|
2008-07-11 16:23:36 +00:00
|
|
|
void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
|
2009-11-30 18:35:58 +00:00
|
|
|
int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
|
|
|
|
int type);
|
|
|
|
int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr);
|
2009-12-01 16:56:24 +00:00
|
|
|
int virDomainDeviceDriveAddressIsValid(virDomainDeviceDriveAddressPtr addr);
|
2010-02-18 16:52:03 +00:00
|
|
|
int virDomainDeviceVirtioSerialAddressIsValid(virDomainDeviceVirtioSerialAddressPtr addr);
|
2009-11-30 18:35:58 +00:00
|
|
|
int virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info);
|
|
|
|
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
|
2010-01-06 10:35:30 +00:00
|
|
|
void virDomainDefClearPCIAddresses(virDomainDefPtr def);
|
2010-01-08 15:53:53 +00:00
|
|
|
void virDomainDefClearDeviceAliases(virDomainDefPtr def);
|
2010-01-06 10:35:30 +00:00
|
|
|
|
2010-01-27 15:10:34 +00:00
|
|
|
typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
|
|
|
|
virDomainDeviceInfoPtr dev,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
int virDomainDeviceInfoIterate(virDomainDefPtr def,
|
|
|
|
virDomainDeviceInfoCallback cb,
|
|
|
|
void *opaque);
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
void virDomainDefFree(virDomainDefPtr vm);
|
2009-10-15 11:30:26 +00:00
|
|
|
void virDomainObjRef(virDomainObjPtr vm);
|
|
|
|
/* Returns 1 if the object was freed, 0 if more refs exist */
|
2011-03-18 17:32:35 +00:00
|
|
|
int virDomainObjUnref(virDomainObjPtr vm) ATTRIBUTE_RETURN_CHECK;
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2011-04-14 16:05:14 +00:00
|
|
|
virDomainChrDefPtr virDomainChrDefNew(void);
|
|
|
|
|
2010-03-24 14:31:21 +00:00
|
|
|
/* live == true means def describes an active domain (being migrated or
|
|
|
|
* restored) as opposed to a new persistent configuration of the domain */
|
2010-02-09 18:58:01 +00:00
|
|
|
virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
|
2008-10-10 14:20:37 +00:00
|
|
|
virDomainObjListPtr doms,
|
2010-03-24 14:31:21 +00:00
|
|
|
const virDomainDefPtr def,
|
|
|
|
bool live);
|
2010-05-20 09:36:24 +00:00
|
|
|
void virDomainObjAssignDef(virDomainObjPtr domain,
|
|
|
|
const virDomainDefPtr def,
|
|
|
|
bool live);
|
2010-11-19 18:34:19 +00:00
|
|
|
int virDomainObjSetDefTransient(virCapsPtr caps,
|
2011-01-12 06:04:33 +00:00
|
|
|
virDomainObjPtr domain,
|
|
|
|
bool live);
|
2010-11-19 19:51:46 +00:00
|
|
|
virDomainDefPtr
|
|
|
|
virDomainObjGetPersistentDef(virCapsPtr caps,
|
|
|
|
virDomainObjPtr domain);
|
2011-04-22 03:07:56 +00:00
|
|
|
virDomainDefPtr
|
|
|
|
virDomainObjCopyPersistentDef(virCapsPtr caps, virDomainObjPtr dom);
|
|
|
|
|
2008-10-10 14:20:37 +00:00
|
|
|
void virDomainRemoveInactive(virDomainObjListPtr doms,
|
2008-07-11 16:23:36 +00:00
|
|
|
virDomainObjPtr dom);
|
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
|
2008-07-11 16:23:36 +00:00
|
|
|
const virDomainDefPtr def,
|
2009-01-08 13:54:20 +00:00
|
|
|
const char *xmlStr,
|
|
|
|
int flags);
|
2010-02-09 18:58:01 +00:00
|
|
|
virDomainDefPtr virDomainDefParseString(virCapsPtr caps,
|
2009-01-08 13:54:20 +00:00
|
|
|
const char *xmlStr,
|
|
|
|
int flags);
|
2010-02-09 18:58:01 +00:00
|
|
|
virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
|
2008-12-04 12:02:59 +00:00
|
|
|
const char *filename,
|
|
|
|
int flags);
|
2010-02-09 18:58:01 +00:00
|
|
|
virDomainDefPtr virDomainDefParseNode(virCapsPtr caps,
|
2008-07-11 16:23:36 +00:00
|
|
|
xmlDocPtr doc,
|
2008-12-04 12:02:59 +00:00
|
|
|
xmlNodePtr root,
|
|
|
|
int flags);
|
2009-06-12 11:38:50 +00:00
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
virDomainObjPtr virDomainObjParseFile(virCapsPtr caps,
|
2009-06-12 11:38:50 +00:00
|
|
|
const char *filename);
|
|
|
|
|
2010-02-18 16:52:03 +00:00
|
|
|
int virDomainDefAddImplicitControllers(virDomainDefPtr def);
|
2010-01-05 13:31:20 +00:00
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
char *virDomainDefFormat(virDomainDefPtr def,
|
2008-07-11 16:23:36 +00:00
|
|
|
int flags);
|
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
int virDomainCpuSetParse(const char **str,
|
2008-07-11 16:23:36 +00:00
|
|
|
char sep,
|
|
|
|
char *cpuset,
|
|
|
|
int maxcpu);
|
2010-02-09 18:58:01 +00:00
|
|
|
char *virDomainCpuSetFormat(char *cpuset,
|
2008-07-11 16:23:36 +00:00
|
|
|
int maxcpu);
|
|
|
|
|
2011-03-29 13:33:36 +00:00
|
|
|
int virDomainVcpupinAdd(virDomainDefPtr def,
|
|
|
|
unsigned char *cpumap,
|
|
|
|
int maplen,
|
|
|
|
int vcpu);
|
|
|
|
|
2011-04-22 03:09:32 +00:00
|
|
|
int virDomainDiskIndexByName(virDomainDefPtr def, const char *name);
|
2009-08-14 09:31:36 +00:00
|
|
|
int virDomainDiskInsert(virDomainDefPtr def,
|
|
|
|
virDomainDiskDefPtr disk);
|
|
|
|
void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
|
|
|
|
virDomainDiskDefPtr disk);
|
2010-06-15 22:17:34 +00:00
|
|
|
int virDomainDiskDefAssignAddress(virCapsPtr caps, virDomainDiskDefPtr def);
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2010-08-23 09:31:26 +00:00
|
|
|
void virDomainDiskRemove(virDomainDefPtr def, size_t i);
|
2011-04-22 03:09:32 +00:00
|
|
|
int virDomainDiskRemoveByName(virDomainDefPtr def, const char *name);
|
2010-08-23 09:31:26 +00:00
|
|
|
|
2011-05-27 07:01:47 +00:00
|
|
|
int virDomainNetIndexByMac(virDomainDefPtr def, const unsigned char *mac);
|
|
|
|
int virDomainNetInsert(virDomainDefPtr def, virDomainNetDefPtr net);
|
|
|
|
int virDomainNetRemoveByMac(virDomainDefPtr def, const unsigned char *mac);
|
|
|
|
|
2009-12-02 19:15:38 +00:00
|
|
|
int virDomainControllerInsert(virDomainDefPtr def,
|
|
|
|
virDomainControllerDefPtr controller);
|
|
|
|
void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
|
|
|
|
virDomainControllerDefPtr controller);
|
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
int virDomainSaveXML(const char *configDir,
|
2008-12-20 13:09:45 +00:00
|
|
|
virDomainDefPtr def,
|
|
|
|
const char *xml);
|
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
int virDomainSaveConfig(const char *configDir,
|
2008-08-20 19:42:36 +00:00
|
|
|
virDomainDefPtr def);
|
2010-02-09 18:58:01 +00:00
|
|
|
int virDomainSaveStatus(virCapsPtr caps,
|
2009-06-12 11:38:50 +00:00
|
|
|
const char *statusDir,
|
2010-05-19 15:48:03 +00:00
|
|
|
virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2008-11-17 16:52:32 +00:00
|
|
|
typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
|
|
|
|
int newDomain,
|
|
|
|
void *opaque);
|
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
int virDomainLoadAllConfigs(virCapsPtr caps,
|
2008-10-10 14:20:37 +00:00
|
|
|
virDomainObjListPtr doms,
|
2008-07-11 16:23:36 +00:00
|
|
|
const char *configDir,
|
2008-11-17 16:52:32 +00:00
|
|
|
const char *autostartDir,
|
2009-06-12 11:38:50 +00:00
|
|
|
int liveStatus,
|
2008-11-17 16:52:32 +00:00
|
|
|
virDomainLoadConfigNotify notify,
|
|
|
|
void *opaque);
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
int virDomainDeleteConfig(const char *configDir,
|
2008-08-20 19:42:36 +00:00
|
|
|
const char *autostartDir,
|
2008-07-11 16:23:36 +00:00
|
|
|
virDomainObjPtr dom);
|
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
char *virDomainConfigFile(const char *dir,
|
2008-08-20 19:42:36 +00:00
|
|
|
const char *name);
|
|
|
|
|
2008-09-03 16:05:25 +00:00
|
|
|
int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
|
|
|
|
int *busIdx,
|
|
|
|
int *devIdx);
|
|
|
|
|
2009-04-22 14:26:50 +00:00
|
|
|
virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def);
|
2009-07-06 13:54:44 +00:00
|
|
|
int virDomainVideoDefaultType(virDomainDefPtr def);
|
|
|
|
int virDomainVideoDefaultRAM(virDomainDefPtr def, int type);
|
2009-04-22 14:26:50 +00:00
|
|
|
|
2009-11-02 18:37:38 +00:00
|
|
|
int virDomainObjIsDuplicate(virDomainObjListPtr doms,
|
|
|
|
virDomainDefPtr def,
|
|
|
|
unsigned int check_active);
|
|
|
|
|
2008-12-04 20:53:20 +00:00
|
|
|
void virDomainObjLock(virDomainObjPtr obj);
|
|
|
|
void virDomainObjUnlock(virDomainObjPtr obj);
|
2008-09-05 11:52:12 +00:00
|
|
|
|
Convert virDomainObjListPtr to use a hash of domain objects
The current virDomainObjListPtr object stores domain objects in
an array. This means that to find a particular objects requires
O(n) time, and more critically acquiring O(n) mutex locks.
The new impl replaces the array with a virHashTable, keyed off
UUID. Finding a object based on UUID is now O(1) time, and only
requires a single mutex lock. Finding by name/id is unchanged
in complexity.
In changing this, all code which iterates over the array had
to be updated to use a hash table iterator function callback.
Several of the functions which were identically duplicating
across all drivers were pulled into domain_conf.c
* src/conf/domain_conf.h, src/conf/domain_conf.c: Change
virDomainObjListPtr to use virHashTable. Add a initializer
method virDomainObjListInit, and rename virDomainObjListFree
to virDomainObjListDeinit, since its not actually freeing
the container, only its contents. Also add some convenient
methods virDomainObjListGetInactiveNames,
virDomainObjListGetActiveIDs and virDomainObjListNumOfDomains
which can be used to implement the correspondingly named
public API entry points in drivers
* src/libvirt_private.syms: Export new methods from domain_conf.h
* src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
src/openvz/openvz_conf.c, src/openvz/openvz_driver.c,
src/qemu/qemu_driver.c, src/test/test_driver.c,
src/uml/uml_driver.c, src/vbox/vbox_tmpl.c: Update all code
to deal with hash tables instead of arrays for domains
2009-10-09 11:33:51 +00:00
|
|
|
int virDomainObjListNumOfDomains(virDomainObjListPtr doms, int active);
|
|
|
|
|
|
|
|
int virDomainObjListGetActiveIDs(virDomainObjListPtr doms,
|
|
|
|
int *ids,
|
|
|
|
int maxids);
|
|
|
|
int virDomainObjListGetInactiveNames(virDomainObjListPtr doms,
|
|
|
|
char **const names,
|
|
|
|
int maxnames);
|
|
|
|
|
2011-01-10 16:41:33 +00:00
|
|
|
typedef int (*virDomainSmartcardDefIterator)(virDomainDefPtr def,
|
|
|
|
virDomainSmartcardDefPtr dev,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
int virDomainSmartcardDefForeach(virDomainDefPtr def,
|
|
|
|
bool abortOnError,
|
|
|
|
virDomainSmartcardDefIterator iter,
|
|
|
|
void *opaque);
|
|
|
|
|
2010-06-24 14:06:43 +00:00
|
|
|
typedef int (*virDomainChrDefIterator)(virDomainDefPtr def,
|
|
|
|
virDomainChrDefPtr dev,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
int virDomainChrDefForeach(virDomainDefPtr def,
|
|
|
|
bool abortOnError,
|
|
|
|
virDomainChrDefIterator iter,
|
|
|
|
void *opaque);
|
|
|
|
|
2010-06-14 17:09:15 +00:00
|
|
|
typedef int (*virDomainDiskDefPathIterator)(virDomainDiskDefPtr disk,
|
|
|
|
const char *path,
|
|
|
|
size_t depth,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
|
|
|
|
bool allowProbing,
|
|
|
|
bool ignoreOpenFailure,
|
|
|
|
virDomainDiskDefPathIterator iter,
|
|
|
|
void *opaque);
|
|
|
|
|
2011-05-04 09:07:01 +00:00
|
|
|
void
|
|
|
|
virDomainObjSetState(virDomainObjPtr obj, virDomainState state, int reason)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
virDomainState
|
|
|
|
virDomainObjGetState(virDomainObjPtr obj, int *reason)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2010-08-12 17:15:44 +00:00
|
|
|
typedef const char* (*virLifecycleToStringFunc)(int type);
|
|
|
|
typedef int (*virLifecycleFromStringFunc)(const char *type);
|
|
|
|
|
2011-05-04 10:40:59 +00:00
|
|
|
VIR_ENUM_DECL(virDomainTaint)
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
VIR_ENUM_DECL(virDomainVirt)
|
|
|
|
VIR_ENUM_DECL(virDomainBoot)
|
|
|
|
VIR_ENUM_DECL(virDomainFeature)
|
|
|
|
VIR_ENUM_DECL(virDomainLifecycle)
|
2010-08-12 17:15:44 +00:00
|
|
|
VIR_ENUM_DECL(virDomainLifecycleCrash)
|
2009-03-02 17:39:43 +00:00
|
|
|
VIR_ENUM_DECL(virDomainDevice)
|
2009-11-30 18:35:58 +00:00
|
|
|
VIR_ENUM_DECL(virDomainDeviceAddress)
|
|
|
|
VIR_ENUM_DECL(virDomainDeviceAddressMode)
|
2008-07-11 16:23:36 +00:00
|
|
|
VIR_ENUM_DECL(virDomainDisk)
|
|
|
|
VIR_ENUM_DECL(virDomainDiskDevice)
|
|
|
|
VIR_ENUM_DECL(virDomainDiskBus)
|
2009-01-30 17:15:39 +00:00
|
|
|
VIR_ENUM_DECL(virDomainDiskCache)
|
2010-03-24 15:32:10 +00:00
|
|
|
VIR_ENUM_DECL(virDomainDiskErrorPolicy)
|
2010-12-06 07:24:09 +00:00
|
|
|
VIR_ENUM_DECL(virDomainDiskProtocol)
|
2010-04-21 14:28:21 +00:00
|
|
|
VIR_ENUM_DECL(virDomainDiskIo)
|
2009-12-02 19:15:38 +00:00
|
|
|
VIR_ENUM_DECL(virDomainController)
|
2010-06-17 14:39:50 +00:00
|
|
|
VIR_ENUM_DECL(virDomainControllerModel)
|
2008-08-01 13:31:37 +00:00
|
|
|
VIR_ENUM_DECL(virDomainFS)
|
2010-10-14 13:08:24 +00:00
|
|
|
VIR_ENUM_DECL(virDomainFSAccessMode)
|
2008-07-11 16:23:36 +00:00
|
|
|
VIR_ENUM_DECL(virDomainNet)
|
2011-01-12 04:18:49 +00:00
|
|
|
VIR_ENUM_DECL(virDomainNetBackend)
|
Add txmode attribute to interface XML for virtio backend
This is in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=629662
Explanation
qemu's virtio-net-pci driver allows setting the algorithm used for tx
packets to either "bh" or "timer". This is done by adding ",tx=bh" or
",tx=timer" to the "-device virtio-net-pci" commandline option.
'bh' stands for 'bottom half'; when this is set, packet tx is all done
in an iothread in the bottom half of the driver. (In libvirt, this
option is called the more descriptive "iothread".)
'timer' means that tx work is done in qemu, and if there is more tx
data than can be sent at the present time, a timer is set before qemu
moves on to do other things; when the timer fires, another attempt is
made to send more data. (libvirt retains the name "timer" for this
option.)
The resulting difference, according to the qemu developer who added
the option is:
bh makes tx more asynchronous and reduces latency, but potentially
causes more processor bandwidth contention since the cpu doing the
tx isn't necessarily the cpu where the guest generated the
packets.
Solution
This patch provides a libvirt domain xml knob to change the option on
the qemu commandline, by adding a new attribute "txmode" to the
<driver> element that can be placed inside any <interface> element in
a domain definition. It's use would be something like this:
<interface ...>
...
<model type='virtio'/>
<driver txmode='iothread'/>
...
</interface>
I chose to put this setting as an attribute to <driver> rather than as
a sub-element to <tune> because it is specific to the virtio-net
driver, not something that is generally usable by all network drivers.
(note that this is the same placement as the "driver name=..."
attribute used to choose kernel vs. userland backend for the
virtio-net driver.)
Actually adding the tx=xxx option to the qemu commandline is only done
if the version of qemu being used advertises it in the output of
qemu -device virtio-net-pci,?
If a particular txmode is requested in the XML, and the option isn't
listed in that help output, an UNSUPPORTED_CONFIG error is logged, and
the domain fails to start.
2011-02-03 20:20:01 +00:00
|
|
|
VIR_ENUM_DECL(virDomainNetVirtioTxMode)
|
2010-07-13 19:05:34 +00:00
|
|
|
VIR_ENUM_DECL(virDomainChrDevice)
|
2010-07-13 20:06:38 +00:00
|
|
|
VIR_ENUM_DECL(virDomainChrChannelTarget)
|
2010-07-22 17:56:21 +00:00
|
|
|
VIR_ENUM_DECL(virDomainChrConsoleTarget)
|
2011-01-10 16:41:33 +00:00
|
|
|
VIR_ENUM_DECL(virDomainSmartcard)
|
2008-07-11 16:23:36 +00:00
|
|
|
VIR_ENUM_DECL(virDomainChr)
|
2010-09-29 21:04:19 +00:00
|
|
|
VIR_ENUM_DECL(virDomainChrTcpProtocol)
|
2011-02-04 02:23:31 +00:00
|
|
|
VIR_ENUM_DECL(virDomainChrSpicevmc)
|
2008-07-11 16:23:36 +00:00
|
|
|
VIR_ENUM_DECL(virDomainSoundModel)
|
2010-07-15 13:02:42 +00:00
|
|
|
VIR_ENUM_DECL(virDomainMemballoonModel)
|
2010-11-05 10:45:44 +00:00
|
|
|
VIR_ENUM_DECL(virDomainSysinfo)
|
2010-11-05 13:10:34 +00:00
|
|
|
VIR_ENUM_DECL(virDomainSmbiosMode)
|
2009-10-21 12:26:38 +00:00
|
|
|
VIR_ENUM_DECL(virDomainWatchdogModel)
|
|
|
|
VIR_ENUM_DECL(virDomainWatchdogAction)
|
2009-07-06 13:54:44 +00:00
|
|
|
VIR_ENUM_DECL(virDomainVideo)
|
2008-08-08 14:27:05 +00:00
|
|
|
VIR_ENUM_DECL(virDomainHostdevMode)
|
|
|
|
VIR_ENUM_DECL(virDomainHostdevSubsys)
|
2008-07-11 16:23:36 +00:00
|
|
|
VIR_ENUM_DECL(virDomainInput)
|
|
|
|
VIR_ENUM_DECL(virDomainInputBus)
|
|
|
|
VIR_ENUM_DECL(virDomainGraphics)
|
2010-04-09 16:56:00 +00:00
|
|
|
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelName)
|
|
|
|
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelMode)
|
2011-04-14 08:44:20 +00:00
|
|
|
VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
|
|
|
|
VIR_ENUM_DECL(virDomainGraphicsSpiceJpegCompression)
|
|
|
|
VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
|
|
|
|
VIR_ENUM_DECL(virDomainGraphicsSpicePlaybackCompression)
|
2011-05-23 15:16:42 +00:00
|
|
|
VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
|
2009-01-19 21:06:26 +00:00
|
|
|
/* from libvirt.h */
|
|
|
|
VIR_ENUM_DECL(virDomainState)
|
2011-05-04 09:07:01 +00:00
|
|
|
VIR_ENUM_DECL(virDomainNostateReason)
|
|
|
|
VIR_ENUM_DECL(virDomainRunningReason)
|
|
|
|
VIR_ENUM_DECL(virDomainBlockedReason)
|
|
|
|
VIR_ENUM_DECL(virDomainPausedReason)
|
|
|
|
VIR_ENUM_DECL(virDomainShutdownReason)
|
|
|
|
VIR_ENUM_DECL(virDomainShutoffReason)
|
|
|
|
VIR_ENUM_DECL(virDomainCrashedReason)
|
|
|
|
|
|
|
|
const char *virDomainStateReasonToString(virDomainState state, int reason);
|
|
|
|
int virDomainStateReasonFromString(virDomainState state, const char *reason);
|
|
|
|
|
2009-03-03 16:53:13 +00:00
|
|
|
VIR_ENUM_DECL(virDomainSeclabel)
|
2010-02-02 17:22:03 +00:00
|
|
|
VIR_ENUM_DECL(virDomainClockOffset)
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2010-02-12 17:07:06 +00:00
|
|
|
VIR_ENUM_DECL(virDomainNetdevMacvtap)
|
|
|
|
|
2010-03-30 11:44:22 +00:00
|
|
|
VIR_ENUM_DECL(virDomainTimerName)
|
2010-03-31 17:03:54 +00:00
|
|
|
VIR_ENUM_DECL(virDomainTimerTrack)
|
2010-03-30 11:44:22 +00:00
|
|
|
VIR_ENUM_DECL(virDomainTimerTickpolicy)
|
|
|
|
VIR_ENUM_DECL(virDomainTimerMode)
|
|
|
|
|
2008-07-11 16:23:36 +00:00
|
|
|
#endif /* __DOMAIN_CONF_H */
|