domain_conf.h 100.6 KB
Newer Older
1 2 3
/*
 * domain_conf.h: domain XML processing
 *
4
 * Copyright (C) 2006-2015 Red Hat, Inc.
5
 * Copyright (C) 2006-2008 Daniel P. Berrange
6
 * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
7 8 9 10 11 12 13 14 15 16 17 18
 *
 * 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
19
 * License along with this library.  If not, see
O
Osier Yang 已提交
20
 * <http://www.gnu.org/licenses/>.
21 22 23 24 25
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#ifndef __DOMAIN_CONF_H
26
# define __DOMAIN_CONF_H
27

28 29 30
# include <libxml/parser.h>
# include <libxml/tree.h>
# include <libxml/xpath.h>
31

32 33
# include "internal.h"
# include "capabilities.h"
34
# include "virstorageencryption.h"
35
# include "cpu_conf.h"
36
# include "virthread.h"
37
# include "virhash.h"
38
# include "virsocketaddr.h"
39
# include "networkcommon_conf.h"
40
# include "nwfilter_params.h"
41
# include "numa_conf.h"
42
# include "virnetdevmacvlan.h"
43
# include "virsysinfo.h"
44 45
# include "virnetdevvportprofile.h"
# include "virnetdevbandwidth.h"
46
# include "virnetdevvlan.h"
47
# include "virobject.h"
48
# include "device_conf.h"
49
# include "virbitmap.h"
50
# include "virstoragefile.h"
51
# include "virseclabel.h"
52
# include "virprocess.h"
53
# include "virgic.h"
54

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
/* 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;

76 77 78
typedef struct _virDomainSoundCodecDef virDomainSoundCodecDef;
typedef virDomainSoundCodecDef *virDomainSoundCodecDefPtr;

79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
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;

100 101
typedef struct _virDomainRedirFilterUSBDevDef virDomainRedirFilterUSBDevDef;
typedef virDomainRedirFilterUSBDevDef *virDomainRedirFilterUSBDevDefPtr;
102 103 104 105

typedef struct _virDomainRedirFilterDef virDomainRedirFilterDef;
typedef virDomainRedirFilterDef *virDomainRedirFilterDefPtr;

106 107 108 109 110 111 112 113 114
typedef struct _virDomainSmartcardDef virDomainSmartcardDef;
typedef virDomainSmartcardDef *virDomainSmartcardDefPtr;

typedef struct _virDomainChrDef virDomainChrDef;
typedef virDomainChrDef *virDomainChrDefPtr;

typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;

L
Li Zhang 已提交
115 116 117
typedef struct _virDomainNVRAMDef virDomainNVRAMDef;
typedef virDomainNVRAMDef *virDomainNVRAMDefPtr;

118 119 120 121 122 123
typedef struct _virDomainSnapshotObj virDomainSnapshotObj;
typedef virDomainSnapshotObj *virDomainSnapshotObjPtr;

typedef struct _virDomainSnapshotObjList virDomainSnapshotObjList;
typedef virDomainSnapshotObjList *virDomainSnapshotObjListPtr;

124 125 126
typedef struct _virDomainRNGDef virDomainRNGDef;
typedef virDomainRNGDef *virDomainRNGDefPtr;

127 128 129 130 131 132
typedef struct _virDomainIdMapEntry virDomainIdMapEntry;
typedef virDomainIdMapEntry *virDomainIdMapEntryPtr;

typedef struct _virDomainIdMapDef virDomainIdMapDef;
typedef virDomainIdMapDef *virDomainIdMapDefPtr;

H
Hu Tao 已提交
133 134 135
typedef struct _virDomainPanicDef virDomainPanicDef;
typedef virDomainPanicDef *virDomainPanicDefPtr;

136 137 138
typedef struct _virDomainMemoryDef virDomainMemoryDef;
typedef virDomainMemoryDef *virDomainMemoryDefPtr;

M
Michele Paolino 已提交
139 140 141 142 143 144
/* forward declarations virDomainChrSourceDef, required by
 * virDomainNetDef
 */
typedef struct _virDomainChrSourceDef virDomainChrSourceDef;
typedef virDomainChrSourceDef *virDomainChrSourceDefPtr;

145 146 147
typedef struct _virDomainShmemDef virDomainShmemDef;
typedef virDomainShmemDef *virDomainShmemDefPtr;

148 149 150
typedef struct _virDomainTPMDef virDomainTPMDef;
typedef virDomainTPMDef *virDomainTPMDefPtr;

151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
/* 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,
L
Li Zhang 已提交
170
    VIR_DOMAIN_DEVICE_NVRAM,
171
    VIR_DOMAIN_DEVICE_RNG,
172
    VIR_DOMAIN_DEVICE_SHMEM,
173
    VIR_DOMAIN_DEVICE_TPM,
174
    VIR_DOMAIN_DEVICE_PANIC,
175
    VIR_DOMAIN_DEVICE_MEMORY,
176

177
    VIR_DOMAIN_DEVICE_LAST
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
} 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;
L
Li Zhang 已提交
201
        virDomainNVRAMDefPtr nvram;
202
        virDomainRNGDefPtr rng;
203
        virDomainShmemDefPtr shmem;
204
        virDomainTPMDefPtr tpm;
205
        virDomainPanicDefPtr panic;
206
        virDomainMemoryDefPtr memory;
207 208 209
    } data;
};

210 211
/* Different types of hypervisor */
/* NB: Keep in sync with virDomainVirtTypeToString impl */
212
typedef enum {
213
    VIR_DOMAIN_VIRT_NONE = 0,
214 215 216 217 218 219 220 221 222 223
    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,
224
    VIR_DOMAIN_VIRT_VBOX,
225
    VIR_DOMAIN_VIRT_PHYP,
D
Dmitry Guryanov 已提交
226
    VIR_DOMAIN_VIRT_PARALLELS,
R
Roman Bogorodskiy 已提交
227
    VIR_DOMAIN_VIRT_BHYVE,
228
    VIR_DOMAIN_VIRT_VZ,
229

230
    VIR_DOMAIN_VIRT_LAST
231
} virDomainVirtType;
232

233 234 235 236 237 238 239 240 241 242 243 244
typedef enum {
    VIR_DOMAIN_OSTYPE_HVM,
    VIR_DOMAIN_OSTYPE_XEN,
    VIR_DOMAIN_OSTYPE_LINUX,
    VIR_DOMAIN_OSTYPE_EXE,
    VIR_DOMAIN_OSTYPE_UML,

    VIR_DOMAIN_OSTYPE_LAST
} virDomainOSType;
VIR_ENUM_DECL(virDomainOS)


245
typedef enum {
246 247
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
248
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE,
249
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL,
E
Eric Blake 已提交
250
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID,
251
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB,
252
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
253
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
254
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
255
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO,
H
Hu Tao 已提交
256
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA,
257
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM,
258 259

    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
260
} virDomainDeviceAddressType;
261

262 263 264 265 266
typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
struct _virDomainDeviceDriveAddress {
    unsigned int controller;
    unsigned int bus;
267
    unsigned int target;
268 269 270
    unsigned int unit;
};

271 272 273 274 275
typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress;
typedef virDomainDeviceVirtioSerialAddress *virDomainDeviceVirtioSerialAddressPtr;
struct _virDomainDeviceVirtioSerialAddress {
    unsigned int controller;
    unsigned int bus;
276
    unsigned int port;
277 278
};

279 280 281 282 283 284 285 286 287 288 289 290 291
# define VIR_DOMAIN_DEVICE_CCW_MAX_CSSID    254
# define VIR_DOMAIN_DEVICE_CCW_MAX_SSID       3
# define VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO  65535

typedef struct _virDomainDeviceCCWAddress virDomainDeviceCCWAddress;
typedef virDomainDeviceCCWAddress *virDomainDeviceCCWAddressPtr;
struct _virDomainDeviceCCWAddress {
    unsigned int cssid;
    unsigned int ssid;
    unsigned int devno;
    bool         assigned;
};

E
Eric Blake 已提交
292 293 294 295 296 297 298
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
typedef virDomainDeviceCcidAddress *virDomainDeviceCcidAddressPtr;
struct _virDomainDeviceCcidAddress {
    unsigned int controller;
    unsigned int slot;
};

299 300 301 302
typedef struct _virDomainDeviceUSBAddress virDomainDeviceUSBAddress;
typedef virDomainDeviceUSBAddress *virDomainDeviceUSBAddressPtr;
struct _virDomainDeviceUSBAddress {
    unsigned int bus;
303
    char *port;
304 305
};

306 307 308 309 310 311 312
typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress;
typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr;
struct _virDomainDeviceSpaprVioAddress {
    unsigned long long reg;
    bool has_reg;
};

313
typedef enum {
314 315 316 317
    VIR_DOMAIN_CONTROLLER_MASTER_NONE,
    VIR_DOMAIN_CONTROLLER_MASTER_USB,

    VIR_DOMAIN_CONTROLLER_MASTER_LAST
318
} virDomainControllerMaster;
319 320 321 322 323 324 325

typedef struct _virDomainDeviceUSBMaster virDomainDeviceUSBMaster;
typedef virDomainDeviceUSBMaster *virDomainDeviceUSBMasterPtr;
struct _virDomainDeviceUSBMaster {
    unsigned int startport;
};

H
Hu Tao 已提交
326 327 328 329 330 331 332
typedef struct _virDomainDeviceISAAddress virDomainDeviceISAAddress;
typedef virDomainDeviceISAAddress *virDomainDeviceISAAddressPtr;
struct _virDomainDeviceISAAddress {
    unsigned int iobase;
    unsigned int irq;
};

333 334 335 336 337 338 339
typedef struct _virDomainDeviceDimmAddress virDomainDeviceDimmAddress;
typedef virDomainDeviceDimmAddress *virDomainDeviceDimmAddressPtr;
struct _virDomainDeviceDimmAddress {
    unsigned int slot;
    unsigned long long base;
};

340 341 342
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
struct _virDomainDeviceInfo {
343 344 345 346
    /* If adding to this struct, ensure that
     * virDomainDeviceInfoIsSet() is updated
     * to consider the new fields
     */
D
Daniel P. Berrange 已提交
347
    char *alias;
348
    int type; /* virDomainDeviceAddressType */
349
    union {
350
        virDevicePCIAddress pci;
351
        virDomainDeviceDriveAddress drive;
352
        virDomainDeviceVirtioSerialAddress vioserial;
E
Eric Blake 已提交
353
        virDomainDeviceCcidAddress ccid;
354
        virDomainDeviceUSBAddress usb;
355
        virDomainDeviceSpaprVioAddress spaprvio;
356
        virDomainDeviceCCWAddress ccw;
H
Hu Tao 已提交
357
        virDomainDeviceISAAddress isa;
358
        virDomainDeviceDimmAddress dimm;
359
    } addr;
360 361 362 363
    int mastertype;
    union {
        virDomainDeviceUSBMaster usb;
    } master;
364 365
    /* rombar and romfile are only used for pci hostdev and network
     * devices. */
J
Ján Tomko 已提交
366
    int rombar;         /* enum virTristateSwitch */
367
    char *romfile;
368 369
    /* bootIndex is only used for disk, network interface, hostdev
     * and redirdev devices */
370
    int bootIndex;
371 372
};

373

374 375 376 377 378 379 380 381
typedef struct _virDomainHostdevOrigStates virDomainHostdevOrigStates;
typedef virDomainHostdevOrigStates *virDomainHostdevOrigStatesPtr;
struct _virDomainHostdevOrigStates {
    union {
        struct {
            /* Does the device need to unbind from stub when
             * reattaching to host?
             */
382
            bool unbind_from_stub;
383 384 385 386

            /* Does it need to use remove_slot when reattaching
             * the device to host?
             */
387
            bool remove_slot;
388 389 390 391

            /* Does it need to reprobe driver for the device when
             * reattaching to host?
             */
392
            bool reprobe;
393 394 395 396 397 398
        } pci;

        /* Perhaps 'usb' in future */
    } states;
};

399 400 401 402 403 404 405
struct _virDomainLeaseDef {
    char *lockspace;
    char *key;
    char *path;
    unsigned long long offset;
};

406

407
typedef enum {
408 409 410
    VIR_DOMAIN_HOSTDEV_MODE_SUBSYS,
    VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES,

411
    VIR_DOMAIN_HOSTDEV_MODE_LAST
412
} virDomainHostdevMode;
413

414
typedef enum {
415 416
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
H
Han Cheng 已提交
417
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI,
418 419

    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
420
} virDomainHostdevSubsysType;
421

422 423
/* the backend driver used for PCI hostdev devices */
typedef enum {
424
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automaticaly, prefer VFIO */
425 426
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM,    /* force legacy kvm style */
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO,   /* force vfio */
427
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN,    /* force legacy xen style, use pciback */
428 429

    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST
430
} virDomainHostdevSubsysPCIBackendType;
431

432
VIR_ENUM_DECL(virDomainHostdevSubsysPCIBackend)
433

434 435 436 437 438 439 440 441 442
typedef enum {
    VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE,
    VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI,

    VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST,
} virDomainHostdevSCSIProtocolType;

VIR_ENUM_DECL(virDomainHostdevSubsysSCSIProtocol)

443 444 445 446 447 448 449 450 451 452 453 454
typedef struct _virDomainHostdevSubsysUSB virDomainHostdevSubsysUSB;
typedef virDomainHostdevSubsysUSB *virDomainHostdevSubsysUSBPtr;
struct _virDomainHostdevSubsysUSB {
    bool autoAddress; /* bus/device were filled automatically based
                         on vendor/product */
    unsigned bus;
    unsigned device;

    unsigned vendor;
    unsigned product;
};

455 456 457 458 459 460 461
typedef struct _virDomainHostdevSubsysPCI virDomainHostdevSubsysPCI;
typedef virDomainHostdevSubsysPCI *virDomainHostdevSubsysPCIPtr;
struct _virDomainHostdevSubsysPCI {
    virDevicePCIAddress addr; /* host address */
    int backend; /* enum virDomainHostdevSubsysPCIBackendType */
};

462 463 464
typedef struct _virDomainHostdevSubsysSCSIHost virDomainHostdevSubsysSCSIHost;
typedef virDomainHostdevSubsysSCSIHost *virDomainHostdevSubsysSCSIHostPtr;
struct _virDomainHostdevSubsysSCSIHost {
465 466 467
    char *adapter;
    unsigned bus;
    unsigned target;
468
    unsigned long long unit;
469 470
};

471 472 473 474 475 476 477 478 479
typedef struct _virDomainHostdevSubsysSCSIiSCSI virDomainHostdevSubsysSCSIiSCSI;
typedef virDomainHostdevSubsysSCSIiSCSI *virDomainHostdevSubsysSCSIiSCSIPtr;
struct _virDomainHostdevSubsysSCSIiSCSI {
    char *path;
    size_t nhosts;
    virStorageNetHostDefPtr hosts;
    virStorageAuthDefPtr auth;
};

480 481 482
typedef struct _virDomainHostdevSubsysSCSI virDomainHostdevSubsysSCSI;
typedef virDomainHostdevSubsysSCSI *virDomainHostdevSubsysSCSIPtr;
struct _virDomainHostdevSubsysSCSI {
483
    int protocol; /* enum virDomainHostdevSCSIProtocolType */
484
    int sgio; /* enum virDomainDeviceSGIO */
485
    int rawio; /* enum virTristateBool */
486 487
    union {
        virDomainHostdevSubsysSCSIHost host;
488
        virDomainHostdevSubsysSCSIiSCSI iscsi;
489
    } u;
490 491
};

492 493 494
typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
typedef virDomainHostdevSubsys *virDomainHostdevSubsysPtr;
struct _virDomainHostdevSubsys {
495
    int type; /* enum virDomainHostdevSubsysType */
496
    union {
497
        virDomainHostdevSubsysUSB usb;
498
        virDomainHostdevSubsysPCI pci;
499
        virDomainHostdevSubsysSCSI scsi;
500 501 502
    } u;
};

503

504
typedef enum {
505 506
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE,
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC,
507
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET,
508 509

    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST
510
} virDomainHostdevCapsType;
511

512 513 514 515 516 517 518
typedef struct _virDomainNetIpDef virDomainNetIpDef;
typedef virDomainNetIpDef *virDomainNetIpDefPtr;
struct _virDomainNetIpDef {
    virSocketAddr address;       /* ipv4 or ipv6 address */
    unsigned int prefix; /* number of 1 bits in the net mask */
};

519 520 521 522 523 524 525 526 527 528 529
typedef struct _virDomainHostdevCaps virDomainHostdevCaps;
typedef virDomainHostdevCaps *virDomainHostdevCapsPtr;
struct _virDomainHostdevCaps {
    int type; /* enum virDOmainHostdevCapsType */
    union {
        struct {
            char *block;
        } storage;
        struct {
            char *chardev;
        } misc;
530 531
        struct {
            char *iface;
532 533
            size_t nips;
            virDomainNetIpDefPtr *ips;
534
            size_t nroutes;
535
            virNetworkRouteDefPtr *routes;
536
        } net;
537 538 539 540
    } u;
};


541 542
/* basic device for direct passthrough */
struct _virDomainHostdevDef {
543
    virDomainDeviceDef parent; /* higher level Def containing this */
544
    int mode; /* enum virDomainHostdevMode */
545
    int startupPolicy; /* enum virDomainStartupPolicy */
546
    bool managed;
547
    bool missing;
O
Osier Yang 已提交
548
    bool readonly;
549
    bool shareable;
550
    union {
551
        virDomainHostdevSubsys subsys;
552
        virDomainHostdevCaps caps;
553 554
    } source;
    virDomainHostdevOrigStates origstates;
555
    virDomainDeviceInfoPtr info; /* Guest address */
556 557
};

558

E
Eric Blake 已提交
559 560
/* Types of disk frontend (guest view).  For backends (host view), see
 * virStorageType in util/virstoragefile.h */
561
typedef enum {
562 563 564
    VIR_DOMAIN_DISK_DEVICE_DISK,
    VIR_DOMAIN_DISK_DEVICE_CDROM,
    VIR_DOMAIN_DISK_DEVICE_FLOPPY,
565
    VIR_DOMAIN_DISK_DEVICE_LUN,
566 567

    VIR_DOMAIN_DISK_DEVICE_LAST
568
} virDomainDiskDevice;
569

570
typedef enum {
571 572 573 574 575
    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,
576
    VIR_DOMAIN_DISK_BUS_USB,
577
    VIR_DOMAIN_DISK_BUS_UML,
578
    VIR_DOMAIN_DISK_BUS_SATA,
579
    VIR_DOMAIN_DISK_BUS_SD,
580 581

    VIR_DOMAIN_DISK_BUS_LAST
582
} virDomainDiskBus;
583

584
typedef enum {
585 586 587 588
    VIR_DOMAIN_DISK_CACHE_DEFAULT,
    VIR_DOMAIN_DISK_CACHE_DISABLE,
    VIR_DOMAIN_DISK_CACHE_WRITETHRU,
    VIR_DOMAIN_DISK_CACHE_WRITEBACK,
589
    VIR_DOMAIN_DISK_CACHE_DIRECTSYNC,
590
    VIR_DOMAIN_DISK_CACHE_UNSAFE,
591 592

    VIR_DOMAIN_DISK_CACHE_LAST
593
} virDomainDiskCache;
594

595
typedef enum {
596 597
    VIR_DOMAIN_DISK_ERROR_POLICY_DEFAULT,
    VIR_DOMAIN_DISK_ERROR_POLICY_STOP,
598
    VIR_DOMAIN_DISK_ERROR_POLICY_REPORT,
599
    VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE,
600
    VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE,
601 602

    VIR_DOMAIN_DISK_ERROR_POLICY_LAST
603
} virDomainDiskErrorPolicy;
604

M
MORITA Kazutaka 已提交
605

606
typedef enum {
607 608 609 610
    VIR_DOMAIN_DISK_TRAY_CLOSED,
    VIR_DOMAIN_DISK_TRAY_OPEN,

    VIR_DOMAIN_DISK_TRAY_LAST
611
} virDomainDiskTray;
612

613
typedef enum {
J
J.B. Joret 已提交
614 615 616 617 618 619
    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
620
} virDomainDiskGeometryTrans;
J
J.B. Joret 已提交
621

622
typedef enum {
M
Matthias Dahl 已提交
623 624 625 626 627
    VIR_DOMAIN_DISK_IO_DEFAULT,
    VIR_DOMAIN_DISK_IO_NATIVE,
    VIR_DOMAIN_DISK_IO_THREADS,

    VIR_DOMAIN_DISK_IO_LAST
628
} virDomainDiskIo;
M
Matthias Dahl 已提交
629

630
typedef enum {
631 632 633 634 635 636
    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
637
} virDomainStartupPolicy;
638

639

640
typedef enum {
641 642 643
    VIR_DOMAIN_DEVICE_SGIO_DEFAULT = 0,
    VIR_DOMAIN_DEVICE_SGIO_FILTERED,
    VIR_DOMAIN_DEVICE_SGIO_UNFILTERED,
O
Osier Yang 已提交
644

645
    VIR_DOMAIN_DEVICE_SGIO_LAST
646
} virDomainDeviceSGIO;
O
Osier Yang 已提交
647

648
typedef enum {
O
Osier Yang 已提交
649
    VIR_DOMAIN_DISK_DISCARD_DEFAULT = 0,
O
Osier Yang 已提交
650 651
    VIR_DOMAIN_DISK_DISCARD_UNMAP,
    VIR_DOMAIN_DISK_DISCARD_IGNORE,
O
Osier Yang 已提交
652 653

    VIR_DOMAIN_DISK_DISCARD_LAST
654
} virDomainDiskDiscard;
O
Osier Yang 已提交
655

L
Lei Li 已提交
656 657 658 659 660 661 662 663
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;
664 665 666 667 668 669 670
    unsigned long long total_bytes_sec_max;
    unsigned long long read_bytes_sec_max;
    unsigned long long write_bytes_sec_max;
    unsigned long long total_iops_sec_max;
    unsigned long long read_iops_sec_max;
    unsigned long long write_iops_sec_max;
    unsigned long long size_iops_sec;
L
Lei Li 已提交
671 672 673
};
typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;

674

675 676 677 678 679 680 681 682 683 684
typedef enum {
    VIR_DOMAIN_DISK_MIRROR_STATE_NONE = 0, /* No job, or job still not synced */
    VIR_DOMAIN_DISK_MIRROR_STATE_READY, /* Job in second phase */
    VIR_DOMAIN_DISK_MIRROR_STATE_ABORT, /* Job aborted, waiting for event */
    VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT, /* Job pivoted, waiting for event */

    VIR_DOMAIN_DISK_MIRROR_STATE_LAST
} virDomainDiskMirrorState;


685 686
/* Stores the virtual disk configuration */
struct _virDomainDiskDef {
687
    virStorageSourcePtr src; /* non-NULL.  XXX Allow NULL for empty cdrom? */
688

689 690
    virObjectPtr privateData;

691 692 693 694
    int device; /* enum virDomainDiskDevice */
    int bus; /* enum virDomainDiskBus */
    char *dst;
    int tray_status; /* enum virDomainDiskTray */
J
Ján Tomko 已提交
695
    int removable; /* enum virTristateSwitch */
L
Lei Li 已提交
696

697
    virStorageSourcePtr mirror;
698
    int mirrorState; /* enum virDomainDiskMirrorState */
E
Eric Blake 已提交
699
    int mirrorJob; /* virDomainBlockJobType */
700

J
J.B. Joret 已提交
701 702 703 704
    struct {
        unsigned int cylinders;
        unsigned int heads;
        unsigned int sectors;
705
        int trans; /* enum virDomainDiskGeometryTrans */
J
J.B. Joret 已提交
706 707
    } geometry;

708 709 710
    struct {
        unsigned int logical_block_size;
        unsigned int physical_block_size;
V
Viktor Mihajlovski 已提交
711
    } blockio;
712

L
Lei Li 已提交
713 714
    virDomainBlockIoTuneInfo blkdeviotune;

715
    char *serial;
O
Osier Yang 已提交
716
    char *wwn;
717 718
    char *vendor;
    char *product;
719
    int cachemode; /* enum virDomainDiskCache */
720 721
    int error_policy;  /* enum virDomainDiskErrorPolicy */
    int rerror_policy; /* enum virDomainDiskErrorPolicy */
722
    int iomode; /* enum virDomainDiskIo */
J
Ján Tomko 已提交
723 724 725
    int ioeventfd; /* enum virTristateSwitch */
    int event_idx; /* enum virTristateSwitch */
    int copy_on_read; /* enum virTristateSwitch */
726
    int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
727
    int startupPolicy; /* enum virDomainStartupPolicy */
728
    bool transient;
729
    virDomainDeviceInfo info;
730
    int rawio; /* enum virTristateBool */
731
    int sgio; /* enum virDomainDeviceSGIO */
O
Osier Yang 已提交
732
    int discard; /* enum virDomainDiskDiscard */
733
    unsigned int iothread; /* unused = 0, > 0 specific thread # */
734
    char *domain_name; /* backend domain name */
735 736 737
};


738
typedef enum {
739 740 741 742
    VIR_DOMAIN_CONTROLLER_TYPE_IDE,
    VIR_DOMAIN_CONTROLLER_TYPE_FDC,
    VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
    VIR_DOMAIN_CONTROLLER_TYPE_SATA,
743
    VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
E
Eric Blake 已提交
744
    VIR_DOMAIN_CONTROLLER_TYPE_CCID,
745
    VIR_DOMAIN_CONTROLLER_TYPE_USB,
J
Ján Tomko 已提交
746
    VIR_DOMAIN_CONTROLLER_TYPE_PCI,
747 748

    VIR_DOMAIN_CONTROLLER_TYPE_LAST
749
} virDomainControllerType;
750

751

752
typedef enum {
J
Ján Tomko 已提交
753
    VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT,
L
Laine Stump 已提交
754
    VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT,
J
Ján Tomko 已提交
755
    VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE,
756
    VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE,
757
    VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT,
758
    VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT,
759
    VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT,
J
Ján Tomko 已提交
760 761

    VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST
762
} virDomainControllerModelPCI;
J
Ján Tomko 已提交
763

764 765 766 767
typedef enum {
    VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE,
    VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE,
    VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE,
768
    VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420,
769
    VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X3130_UPSTREAM,
770
    VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTREAM,
771 772 773 774

    VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST
} virDomainControllerPCIModelName;

775
typedef enum {
776 777 778 779 780
    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,
781
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
782
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI,
783
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078,
784

785
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
786
} virDomainControllerModelSCSI;
787

788
typedef enum {
M
Marc-André Lureau 已提交
789 790 791 792 793 794 795 796 797
    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,
G
Gerd Hoffmann 已提交
798
    VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
799
    VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE,
M
Marc-André Lureau 已提交
800 801

    VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
802
} virDomainControllerModelUSB;
M
Marc-André Lureau 已提交
803

804 805 806 807 808 809 810
typedef struct _virDomainVirtioSerialOpts virDomainVirtioSerialOpts;
typedef virDomainVirtioSerialOpts *virDomainVirtioSerialOptsPtr;
struct _virDomainVirtioSerialOpts {
    int ports;   /* -1 == undef */
    int vectors; /* -1 == undef */
};

811 812 813
typedef struct _virDomainPCIControllerOpts virDomainPCIControllerOpts;
typedef virDomainPCIControllerOpts *virDomainPCIControllerOptsPtr;
struct _virDomainPCIControllerOpts {
814 815
    bool pcihole64;
    unsigned long pcihole64size;
816 817 818 819 820 821 822

    /* the exact controller name is in the "model" subelement, e.g.:
     * <controller type='pci' model='pcie-root-port'>
     *   <model name='ioh3420''/>
     *   ...
     */
    int modelName; /* the exact name of the device in hypervisor */
823 824 825 826 827 828 829 830

    /* the following items are attributes of the "target" subelement
     * of controller type='pci'. They are bits of configuration that
     * are specified on the qemu commandline and are visible to the
     * guest OS, so they must be preserved to ensure ABI
     * compatibility.
     */
    int chassisNr; /* used by pci-bridge, -1 == unspecified */
831 832 833 834 835
    /* chassis & port used by
     * pcie-root-port/pcie-switch-downstream-port, -1 = unspecified */
    int chassis;
    int port;
};
836

837 838 839
/* Stores the virtual disk controller configuration */
struct _virDomainControllerDef {
    int type;
840
    unsigned int idx;
841
    int model; /* -1 == undef */
842
    unsigned int queues;
843 844
    unsigned int cmd_per_lun;
    unsigned int max_sectors;
845
    int ioeventfd; /* enum virTristateSwitch */
846 847
    union {
        virDomainVirtioSerialOpts vioserial;
848
        virDomainPCIControllerOpts pciopts;
849
    } opts;
850 851 852 853
    virDomainDeviceInfo info;
};


G
Giuseppe Scrivano 已提交
854
/* Types of disk backends */
855
typedef enum {
856 857 858 859 860 861
    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 */
862 863

    VIR_DOMAIN_FS_TYPE_LAST
864
} virDomainFSType;
865

866
/* Filesystem driver type */
867
typedef enum {
868 869 870
    VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT = 0,
    VIR_DOMAIN_FS_DRIVER_TYPE_PATH,
    VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE,
871
    VIR_DOMAIN_FS_DRIVER_TYPE_LOOP,
872
    VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
D
Dmitry Guryanov 已提交
873
    VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP,
874 875

    VIR_DOMAIN_FS_DRIVER_TYPE_LAST
876
} virDomainFSDriverType;
877

878
/* Filesystem mount access mode  */
879
typedef enum {
880 881 882 883 884
    VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH,
    VIR_DOMAIN_FS_ACCESSMODE_MAPPED,
    VIR_DOMAIN_FS_ACCESSMODE_SQUASH,

    VIR_DOMAIN_FS_ACCESSMODE_LAST
885
} virDomainFSAccessMode;
886

887
/* Filesystem Write policy */
888
typedef enum {
889 890 891 892
    VIR_DOMAIN_FS_WRPOLICY_DEFAULT = 0,
    VIR_DOMAIN_FS_WRPOLICY_IMMEDIATE,

    VIR_DOMAIN_FS_WRPOLICY_LAST
893
} virDomainFSWrpolicy;
894

895 896 897
/* Allow 2 MB ram usage */
# define VIR_DOMAIN_FS_RAM_DEFAULT_USAGE (1024 * 2)

898 899
struct _virDomainFSDef {
    int type;
900 901
    int fsdriver; /* enum virDomainFSDriverType */
    int accessmode; /* enum virDomainFSAccessMode */
902
    int wrpolicy; /* enum virDomainFSWrpolicy */
903
    int format; /* virStorageFileFormat */
904
    unsigned long long usage; /* in bytes */
905 906
    char *src;
    char *dst;
907
    bool readonly;
908
    virDomainDeviceInfo info;
909 910
    unsigned long long space_hard_limit; /* in bytes */
    unsigned long long space_soft_limit; /* in bytes */
911
    bool symlinksResolved;
912 913 914
};


915
/* network config types */
916
typedef enum {
917 918
    VIR_DOMAIN_NET_TYPE_USER,
    VIR_DOMAIN_NET_TYPE_ETHERNET,
M
Michele Paolino 已提交
919
    VIR_DOMAIN_NET_TYPE_VHOSTUSER,
920 921 922 923 924
    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,
D
Daniel Veillard 已提交
925
    VIR_DOMAIN_NET_TYPE_INTERNAL,
926
    VIR_DOMAIN_NET_TYPE_DIRECT,
927
    VIR_DOMAIN_NET_TYPE_HOSTDEV,
928
    VIR_DOMAIN_NET_TYPE_UDP,
929

930
    VIR_DOMAIN_NET_TYPE_LAST
931
} virDomainNetType;
932

933
/* the backend driver used for virtio interfaces */
934
typedef enum {
935 936 937 938
    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 */

939
    VIR_DOMAIN_NET_BACKEND_TYPE_LAST
940
} virDomainNetBackendType;
941

942
/* the TX algorithm used for virtio interfaces */
943
typedef enum {
944 945 946 947
    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,

948
    VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST
949
} virDomainNetVirtioTxModeType;
950

951
/* link interface states */
952
typedef enum {
953 954 955 956 957
        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
958
} virDomainNetInterfaceLinkState;
959

960 961 962 963 964 965 966 967 968 969 970 971
/* 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;
972
            int macTableManager; /* enum virNetworkBridgeMACTableManagerType */
973 974 975 976 977
        } bridge;
        struct {
            char *linkdev;
            int mode; /* enum virMacvtapMode from util/macvtap.h */
        } direct;
978 979 980
        struct {
            virDomainHostdevDef def;
        } hostdev;
981
    } data;
982
    virNetDevVPortProfilePtr virtPortProfile;
983
    virNetDevBandwidthPtr bandwidth;
984
    virNetDevVlan vlan;
985
    int trustGuestRxFilters; /* enum virTristateBool */
986
    unsigned int class_id; /* class ID for bandwidth 'floor' */
987 988
};

989 990
/* Stores the virtual network interface configuration */
struct _virDomainNetDef {
991
    virDomainNetType type;
992
    virMacAddr mac;
993
    char *model;
994 995
    union {
        struct {
996 997
            virDomainNetBackendType name; /* which driver backend to use */
            virDomainNetVirtioTxModeType txmode;
J
Ján Tomko 已提交
998 999
            virTristateSwitch ioeventfd;
            virTristateSwitch event_idx;
1000
            unsigned int queues; /* Multiqueue virtio-net */
1001 1002 1003 1004 1005 1006 1007
            struct {
                virTristateSwitch csum;
                virTristateSwitch gso;
                virTristateSwitch tso4;
                virTristateSwitch tso6;
                virTristateSwitch ecn;
                virTristateSwitch ufo;
1008
                virTristateSwitch mrg_rxbuf;
1009 1010 1011 1012 1013 1014 1015 1016
            } host;
            struct {
                virTristateSwitch csum;
                virTristateSwitch tso4;
                virTristateSwitch tso6;
                virTristateSwitch ecn;
                virTristateSwitch ufo;
            } guest;
1017 1018
        } virtio;
    } driver;
1019 1020 1021 1022
    struct {
        char *tap;
        char *vhost;
    } backend;
1023 1024 1025 1026
    union {
        struct {
            char *dev;
        } ethernet;
M
Michele Paolino 已提交
1027
        virDomainChrSourceDefPtr vhostuser;
1028 1029 1030
        struct {
            char *address;
            int port;
1031 1032
            char *localaddr;
            int localport;
1033 1034 1035
        } socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */
        struct {
            char *name;
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
            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;
1046 1047 1048 1049
        } network;
        struct {
            char *brname;
        } bridge;
D
Daniel Veillard 已提交
1050 1051 1052
        struct {
            char *name;
        } internal;
1053 1054
        struct {
            char *linkdev;
1055
            int mode; /* enum virMacvtapMode from util/macvtap.h */
1056
        } direct;
1057 1058 1059
        struct {
            virDomainHostdevDef def;
        } hostdev;
1060
    } data;
1061 1062
    /* virtPortProfile is used by network/bridge/direct/hostdev */
    virNetDevVPortProfilePtr virtPortProfile;
1063 1064 1065 1066
    struct {
        bool sndbuf_specified;
        unsigned long sndbuf;
    } tune;
1067
    char *script;
1068
    char *domain_name; /* backend domain name */
1069
    char *ifname;
1070 1071
    char *ifname_guest;
    char *ifname_guest_actual;
1072
    virDomainDeviceInfo info;
1073 1074
    char *filter;
    virNWFilterHashTablePtr filterparams;
1075
    virNetDevBandwidthPtr bandwidth;
1076
    virNetDevVlan vlan;
1077
    int trustGuestRxFilters; /* enum virTristateBool */
1078
    int linkstate;
1079 1080
    size_t nips;
    virDomainNetIpDefPtr *ips;
1081
    size_t nroutes;
1082
    virNetworkRouteDefPtr *routes;
1083 1084
};

E
Eric Blake 已提交
1085 1086 1087 1088
/* 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"

1089 1090 1091 1092 1093 1094 1095 1096 1097 1098
typedef enum {
    VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT = 0,
    VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED,
    VIR_DOMAIN_CHR_DEVICE_STATE_DISCONNECTED,

    VIR_DOMAIN_CHR_DEVICE_STATE_LAST
} virDomainChrDeviceState;

VIR_ENUM_DECL(virDomainChrDeviceState)

1099
typedef enum {
1100
    VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL = 0,
1101 1102
    VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL,
    VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE,
1103
    VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL,
1104

1105
    VIR_DOMAIN_CHR_DEVICE_TYPE_LAST
1106
} virDomainChrDeviceType;
1107

1108
typedef enum {
G
Guannan Ren 已提交
1109 1110
    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA = 0,
    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB,
M
Michal Privoznik 已提交
1111
    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI,
G
Guannan Ren 已提交
1112 1113

    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST
1114
} virDomainChrSerialTargetType;
G
Guannan Ren 已提交
1115

1116
typedef enum {
1117 1118
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE = 0,
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD,
1119 1120
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,

1121
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST
1122
} virDomainChrChannelTargetType;
1123

1124
typedef enum {
1125 1126
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE  = 0,
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL,
1127 1128
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN,
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML,
C
Cole Robinson 已提交
1129
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO,
1130 1131
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC,
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ,
1132 1133
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP,
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM,
1134

1135
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST
1136
} virDomainChrConsoleTargetType;
1137

1138
typedef enum {
1139 1140 1141 1142 1143 1144 1145 1146 1147 1148
    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,
1149
    VIR_DOMAIN_CHR_TYPE_SPICEVMC,
1150
    VIR_DOMAIN_CHR_TYPE_SPICEPORT,
1151
    VIR_DOMAIN_CHR_TYPE_NMDM,
1152

1153
    VIR_DOMAIN_CHR_TYPE_LAST
1154
} virDomainChrType;
1155

1156
typedef enum {
1157 1158
    VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW,
    VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET,
1159 1160
    VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNETS, /* secure telnet */
    VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS,
1161

1162
    VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST
1163
} virDomainChrTcpProtocol;
1164

1165
typedef enum {
E
Eric Blake 已提交
1166 1167
    VIR_DOMAIN_CHR_SPICEVMC_VDAGENT,
    VIR_DOMAIN_CHR_SPICEVMC_SMARTCARD,
1168
    VIR_DOMAIN_CHR_SPICEVMC_USBREDIR,
E
Eric Blake 已提交
1169

1170
    VIR_DOMAIN_CHR_SPICEVMC_LAST
1171
} virDomainChrSpicevmcName;
E
Eric Blake 已提交
1172

1173 1174 1175
/* The host side information for a character device.  */
struct _virDomainChrSourceDef {
    int type; /* virDomainChrType */
1176
    union {
E
Eric Blake 已提交
1177
        /* no <source> for null, vc, stdio */
1178 1179
        struct {
            char *path;
1180
            int append; /* enum virTristateSwitch */
1181
        } file; /* pty, file, pipe, or device */
1182 1183 1184 1185
        struct {
            char *master;
            char *slave;
        } nmdm;
1186 1187 1188
        struct {
            char *host;
            char *service;
1189
            bool listen;
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199
            int protocol;
        } tcp;
        struct {
            char *bindHost;
            char *bindService;
            char *connectHost;
            char *connectService;
        } udp;
        struct {
            char *path;
1200
            bool listen;
1201
        } nix;
E
Eric Blake 已提交
1202
        int spicevmc;
1203 1204 1205
        struct {
            char *channel;
        } spiceport;
1206
    } data;
1207 1208 1209 1210
};

/* A complete character device, both host and domain views.  */
struct _virDomainChrDef {
1211
    int deviceType; /* enum virDomainChrDeviceType */
G
Guannan Ren 已提交
1212 1213

    bool targetTypeAttr;
1214 1215 1216 1217
    int targetType; /* enum virDomainChrConsoleTargetType ||
                       enum virDomainChrChannelTargetType ||
                       enum virDomainChrSerialTargetType according to deviceType */

1218 1219 1220 1221 1222 1223
    union {
        int port; /* parallel, serial, console */
        virSocketAddrPtr addr; /* guestfwd */
        char *name; /* virtio */
    } target;

1224 1225
    virDomainChrDeviceState state;

1226
    virDomainChrSourceDef source;
1227 1228

    virDomainDeviceInfo info;
1229 1230 1231

    size_t nseclabels;
    virSecurityDeviceLabelDefPtr *seclabels;
1232 1233
};

1234
typedef enum {
E
Eric Blake 已提交
1235 1236 1237 1238
    VIR_DOMAIN_SMARTCARD_TYPE_HOST,
    VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES,
    VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH,

1239
    VIR_DOMAIN_SMARTCARD_TYPE_LAST
1240
} virDomainSmartcardType;
E
Eric Blake 已提交
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258

# define VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES 3
# define VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE "/etc/pki/nssdb"

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;
};

M
Marc-André Lureau 已提交
1259 1260 1261 1262 1263
struct _virDomainHubDef {
    int type;
    virDomainDeviceInfo info;
};

1264
typedef enum {
1265 1266 1267
    VIR_DOMAIN_TPM_MODEL_TIS,

    VIR_DOMAIN_TPM_MODEL_LAST
1268
} virDomainTPMModel;
1269

1270
typedef enum {
1271 1272 1273
    VIR_DOMAIN_TPM_TYPE_PASSTHROUGH,

    VIR_DOMAIN_TPM_TYPE_LAST
1274
} virDomainTPMBackendType;
1275 1276 1277 1278

# define VIR_DOMAIN_TPM_DEFAULT_DEVICE "/dev/tpm0"

struct _virDomainTPMDef {
1279
    virDomainTPMBackendType type;
1280
    virDomainDeviceInfo info;
1281
    virDomainTPMModel model;
1282 1283 1284 1285 1286 1287 1288
    union {
        struct {
            virDomainChrSourceDef source;
        } passthrough;
    } data;
};

1289
typedef enum {
1290 1291
    VIR_DOMAIN_INPUT_TYPE_MOUSE,
    VIR_DOMAIN_INPUT_TYPE_TABLET,
L
Li Zhang 已提交
1292
    VIR_DOMAIN_INPUT_TYPE_KBD,
1293
    VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH,
1294

1295
    VIR_DOMAIN_INPUT_TYPE_LAST
1296
} virDomainInputType;
1297

1298
typedef enum {
1299 1300 1301
    VIR_DOMAIN_INPUT_BUS_PS2,
    VIR_DOMAIN_INPUT_BUS_USB,
    VIR_DOMAIN_INPUT_BUS_XEN,
1302
    VIR_DOMAIN_INPUT_BUS_PARALLELS, /* pseudo device for VNC in containers */
1303
    VIR_DOMAIN_INPUT_BUS_VIRTIO,
1304 1305

    VIR_DOMAIN_INPUT_BUS_LAST
1306
} virDomainInputBus;
1307 1308 1309 1310

struct _virDomainInputDef {
    int type;
    int bus;
1311 1312 1313
    struct {
        char *evdev;
    } source;
1314
    virDomainDeviceInfo info;
1315 1316
};

1317
typedef enum {
1318 1319 1320 1321
    VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
    VIR_DOMAIN_SOUND_CODEC_TYPE_MICRO,

    VIR_DOMAIN_SOUND_CODEC_TYPE_LAST
1322
} virDomainSoundCodecType;
1323

1324
typedef enum {
1325 1326 1327
    VIR_DOMAIN_SOUND_MODEL_SB16,
    VIR_DOMAIN_SOUND_MODEL_ES1370,
    VIR_DOMAIN_SOUND_MODEL_PCSPK,
D
Daniel P. Berrange 已提交
1328
    VIR_DOMAIN_SOUND_MODEL_AC97,
1329
    VIR_DOMAIN_SOUND_MODEL_ICH6,
1330
    VIR_DOMAIN_SOUND_MODEL_ICH9,
1331
    VIR_DOMAIN_SOUND_MODEL_USB,
1332 1333

    VIR_DOMAIN_SOUND_MODEL_LAST
1334
} virDomainSoundModel;
1335

1336 1337 1338 1339 1340
struct _virDomainSoundCodecDef {
    int type;
    int cad;
};

1341 1342
struct _virDomainSoundDef {
    int model;
1343
    virDomainDeviceInfo info;
1344

1345
    size_t ncodecs;
1346
    virDomainSoundCodecDefPtr *codecs;
1347 1348
};

1349
typedef enum {
R
Richard Jones 已提交
1350 1351
    VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB,
    VIR_DOMAIN_WATCHDOG_MODEL_IB700,
1352
    VIR_DOMAIN_WATCHDOG_MODEL_DIAG288,
R
Richard Jones 已提交
1353 1354

    VIR_DOMAIN_WATCHDOG_MODEL_LAST
1355
} virDomainWatchdogModel;
R
Richard Jones 已提交
1356

1357
typedef enum {
R
Richard Jones 已提交
1358 1359 1360 1361
    VIR_DOMAIN_WATCHDOG_ACTION_RESET,
    VIR_DOMAIN_WATCHDOG_ACTION_SHUTDOWN,
    VIR_DOMAIN_WATCHDOG_ACTION_POWEROFF,
    VIR_DOMAIN_WATCHDOG_ACTION_PAUSE,
H
Hu Tao 已提交
1362
    VIR_DOMAIN_WATCHDOG_ACTION_DUMP,
R
Richard Jones 已提交
1363
    VIR_DOMAIN_WATCHDOG_ACTION_NONE,
1364
    VIR_DOMAIN_WATCHDOG_ACTION_INJECTNMI,
R
Richard Jones 已提交
1365 1366

    VIR_DOMAIN_WATCHDOG_ACTION_LAST
1367
} virDomainWatchdogAction;
R
Richard Jones 已提交
1368 1369 1370 1371

struct _virDomainWatchdogDef {
    int model;
    int action;
1372
    virDomainDeviceInfo info;
R
Richard Jones 已提交
1373 1374
};

1375

1376
typedef enum {
1377 1378 1379 1380 1381
    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,
1382
    VIR_DOMAIN_VIDEO_TYPE_QXL,
1383
    VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in containers */
M
Marc-André Lureau 已提交
1384
    VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
1385 1386

    VIR_DOMAIN_VIDEO_TYPE_LAST
1387
} virDomainVideoType;
1388 1389


1390 1391 1392
typedef struct _virDomainVideoAccelDef virDomainVideoAccelDef;
typedef virDomainVideoAccelDef *virDomainVideoAccelDefPtr;
struct _virDomainVideoAccelDef {
1393 1394
    int accel2d; /* enum virTristateBool */
    int accel3d; /* enum virTristateBool */
1395 1396 1397
};


1398 1399
struct _virDomainVideoDef {
    int type;
1400 1401
    unsigned int ram;  /* kibibytes (multiples of 1024) */
    unsigned int vram; /* kibibytes (multiples of 1024) */
1402
    unsigned int vram64; /* kibibytes (multiples of 1024) */
1403
    unsigned int vgamem; /* kibibytes (multiples of 1024) */
1404
    unsigned int heads;
1405
    bool primary;
1406
    virDomainVideoAccelDefPtr accel;
1407
    virDomainDeviceInfo info;
1408 1409
};

1410
/* graphics console modes */
1411
typedef enum {
1412 1413
    VIR_DOMAIN_GRAPHICS_TYPE_SDL,
    VIR_DOMAIN_GRAPHICS_TYPE_VNC,
1414 1415
    VIR_DOMAIN_GRAPHICS_TYPE_RDP,
    VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
1416
    VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
1417

1418
    VIR_DOMAIN_GRAPHICS_TYPE_LAST
1419
} virDomainGraphicsType;
1420

1421
typedef enum {
1422 1423 1424 1425 1426 1427
    VIR_DOMAIN_GRAPHICS_VNC_SHARE_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_VNC_SHARE_ALLOW_EXCLUSIVE,
    VIR_DOMAIN_GRAPHICS_VNC_SHARE_FORCE_SHARED,
    VIR_DOMAIN_GRAPHICS_VNC_SHARE_IGNORE,

    VIR_DOMAIN_GRAPHICS_VNC_SHARE_LAST
1428
} virDomainGraphicsVNCSharePolicy;
1429

1430
typedef enum {
1431 1432 1433 1434 1435 1436
    VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_FAIL,
    VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_DISCONNECT,
    VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_KEEP,

    VIR_DOMAIN_GRAPHICS_AUTH_CONNECTED_LAST
1437
} virDomainGraphicsAuthConnectedType;
1438

1439 1440 1441 1442
typedef struct _virDomainGraphicsAuthDef virDomainGraphicsAuthDef;
typedef virDomainGraphicsAuthDef *virDomainGraphicsAuthDefPtr;
struct _virDomainGraphicsAuthDef {
    char *passwd;
1443
    bool expires; /* Whether there is an expiry time set */
1444
    time_t validTo;  /* seconds since epoch */
1445
    int connected; /* action if connected */
1446 1447
};

1448
typedef enum {
1449 1450 1451 1452 1453 1454
    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,
E
Eric Blake 已提交
1455
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_SMARTCARD,
1456
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_USBREDIR,
1457 1458

    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST
1459
} virDomainGraphicsSpiceChannelName;
1460

1461
typedef enum {
1462 1463 1464 1465 1466
    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
1467
} virDomainGraphicsSpiceChannelMode;
1468

1469
typedef enum {
1470 1471 1472 1473 1474 1475 1476 1477 1478
    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
1479
} virDomainGraphicsSpiceImageCompression;
1480

1481
typedef enum {
1482 1483 1484 1485 1486 1487
    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
1488
} virDomainGraphicsSpiceJpegCompression;
1489

1490
typedef enum {
1491 1492 1493 1494 1495 1496
    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
1497
} virDomainGraphicsSpiceZlibCompression;
1498

1499
typedef enum {
P
Peng Zhou 已提交
1500 1501 1502 1503 1504
    VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER,
    VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT,

    VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST
1505
} virDomainGraphicsSpiceMouseMode;
P
Peng Zhou 已提交
1506

1507
typedef enum {
1508 1509 1510 1511 1512 1513
    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
1514
} virDomainGraphicsSpiceStreamingMode;
1515

1516
typedef enum {
1517 1518 1519 1520
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE = 0,
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS,
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK,

1521
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
1522
} virDomainGraphicsListenType;
1523

1524
typedef enum {
M
Marc-André Lureau 已提交
1525 1526
    VIR_DOMAIN_HUB_TYPE_USB,

1527
    VIR_DOMAIN_HUB_TYPE_LAST
1528
} virDomainHubType;
M
Marc-André Lureau 已提交
1529

1530 1531 1532 1533 1534 1535
typedef struct _virDomainGraphicsListenDef virDomainGraphicsListenDef;
typedef virDomainGraphicsListenDef *virDomainGraphicsListenDefPtr;
struct _virDomainGraphicsListenDef {
    int type;   /* enum virDomainGraphicsListenType */
    char *address;
    char *network;
1536
    bool fromConfig;    /* true if the @address is config file originated */
1537 1538
};

1539
struct _virDomainGraphicsDef {
M
Michal Privoznik 已提交
1540 1541 1542 1543 1544
    /* Port value discipline:
     * Value -1 is legacy syntax indicating that it should be auto-allocated.
     * Value 0 means port wasn't specified in XML at all.
     * Positive value is actual port number given in XML.
     */
1545 1546 1547 1548
    int type;
    union {
        struct {
            int port;
1549
            bool portReserved;
M
Martin Kletzander 已提交
1550
            int websocket;
1551
            bool autoport;
1552
            char *keymap;
1553
            char *socket;
1554
            virDomainGraphicsAuthDef auth;
1555
            int sharePolicy;
1556 1557 1558 1559
        } vnc;
        struct {
            char *display;
            char *xauth;
1560
            bool fullscreen;
1561
        } sdl;
1562 1563
        struct {
            int port;
1564 1565 1566
            bool autoport;
            bool replaceUser;
            bool multiUser;
1567 1568 1569
        } rdp;
        struct {
            char *display;
1570
            bool fullscreen;
1571
        } desktop;
1572 1573 1574
        struct {
            int port;
            int tlsPort;
1575 1576
            bool portReserved;
            bool tlsPortReserved;
P
Peng Zhou 已提交
1577
            int mousemode;
1578
            char *keymap;
1579
            virDomainGraphicsAuthDef auth;
1580
            bool autoport;
1581
            int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
1582
            int defaultMode; /* enum virDomainGraphicsSpiceChannelMode */
1583 1584 1585 1586
            int image;
            int jpeg;
            int zlib;
            int playback;
1587
            int streaming;
J
Ján Tomko 已提交
1588 1589
            int copypaste; /* enum virTristateBool */
            int filetransfer; /* enum virTristateBool */
1590
            int gl; /* enum virTristateBool */
1591
        } spice;
1592
    } data;
1593 1594 1595 1596 1597
    /* nListens, listens, and *port are only useful if type is vnc,
     * rdp, or spice. They've been extracted from the union only to
     * simplify parsing code.*/
    size_t nListens;
    virDomainGraphicsListenDefPtr listens;
1598 1599
};

1600
typedef enum {
1601 1602 1603
    VIR_DOMAIN_REDIRDEV_BUS_USB,

    VIR_DOMAIN_REDIRDEV_BUS_LAST
1604
} virDomainRedirdevBus;
1605 1606 1607 1608 1609 1610 1611 1612 1613 1614

struct _virDomainRedirdevDef {
    int bus; /* enum virDomainRedirdevBus */

    union {
        virDomainChrSourceDef chr;
    } source;

    virDomainDeviceInfo info; /* Guest address */
};
1615

1616
struct _virDomainRedirFilterUSBDevDef {
1617 1618 1619 1620
    int usbClass;
    int vendor;
    int product;
    int version;
1621
    bool allow;
1622 1623 1624 1625
};

struct _virDomainRedirFilterDef {
    size_t nusbdevs;
1626
    virDomainRedirFilterUSBDevDefPtr *usbdevs;
1627 1628
};

1629 1630 1631
enum {
    VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
    VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
1632
    VIR_DOMAIN_MEMBALLOON_MODEL_NONE,
1633 1634 1635 1636 1637 1638 1639

    VIR_DOMAIN_MEMBALLOON_MODEL_LAST
};

struct _virDomainMemballoonDef {
    int model;
    virDomainDeviceInfo info;
1640
    int period; /* seconds between collections */
1641
    int autodeflate; /* enum virTristateSwitch */
1642 1643
};

L
Li Zhang 已提交
1644 1645 1646
struct _virDomainNVRAMDef {
    virDomainDeviceInfo info;
};
1647

1648 1649 1650 1651 1652
struct _virDomainShmemDef {
    char *name;
    unsigned long long size;
    struct {
        bool enabled;
1653
        virDomainChrSourceDef chr;
1654 1655 1656 1657 1658 1659 1660 1661 1662
    } server;
    struct {
        bool enabled;
        unsigned vectors;
        virTristateSwitch ioeventfd;
    } msi;
    virDomainDeviceInfo info;
};

1663
typedef enum {
1664
    VIR_DOMAIN_SMBIOS_NONE = 0,
1665 1666 1667 1668 1669
    VIR_DOMAIN_SMBIOS_EMULATE,
    VIR_DOMAIN_SMBIOS_HOST,
    VIR_DOMAIN_SMBIOS_SYSINFO,

    VIR_DOMAIN_SMBIOS_LAST
1670
} virDomainSmbiosMode;
1671

1672

1673
# define VIR_DOMAIN_MAX_BOOT_DEVS 4
1674

1675
typedef enum {
1676 1677 1678 1679 1680
    VIR_DOMAIN_BOOT_FLOPPY,
    VIR_DOMAIN_BOOT_CDROM,
    VIR_DOMAIN_BOOT_DISK,
    VIR_DOMAIN_BOOT_NET,

1681
    VIR_DOMAIN_BOOT_LAST
1682
} virDomainBootOrder;
1683

1684
typedef enum {
1685 1686 1687
    VIR_DOMAIN_FEATURE_ACPI,
    VIR_DOMAIN_FEATURE_APIC,
    VIR_DOMAIN_FEATURE_PAE,
J
Jim Fehlig 已提交
1688
    VIR_DOMAIN_FEATURE_HAP,
1689
    VIR_DOMAIN_FEATURE_VIRIDIAN,
1690
    VIR_DOMAIN_FEATURE_PRIVNET,
1691
    VIR_DOMAIN_FEATURE_HYPERV,
1692
    VIR_DOMAIN_FEATURE_KVM,
1693
    VIR_DOMAIN_FEATURE_PVSPINLOCK,
1694
    VIR_DOMAIN_FEATURE_CAPABILITIES,
1695
    VIR_DOMAIN_FEATURE_PMU,
1696
    VIR_DOMAIN_FEATURE_VMPORT,
M
Michal Privoznik 已提交
1697
    VIR_DOMAIN_FEATURE_GIC,
1698 1699

    VIR_DOMAIN_FEATURE_LAST
1700
} virDomainFeature;
1701

1702
typedef enum {
1703
    VIR_DOMAIN_HYPERV_RELAXED = 0,
1704 1705
    VIR_DOMAIN_HYPERV_VAPIC,
    VIR_DOMAIN_HYPERV_SPINLOCKS,
1706 1707

    VIR_DOMAIN_HYPERV_LAST
1708
} virDomainHyperv;
1709

1710 1711 1712 1713 1714 1715
typedef enum {
    VIR_DOMAIN_KVM_HIDDEN = 0,

    VIR_DOMAIN_KVM_LAST
} virDomainKVM;

1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765
typedef enum {
    VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT = 0,
    VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW,
    VIR_DOMAIN_CAPABILITIES_POLICY_DENY,

    VIR_DOMAIN_CAPABILITIES_POLICY_LAST
} virDomainCapabilitiesPolicy;

/* The capabilities are ordered alphabetically to help check for new ones */
typedef enum {
    VIR_DOMAIN_CAPS_FEATURE_AUDIT_CONTROL = 0,
    VIR_DOMAIN_CAPS_FEATURE_AUDIT_WRITE,
    VIR_DOMAIN_CAPS_FEATURE_BLOCK_SUSPEND,
    VIR_DOMAIN_CAPS_FEATURE_CHOWN,
    VIR_DOMAIN_CAPS_FEATURE_DAC_OVERRIDE,
    VIR_DOMAIN_CAPS_FEATURE_DAC_READ_SEARCH,
    VIR_DOMAIN_CAPS_FEATURE_FOWNER,
    VIR_DOMAIN_CAPS_FEATURE_FSETID,
    VIR_DOMAIN_CAPS_FEATURE_IPC_LOCK,
    VIR_DOMAIN_CAPS_FEATURE_IPC_OWNER,
    VIR_DOMAIN_CAPS_FEATURE_KILL,
    VIR_DOMAIN_CAPS_FEATURE_LEASE,
    VIR_DOMAIN_CAPS_FEATURE_LINUX_IMMUTABLE,
    VIR_DOMAIN_CAPS_FEATURE_MAC_ADMIN,
    VIR_DOMAIN_CAPS_FEATURE_MAC_OVERRIDE,
    VIR_DOMAIN_CAPS_FEATURE_MKNOD,
    VIR_DOMAIN_CAPS_FEATURE_NET_ADMIN,
    VIR_DOMAIN_CAPS_FEATURE_NET_BIND_SERVICE,
    VIR_DOMAIN_CAPS_FEATURE_NET_BROADCAST,
    VIR_DOMAIN_CAPS_FEATURE_NET_RAW,
    VIR_DOMAIN_CAPS_FEATURE_SETGID,
    VIR_DOMAIN_CAPS_FEATURE_SETFCAP,
    VIR_DOMAIN_CAPS_FEATURE_SETPCAP,
    VIR_DOMAIN_CAPS_FEATURE_SETUID,
    VIR_DOMAIN_CAPS_FEATURE_SYS_ADMIN,
    VIR_DOMAIN_CAPS_FEATURE_SYS_BOOT,
    VIR_DOMAIN_CAPS_FEATURE_SYS_CHROOT,
    VIR_DOMAIN_CAPS_FEATURE_SYS_MODULE,
    VIR_DOMAIN_CAPS_FEATURE_SYS_NICE,
    VIR_DOMAIN_CAPS_FEATURE_SYS_PACCT,
    VIR_DOMAIN_CAPS_FEATURE_SYS_PTRACE,
    VIR_DOMAIN_CAPS_FEATURE_SYS_RAWIO,
    VIR_DOMAIN_CAPS_FEATURE_SYS_RESOURCE,
    VIR_DOMAIN_CAPS_FEATURE_SYS_TIME,
    VIR_DOMAIN_CAPS_FEATURE_SYS_TTY_CONFIG,
    VIR_DOMAIN_CAPS_FEATURE_SYSLOG,
    VIR_DOMAIN_CAPS_FEATURE_WAKE_ALARM,
    VIR_DOMAIN_CAPS_FEATURE_LAST
} virDomainCapsFeature;

1766
typedef enum {
1767 1768 1769 1770 1771 1772
    VIR_DOMAIN_LIFECYCLE_DESTROY,
    VIR_DOMAIN_LIFECYCLE_RESTART,
    VIR_DOMAIN_LIFECYCLE_RESTART_RENAME,
    VIR_DOMAIN_LIFECYCLE_PRESERVE,

    VIR_DOMAIN_LIFECYCLE_LAST
1773
} virDomainLifecycleAction;
1774

1775
typedef enum {
1776 1777 1778 1779 1780 1781 1782 1783
    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
1784
} virDomainLifecycleCrashAction;
1785

1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797
typedef enum {
    VIR_DOMAIN_LOCK_FAILURE_DEFAULT,
    VIR_DOMAIN_LOCK_FAILURE_POWEROFF,
    VIR_DOMAIN_LOCK_FAILURE_RESTART,
    VIR_DOMAIN_LOCK_FAILURE_PAUSE,
    VIR_DOMAIN_LOCK_FAILURE_IGNORE,

    VIR_DOMAIN_LOCK_FAILURE_LAST
} virDomainLockFailureAction;

VIR_ENUM_DECL(virDomainLockFailure)

M
Michal Privoznik 已提交
1798 1799 1800
typedef struct _virDomainBIOSDef virDomainBIOSDef;
typedef virDomainBIOSDef *virDomainBIOSDefPtr;
struct _virDomainBIOSDef {
J
Ján Tomko 已提交
1801
    int useserial; /* enum virTristateBool */
1802 1803 1804
    /* reboot-timeout parameters */
    bool rt_set;
    int rt_delay;
M
Michal Privoznik 已提交
1805 1806
};

1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822
typedef enum {
    VIR_DOMAIN_LOADER_TYPE_ROM = 0,
    VIR_DOMAIN_LOADER_TYPE_PFLASH,

    VIR_DOMAIN_LOADER_TYPE_LAST
} virDomainLoader;

VIR_ENUM_DECL(virDomainLoader)

typedef struct _virDomainLoaderDef virDomainLoaderDef;
typedef virDomainLoaderDef *virDomainLoaderDefPtr;
struct _virDomainLoaderDef {
    char *path;
    int readonly;   /* enum virTristateBool */
    virDomainLoader type;
    char *nvram;    /* path to non-volatile RAM */
1823
    char *templt;   /* user override of path to master nvram */
1824 1825 1826 1827
};

void virDomainLoaderDefFree(virDomainLoaderDefPtr loader);

1828 1829 1830 1831
/* Operating system configuration data & machine / arch */
typedef struct _virDomainOSDef virDomainOSDef;
typedef virDomainOSDef *virDomainOSDefPtr;
struct _virDomainOSDef {
1832
    int type;
1833
    virArch arch;
1834
    char *machine;
1835
    size_t nBootDevs;
1836
    int bootDevs[VIR_DOMAIN_BOOT_LAST];
J
Ján Tomko 已提交
1837
    int bootmenu; /* enum virTristateBool */
1838 1839
    unsigned int bm_timeout;
    bool bm_timeout_set;
1840
    char *init;
1841
    char **initargv;
1842 1843 1844
    char *kernel;
    char *initrd;
    char *cmdline;
1845
    char *dtb;
1846
    char *root;
1847
    virDomainLoaderDefPtr loader;
1848 1849
    char *bootloader;
    char *bootloaderArgs;
1850
    int smbios_mode;
1851

M
Michal Privoznik 已提交
1852
    virDomainBIOSDef bios;
1853 1854
};

1855
typedef enum {
1856 1857 1858 1859 1860
    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,
P
Paolo Bonzini 已提交
1861
    VIR_DOMAIN_TIMER_NAME_KVMCLOCK,
1862
    VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK,
1863

1864
    VIR_DOMAIN_TIMER_NAME_LAST
1865
} virDomainTimerNameType;
1866

1867
typedef enum {
1868 1869 1870
    VIR_DOMAIN_TIMER_TRACK_BOOT = 0,
    VIR_DOMAIN_TIMER_TRACK_GUEST,
    VIR_DOMAIN_TIMER_TRACK_WALL,
1871

1872
    VIR_DOMAIN_TIMER_TRACK_LAST
1873
} virDomainTimerTrackType;
1874

1875
typedef enum {
1876 1877 1878 1879 1880
    VIR_DOMAIN_TIMER_TICKPOLICY_DELAY = 0,
    VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP,
    VIR_DOMAIN_TIMER_TICKPOLICY_MERGE,
    VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD,

1881
    VIR_DOMAIN_TIMER_TICKPOLICY_LAST
1882
} virDomainTimerTickpolicyType;
1883

1884
typedef enum {
1885 1886 1887 1888
    VIR_DOMAIN_TIMER_MODE_AUTO = 0,
    VIR_DOMAIN_TIMER_MODE_NATIVE,
    VIR_DOMAIN_TIMER_MODE_EMULATE,
    VIR_DOMAIN_TIMER_MODE_PARAVIRT,
1889
    VIR_DOMAIN_TIMER_MODE_SMPSAFE,
1890

1891
    VIR_DOMAIN_TIMER_MODE_LAST
1892
} virDomainTimerModeType;
1893

1894
typedef enum {
1895
    VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC = 0,
O
Osier Yang 已提交
1896 1897
    VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO,

1898
    VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST
1899
} virDomainCpuPlacementMode;
O
Osier Yang 已提交
1900

1901 1902 1903
typedef struct _virDomainThreadSchedParam virDomainThreadSchedParam;
typedef virDomainThreadSchedParam *virDomainThreadSchedParamPtr;
struct _virDomainThreadSchedParam {
1904
    virProcessSchedPolicy policy;
1905 1906 1907
    int priority;
};

1908 1909 1910 1911 1912 1913 1914 1915
typedef struct _virDomainTimerCatchupDef virDomainTimerCatchupDef;
typedef virDomainTimerCatchupDef *virDomainTimerCatchupDefPtr;
struct _virDomainTimerCatchupDef {
    unsigned long threshold;
    unsigned long slew;
    unsigned long limit;
};

1916 1917 1918 1919 1920 1921 1922
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 */

1923 1924 1925 1926
    virDomainTimerCatchupDef catchup;

    /* track is only valid for name='platform|rtc' */
    int track;  /* host|guest */
1927 1928 1929 1930 1931 1932

    /* frequency & mode are only valid for name='tsc' */
    unsigned long frequency; /* in Hz, unspecified = 0 */
    int mode;       /* auto|native|emulate|paravirt */
};

1933
typedef enum {
1934 1935
    VIR_DOMAIN_CLOCK_OFFSET_UTC = 0,
    VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME = 1,
1936
    VIR_DOMAIN_CLOCK_OFFSET_VARIABLE = 2,
1937
    VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE = 3,
1938

1939
    VIR_DOMAIN_CLOCK_OFFSET_LAST
1940
} virDomainClockOffsetType;
1941

1942
typedef enum {
1943 1944 1945
    VIR_DOMAIN_CLOCK_BASIS_UTC = 0,
    VIR_DOMAIN_CLOCK_BASIS_LOCALTIME = 1,

1946
    VIR_DOMAIN_CLOCK_BASIS_LAST
1947
} virDomainClockBasis;
1948

1949 1950 1951 1952
typedef struct _virDomainClockDef virDomainClockDef;
typedef virDomainClockDef *virDomainClockDefPtr;
struct _virDomainClockDef {
    int offset;
1953

1954
    union {
1955 1956 1957
        /* Bug-compatibility-mode for Xen utc|localtime */
        int utc_reset;
        /* Adjustment in seconds, relative to UTC or LOCALTIME, when
1958
         * offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE */
1959 1960 1961
        struct {
            long long adjustment;
            int basis;
1962 1963 1964 1965 1966 1967 1968

            /* domain start-time adjustment. This is a
             * private/internal read-only value that only exists when
             * a domain is running, and only if the clock
             * offset='variable'
             */
            long long adjustment0;
1969
        } variable;
1970 1971 1972 1973 1974

        /* Timezone name, when
         * offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME */
        char *timezone;
    } data;
1975

1976
    size_t ntimers;
1977
    virDomainTimerDefPtr *timers;
1978 1979
};

1980

1981 1982 1983
typedef struct _virBlkioDevice virBlkioDevice;
typedef virBlkioDevice *virBlkioDevicePtr;
struct _virBlkioDevice {
1984 1985
    char *path;
    unsigned int weight;
1986 1987 1988 1989
    unsigned int riops;
    unsigned int wiops;
    unsigned long long rbps;
    unsigned long long wbps;
1990 1991
};

1992
typedef enum {
1993 1994 1995
    VIR_DOMAIN_RNG_MODEL_VIRTIO,

    VIR_DOMAIN_RNG_MODEL_LAST
1996
} virDomainRNGModel;
1997

1998
typedef enum {
1999 2000 2001 2002 2003
    VIR_DOMAIN_RNG_BACKEND_RANDOM,
    VIR_DOMAIN_RNG_BACKEND_EGD,
    /* VIR_DOMAIN_RNG_BACKEND_POOL, */

    VIR_DOMAIN_RNG_BACKEND_LAST
2004
} virDomainRNGBackend;
2005 2006 2007 2008

struct _virDomainRNGDef {
    int model;
    int backend;
2009 2010
    unsigned int rate; /* bytes per period */
    unsigned int period; /* milliseconds */
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020

    union {
        char *file; /* file name for 'random' source */
        virDomainChrSourceDefPtr chardev; /* a char backend for
                                             the EGD source */
    } source;

    virDomainDeviceInfo info;
};

2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034
typedef enum {
    VIR_DOMAIN_MEMORY_MODEL_NONE,
    VIR_DOMAIN_MEMORY_MODEL_DIMM, /* dimm hotpluggable memory device */

    VIR_DOMAIN_MEMORY_MODEL_LAST
} virDomainMemoryModel;

struct _virDomainMemoryDef {
    /* source */
    virBitmapPtr sourceNodes;
    unsigned long long pagesize; /* kibibytes */

    /* target */
    int model; /* virDomainMemoryModel */
2035
    int targetNode;
2036 2037 2038 2039 2040 2041 2042
    unsigned long long size; /* kibibytes */

    virDomainDeviceInfo info;
};

void virDomainMemoryDefFree(virDomainMemoryDefPtr def);

2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057
struct _virDomainIdMapEntry {
    unsigned int start;
    unsigned int target;
    unsigned int count;
};

struct _virDomainIdMapDef {
    size_t nuidmap;
    virDomainIdMapEntryPtr uidmap;

    size_t ngidmap;
    virDomainIdMapEntryPtr gidmap;
};


2058 2059 2060 2061 2062 2063 2064 2065 2066
typedef enum {
    VIR_DOMAIN_PANIC_MODEL_DEFAULT,
    VIR_DOMAIN_PANIC_MODEL_ISA,
    VIR_DOMAIN_PANIC_MODEL_PSERIES,
    VIR_DOMAIN_PANIC_MODEL_HYPERV,

    VIR_DOMAIN_PANIC_MODEL_LAST
} virDomainPanicModel;

H
Hu Tao 已提交
2067
struct _virDomainPanicDef {
2068
    int model; /* virDomainPanicModel */
H
Hu Tao 已提交
2069 2070 2071 2072
    virDomainDeviceInfo info;
};


2073
void virBlkioDeviceArrayClear(virBlkioDevicePtr deviceWeights,
2074
                              int ndevices);
2075

2076 2077 2078 2079 2080
typedef struct _virDomainResourceDef virDomainResourceDef;
typedef virDomainResourceDef *virDomainResourceDefPtr;
struct _virDomainResourceDef {
    char *partition;
};
2081

2082
typedef struct _virDomainHugePage virDomainHugePage;
2083 2084
typedef virDomainHugePage *virDomainHugePagePtr;

2085
struct _virDomainHugePage {
2086 2087 2088 2089
    virBitmapPtr nodemask;      /* guest's NUMA node mask */
    unsigned long long size;    /* hugepage size in KiB */
};

2090 2091
# define VIR_DOMAIN_CPUMASK_LEN 1024

2092 2093 2094 2095 2096 2097
typedef struct _virDomainIOThreadIDDef virDomainIOThreadIDDef;
typedef virDomainIOThreadIDDef *virDomainIOThreadIDDefPtr;

struct _virDomainIOThreadIDDef {
    bool autofill;
    unsigned int iothread_id;
2098
    int thread_id;
2099
    virBitmapPtr cpumask;
2100 2101

    virDomainThreadSchedParam sched;
2102 2103 2104 2105
};

void virDomainIOThreadIDDefFree(virDomainIOThreadIDDefPtr def);

2106

2107 2108 2109 2110 2111 2112 2113 2114
typedef struct _virDomainCputune virDomainCputune;
typedef virDomainCputune *virDomainCputunePtr;

struct _virDomainCputune {
    unsigned long shares;
    bool sharesSpecified;
    unsigned long long period;
    long long quota;
2115
    unsigned long long global_period;
2116
    long long global_quota;
2117 2118
    unsigned long long emulator_period;
    long long emulator_quota;
2119
    virBitmapPtr emulatorpin;
2120 2121
};

2122 2123 2124 2125 2126 2127

typedef struct _virDomainVcpuInfo virDomainVcpuInfo;
typedef virDomainVcpuInfo *virDomainVcpuInfoPtr;

struct _virDomainVcpuInfo {
    bool online;
2128
    virBitmapPtr cpumask;
2129 2130

    virDomainThreadSchedParam sched;
2131 2132
};

2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146
typedef struct _virDomainBlkiotune virDomainBlkiotune;
typedef virDomainBlkiotune *virDomainBlkiotunePtr;

struct _virDomainBlkiotune {
    unsigned int weight;

    size_t ndevices;
    virBlkioDevicePtr devices;
};

typedef struct _virDomainMemtune virDomainMemtune;
typedef virDomainMemtune *virDomainMemtunePtr;

struct _virDomainMemtune {
2147 2148 2149
    /* total memory size including memory modules in kibibytes, this field
     * should be accessed only via accessors */
    unsigned long long total_memory;
2150 2151
    /* initial memory size in kibibytes = total_memory excluding memory modules*/
    unsigned long long initial_memory;
2152 2153
    unsigned long long cur_balloon; /* in kibibytes, capped at ulong thanks
                                       to virDomainGetInfo */
2154 2155 2156 2157

    virDomainHugePagePtr hugepages;
    size_t nhugepages;

2158 2159 2160 2161
    /* maximum supported memory for a guest, for hotplugging */
    unsigned long long max_memory; /* in kibibytes */
    unsigned int memory_slots; /* maximum count of RAM memory slots */

2162 2163 2164
    bool nosharepages;
    bool locked;
    int dump_core; /* enum virTristateSwitch */
2165 2166 2167 2168
    unsigned long long hard_limit; /* in kibibytes, limit at off_t bytes */
    unsigned long long soft_limit; /* in kibibytes, limit at off_t bytes */
    unsigned long long min_guarantee; /* in kibibytes, limit at off_t bytes */
    unsigned long long swap_hard_limit; /* in kibibytes, limit at off_t bytes */
2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179
};

typedef struct _virDomainPowerManagement virDomainPowerManagement;
typedef virDomainPowerManagement *virDomainPowerManagementPtr;

struct _virDomainPowerManagement {
    /* These options are of type enum virTristateBool */
    int s3;
    int s4;
};

2180 2181 2182 2183 2184 2185 2186
typedef struct _virDomainKeyWrapDef virDomainKeyWrapDef;
typedef virDomainKeyWrapDef *virDomainKeyWrapDefPtr;
struct _virDomainKeyWrapDef {
    int aes; /* enum virTristateSwitch */
    int dea; /* enum virTristateSwitch */
};

2187 2188 2189 2190 2191 2192
/*
 * Guest VM main configuration
 *
 * NB: if adding to this struct, virDomainDefCheckABIStability
 * may well need an update
 */
2193 2194
typedef struct _virDomainDef virDomainDef;
typedef virDomainDef *virDomainDefPtr;
2195
struct _virDomainDef {
2196
    virDomainVirtType virtType;
2197 2198 2199
    int id;
    unsigned char uuid[VIR_UUID_BUFLEN];
    char *name;
2200
    char *title;
2201
    char *description;
2202

2203 2204
    virDomainBlkiotune blkio;
    virDomainMemtune mem;
2205

2206
    virDomainVcpuInfoPtr vcpus;
2207
    size_t maxvcpus;
O
Osier Yang 已提交
2208
    int placement_mode;
H
Hu Tao 已提交
2209
    virBitmapPtr cpumask;
2210

2211
    unsigned int iothreads;
2212 2213
    size_t niothreadids;
    virDomainIOThreadIDDefPtr *iothreadids;
2214

2215
    virDomainCputune cputune;
2216

2217
    virDomainNumaPtr numa;
2218
    virDomainResourceDefPtr resource;
2219
    virDomainIdMapDef idmap;
2220

2221 2222 2223 2224 2225
    /* These 3 are based on virDomainLifeCycleAction enum flags */
    int onReboot;
    int onPoweroff;
    int onCrash;

2226 2227
    int onLockFailure; /* enum virDomainLockFailureAction */

2228
    virDomainPowerManagement pm;
2229

2230 2231
    virDomainOSDef os;
    char *emulator;
2232 2233 2234
    /* These three options are of type virTristateSwitch,
     * except VIR_DOMAIN_FEATURE_CAPABILITIES that is of type
     * virDomainCapabilitiesPolicy */
2235
    int features[VIR_DOMAIN_FEATURE_LAST];
2236
    int apic_eoi;
2237
    int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
2238
    int kvm_features[VIR_DOMAIN_KVM_LAST];
2239
    unsigned int hyperv_spinlocks;
2240
    virGICVersion gic_version;
2241

J
Ján Tomko 已提交
2242
    /* These options are of type virTristateSwitch: ON = keep, OFF = drop */
2243 2244
    int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST];

2245
    virDomainClockDef clock;
2246

2247
    size_t ngraphics;
2248
    virDomainGraphicsDefPtr *graphics;
2249

2250
    size_t ndisks;
2251 2252
    virDomainDiskDefPtr *disks;

2253
    size_t ncontrollers;
2254 2255
    virDomainControllerDefPtr *controllers;

2256
    size_t nfss;
2257 2258
    virDomainFSDefPtr *fss;

2259
    size_t nnets;
2260 2261
    virDomainNetDefPtr *nets;

2262
    size_t ninputs;
2263 2264
    virDomainInputDefPtr *inputs;

2265
    size_t nsounds;
2266 2267
    virDomainSoundDefPtr *sounds;

2268
    size_t nvideos;
2269 2270
    virDomainVideoDefPtr *videos;

2271
    size_t nhostdevs;
2272 2273
    virDomainHostdevDefPtr *hostdevs;

2274
    size_t nredirdevs;
2275 2276
    virDomainRedirdevDefPtr *redirdevs;

2277
    size_t nsmartcards;
E
Eric Blake 已提交
2278 2279
    virDomainSmartcardDefPtr *smartcards;

2280
    size_t nserials;
2281 2282
    virDomainChrDefPtr *serials;

2283
    size_t nparallels;
2284 2285
    virDomainChrDefPtr *parallels;

2286
    size_t nchannels;
2287 2288
    virDomainChrDefPtr *channels;

2289
    size_t nconsoles;
2290 2291
    virDomainChrDefPtr *consoles;

2292
    size_t nleases;
2293 2294
    virDomainLeaseDefPtr *leases;

2295
    size_t nhubs;
M
Marc-André Lureau 已提交
2296 2297
    virDomainHubDefPtr *hubs;

2298 2299 2300
    size_t nseclabels;
    virSecurityLabelDefPtr *seclabels;

2301 2302 2303
    size_t nrngs;
    virDomainRNGDefPtr *rngs;

2304 2305 2306
    size_t nshmems;
    virDomainShmemDefPtr *shmems;

2307 2308 2309
    size_t nmems;
    virDomainMemoryDefPtr *mems;

D
Dmitry Andreev 已提交
2310 2311 2312
    size_t npanics;
    virDomainPanicDefPtr *panics;

2313
    /* Only 1 */
R
Richard Jones 已提交
2314
    virDomainWatchdogDefPtr watchdog;
2315
    virDomainMemballoonDefPtr memballoon;
L
Li Zhang 已提交
2316
    virDomainNVRAMDefPtr nvram;
2317
    virDomainTPMDefPtr tpm;
2318
    virCPUDefPtr cpu;
2319
    virSysinfoDefPtr sysinfo;
2320
    virDomainRedirFilterDefPtr redirfilter;
2321 2322 2323

    void *namespaceData;
    virDomainXMLNamespace ns;
2324

2325 2326
    virDomainKeyWrapDefPtr keywrap;

2327 2328
    /* Application-specific custom metadata */
    xmlNodePtr metadata;
2329 2330
};

2331
int virDomainDefSetVcpusMax(virDomainDefPtr def, unsigned int vcpus);
2332
bool virDomainDefHasVcpusOffline(const virDomainDef *def);
2333
unsigned int virDomainDefGetVcpusMax(const virDomainDef *def);
2334
int virDomainDefSetVcpus(virDomainDefPtr def, unsigned int vcpus);
2335
unsigned int virDomainDefGetVcpus(const virDomainDef *def);
2336
virBitmapPtr virDomainDefGetOnlineVcpumap(const virDomainDef *def);
2337 2338
virDomainVcpuInfoPtr virDomainDefGetVcpu(virDomainDefPtr def, unsigned int vcpu)
    ATTRIBUTE_RETURN_CHECK;
2339

2340
unsigned long long virDomainDefGetMemoryInitial(const virDomainDef *def);
2341
void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size);
2342
void virDomainDefSetMemoryInitial(virDomainDefPtr def, unsigned long long size);
2343
unsigned long long virDomainDefGetMemoryActual(virDomainDefPtr def);
2344
bool virDomainDefHasMemoryHotplug(const virDomainDef *def);
2345

2346 2347 2348 2349 2350 2351 2352
typedef enum {
    VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_AES,
    VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_DEA,

    VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_LAST
} virDomainKeyWrapCipherName;

2353
typedef enum {
2354 2355 2356 2357 2358
    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 */
2359
    VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH,  /* Externally launched guest domain */
2360
    VIR_DOMAIN_TAINT_HOST_CPU,         /* Host CPU passthrough in use */
2361
    VIR_DOMAIN_TAINT_HOOK,             /* Domain (possibly) changed via hook script */
2362
    VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */
2363
    VIR_DOMAIN_TAINT_CUSTOM_DTB,       /* Custom device tree blob was specifed */
2364 2365

    VIR_DOMAIN_TAINT_LAST
2366
} virDomainTaintFlags;
2367

2368
/* Guest VM runtime state */
J
Jiri Denemark 已提交
2369 2370 2371 2372 2373 2374
typedef struct _virDomainStateReason virDomainStateReason;
struct _virDomainStateReason {
    int state;
    int reason;
};

2375 2376 2377
typedef struct _virDomainObj virDomainObj;
typedef virDomainObj *virDomainObjPtr;
struct _virDomainObj {
2378
    virObjectLockable parent;
2379
    virCond cond;
2380

2381
    pid_t pid;
J
Jiri Denemark 已提交
2382
    virDomainStateReason state;
2383 2384 2385

    unsigned int autostart : 1;
    unsigned int persistent : 1;
2386
    unsigned int updated : 1;
2387
    unsigned int removing : 1;
2388 2389 2390

    virDomainDefPtr def; /* The current definition */
    virDomainDefPtr newDef; /* New definition to activate at shutdown */
2391

2392
    virDomainSnapshotObjListPtr snapshots;
C
Chris Lalancette 已提交
2393 2394
    virDomainSnapshotObjPtr current_snapshot;

2395 2396
    bool hasManagedSave;

2397 2398
    void *privateData;
    void (*privateDataFreeFunc)(void *);
2399 2400

    int taint;
2401 2402 2403

    unsigned long long original_memlock; /* Original RLIMIT_MEMLOCK, zero if no
                                          * restore will be required later */
2404 2405
};

2406 2407
typedef bool (*virDomainObjListACLFilter)(virConnectPtr conn,
                                          virDomainDefPtr def);
2408

2409 2410 2411

/* This structure holds various callbacks and data needed
 * while parsing and creating domain XMLs */
2412 2413
typedef struct _virDomainXMLOption virDomainXMLOption;
typedef virDomainXMLOption *virDomainXMLOptionPtr;
2414

2415 2416
/* Called once after everything else has been parsed, for adjusting
 * overall domain defaults.  */
2417 2418
typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def,
                                             virCapsPtr caps,
2419
                                             unsigned int parseFlags,
2420
                                             void *opaque);
2421 2422
/* Called once per device, for adjusting per-device settings while
 * leaving the overall domain otherwise unchanged.  */
2423
typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev,
2424
                                                   const virDomainDef *def,
2425
                                                   virCapsPtr caps,
2426
                                                   unsigned int parseFlags,
2427 2428 2429 2430 2431
                                                   void *opaque);

typedef struct _virDomainDefParserConfig virDomainDefParserConfig;
typedef virDomainDefParserConfig *virDomainDefParserConfigPtr;
struct _virDomainDefParserConfig {
2432
    /* driver domain definition callbacks */
2433 2434 2435
    virDomainDefPostParseCallback domainPostParseCallback;
    virDomainDeviceDefPostParseCallback devicesPostParseCallback;

2436
    /* private data for the callbacks */
2437 2438
    void *priv;
    virFreeCallback privFree;
2439 2440

    /* data */
2441
    bool hasWideSCSIBus;
2442
    unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
2443 2444
};

2445 2446 2447 2448 2449 2450 2451 2452 2453
typedef void *(*virDomainXMLPrivateDataAllocFunc)(void);
typedef void (*virDomainXMLPrivateDataFreeFunc)(void *);
typedef virObjectPtr (*virDomainXMLPrivateDataNewFunc)(void);
typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr,
                                                 virDomainObjPtr);
typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr,
                                                virDomainObjPtr,
                                                virDomainDefParserConfigPtr);

2454 2455 2456 2457 2458
typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks;
typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr;
struct _virDomainXMLPrivateDataCallbacks {
    virDomainXMLPrivateDataAllocFunc  alloc;
    virDomainXMLPrivateDataFreeFunc   free;
2459
    virDomainXMLPrivateDataNewFunc    diskNew;
2460 2461 2462 2463
    virDomainXMLPrivateDataFormatFunc format;
    virDomainXMLPrivateDataParseFunc  parse;
};

2464 2465 2466
virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config,
                                            virDomainXMLPrivateDataCallbacksPtr priv,
                                            virDomainXMLNamespacePtr xmlns);
2467

2468 2469
void virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt, virMacAddrPtr mac);

2470
virDomainXMLNamespacePtr
2471
virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
2472 2473
    ATTRIBUTE_NONNULL(1);

2474 2475 2476
int
virDomainDefPostParse(virDomainDefPtr def,
                      virCapsPtr caps,
2477
                      unsigned int parseFlags,
2478 2479
                      virDomainXMLOptionPtr xmlopt);

2480
static inline bool
D
Daniel P. Berrange 已提交
2481
virDomainObjIsActive(virDomainObjPtr dom)
2482 2483 2484 2485
{
    return dom->def->id != -1;
}

2486
virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps)
2487
    ATTRIBUTE_NONNULL(1);
2488

M
Michal Privoznik 已提交
2489 2490
void virDomainObjEndAPI(virDomainObjPtr *vm);

2491
bool virDomainObjTaint(virDomainObjPtr obj,
2492
                       virDomainTaintFlags taint);
2493

2494 2495 2496 2497
void virDomainObjBroadcast(virDomainObjPtr vm);
int virDomainObjWait(virDomainObjPtr vm);
int virDomainObjWaitUntil(virDomainObjPtr vm,
                          unsigned long long whenms);
2498 2499

int virDomainDefCheckUnsupportedMemoryHotplug(virDomainDefPtr def);
2500
int virDomainDeviceDefCheckUnsupportedMemoryDevice(virDomainDeviceDefPtr dev);
2501

H
Hu Tao 已提交
2502
void virDomainPanicDefFree(virDomainPanicDefPtr panic);
2503
void virDomainResourceDefFree(virDomainResourceDefPtr resource);
2504 2505
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def);
2506
virDomainDiskDefPtr virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt);
2507
void virDomainDiskDefFree(virDomainDiskDefPtr def);
2508
void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
2509 2510
int virDomainDiskGetType(virDomainDiskDefPtr def);
void virDomainDiskSetType(virDomainDiskDefPtr def, int type);
2511
const char *virDomainDiskGetSource(virDomainDiskDef const *def);
2512 2513 2514 2515 2516 2517 2518
int virDomainDiskSetSource(virDomainDiskDefPtr def, const char *src)
    ATTRIBUTE_RETURN_CHECK;
const char *virDomainDiskGetDriver(virDomainDiskDefPtr def);
int virDomainDiskSetDriver(virDomainDiskDefPtr def, const char *name)
    ATTRIBUTE_RETURN_CHECK;
int virDomainDiskGetFormat(virDomainDiskDefPtr def);
void virDomainDiskSetFormat(virDomainDiskDefPtr def, int format);
H
Han Cheng 已提交
2519 2520 2521
int virDomainDeviceFindControllerModel(virDomainDefPtr def,
                                       virDomainDeviceInfoPtr info,
                                       int controllerType);
2522 2523 2524
virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
                                                 int bus,
                                                 char *dst);
2525
void virDomainControllerDefFree(virDomainControllerDefPtr def);
2526
void virDomainFSDefFree(virDomainFSDefPtr def);
2527
void virDomainActualNetDefFree(virDomainActualNetDefPtr def);
2528
void virDomainNetDefFree(virDomainNetDefPtr def);
E
Eric Blake 已提交
2529
void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def);
2530
void virDomainChrDefFree(virDomainChrDefPtr def);
2531
void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def);
2532 2533
int virDomainChrSourceDefCopy(virDomainChrSourceDefPtr src,
                              virDomainChrSourceDefPtr dest);
2534
void virDomainSoundCodecDefFree(virDomainSoundCodecDefPtr def);
2535
void virDomainSoundDefFree(virDomainSoundDefPtr def);
2536
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
L
Li Zhang 已提交
2537
void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
R
Richard Jones 已提交
2538
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
2539
void virDomainVideoDefFree(virDomainVideoDefPtr def);
2540 2541
virDomainHostdevDefPtr virDomainHostdevDefAlloc(void);
void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
2542
void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
M
Marc-André Lureau 已提交
2543
void virDomainHubDefFree(virDomainHubDefPtr def);
2544
void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def);
2545
void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def);
2546
void virDomainShmemDefFree(virDomainShmemDefPtr def);
2547
void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
2548
virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
2549
                                             const virDomainDef *def,
2550 2551
                                             virCapsPtr caps,
                                             virDomainXMLOptionPtr xmlopt);
2552 2553
int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
                                  int type);
2554
virDomainDeviceInfoPtr virDomainDeviceGetInfo(virDomainDeviceDefPtr device);
2555 2556
int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
                            virDomainDeviceInfoPtr src);
2557
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
2558
void virDomainDefClearPCIAddresses(virDomainDefPtr def);
2559
void virDomainDefClearCCWAddresses(virDomainDefPtr def);
D
Daniel P. Berrange 已提交
2560
void virDomainDefClearDeviceAliases(virDomainDefPtr def);
2561
void virDomainTPMDefFree(virDomainTPMDefPtr def);
2562

2563
typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
2564 2565
                                           virDomainDeviceDefPtr dev,
                                           virDomainDeviceInfoPtr info,
2566 2567 2568 2569 2570 2571
                                           void *opaque);

int virDomainDeviceInfoIterate(virDomainDefPtr def,
                               virDomainDeviceInfoCallback cb,
                               void *opaque);

2572 2573 2574 2575
bool virDomainDefHasDeviceAddress(virDomainDefPtr def,
                                  virDomainDeviceInfoPtr info)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

2576 2577
void virDomainDefFree(virDomainDefPtr vm);

M
Michal Novotny 已提交
2578 2579
virDomainChrDefPtr virDomainChrDefNew(void);

2580 2581 2582 2583
virDomainDefPtr virDomainDefNew(void);
virDomainDefPtr virDomainDefNewFull(const char *name,
                                    const unsigned char *uuid,
                                    int id);
2584

2585
void virDomainObjAssignDef(virDomainObjPtr domain,
2586
                           virDomainDefPtr def,
2587 2588
                           bool live,
                           virDomainDefPtr *oldDef);
2589
int virDomainObjSetDefTransient(virCapsPtr caps,
2590
                                virDomainXMLOptionPtr xmlopt,
2591 2592
                                virDomainObjPtr domain,
                                bool live);
2593 2594
virDomainDefPtr
virDomainObjGetPersistentDef(virCapsPtr caps,
2595
                             virDomainXMLOptionPtr xmlopt,
2596
                             virDomainObjPtr domain);
2597 2598 2599 2600 2601 2602 2603 2604

int virDomainObjUpdateModificationImpact(virDomainObjPtr vm,
                                         unsigned int *flags);

int virDomainObjGetDefs(virDomainObjPtr vm,
                        unsigned int flags,
                        virDomainDefPtr *liveDef,
                        virDomainDefPtr *persDef);
2605
virDomainDefPtr virDomainObjGetOneDef(virDomainObjPtr vm, unsigned int flags);
2606 2607 2608

int
virDomainLiveConfigHelperMethod(virCapsPtr caps,
2609
                                virDomainXMLOptionPtr xmlopt,
2610 2611 2612 2613
                                virDomainObjPtr dom,
                                unsigned int *flags,
                                virDomainDefPtr *persistentDef);

2614 2615 2616 2617 2618 2619 2620
virDomainDefPtr virDomainDefCopy(virDomainDefPtr src,
                                 virCapsPtr caps,
                                 virDomainXMLOptionPtr xmlopt,
                                 bool migratable);
virDomainDefPtr virDomainObjCopyPersistentDef(virDomainObjPtr dom,
                                              virCapsPtr caps,
                                              virDomainXMLOptionPtr xmlopt);
2621

2622 2623 2624
typedef enum {
    /* parse internal domain status information */
    VIR_DOMAIN_DEF_PARSE_STATUS          = 1 << 0,
2625 2626 2627 2628
    /* Parse only parts of the XML that would be present in an inactive libvirt
     * XML. Note that the flag does not imply that ABI incompatible
     * transformations can be used, since it's used to strip runtime info when
     * restoring save images/migration. */
2629 2630 2631 2632 2633
    VIR_DOMAIN_DEF_PARSE_INACTIVE        = 1 << 1,
    /* parse <actual> element */
    VIR_DOMAIN_DEF_PARSE_ACTUAL_NET      = 1 << 2,
    /* parse original states of host PCI device */
    VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES = 1 << 3,
2634
    /* internal flag passed to device info sub-parser to allow using <rom> */
2635
    VIR_DOMAIN_DEF_PARSE_ALLOW_ROM       = 1 << 4,
2636
    /* internal flag passed to device info sub-parser to allow specifying boot order */
2637 2638
    VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT      = 1 << 5,
    /* parse only source half of <disk> */
2639
    VIR_DOMAIN_DEF_PARSE_DISK_SOURCE     = 1 << 6,
2640
    /* perform RNG schema validation on the passed XML document */
2641
    VIR_DOMAIN_DEF_PARSE_VALIDATE        = 1 << 7,
2642
    /* don't validate os.type and arch against capabilities. Prevents
2643
     * VMs from disappearing when qemu is removed and libvirtd is restarted */
2644
    VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS = 1 << 8,
2645 2646
    /* allow updates in post parse callback that would break ABI otherwise */
    VIR_DOMAIN_DEF_PARSE_ABI_UPDATE = 1 << 9,
2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664
} virDomainDefParseFlags;

typedef enum {
    VIR_DOMAIN_DEF_FORMAT_SECURE          = 1 << 0,
    VIR_DOMAIN_DEF_FORMAT_INACTIVE        = 1 << 1,
    VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU      = 1 << 2,
    VIR_DOMAIN_DEF_FORMAT_MIGRATABLE      = 1 << 3,
    /* format internal domain status information */
    VIR_DOMAIN_DEF_FORMAT_STATUS          = 1 << 4,
    /* format <actual> element */
    VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET      = 1 << 5,
    /* format original states of host PCI device */
    VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES = 1 << 6,
    VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM       = 1 << 7,
    VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT      = 1 << 8,
    VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST    = 1 << 9,
} virDomainDefFormatFlags;

2665
virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr,
2666
                                              const virDomainDef *def,
2667 2668
                                              virCapsPtr caps,
                                              virDomainXMLOptionPtr xmlopt,
L
Laine Stump 已提交
2669
                                              unsigned int flags);
2670 2671 2672 2673
virStorageSourcePtr virDomainDiskDefSourceParse(const char *xmlStr,
                                                const virDomainDef *def,
                                                virDomainXMLOptionPtr xmlopt,
                                                unsigned int flags);
2674 2675
virDomainDefPtr virDomainDefParseString(const char *xmlStr,
                                        virCapsPtr caps,
2676
                                        virDomainXMLOptionPtr xmlopt,
L
Laine Stump 已提交
2677
                                        unsigned int flags);
2678 2679
virDomainDefPtr virDomainDefParseFile(const char *filename,
                                      virCapsPtr caps,
2680
                                      virDomainXMLOptionPtr xmlopt,
L
Laine Stump 已提交
2681
                                      unsigned int flags);
2682
virDomainDefPtr virDomainDefParseNode(xmlDocPtr doc,
2683
                                      xmlNodePtr root,
2684 2685
                                      virCapsPtr caps,
                                      virDomainXMLOptionPtr xmlopt,
L
Laine Stump 已提交
2686
                                      unsigned int flags);
2687 2688 2689 2690 2691
virDomainObjPtr virDomainObjParseNode(xmlDocPtr xml,
                                      xmlNodePtr root,
                                      virCapsPtr caps,
                                      virDomainXMLOptionPtr xmlopt,
                                      unsigned int flags);
2692 2693 2694 2695
virDomainObjPtr virDomainObjParseFile(const char *filename,
                                      virCapsPtr caps,
                                      virDomainXMLOptionPtr xmlopt,
                                      unsigned int flags);
2696

2697 2698 2699
bool virDomainDefCheckABIStability(virDomainDefPtr src,
                                   virDomainDefPtr dst);

2700
int virDomainDefAddImplicitControllers(virDomainDefPtr def);
2701

2702 2703 2704 2705
virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(virDomainDefPtr def,
                                                  unsigned int iothread_id);
virDomainIOThreadIDDefPtr virDomainIOThreadIDAdd(virDomainDefPtr def,
                                                 unsigned int iothread_id);
2706 2707 2708

virBitmapPtr virDomainIOThreadIDMap(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
2709 2710
void virDomainIOThreadIDDel(virDomainDefPtr def, unsigned int iothread_id);

2711 2712
unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);

2713
char *virDomainDefFormat(virDomainDefPtr def,
2714
                         virCapsPtr caps,
L
Laine Stump 已提交
2715
                         unsigned int flags);
2716 2717
char *virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
                         virDomainObjPtr obj,
2718
                         virCapsPtr caps,
2719
                         unsigned int flags);
2720
int virDomainDefFormatInternal(virDomainDefPtr def,
2721
                               virCapsPtr caps,
2722 2723
                               unsigned int flags,
                               virBufferPtr buf);
2724

2725 2726 2727 2728
int virDomainDiskSourceFormat(virBufferPtr buf,
                              virStorageSourcePtr src,
                              int policy,
                              unsigned int flags);
2729

2730 2731
int virDomainNetDefFormat(virBufferPtr buf,
                          virDomainNetDefPtr def,
2732
                          char *prefix,
2733 2734
                          unsigned int flags);

2735 2736 2737 2738 2739 2740
typedef enum {
    VIR_DOMAIN_DEVICE_ACTION_ATTACH,
    VIR_DOMAIN_DEVICE_ACTION_DETACH,
    VIR_DOMAIN_DEVICE_ACTION_UPDATE,
} virDomainDeviceAction;

2741
int virDomainDefCompatibleDevice(virDomainDefPtr def,
2742 2743
                                 virDomainDeviceDefPtr dev,
                                 virDomainDeviceAction action);
2744

2745 2746
void virDomainRNGDefFree(virDomainRNGDefPtr def);

2747 2748 2749 2750
int virDomainDiskIndexByAddress(virDomainDefPtr def,
                                virDevicePCIAddressPtr pci_controller,
                                unsigned int bus, unsigned int target,
                                unsigned int unit);
2751 2752 2753 2754 2755
virDomainDiskDefPtr virDomainDiskByAddress(virDomainDefPtr def,
                                           virDevicePCIAddressPtr pci_controller,
                                           unsigned int bus,
                                           unsigned int target,
                                           unsigned int unit);
2756 2757
int virDomainDiskIndexByName(virDomainDefPtr def, const char *name,
                             bool allow_ambiguous);
2758 2759 2760
virDomainDiskDefPtr virDomainDiskByName(virDomainDefPtr def,
                                        const char *name,
                                        bool allow_ambiguous);
2761
const char *virDomainDiskPathByName(virDomainDefPtr, const char *name);
2762
int virDomainDiskInsert(virDomainDefPtr def,
2763 2764
                        virDomainDiskDefPtr disk)
    ATTRIBUTE_RETURN_CHECK;
2765 2766
void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
                                   virDomainDiskDefPtr disk);
2767
int virDomainDiskDefAssignAddress(virDomainXMLOptionPtr xmlopt,
2768 2769
                                  virDomainDiskDefPtr def,
                                  const virDomainDef *vmdef);
2770

2771 2772 2773 2774
virDomainDiskDefPtr
virDomainDiskRemove(virDomainDefPtr def, size_t i);
virDomainDiskDefPtr
virDomainDiskRemoveByName(virDomainDefPtr def, const char *name);
2775
int virDomainDiskSourceParse(xmlNodePtr node,
2776
                             xmlXPathContextPtr ctxt,
2777
                             virStorageSourcePtr src);
2778

2779 2780
int virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net);
virDomainNetDefPtr virDomainNetFind(virDomainDefPtr def, const char *device);
2781
bool virDomainHasNet(virDomainDefPtr def, virDomainNetDefPtr net);
2782
int virDomainNetInsert(virDomainDefPtr def, virDomainNetDefPtr net);
2783
virDomainNetDefPtr virDomainNetRemove(virDomainDefPtr def, size_t i);
2784
void virDomainNetRemoveHostdev(virDomainDefPtr def, virDomainNetDefPtr net);
2785

L
Laine Stump 已提交
2786
int virDomainHostdevInsert(virDomainDefPtr def, virDomainHostdevDefPtr hostdev);
2787 2788
virDomainHostdevDefPtr
virDomainHostdevRemove(virDomainDefPtr def, size_t i);
L
Laine Stump 已提交
2789 2790 2791
int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
                         virDomainHostdevDefPtr *found);

2792
int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
2793
            ATTRIBUTE_NONNULL(1);
2794
int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t i, int val)
2795 2796
            ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
2797
                                              size_t i)
2798 2799
            ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
2800
                                      size_t i, const char *address,
2801 2802 2803
                                      int len, bool setType)
            ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
2804
                                              size_t i)
2805 2806
            ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
2807
                                      size_t i, const char *network, int len)
2808 2809
            ATTRIBUTE_NONNULL(1);

2810
int virDomainNetGetActualType(virDomainNetDefPtr iface);
2811
const char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface);
2812
int virDomainNetGetActualBridgeMACTableManager(virDomainNetDefPtr iface);
2813
const char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface);
2814
int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface);
2815
virDomainHostdevDefPtr virDomainNetGetActualHostdev(virDomainNetDefPtr iface);
2816
virNetDevVPortProfilePtr
2817
virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface);
2818
virNetDevBandwidthPtr
2819
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
2820
virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface);
2821
bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
2822 2823 2824 2825
int virDomainNetAppendIpAddress(virDomainNetDefPtr def,
                                const char *address,
                                int family,
                                unsigned int prefix);
2826

2827
int virDomainControllerInsert(virDomainDefPtr def,
2828 2829
                              virDomainControllerDefPtr controller)
    ATTRIBUTE_RETURN_CHECK;
2830 2831
void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
                                         virDomainControllerDefPtr controller);
2832
int virDomainControllerFind(virDomainDefPtr def, int type, int idx);
2833
int virDomainControllerFindByType(virDomainDefPtr def, int type);
2834 2835
int virDomainControllerFindByPCIAddress(virDomainDefPtr def,
                                        virDevicePCIAddressPtr addr);
2836
virDomainControllerDefPtr virDomainControllerRemove(virDomainDefPtr def, size_t i);
2837 2838 2839
const char *virDomainControllerAliasFind(virDomainDefPtr def,
                                         int type, int idx)
    ATTRIBUTE_NONNULL(1);
2840 2841 2842 2843 2844

int virDomainLeaseIndex(virDomainDefPtr def,
                        virDomainLeaseDefPtr lease);
int virDomainLeaseInsert(virDomainDefPtr def,
                         virDomainLeaseDefPtr lease);
2845 2846
int virDomainLeaseInsertPreAlloc(virDomainDefPtr def)
    ATTRIBUTE_RETURN_CHECK;
2847 2848
void virDomainLeaseInsertPreAlloced(virDomainDefPtr def,
                                    virDomainLeaseDefPtr lease);
2849 2850 2851 2852 2853
virDomainLeaseDefPtr
virDomainLeaseRemoveAt(virDomainDefPtr def, size_t i);
virDomainLeaseDefPtr
virDomainLeaseRemove(virDomainDefPtr def,
                     virDomainLeaseDefPtr lease);
2854

2855
void
2856
virDomainChrGetDomainPtrs(const virDomainDef *vmdef,
2857
                          virDomainChrDeviceType type,
2858 2859 2860
                          const virDomainChrDef ***arrPtr,
                          size_t *cntPtr)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
2861 2862 2863
virDomainChrDefPtr
virDomainChrFind(virDomainDefPtr def,
                 virDomainChrDefPtr target);
2864 2865 2866
bool
virDomainChrEquals(virDomainChrDefPtr src,
                   virDomainChrDefPtr tgt);
2867
int
2868 2869 2870 2871 2872
virDomainChrPreAlloc(virDomainDefPtr vmdef,
                     virDomainChrDefPtr chr);
void
virDomainChrInsertPreAlloced(virDomainDefPtr vmdef,
                             virDomainChrDefPtr chr);
2873 2874 2875 2876
virDomainChrDefPtr
virDomainChrRemove(virDomainDefPtr vmdef,
                   virDomainChrDefPtr chr);

2877 2878 2879 2880 2881 2882
int virDomainRNGInsert(virDomainDefPtr def,
                       virDomainRNGDefPtr rng,
                       bool inplace);
ssize_t virDomainRNGFind(virDomainDefPtr def, virDomainRNGDefPtr rng);
virDomainRNGDefPtr virDomainRNGRemove(virDomainDefPtr def, size_t idx);

2883
int virDomainSaveXML(const char *configDir,
2884 2885 2886
                     virDomainDefPtr def,
                     const char *xml);

2887
int virDomainSaveConfig(const char *configDir,
2888
                        virCapsPtr caps,
2889
                        virDomainDefPtr def);
2890
int virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
2891
                        const char *statusDir,
2892 2893
                        virDomainObjPtr obj,
                        virCapsPtr caps) ATTRIBUTE_RETURN_CHECK;
2894

2895 2896 2897 2898
typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
                                          int newDomain,
                                          void *opaque);

2899
int virDomainDeleteConfig(const char *configDir,
2900
                          const char *autostartDir,
2901 2902
                          virDomainObjPtr dom);

2903
char *virDomainConfigFile(const char *dir,
2904 2905
                          const char *name);

2906 2907 2908 2909
int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
                                int *busIdx,
                                int *devIdx);

2910
virDomainFSDefPtr virDomainGetFilesystemForTarget(virDomainDefPtr def,
2911
                                                  const char *target);
2912
int virDomainFSInsert(virDomainDefPtr def, virDomainFSDefPtr fs);
2913
int virDomainFSIndexByName(virDomainDefPtr def, const char *name);
2914 2915
virDomainFSDefPtr virDomainFSRemove(virDomainDefPtr def, size_t i);

2916
int virDomainVideoDefaultType(const virDomainDef *def);
2917 2918
unsigned int virDomainVideoDefaultRAM(const virDomainDef *def,
                                      const virDomainVideoType type);
2919

E
Eric Blake 已提交
2920 2921 2922 2923 2924 2925 2926 2927 2928
typedef int (*virDomainSmartcardDefIterator)(virDomainDefPtr def,
                                             virDomainSmartcardDefPtr dev,
                                             void *opaque);

int virDomainSmartcardDefForeach(virDomainDefPtr def,
                                 bool abortOnError,
                                 virDomainSmartcardDefIterator iter,
                                 void *opaque);

2929 2930 2931 2932 2933 2934 2935 2936 2937
typedef int (*virDomainChrDefIterator)(virDomainDefPtr def,
                                       virDomainChrDefPtr dev,
                                       void *opaque);

int virDomainChrDefForeach(virDomainDefPtr def,
                           bool abortOnError,
                           virDomainChrDefIterator iter,
                           void *opaque);

2938 2939 2940 2941 2942 2943 2944 2945 2946 2947
typedef int (*virDomainDiskDefPathIterator)(virDomainDiskDefPtr disk,
                                            const char *path,
                                            size_t depth,
                                            void *opaque);

int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
                                bool ignoreOpenFailure,
                                virDomainDiskDefPathIterator iter,
                                void *opaque);

J
Jiri Denemark 已提交
2948 2949 2950 2951 2952 2953 2954
void
virDomainObjSetState(virDomainObjPtr obj, virDomainState state, int reason)
        ATTRIBUTE_NONNULL(1);
virDomainState
virDomainObjGetState(virDomainObjPtr obj, int *reason)
        ATTRIBUTE_NONNULL(1);

2955 2956 2957
virSecurityLabelDefPtr
virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model);

2958 2959 2960
virSecurityDeviceLabelDefPtr
virDomainChrDefGetSecurityLabelDef(virDomainChrDefPtr def, const char *model);

2961 2962
typedef const char* (*virEventActionToStringFunc)(int type);
typedef int (*virEventActionFromStringFunc)(const char *type);
2963

2964 2965 2966 2967 2968 2969 2970 2971 2972 2973
int virDomainMemoryInsert(virDomainDefPtr def, virDomainMemoryDefPtr mem)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
virDomainMemoryDefPtr virDomainMemoryRemove(virDomainDefPtr def, int idx)
    ATTRIBUTE_NONNULL(1);
int virDomainMemoryFindByDef(virDomainDefPtr def, virDomainMemoryDefPtr mem)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int virDomainMemoryFindInactiveByDef(virDomainDefPtr def,
                                     virDomainMemoryDefPtr mem)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

2974
VIR_ENUM_DECL(virDomainTaint)
2975 2976 2977
VIR_ENUM_DECL(virDomainVirt)
VIR_ENUM_DECL(virDomainBoot)
VIR_ENUM_DECL(virDomainFeature)
2978 2979
VIR_ENUM_DECL(virDomainCapabilitiesPolicy)
VIR_ENUM_DECL(virDomainCapsFeature)
2980
VIR_ENUM_DECL(virDomainLifecycle)
2981
VIR_ENUM_DECL(virDomainLifecycleCrash)
2982
VIR_ENUM_DECL(virDomainDevice)
2983
VIR_ENUM_DECL(virDomainDeviceAddress)
2984
VIR_ENUM_DECL(virDomainDiskDevice)
J
J.B. Joret 已提交
2985
VIR_ENUM_DECL(virDomainDiskGeometryTrans)
2986
VIR_ENUM_DECL(virDomainDiskBus)
2987
VIR_ENUM_DECL(virDomainDiskCache)
2988
VIR_ENUM_DECL(virDomainDiskErrorPolicy)
M
Matthias Dahl 已提交
2989
VIR_ENUM_DECL(virDomainDiskIo)
2990
VIR_ENUM_DECL(virDomainDeviceSGIO)
2991
VIR_ENUM_DECL(virDomainDiskTray)
O
Osier Yang 已提交
2992
VIR_ENUM_DECL(virDomainDiskDiscard)
2993
VIR_ENUM_DECL(virDomainDiskMirrorState)
2994
VIR_ENUM_DECL(virDomainController)
J
Ján Tomko 已提交
2995
VIR_ENUM_DECL(virDomainControllerModelPCI)
2996
VIR_ENUM_DECL(virDomainControllerPCIModelName)
2997
VIR_ENUM_DECL(virDomainControllerModelSCSI)
M
Marc-André Lureau 已提交
2998
VIR_ENUM_DECL(virDomainControllerModelUSB)
2999
VIR_ENUM_DECL(virDomainFS)
3000
VIR_ENUM_DECL(virDomainFSDriver)
3001
VIR_ENUM_DECL(virDomainFSAccessMode)
3002
VIR_ENUM_DECL(virDomainFSWrpolicy)
3003
VIR_ENUM_DECL(virDomainNet)
3004
VIR_ENUM_DECL(virDomainNetBackend)
3005
VIR_ENUM_DECL(virDomainNetVirtioTxMode)
3006
VIR_ENUM_DECL(virDomainNetInterfaceLinkState)
3007
VIR_ENUM_DECL(virDomainChrDevice)
3008
VIR_ENUM_DECL(virDomainChrChannelTarget)
3009
VIR_ENUM_DECL(virDomainChrConsoleTarget)
G
Guannan Ren 已提交
3010
VIR_ENUM_DECL(virDomainChrSerialTarget)
E
Eric Blake 已提交
3011
VIR_ENUM_DECL(virDomainSmartcard)
3012
VIR_ENUM_DECL(virDomainChr)
3013
VIR_ENUM_DECL(virDomainChrTcpProtocol)
E
Eric Blake 已提交
3014
VIR_ENUM_DECL(virDomainChrSpicevmc)
3015
VIR_ENUM_DECL(virDomainSoundCodec)
3016
VIR_ENUM_DECL(virDomainSoundModel)
3017
VIR_ENUM_DECL(virDomainKeyWrapCipherName)
3018
VIR_ENUM_DECL(virDomainMemballoonModel)
3019
VIR_ENUM_DECL(virDomainSmbiosMode)
R
Richard Jones 已提交
3020 3021
VIR_ENUM_DECL(virDomainWatchdogModel)
VIR_ENUM_DECL(virDomainWatchdogAction)
3022
VIR_ENUM_DECL(virDomainPanicModel)
3023
VIR_ENUM_DECL(virDomainVideo)
3024 3025
VIR_ENUM_DECL(virDomainHostdevMode)
VIR_ENUM_DECL(virDomainHostdevSubsys)
3026
VIR_ENUM_DECL(virDomainHostdevCaps)
M
Marc-André Lureau 已提交
3027
VIR_ENUM_DECL(virDomainHub)
3028
VIR_ENUM_DECL(virDomainRedirdevBus)
3029 3030 3031
VIR_ENUM_DECL(virDomainInput)
VIR_ENUM_DECL(virDomainInputBus)
VIR_ENUM_DECL(virDomainGraphics)
3032
VIR_ENUM_DECL(virDomainGraphicsListen)
3033
VIR_ENUM_DECL(virDomainGraphicsAuthConnected)
3034 3035
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelName)
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelMode)
3036 3037 3038
VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceJpegCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
3039
VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
P
Peng Zhou 已提交
3040
VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode)
3041
VIR_ENUM_DECL(virDomainGraphicsVNCSharePolicy)
3042
VIR_ENUM_DECL(virDomainHyperv)
3043
VIR_ENUM_DECL(virDomainKVM)
3044 3045
VIR_ENUM_DECL(virDomainRNGModel)
VIR_ENUM_DECL(virDomainRNGBackend)
3046 3047
VIR_ENUM_DECL(virDomainTPMModel)
VIR_ENUM_DECL(virDomainTPMBackend)
3048 3049
VIR_ENUM_DECL(virDomainMemoryModel)
VIR_ENUM_DECL(virDomainMemoryBackingModel)
3050 3051
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState)
J
Jiri Denemark 已提交
3052 3053 3054 3055 3056 3057 3058
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)
3059
VIR_ENUM_DECL(virDomainPMSuspendedReason)
J
Jiri Denemark 已提交
3060 3061 3062 3063

const char *virDomainStateReasonToString(virDomainState state, int reason);
int virDomainStateReasonFromString(virDomainState state, const char *reason);

3064
VIR_ENUM_DECL(virDomainSeclabel)
3065
VIR_ENUM_DECL(virDomainClockOffset)
3066
VIR_ENUM_DECL(virDomainClockBasis)
3067

3068
VIR_ENUM_DECL(virDomainTimerName)
3069
VIR_ENUM_DECL(virDomainTimerTrack)
3070 3071
VIR_ENUM_DECL(virDomainTimerTickpolicy)
VIR_ENUM_DECL(virDomainTimerMode)
O
Osier Yang 已提交
3072
VIR_ENUM_DECL(virDomainCpuPlacementMode)
3073

3074
VIR_ENUM_DECL(virDomainStartupPolicy)
3075

3076 3077
int
virDomainDefAddUSBController(virDomainDefPtr def, int idx, int model);
3078 3079 3080 3081 3082
int
virDomainDefMaybeAddController(virDomainDefPtr def,
                               int type,
                               int idx,
                               int model);
3083 3084 3085 3086
int
virDomainDefMaybeAddInput(virDomainDefPtr def,
                          int type,
                          int bus);
3087

3088 3089
char *virDomainDefGetDefaultEmulator(virDomainDefPtr def, virCapsPtr caps);

3090 3091
int virDomainDefFindDevice(virDomainDefPtr def,
                           const char *devAlias,
3092 3093
                           virDomainDeviceDefPtr dev,
                           bool reportError);
3094

3095
bool virDomainDiskSourceIsBlockType(virStorageSourcePtr src, bool report)
3096 3097
    ATTRIBUTE_NONNULL(1);

3098 3099
void virDomainChrSourceDefClear(virDomainChrSourceDefPtr def);

3100 3101 3102 3103 3104 3105 3106
char *virDomainObjGetMetadata(virDomainObjPtr vm,
                              int type,
                              const char *uri,
                              virCapsPtr caps,
                              virDomainXMLOptionPtr xmlopt,
                              unsigned int flags);

3107 3108 3109 3110 3111 3112 3113
int virDomainObjSetMetadata(virDomainObjPtr vm,
                            int type,
                            const char *metadata,
                            const char *key,
                            const char *uri,
                            virCapsPtr caps,
                            virDomainXMLOptionPtr xmlopt,
3114
                            const char *stateDir,
3115 3116 3117
                            const char *configDir,
                            unsigned int flags);

3118 3119 3120 3121 3122 3123 3124 3125
int
virDomainParseMemory(const char *xpath,
                     const char *units_xpath,
                     xmlXPathContextPtr ctxt,
                     unsigned long long *mem,
                     bool required,
                     bool capped);

3126 3127 3128
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

3129 3130 3131
int virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
                                       virDomainDiskDefPtr b)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
3132
int virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
3133 3134
    ATTRIBUTE_NONNULL(1);

3135
#endif /* __DOMAIN_CONF_H */