/*
* domain_conf.h: domain XML processing
*
* Copyright (C) 2006-2012 Red Hat, Inc.
* 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, see
* .
*
* Author: Daniel P. Berrange
*/
#ifndef __DOMAIN_CONF_H
# define __DOMAIN_CONF_H
# include
# include
# include
# include "internal.h"
# include "capabilities.h"
# include "storage_encryption_conf.h"
# include "cpu_conf.h"
# include "util.h"
# include "threads.h"
# include "virhash.h"
# include "virsocketaddr.h"
# include "nwfilter_params.h"
# include "nwfilter_conf.h"
# include "virnetdevmacvlan.h"
# include "sysinfo.h"
# include "virnetdevvportprofile.h"
# include "virnetdevopenvswitch.h"
# include "virnetdevbandwidth.h"
# include "virnetdevvlan.h"
# include "virobject.h"
# include "device_conf.h"
/* forward declarations of all device types, required by
* virDomainDeviceDef
*/
typedef struct _virDomainDiskDef virDomainDiskDef;
typedef virDomainDiskDef *virDomainDiskDefPtr;
typedef struct _virDomainControllerDef virDomainControllerDef;
typedef virDomainControllerDef *virDomainControllerDefPtr;
typedef struct _virDomainLeaseDef virDomainLeaseDef;
typedef virDomainLeaseDef *virDomainLeaseDefPtr;
typedef struct _virDomainFSDef virDomainFSDef;
typedef virDomainFSDef *virDomainFSDefPtr;
typedef struct _virDomainNetDef virDomainNetDef;
typedef virDomainNetDef *virDomainNetDefPtr;
typedef struct _virDomainInputDef virDomainInputDef;
typedef virDomainInputDef *virDomainInputDefPtr;
typedef struct _virDomainSoundCodecDef virDomainSoundCodecDef;
typedef virDomainSoundCodecDef *virDomainSoundCodecDefPtr;
typedef struct _virDomainSoundDef virDomainSoundDef;
typedef virDomainSoundDef *virDomainSoundDefPtr;
typedef struct _virDomainVideoDef virDomainVideoDef;
typedef virDomainVideoDef *virDomainVideoDefPtr;
typedef struct _virDomainHostdevDef virDomainHostdevDef;
typedef virDomainHostdevDef *virDomainHostdevDefPtr;
typedef struct _virDomainWatchdogDef virDomainWatchdogDef;
typedef virDomainWatchdogDef *virDomainWatchdogDefPtr;
typedef struct _virDomainGraphicsDef virDomainGraphicsDef;
typedef virDomainGraphicsDef *virDomainGraphicsDefPtr;
typedef struct _virDomainHubDef virDomainHubDef;
typedef virDomainHubDef *virDomainHubDefPtr;
typedef struct _virDomainRedirdevDef virDomainRedirdevDef;
typedef virDomainRedirdevDef *virDomainRedirdevDefPtr;
typedef struct _virDomainSmartcardDef virDomainSmartcardDef;
typedef virDomainSmartcardDef *virDomainSmartcardDefPtr;
typedef struct _virDomainChrDef virDomainChrDef;
typedef virDomainChrDef *virDomainChrDefPtr;
typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;
/* Flags for the 'type' field in virDomainDeviceDef */
typedef enum {
VIR_DOMAIN_DEVICE_NONE = 0,
VIR_DOMAIN_DEVICE_DISK,
VIR_DOMAIN_DEVICE_LEASE,
VIR_DOMAIN_DEVICE_FS,
VIR_DOMAIN_DEVICE_NET,
VIR_DOMAIN_DEVICE_INPUT,
VIR_DOMAIN_DEVICE_SOUND,
VIR_DOMAIN_DEVICE_VIDEO,
VIR_DOMAIN_DEVICE_HOSTDEV,
VIR_DOMAIN_DEVICE_WATCHDOG,
VIR_DOMAIN_DEVICE_CONTROLLER,
VIR_DOMAIN_DEVICE_GRAPHICS,
VIR_DOMAIN_DEVICE_HUB,
VIR_DOMAIN_DEVICE_REDIRDEV,
VIR_DOMAIN_DEVICE_SMARTCARD,
VIR_DOMAIN_DEVICE_CHR,
VIR_DOMAIN_DEVICE_MEMBALLOON,
VIR_DOMAIN_DEVICE_LAST,
} virDomainDeviceType;
typedef struct _virDomainDeviceDef virDomainDeviceDef;
typedef virDomainDeviceDef *virDomainDeviceDefPtr;
struct _virDomainDeviceDef {
int type; /* enum virDomainDeviceType */
union {
virDomainDiskDefPtr disk;
virDomainControllerDefPtr controller;
virDomainLeaseDefPtr lease;
virDomainFSDefPtr fs;
virDomainNetDefPtr net;
virDomainInputDefPtr input;
virDomainSoundDefPtr sound;
virDomainVideoDefPtr video;
virDomainHostdevDefPtr hostdev;
virDomainWatchdogDefPtr watchdog;
virDomainGraphicsDefPtr graphics;
virDomainHubDefPtr hub;
virDomainRedirdevDefPtr redirdev;
virDomainSmartcardDefPtr smartcard;
virDomainChrDefPtr chr;
virDomainMemballoonDefPtr memballoon;
} data;
};
/* 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_TEST,
VIR_DOMAIN_VIRT_VMWARE,
VIR_DOMAIN_VIRT_HYPERV,
VIR_DOMAIN_VIRT_VBOX,
VIR_DOMAIN_VIRT_PHYP,
VIR_DOMAIN_VIRT_PARALLELS,
VIR_DOMAIN_VIRT_LAST,
};
enum virDomainDeviceAddressType {
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
};
enum virDomainPciRombarMode {
VIR_DOMAIN_PCI_ROMBAR_DEFAULT = 0,
VIR_DOMAIN_PCI_ROMBAR_ON,
VIR_DOMAIN_PCI_ROMBAR_OFF,
VIR_DOMAIN_PCI_ROMBAR_LAST
};
typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
struct _virDomainDeviceDriveAddress {
unsigned int controller;
unsigned int bus;
unsigned int target;
unsigned int unit;
};
typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress;
typedef virDomainDeviceVirtioSerialAddress *virDomainDeviceVirtioSerialAddressPtr;
struct _virDomainDeviceVirtioSerialAddress {
unsigned int controller;
unsigned int bus;
unsigned int port;
};
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
typedef virDomainDeviceCcidAddress *virDomainDeviceCcidAddressPtr;
struct _virDomainDeviceCcidAddress {
unsigned int controller;
unsigned int slot;
};
typedef struct _virDomainDeviceUSBAddress virDomainDeviceUSBAddress;
typedef virDomainDeviceUSBAddress *virDomainDeviceUSBAddressPtr;
struct _virDomainDeviceUSBAddress {
unsigned int bus;
char *port;
};
typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress;
typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr;
struct _virDomainDeviceSpaprVioAddress {
unsigned long long reg;
bool has_reg;
};
enum virDomainControllerMaster {
VIR_DOMAIN_CONTROLLER_MASTER_NONE,
VIR_DOMAIN_CONTROLLER_MASTER_USB,
VIR_DOMAIN_CONTROLLER_MASTER_LAST
};
typedef struct _virDomainDeviceUSBMaster virDomainDeviceUSBMaster;
typedef virDomainDeviceUSBMaster *virDomainDeviceUSBMasterPtr;
struct _virDomainDeviceUSBMaster {
unsigned int startport;
};
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
struct _virDomainDeviceInfo {
/* If adding to this struct, ensure that
* virDomainDeviceInfoIsSet() is updated
* to consider the new fields
*/
char *alias;
int type;
union {
virDevicePCIAddress pci;
virDomainDeviceDriveAddress drive;
virDomainDeviceVirtioSerialAddress vioserial;
virDomainDeviceCcidAddress ccid;
virDomainDeviceUSBAddress usb;
virDomainDeviceSpaprVioAddress spaprvio;
} addr;
int mastertype;
union {
virDomainDeviceUSBMaster usb;
} master;
/* rombar and romfile are only used for pci hostdev and network
* devices. */
int rombar; /* enum virDomainPciRombarMode */
char *romfile;
/* bootIndex is only user for disk, network interface, and
* hostdev devices. */
int bootIndex;
};
enum virDomainSeclabelType {
VIR_DOMAIN_SECLABEL_DEFAULT,
VIR_DOMAIN_SECLABEL_NONE,
VIR_DOMAIN_SECLABEL_DYNAMIC,
VIR_DOMAIN_SECLABEL_STATIC,
VIR_DOMAIN_SECLABEL_LAST,
};
/* 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 */
char *baselabel; /* base name of label string */
int type; /* virDomainSeclabelType */
bool norelabel;
};
/* Security configuration for domain */
typedef struct _virSecurityDeviceLabelDef virSecurityDeviceLabelDef;
typedef virSecurityDeviceLabelDef *virSecurityDeviceLabelDefPtr;
struct _virSecurityDeviceLabelDef {
char *model;
char *label; /* image label string */
bool norelabel;
};
typedef struct _virDomainHostdevOrigStates virDomainHostdevOrigStates;
typedef virDomainHostdevOrigStates *virDomainHostdevOrigStatesPtr;
struct _virDomainHostdevOrigStates {
union {
struct {
/* Does the device need to unbind from stub when
* reattaching to host?
*/
unsigned int unbind_from_stub : 1;
/* Does it need to use remove_slot when reattaching
* the device to host?
*/
unsigned int remove_slot : 1;
/* Does it need to reprobe driver for the device when
* reattaching to host?
*/
unsigned int reprobe :1;
} pci;
/* Perhaps 'usb' in future */
} states;
};
struct _virDomainLeaseDef {
char *lockspace;
char *key;
char *path;
unsigned long long offset;
};
enum virDomainHostdevMode {
VIR_DOMAIN_HOSTDEV_MODE_SUBSYS,
VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES,
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 _virDomainHostdevSubsys virDomainHostdevSubsys;
typedef virDomainHostdevSubsys *virDomainHostdevSubsysPtr;
struct _virDomainHostdevSubsys {
int type; /* enum virDomainHostdevSubsysType */
union {
struct {
unsigned bus;
unsigned device;
unsigned vendor;
unsigned product;
} usb;
virDevicePCIAddress pci; /* host address */
} u;
};
/* basic device for direct passthrough */
struct _virDomainHostdevDef {
virDomainDeviceDef parent; /* higher level Def containing this */
int mode; /* enum virDomainHostdevMode */
unsigned int managed : 1;
union {
virDomainHostdevSubsys subsys;
struct {
/* TBD: struct capabilities see:
* https://www.redhat.com/archives/libvir-list/2008-July/msg00429.html
*/
int dummy;
} caps;
} source;
virDomainHostdevOrigStates origstates;
virDomainDeviceInfoPtr info; /* Guest address */
};
/* Two types of disk backends */
enum virDomainDiskType {
VIR_DOMAIN_DISK_TYPE_BLOCK,
VIR_DOMAIN_DISK_TYPE_FILE,
VIR_DOMAIN_DISK_TYPE_DIR,
VIR_DOMAIN_DISK_TYPE_NETWORK,
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_LUN,
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,
VIR_DOMAIN_DISK_BUS_USB,
VIR_DOMAIN_DISK_BUS_UML,
VIR_DOMAIN_DISK_BUS_SATA,
VIR_DOMAIN_DISK_BUS_LAST
};
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_DIRECTSYNC,
VIR_DOMAIN_DISK_CACHE_UNSAFE,
VIR_DOMAIN_DISK_CACHE_LAST
};
enum virDomainDiskErrorPolicy {
VIR_DOMAIN_DISK_ERROR_POLICY_DEFAULT,
VIR_DOMAIN_DISK_ERROR_POLICY_STOP,
VIR_DOMAIN_DISK_ERROR_POLICY_REPORT,
VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE,
VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE,
VIR_DOMAIN_DISK_ERROR_POLICY_LAST
};
enum virDomainDiskProtocol {
VIR_DOMAIN_DISK_PROTOCOL_NBD,
VIR_DOMAIN_DISK_PROTOCOL_RBD,
VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG,
VIR_DOMAIN_DISK_PROTOCOL_LAST
};
enum virDomainDiskTray {
VIR_DOMAIN_DISK_TRAY_CLOSED,
VIR_DOMAIN_DISK_TRAY_OPEN,
VIR_DOMAIN_DISK_TRAY_LAST
};
enum virDomainDiskGeometryTrans {
VIR_DOMAIN_DISK_TRANS_DEFAULT = 0,
VIR_DOMAIN_DISK_TRANS_NONE,
VIR_DOMAIN_DISK_TRANS_AUTO,
VIR_DOMAIN_DISK_TRANS_LBA,
VIR_DOMAIN_DISK_TRANS_LAST
};
typedef struct _virDomainDiskHostDef virDomainDiskHostDef;
typedef virDomainDiskHostDef *virDomainDiskHostDefPtr;
struct _virDomainDiskHostDef {
char *name;
char *port;
};
enum virDomainDiskIo {
VIR_DOMAIN_DISK_IO_DEFAULT,
VIR_DOMAIN_DISK_IO_NATIVE,
VIR_DOMAIN_DISK_IO_THREADS,
VIR_DOMAIN_DISK_IO_LAST
};
enum virDomainIoEventFd {
VIR_DOMAIN_IO_EVENT_FD_DEFAULT = 0,
VIR_DOMAIN_IO_EVENT_FD_ON,
VIR_DOMAIN_IO_EVENT_FD_OFF,
VIR_DOMAIN_IO_EVENT_FD_LAST
};
enum virDomainVirtioEventIdx {
VIR_DOMAIN_VIRTIO_EVENT_IDX_DEFAULT = 0,
VIR_DOMAIN_VIRTIO_EVENT_IDX_ON,
VIR_DOMAIN_VIRTIO_EVENT_IDX_OFF,
VIR_DOMAIN_VIRTIO_EVENT_IDX_LAST
};
enum virDomainDiskCopyOnRead {
VIR_DOMAIN_DISK_COPY_ON_READ_DEFAULT = 0,
VIR_DOMAIN_DISK_COPY_ON_READ_ON,
VIR_DOMAIN_DISK_COPY_ON_READ_OFF,
VIR_DOMAIN_DISK_COPY_ON_READ_LAST
};
enum virDomainDiskSnapshot {
VIR_DOMAIN_DISK_SNAPSHOT_DEFAULT = 0,
VIR_DOMAIN_DISK_SNAPSHOT_NO,
VIR_DOMAIN_DISK_SNAPSHOT_INTERNAL,
VIR_DOMAIN_DISK_SNAPSHOT_EXTERNAL,
VIR_DOMAIN_DISK_SNAPSHOT_LAST
};
enum virDomainSnapshotState {
/* Inherit the VIR_DOMAIN_* states from virDomainState. */
VIR_DOMAIN_DISK_SNAPSHOT = VIR_DOMAIN_LAST,
VIR_DOMAIN_SNAPSHOT_STATE_LAST
};
enum virDomainStartupPolicy {
VIR_DOMAIN_STARTUP_POLICY_DEFAULT = 0,
VIR_DOMAIN_STARTUP_POLICY_MANDATORY,
VIR_DOMAIN_STARTUP_POLICY_REQUISITE,
VIR_DOMAIN_STARTUP_POLICY_OPTIONAL,
VIR_DOMAIN_STARTUP_POLICY_LAST
};
enum virDomainDiskSecretType {
VIR_DOMAIN_DISK_SECRET_TYPE_NONE,
VIR_DOMAIN_DISK_SECRET_TYPE_UUID,
VIR_DOMAIN_DISK_SECRET_TYPE_USAGE,
VIR_DOMAIN_DISK_SECRET_TYPE_LAST
};
typedef struct _virDomainBlockIoTuneInfo virDomainBlockIoTuneInfo;
struct _virDomainBlockIoTuneInfo {
unsigned long long total_bytes_sec;
unsigned long long read_bytes_sec;
unsigned long long write_bytes_sec;
unsigned long long total_iops_sec;
unsigned long long read_iops_sec;
unsigned long long write_iops_sec;
};
typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;
/* Stores the virtual disk configuration */
struct _virDomainDiskDef {
int type;
int device;
int bus;
char *src;
char *dst;
int tray_status;
int protocol;
int nhosts;
virDomainDiskHostDefPtr hosts;
struct {
char *username;
int secretType; /* enum virDomainDiskSecretType */
union {
unsigned char uuid[VIR_UUID_BUFLEN];
char *usage;
} secret;
} auth;
char *driverName;
char *driverType;
char *mirror;
char *mirrorFormat;
bool mirroring;
struct {
unsigned int cylinders;
unsigned int heads;
unsigned int sectors;
int trans;
} geometry;
virDomainBlockIoTuneInfo blkdeviotune;
char *serial;
int cachemode;
int error_policy; /* enum virDomainDiskErrorPolicy */
int rerror_policy; /* enum virDomainDiskErrorPolicy */
int iomode;
int ioeventfd;
int event_idx;
int copy_on_read;
int snapshot; /* enum virDomainDiskSnapshot */
int startupPolicy; /* enum virDomainStartupPolicy */
unsigned int readonly : 1;
unsigned int shared : 1;
unsigned int transient : 1;
virDomainDeviceInfo info;
virStorageEncryptionPtr encryption;
bool rawio_specified;
int rawio; /* no = 0, yes = 1 */
size_t nseclabels;
virSecurityDeviceLabelDefPtr *seclabels;
};
enum virDomainControllerType {
VIR_DOMAIN_CONTROLLER_TYPE_IDE,
VIR_DOMAIN_CONTROLLER_TYPE_FDC,
VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
VIR_DOMAIN_CONTROLLER_TYPE_SATA,
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
VIR_DOMAIN_CONTROLLER_TYPE_CCID,
VIR_DOMAIN_CONTROLLER_TYPE_USB,
VIR_DOMAIN_CONTROLLER_TYPE_LAST
};
enum virDomainControllerModelSCSI {
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
};
enum virDomainControllerModelUSB {
VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX4_UHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1,
VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1,
VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2,
VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3,
VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE,
VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
};
typedef struct _virDomainVirtioSerialOpts virDomainVirtioSerialOpts;
typedef virDomainVirtioSerialOpts *virDomainVirtioSerialOptsPtr;
struct _virDomainVirtioSerialOpts {
int ports; /* -1 == undef */
int vectors; /* -1 == undef */
};
/* Stores the virtual disk controller configuration */
struct _virDomainControllerDef {
int type;
int idx;
int model; /* -1 == undef */
union {
virDomainVirtioSerialOpts vioserial;
} opts;
virDomainDeviceInfo info;
};
/* Two types of disk backends */
enum virDomainFSType {
VIR_DOMAIN_FS_TYPE_MOUNT, /* Mounts (binds) a host dir on a guest dir */
VIR_DOMAIN_FS_TYPE_BLOCK, /* Mounts a host block dev on a guest dir */
VIR_DOMAIN_FS_TYPE_FILE, /* Loopback mounts a host file on a guest dir */
VIR_DOMAIN_FS_TYPE_TEMPLATE, /* Expands a OS template to a guest dir */
VIR_DOMAIN_FS_TYPE_RAM, /* Mount a RAM filesystem on a guest dir */
VIR_DOMAIN_FS_TYPE_BIND, /* Binds a guest dir to another guest dir */
VIR_DOMAIN_FS_TYPE_LAST
};
/* Filesystem driver type */
enum virDomainFSDriverType {
VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT = 0,
VIR_DOMAIN_FS_DRIVER_TYPE_PATH,
VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE,
VIR_DOMAIN_FS_DRIVER_TYPE_LAST
};
/* 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
};
/* Filesystem Write policy */
enum virDomainFSWrpolicy {
VIR_DOMAIN_FS_WRPOLICY_DEFAULT = 0,
VIR_DOMAIN_FS_WRPOLICY_IMMEDIATE,
VIR_DOMAIN_FS_WRPOLICY_LAST
};
/* Allow 2 MB ram usage */
# define VIR_DOMAIN_FS_RAM_DEFAULT_USAGE (1024 * 2)
struct _virDomainFSDef {
int type;
int fsdriver;
int accessmode;
int wrpolicy; /* enum virDomainFSWrpolicy */
unsigned long long usage;
char *src;
char *dst;
unsigned int readonly : 1;
virDomainDeviceInfo info;
unsigned long long space_hard_limit; /* in bytes */
unsigned long long space_soft_limit; /* in bytes */
};
/* 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,
VIR_DOMAIN_NET_TYPE_INTERNAL,
VIR_DOMAIN_NET_TYPE_DIRECT,
VIR_DOMAIN_NET_TYPE_HOSTDEV,
VIR_DOMAIN_NET_TYPE_LAST,
};
/* 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,
};
/* 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,
};
/* link interface states */
enum virDomainNetInterfaceLinkState {
VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT = 0, /* Default link state (up) */
VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP, /* Link is up. ("cable" connected) */
VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN , /* Link is down. ("cable" disconnected) */
VIR_DOMAIN_NET_INTERFACE_LINK_STATE_LAST
};
/* Config that was actually used to bring up interface, after
* resolving network reference. This is private data, only used within
* libvirt, but still must maintain backward compatibility, because
* different versions of libvirt may read the same data file.
*/
typedef struct _virDomainActualNetDef virDomainActualNetDef;
typedef virDomainActualNetDef *virDomainActualNetDefPtr;
struct _virDomainActualNetDef {
int type; /* enum virDomainNetType */
union {
struct {
char *brname;
} bridge;
struct {
char *linkdev;
int mode; /* enum virMacvtapMode from util/macvtap.h */
} direct;
struct {
virDomainHostdevDef def;
} hostdev;
} data;
virNetDevVPortProfilePtr virtPortProfile;
virNetDevBandwidthPtr bandwidth;
virNetDevVlan vlan;
};
/* Stores the virtual network interface configuration */
struct _virDomainNetDef {
enum virDomainNetType type;
virMacAddr mac;
char *model;
union {
struct {
enum virDomainNetBackendType name; /* which driver backend to use */
enum virDomainNetVirtioTxModeType txmode;
enum virDomainIoEventFd ioeventfd;
enum virDomainVirtioEventIdx event_idx;
} virtio;
} driver;
union {
struct {
char *dev;
char *ipaddr;
} ethernet;
struct {
char *address;
int port;
} socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */
struct {
char *name;
char *portgroup;
/* actual has info about the currently used physical
* device (if the network is of type
* bridge/private/vepa/passthrough). This is saved in the
* domain state, but never written to persistent config,
* since it needs to be re-allocated whenever the domain
* is restarted. It is also never shown to the user, and
* the user cannot specify it in XML documents.
*/
virDomainActualNetDefPtr actual;
} network;
struct {
char *brname;
char *ipaddr;
} bridge;
struct {
char *name;
} internal;
struct {
char *linkdev;
int mode; /* enum virMacvtapMode from util/macvtap.h */
} direct;
struct {
virDomainHostdevDef def;
} hostdev;
} data;
/* virtPortProfile is used by network/bridge/direct/hostdev */
virNetDevVPortProfilePtr virtPortProfile;
struct {
bool sndbuf_specified;
unsigned long sndbuf;
} tune;
char *script;
char *ifname;
virDomainDeviceInfo info;
char *filter;
virNWFilterHashTablePtr filterparams;
virNetDevBandwidthPtr bandwidth;
virNetDevVlan vlan;
int linkstate;
};
/* Used for prefix of ifname of any network name generated dynamically
* by libvirt, and cannot be used for a persistent network name. */
# define VIR_NET_GENERATED_PREFIX "vnet"
enum virDomainChrDeviceType {
VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL = 0,
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL,
VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE,
VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL,
VIR_DOMAIN_CHR_DEVICE_TYPE_LAST,
};
enum virDomainChrChannelTargetType {
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE = 0,
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD,
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
};
enum virDomainChrConsoleTargetType {
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL = 0,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ,
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST,
};
enum virDomainChrType {
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,
VIR_DOMAIN_CHR_TYPE_SPICEVMC,
VIR_DOMAIN_CHR_TYPE_LAST,
};
enum virDomainChrTcpProtocol {
VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW,
VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET,
VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNETS, /* secure telnet */
VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS,
VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST,
};
enum virDomainChrSpicevmcName {
VIR_DOMAIN_CHR_SPICEVMC_VDAGENT,
VIR_DOMAIN_CHR_SPICEVMC_SMARTCARD,
VIR_DOMAIN_CHR_SPICEVMC_USBREDIR,
VIR_DOMAIN_CHR_SPICEVMC_LAST,
};
/* The host side information for a character device. */
typedef struct _virDomainChrSourceDef virDomainChrSourceDef;
typedef virDomainChrSourceDef *virDomainChrSourceDefPtr;
struct _virDomainChrSourceDef {
int type; /* virDomainChrType */
union {
/* no