domain_conf.h 83.8 KB
Newer Older
1 2 3
/*
 * domain_conf.h: domain XML processing
 *
4
 * Copyright (C) 2006-2013 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16 17
 * Copyright (C) 2006-2008 Daniel P. Berrange
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library.  If not, see
O
Osier Yang 已提交
19
 * <http://www.gnu.org/licenses/>.
20 21 22 23 24
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#ifndef __DOMAIN_CONF_H
25
# define __DOMAIN_CONF_H
26

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

31 32 33 34
# include "internal.h"
# include "capabilities.h"
# include "storage_encryption_conf.h"
# include "cpu_conf.h"
35
# include "virthread.h"
36
# include "virhash.h"
37
# include "virsocketaddr.h"
38
# include "nwfilter_params.h"
39
# include "virnetdevmacvlan.h"
40
# include "virsysinfo.h"
41
# include "virnetdevvportprofile.h"
A
Ansis Atteka 已提交
42
# include "virnetdevopenvswitch.h"
43
# include "virnetdevbandwidth.h"
44
# include "virnetdevvlan.h"
45
# include "virobject.h"
46
# include "device_conf.h"
47
# include "virbitmap.h"
48
# include "virstoragefile.h"
G
Gao feng 已提交
49
# include "virnuma.h"
50

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
/* 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;

72 73 74
typedef struct _virDomainSoundCodecDef virDomainSoundCodecDef;
typedef virDomainSoundCodecDef *virDomainSoundCodecDefPtr;

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
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;

96 97 98 99 100 101
typedef struct _virDomainRedirFilterUsbDevDef virDomainRedirFilterUsbDevDef;
typedef virDomainRedirFilterUsbDevDef *virDomainRedirFilterUsbDevDefPtr;

typedef struct _virDomainRedirFilterDef virDomainRedirFilterDef;
typedef virDomainRedirFilterDef *virDomainRedirFilterDefPtr;

102 103 104 105 106 107 108 109 110
typedef struct _virDomainSmartcardDef virDomainSmartcardDef;
typedef virDomainSmartcardDef *virDomainSmartcardDefPtr;

typedef struct _virDomainChrDef virDomainChrDef;
typedef virDomainChrDef *virDomainChrDefPtr;

typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;

L
Li Zhang 已提交
111 112 113
typedef struct _virDomainNVRAMDef virDomainNVRAMDef;
typedef virDomainNVRAMDef *virDomainNVRAMDefPtr;

114 115 116 117 118 119
typedef struct _virDomainSnapshotObj virDomainSnapshotObj;
typedef virDomainSnapshotObj *virDomainSnapshotObjPtr;

typedef struct _virDomainSnapshotObjList virDomainSnapshotObjList;
typedef virDomainSnapshotObjList *virDomainSnapshotObjListPtr;

120 121 122
typedef struct _virDomainRNGDef virDomainRNGDef;
typedef virDomainRNGDef *virDomainRNGDefPtr;

123 124 125 126 127 128
typedef struct _virDomainIdMapEntry virDomainIdMapEntry;
typedef virDomainIdMapEntry *virDomainIdMapEntryPtr;

typedef struct _virDomainIdMapDef virDomainIdMapDef;
typedef virDomainIdMapDef *virDomainIdMapDefPtr;

129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
/* 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 已提交
148
    VIR_DOMAIN_DEVICE_NVRAM,
149
    VIR_DOMAIN_DEVICE_RNG,
150

151
    VIR_DOMAIN_DEVICE_LAST
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
} 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 已提交
175
        virDomainNVRAMDefPtr nvram;
176
        virDomainRNGDefPtr rng;
177 178 179
    } data;
};

180 181 182 183 184 185 186 187 188 189 190 191 192
/* Different types of hypervisor */
/* NB: Keep in sync with virDomainVirtTypeToString impl */
enum virDomainVirtType {
    VIR_DOMAIN_VIRT_QEMU,
    VIR_DOMAIN_VIRT_KQEMU,
    VIR_DOMAIN_VIRT_KVM,
    VIR_DOMAIN_VIRT_XEN,
    VIR_DOMAIN_VIRT_LXC,
    VIR_DOMAIN_VIRT_UML,
    VIR_DOMAIN_VIRT_OPENVZ,
    VIR_DOMAIN_VIRT_TEST,
    VIR_DOMAIN_VIRT_VMWARE,
    VIR_DOMAIN_VIRT_HYPERV,
193
    VIR_DOMAIN_VIRT_VBOX,
194
    VIR_DOMAIN_VIRT_PHYP,
D
Dmitry Guryanov 已提交
195
    VIR_DOMAIN_VIRT_PARALLELS,
196

197
    VIR_DOMAIN_VIRT_LAST
198 199
};

200 201 202
enum virDomainDeviceAddressType {
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
203
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE,
204
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL,
E
Eric Blake 已提交
205
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID,
206
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB,
207
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
208
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
209
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
210 211 212 213

    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
};

214 215 216 217 218 219 220 221
enum virDomainPciRombarMode {
    VIR_DOMAIN_PCI_ROMBAR_DEFAULT = 0,
    VIR_DOMAIN_PCI_ROMBAR_ON,
    VIR_DOMAIN_PCI_ROMBAR_OFF,

    VIR_DOMAIN_PCI_ROMBAR_LAST
};

222 223 224 225 226
typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
struct _virDomainDeviceDriveAddress {
    unsigned int controller;
    unsigned int bus;
227
    unsigned int target;
228 229 230
    unsigned int unit;
};

231 232 233 234 235
typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress;
typedef virDomainDeviceVirtioSerialAddress *virDomainDeviceVirtioSerialAddressPtr;
struct _virDomainDeviceVirtioSerialAddress {
    unsigned int controller;
    unsigned int bus;
236
    unsigned int port;
237 238
};

239 240 241 242 243 244 245 246 247 248 249 250 251
# 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 已提交
252 253 254 255 256 257 258
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
typedef virDomainDeviceCcidAddress *virDomainDeviceCcidAddressPtr;
struct _virDomainDeviceCcidAddress {
    unsigned int controller;
    unsigned int slot;
};

259 260 261 262
typedef struct _virDomainDeviceUSBAddress virDomainDeviceUSBAddress;
typedef virDomainDeviceUSBAddress *virDomainDeviceUSBAddressPtr;
struct _virDomainDeviceUSBAddress {
    unsigned int bus;
263
    char *port;
264 265
};

266 267 268 269 270 271 272
typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress;
typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr;
struct _virDomainDeviceSpaprVioAddress {
    unsigned long long reg;
    bool has_reg;
};

273 274 275 276 277 278 279 280 281 282 283 284 285
enum virDomainControllerMaster {
    VIR_DOMAIN_CONTROLLER_MASTER_NONE,
    VIR_DOMAIN_CONTROLLER_MASTER_USB,

    VIR_DOMAIN_CONTROLLER_MASTER_LAST
};

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

286 287 288
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
struct _virDomainDeviceInfo {
289 290 291 292
    /* If adding to this struct, ensure that
     * virDomainDeviceInfoIsSet() is updated
     * to consider the new fields
     */
D
Daniel P. Berrange 已提交
293
    char *alias;
294 295
    int type;
    union {
296
        virDevicePCIAddress pci;
297
        virDomainDeviceDriveAddress drive;
298
        virDomainDeviceVirtioSerialAddress vioserial;
E
Eric Blake 已提交
299
        virDomainDeviceCcidAddress ccid;
300
        virDomainDeviceUSBAddress usb;
301
        virDomainDeviceSpaprVioAddress spaprvio;
302
        virDomainDeviceCCWAddress ccw;
303
    } addr;
304 305 306 307
    int mastertype;
    union {
        virDomainDeviceUSBMaster usb;
    } master;
308 309
    /* rombar and romfile are only used for pci hostdev and network
     * devices. */
310
    int rombar;         /* enum virDomainPciRombarMode */
311
    char *romfile;
312 313
    /* bootIndex is only used for disk, network interface, hostdev
     * and redirdev devices */
314
    int bootIndex;
315 316
};

E
Eric Blake 已提交
317
enum virDomainSeclabelType {
318 319
    VIR_DOMAIN_SECLABEL_DEFAULT,
    VIR_DOMAIN_SECLABEL_NONE,
E
Eric Blake 已提交
320 321 322
    VIR_DOMAIN_SECLABEL_DYNAMIC,
    VIR_DOMAIN_SECLABEL_STATIC,

323
    VIR_DOMAIN_SECLABEL_LAST
E
Eric Blake 已提交
324 325 326 327 328 329 330 331 332 333 334 335
};

/* Security configuration for domain */
typedef struct _virSecurityLabelDef virSecurityLabelDef;
typedef virSecurityLabelDef *virSecurityLabelDefPtr;
struct _virSecurityLabelDef {
    char *model;        /* name of security model */
    char *label;        /* security label string */
    char *imagelabel;   /* security image label string */
    char *baselabel;    /* base name of label string */
    int type;           /* virDomainSeclabelType */
    bool norelabel;
336
    bool implicit;      /* true if seclabel is auto-added */
E
Eric Blake 已提交
337 338
};

339 340 341 342 343

/* Security configuration for domain */
typedef struct _virSecurityDeviceLabelDef virSecurityDeviceLabelDef;
typedef virSecurityDeviceLabelDef *virSecurityDeviceLabelDefPtr;
struct _virSecurityDeviceLabelDef {
344
    char *model;
345
    char *label;        /* image label string */
346 347
    bool norelabel;     /* true to skip label attempts */
    bool labelskip;     /* live-only; true if skipping failed label attempt */
348 349 350
};


351 352 353 354 355 356 357 358
typedef struct _virDomainHostdevOrigStates virDomainHostdevOrigStates;
typedef virDomainHostdevOrigStates *virDomainHostdevOrigStatesPtr;
struct _virDomainHostdevOrigStates {
    union {
        struct {
            /* Does the device need to unbind from stub when
             * reattaching to host?
             */
359
            bool unbind_from_stub;
360 361 362 363

            /* Does it need to use remove_slot when reattaching
             * the device to host?
             */
364
            bool remove_slot;
365 366 367 368

            /* Does it need to reprobe driver for the device when
             * reattaching to host?
             */
369
            bool reprobe;
370 371 372 373 374 375
        } pci;

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

376 377 378 379 380 381 382
struct _virDomainLeaseDef {
    char *lockspace;
    char *key;
    char *path;
    unsigned long long offset;
};

383

384 385 386 387
enum virDomainHostdevMode {
    VIR_DOMAIN_HOSTDEV_MODE_SUBSYS,
    VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES,

388
    VIR_DOMAIN_HOSTDEV_MODE_LAST
389 390 391 392 393
};

enum virDomainHostdevSubsysType {
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
H
Han Cheng 已提交
394
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI,
395 396 397 398

    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
};

399 400
/* the backend driver used for PCI hostdev devices */
typedef enum {
401 402 403
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* currently kvm, could change */
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM,    /* force legacy kvm style */
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO,   /* force vfio */
404 405 406 407 408

    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST
} virDomainHostdevSubsysPciBackendType;

VIR_ENUM_DECL(virDomainHostdevSubsysPciBackend)
409 410 411 412

typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
typedef virDomainHostdevSubsys *virDomainHostdevSubsysPtr;
struct _virDomainHostdevSubsys {
413
    int type; /* enum virDomainHostdevSubsysType */
414 415
    union {
        struct {
416 417
            bool autoAddress; /* bus/device were filled automatically based
                                 on vedor/product */
418 419 420 421 422 423
            unsigned bus;
            unsigned device;

            unsigned vendor;
            unsigned product;
        } usb;
424 425
        struct {
            virDevicePCIAddress addr; /* host address */
426
            int backend; /* enum virDomainHostdevSubsysPciBackendType */
427
        } pci;
H
Han Cheng 已提交
428 429 430 431 432
        struct {
            char *adapter;
            unsigned bus;
            unsigned target;
            unsigned unit;
O
Osier Yang 已提交
433
            int sgio; /* enum virDomainDeviceSGIO */
H
Han Cheng 已提交
434
        } scsi;
435 436 437
    } u;
};

438 439 440 441

enum virDomainHostdevCapsType {
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE,
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC,
442
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET,
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457

    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST
};

typedef struct _virDomainHostdevCaps virDomainHostdevCaps;
typedef virDomainHostdevCaps *virDomainHostdevCapsPtr;
struct _virDomainHostdevCaps {
    int type; /* enum virDOmainHostdevCapsType */
    union {
        struct {
            char *block;
        } storage;
        struct {
            char *chardev;
        } misc;
458 459 460
        struct {
            char *iface;
        } net;
461 462 463 464
    } u;
};


465 466
/* basic device for direct passthrough */
struct _virDomainHostdevDef {
467
    virDomainDeviceDef parent; /* higher level Def containing this */
468
    int mode; /* enum virDomainHostdevMode */
469
    int startupPolicy; /* enum virDomainStartupPolicy */
470
    bool managed;
471
    bool missing;
O
Osier Yang 已提交
472
    bool readonly;
473
    bool shareable;
474
    union {
475
        virDomainHostdevSubsys subsys;
476
        virDomainHostdevCaps caps;
477 478
    } source;
    virDomainHostdevOrigStates origstates;
479
    virDomainDeviceInfoPtr info; /* Guest address */
480 481
};

482 483 484 485
/* Two types of disk backends */
enum virDomainDiskType {
    VIR_DOMAIN_DISK_TYPE_BLOCK,
    VIR_DOMAIN_DISK_TYPE_FILE,
486
    VIR_DOMAIN_DISK_TYPE_DIR,
M
MORITA Kazutaka 已提交
487
    VIR_DOMAIN_DISK_TYPE_NETWORK,
488
    VIR_DOMAIN_DISK_TYPE_VOLUME,
489 490 491 492 493 494 495 496 497

    VIR_DOMAIN_DISK_TYPE_LAST
};

/* Three types of disk frontend */
enum virDomainDiskDevice {
    VIR_DOMAIN_DISK_DEVICE_DISK,
    VIR_DOMAIN_DISK_DEVICE_CDROM,
    VIR_DOMAIN_DISK_DEVICE_FLOPPY,
498
    VIR_DOMAIN_DISK_DEVICE_LUN,
499 500 501 502 503 504 505 506 507 508

    VIR_DOMAIN_DISK_DEVICE_LAST
};

enum virDomainDiskBus {
    VIR_DOMAIN_DISK_BUS_IDE,
    VIR_DOMAIN_DISK_BUS_FDC,
    VIR_DOMAIN_DISK_BUS_SCSI,
    VIR_DOMAIN_DISK_BUS_VIRTIO,
    VIR_DOMAIN_DISK_BUS_XEN,
509
    VIR_DOMAIN_DISK_BUS_USB,
510
    VIR_DOMAIN_DISK_BUS_UML,
511
    VIR_DOMAIN_DISK_BUS_SATA,
512 513 514 515

    VIR_DOMAIN_DISK_BUS_LAST
};

516 517 518 519 520
enum  virDomainDiskCache {
    VIR_DOMAIN_DISK_CACHE_DEFAULT,
    VIR_DOMAIN_DISK_CACHE_DISABLE,
    VIR_DOMAIN_DISK_CACHE_WRITETHRU,
    VIR_DOMAIN_DISK_CACHE_WRITEBACK,
521
    VIR_DOMAIN_DISK_CACHE_DIRECTSYNC,
522
    VIR_DOMAIN_DISK_CACHE_UNSAFE,
523 524 525 526

    VIR_DOMAIN_DISK_CACHE_LAST
};

527 528 529
enum  virDomainDiskErrorPolicy {
    VIR_DOMAIN_DISK_ERROR_POLICY_DEFAULT,
    VIR_DOMAIN_DISK_ERROR_POLICY_STOP,
530
    VIR_DOMAIN_DISK_ERROR_POLICY_REPORT,
531
    VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE,
532
    VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE,
533 534 535 536

    VIR_DOMAIN_DISK_ERROR_POLICY_LAST
};

M
MORITA Kazutaka 已提交
537 538 539 540
enum virDomainDiskProtocol {
    VIR_DOMAIN_DISK_PROTOCOL_NBD,
    VIR_DOMAIN_DISK_PROTOCOL_RBD,
    VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG,
541
    VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
542
    VIR_DOMAIN_DISK_PROTOCOL_ISCSI,
543
    VIR_DOMAIN_DISK_PROTOCOL_HTTP,
544
    VIR_DOMAIN_DISK_PROTOCOL_FTP,
M
MORITA Kazutaka 已提交
545 546 547 548

    VIR_DOMAIN_DISK_PROTOCOL_LAST
};

549 550 551 552 553 554 555 556
enum virDomainDiskProtocolTransport {
    VIR_DOMAIN_DISK_PROTO_TRANS_TCP,
    VIR_DOMAIN_DISK_PROTO_TRANS_UNIX,
    VIR_DOMAIN_DISK_PROTO_TRANS_RDMA,

    VIR_DOMAIN_DISK_PROTO_TRANS_LAST
};

557 558 559 560 561 562 563
enum virDomainDiskTray {
    VIR_DOMAIN_DISK_TRAY_CLOSED,
    VIR_DOMAIN_DISK_TRAY_OPEN,

    VIR_DOMAIN_DISK_TRAY_LAST
};

J
J.B. Joret 已提交
564 565 566 567 568 569 570 571 572
enum  virDomainDiskGeometryTrans {
    VIR_DOMAIN_DISK_TRANS_DEFAULT = 0,
    VIR_DOMAIN_DISK_TRANS_NONE,
    VIR_DOMAIN_DISK_TRANS_AUTO,
    VIR_DOMAIN_DISK_TRANS_LBA,

    VIR_DOMAIN_DISK_TRANS_LAST
};

M
MORITA Kazutaka 已提交
573 574 575 576 577
typedef struct _virDomainDiskHostDef virDomainDiskHostDef;
typedef virDomainDiskHostDef *virDomainDiskHostDefPtr;
struct _virDomainDiskHostDef {
    char *name;
    char *port;
578 579
    int transport; /* enum virDomainDiskProtocolTransport */
    char *socket;  /* path to unix socket */
M
MORITA Kazutaka 已提交
580 581
};

M
Matthias Dahl 已提交
582 583 584 585 586 587 588 589
enum  virDomainDiskIo {
    VIR_DOMAIN_DISK_IO_DEFAULT,
    VIR_DOMAIN_DISK_IO_NATIVE,
    VIR_DOMAIN_DISK_IO_THREADS,

    VIR_DOMAIN_DISK_IO_LAST
};

590 591 592 593 594 595 596 597
enum virDomainIoEventFd {
    VIR_DOMAIN_IO_EVENT_FD_DEFAULT = 0,
    VIR_DOMAIN_IO_EVENT_FD_ON,
    VIR_DOMAIN_IO_EVENT_FD_OFF,

    VIR_DOMAIN_IO_EVENT_FD_LAST
};

598 599 600 601 602 603 604 605
enum virDomainVirtioEventIdx {
    VIR_DOMAIN_VIRTIO_EVENT_IDX_DEFAULT = 0,
    VIR_DOMAIN_VIRTIO_EVENT_IDX_ON,
    VIR_DOMAIN_VIRTIO_EVENT_IDX_OFF,

    VIR_DOMAIN_VIRTIO_EVENT_IDX_LAST
};

O
Osier Yang 已提交
606 607 608 609 610 611 612 613
enum virDomainDiskCopyOnRead {
    VIR_DOMAIN_DISK_COPY_ON_READ_DEFAULT = 0,
    VIR_DOMAIN_DISK_COPY_ON_READ_ON,
    VIR_DOMAIN_DISK_COPY_ON_READ_OFF,

    VIR_DOMAIN_DISK_COPY_ON_READ_LAST
};

614 615 616 617 618 619 620 621 622
enum virDomainStartupPolicy {
    VIR_DOMAIN_STARTUP_POLICY_DEFAULT = 0,
    VIR_DOMAIN_STARTUP_POLICY_MANDATORY,
    VIR_DOMAIN_STARTUP_POLICY_REQUISITE,
    VIR_DOMAIN_STARTUP_POLICY_OPTIONAL,

    VIR_DOMAIN_STARTUP_POLICY_LAST
};

623 624 625 626 627 628 629 630
enum virDomainDiskSecretType {
    VIR_DOMAIN_DISK_SECRET_TYPE_NONE,
    VIR_DOMAIN_DISK_SECRET_TYPE_UUID,
    VIR_DOMAIN_DISK_SECRET_TYPE_USAGE,

    VIR_DOMAIN_DISK_SECRET_TYPE_LAST
};

631 632 633 634
enum virDomainDeviceSGIO {
    VIR_DOMAIN_DEVICE_SGIO_DEFAULT = 0,
    VIR_DOMAIN_DEVICE_SGIO_FILTERED,
    VIR_DOMAIN_DEVICE_SGIO_UNFILTERED,
O
Osier Yang 已提交
635

636
    VIR_DOMAIN_DEVICE_SGIO_LAST
O
Osier Yang 已提交
637 638
};

O
Osier Yang 已提交
639 640
enum virDomainDiskDiscard {
    VIR_DOMAIN_DISK_DISCARD_DEFAULT = 0,
O
Osier Yang 已提交
641 642
    VIR_DOMAIN_DISK_DISCARD_UNMAP,
    VIR_DOMAIN_DISK_DISCARD_IGNORE,
O
Osier Yang 已提交
643 644 645 646

    VIR_DOMAIN_DISK_DISCARD_LAST
};

L
Lei Li 已提交
647 648 649 650 651 652 653 654 655 656 657
typedef struct _virDomainBlockIoTuneInfo virDomainBlockIoTuneInfo;
struct _virDomainBlockIoTuneInfo {
    unsigned long long total_bytes_sec;
    unsigned long long read_bytes_sec;
    unsigned long long write_bytes_sec;
    unsigned long long total_iops_sec;
    unsigned long long read_iops_sec;
    unsigned long long write_iops_sec;
};
typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;

658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
/*
 * Used for volume "type" disk to indicate how to represent
 * the disk source if the specified "pool" is of iscsi type.
 */
enum virDomainDiskSourcePoolMode {
    VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DEFAULT = 0,

    /* Use the path as it shows up on host, e.g.
     * /dev/disk/by-path/ip-$ip-iscsi-$iqn:iscsi.iscsi-pool0-lun-1
     */
    VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST,

    /* Use the URI from the storage pool source element host attribute. E.g.
     * file=iscsi://demo.org:6000/iqn.1992-01.com.example/1.
     */
    VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT,

    VIR_DOMAIN_DISK_SOURCE_POOL_MODE_LAST
};

678 679 680 681
typedef struct _virDomainDiskSourcePoolDef virDomainDiskSourcePoolDef;
struct _virDomainDiskSourcePoolDef {
    char *pool; /* pool name */
    char *volume; /* volume name */
682
    int voltype; /* enum virStorageVolType, internal only */
683
    int pooltype; /* enum virStoragePoolType, internal only */
684
    int mode; /* enum virDomainDiskSourcePoolMode */
685 686 687
};
typedef virDomainDiskSourcePoolDef *virDomainDiskSourcePoolDefPtr;

688 689 690 691 692 693 694
/* Stores the virtual disk configuration */
struct _virDomainDiskDef {
    int type;
    int device;
    int bus;
    char *src;
    char *dst;
695
    int tray_status;
M
MORITA Kazutaka 已提交
696
    int protocol;
697
    size_t nhosts;
M
MORITA Kazutaka 已提交
698
    virDomainDiskHostDefPtr hosts;
699
    virDomainDiskSourcePoolDefPtr srcpool;
700 701 702 703 704 705 706 707
    struct {
        char *username;
        int secretType; /* enum virDomainDiskSecretType */
        union {
            unsigned char uuid[VIR_UUID_BUFLEN];
            char *usage;
        } secret;
    } auth;
708
    char *driverName;
709
    int format; /* enum virStorageFileFormat */
710
    virStorageFileMetadataPtr backingChain;
L
Lei Li 已提交
711

712
    char *mirror;
713
    int mirrorFormat; /* enum virStorageFileFormat */
714 715
    bool mirroring;

J
J.B. Joret 已提交
716 717 718 719 720 721 722
    struct {
        unsigned int cylinders;
        unsigned int heads;
        unsigned int sectors;
        int trans;
    } geometry;

723 724 725
    struct {
        unsigned int logical_block_size;
        unsigned int physical_block_size;
V
Viktor Mihajlovski 已提交
726
    } blockio;
727

L
Lei Li 已提交
728 729
    virDomainBlockIoTuneInfo blkdeviotune;

730
    char *serial;
O
Osier Yang 已提交
731
    char *wwn;
732 733
    char *vendor;
    char *product;
734
    int cachemode;
735 736
    int error_policy;  /* enum virDomainDiskErrorPolicy */
    int rerror_policy; /* enum virDomainDiskErrorPolicy */
M
Matthias Dahl 已提交
737
    int iomode;
738
    int ioeventfd;
739
    int event_idx;
O
Osier Yang 已提交
740
    int copy_on_read;
E
Eric Blake 已提交
741
    int snapshot; /* enum virDomainSnapshotLocation, snapshot_conf.h */
742
    int startupPolicy; /* enum virDomainStartupPolicy */
743
    bool readonly;
744
    bool shared;
745
    bool transient;
746
    virDomainDeviceInfo info;
747
    virStorageEncryptionPtr encryption;
748 749
    bool rawio_specified;
    int rawio; /* no = 0, yes = 1 */
750
    int sgio; /* enum virDomainDeviceSGIO */
O
Osier Yang 已提交
751
    int discard; /* enum virDomainDiskDiscard */
752 753 754

    size_t nseclabels;
    virSecurityDeviceLabelDefPtr *seclabels;
755 756 757
};


758 759 760 761 762
enum virDomainControllerType {
    VIR_DOMAIN_CONTROLLER_TYPE_IDE,
    VIR_DOMAIN_CONTROLLER_TYPE_FDC,
    VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
    VIR_DOMAIN_CONTROLLER_TYPE_SATA,
763
    VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
E
Eric Blake 已提交
764
    VIR_DOMAIN_CONTROLLER_TYPE_CCID,
765
    VIR_DOMAIN_CONTROLLER_TYPE_USB,
J
Ján Tomko 已提交
766
    VIR_DOMAIN_CONTROLLER_TYPE_PCI,
767 768 769 770

    VIR_DOMAIN_CONTROLLER_TYPE_LAST
};

771

772
typedef enum {
J
Ján Tomko 已提交
773
    VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT,
L
Laine Stump 已提交
774
    VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT,
J
Ján Tomko 已提交
775
    VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE,
776
    VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE,
J
Ján Tomko 已提交
777 778

    VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST
779
} virDomainControllerModelPCI;
J
Ján Tomko 已提交
780

781 782 783 784 785 786
enum virDomainControllerModelSCSI {
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO,
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC,
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC,
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068,
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI,
787
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
788
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI,
789
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078,
790

791
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
792 793
};

M
Marc-André Lureau 已提交
794 795 796 797 798 799 800 801 802 803
enum virDomainControllerModelUSB {
    VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI,
    VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX4_UHCI,
    VIR_DOMAIN_CONTROLLER_MODEL_USB_EHCI,
    VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1,
    VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1,
    VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2,
    VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3,
    VIR_DOMAIN_CONTROLLER_MODEL_USB_VT82C686B_UHCI,
    VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI,
G
Gerd Hoffmann 已提交
804
    VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
805
    VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE,
M
Marc-André Lureau 已提交
806 807 808 809

    VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
};

810 811 812 813 814 815 816
typedef struct _virDomainVirtioSerialOpts virDomainVirtioSerialOpts;
typedef virDomainVirtioSerialOpts *virDomainVirtioSerialOptsPtr;
struct _virDomainVirtioSerialOpts {
    int ports;   /* -1 == undef */
    int vectors; /* -1 == undef */
};

817 818 819 820 821 822 823
typedef struct _virDomainPciControllerOpts virDomainPciControllerOpts;
typedef virDomainPciControllerOpts *virDomainPciControllerOptsPtr;
struct _virDomainPciControllerOpts {
    bool pcihole64;
    unsigned long pcihole64size;
};

824 825 826
/* Stores the virtual disk controller configuration */
struct _virDomainControllerDef {
    int type;
827
    unsigned int idx;
828
    int model; /* -1 == undef */
829
    unsigned int queues;
830 831
    union {
        virDomainVirtioSerialOpts vioserial;
832
        virDomainPciControllerOpts pciopts;
833
    } opts;
834 835 836 837
    virDomainDeviceInfo info;
};


838 839
/* Two types of disk backends */
enum virDomainFSType {
840 841 842 843 844 845
    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 */
846 847 848 849

    VIR_DOMAIN_FS_TYPE_LAST
};

850 851 852 853 854
/* Filesystem driver type */
enum virDomainFSDriverType {
    VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT = 0,
    VIR_DOMAIN_FS_DRIVER_TYPE_PATH,
    VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE,
855
    VIR_DOMAIN_FS_DRIVER_TYPE_LOOP,
856
    VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
857 858 859 860

    VIR_DOMAIN_FS_DRIVER_TYPE_LAST
};

861 862 863 864 865 866 867 868 869
/* Filesystem mount access mode  */
enum virDomainFSAccessMode {
    VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH,
    VIR_DOMAIN_FS_ACCESSMODE_MAPPED,
    VIR_DOMAIN_FS_ACCESSMODE_SQUASH,

    VIR_DOMAIN_FS_ACCESSMODE_LAST
};

870 871 872 873 874 875 876 877
/* Filesystem Write policy */
enum virDomainFSWrpolicy {
    VIR_DOMAIN_FS_WRPOLICY_DEFAULT = 0,
    VIR_DOMAIN_FS_WRPOLICY_IMMEDIATE,

    VIR_DOMAIN_FS_WRPOLICY_LAST
};

878 879 880
/* Allow 2 MB ram usage */
# define VIR_DOMAIN_FS_RAM_DEFAULT_USAGE (1024 * 2)

881 882
struct _virDomainFSDef {
    int type;
883 884
    int fsdriver; /* enum virDomainFSDriverType */
    int accessmode; /* enum virDomainFSAccessMode */
885
    int wrpolicy; /* enum virDomainFSWrpolicy */
886
    int format; /* enum virStorageFileFormat */
887
    unsigned long long usage;
888 889
    char *src;
    char *dst;
890
    bool readonly;
891
    virDomainDeviceInfo info;
892 893
    unsigned long long space_hard_limit; /* in bytes */
    unsigned long long space_soft_limit; /* in bytes */
894 895 896
};


897
/* network config types */
898 899 900 901 902 903 904 905
enum virDomainNetType {
    VIR_DOMAIN_NET_TYPE_USER,
    VIR_DOMAIN_NET_TYPE_ETHERNET,
    VIR_DOMAIN_NET_TYPE_SERVER,
    VIR_DOMAIN_NET_TYPE_CLIENT,
    VIR_DOMAIN_NET_TYPE_MCAST,
    VIR_DOMAIN_NET_TYPE_NETWORK,
    VIR_DOMAIN_NET_TYPE_BRIDGE,
D
Daniel Veillard 已提交
906
    VIR_DOMAIN_NET_TYPE_INTERNAL,
907
    VIR_DOMAIN_NET_TYPE_DIRECT,
908
    VIR_DOMAIN_NET_TYPE_HOSTDEV,
909

910
    VIR_DOMAIN_NET_TYPE_LAST
911 912
};

913 914 915 916 917 918
/* the backend driver used for virtio interfaces */
enum virDomainNetBackendType {
    VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT, /* prefer kernel, fall back to user */
    VIR_DOMAIN_NET_BACKEND_TYPE_QEMU,    /* userland */
    VIR_DOMAIN_NET_BACKEND_TYPE_VHOST,   /* kernel */

919
    VIR_DOMAIN_NET_BACKEND_TYPE_LAST
920
};
921

922 923 924 925 926 927
/* the TX algorithm used for virtio interfaces */
enum virDomainNetVirtioTxModeType {
    VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT, /* default for this version of qemu */
    VIR_DOMAIN_NET_VIRTIO_TX_MODE_IOTHREAD,
    VIR_DOMAIN_NET_VIRTIO_TX_MODE_TIMER,

928
    VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST
929 930
};

931 932 933 934 935 936 937 938 939
/* link interface states */
enum virDomainNetInterfaceLinkState {
        VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT = 0, /* Default link state (up) */
        VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP,          /* Link is up. ("cable" connected) */
        VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN ,       /* Link is down. ("cable" disconnected) */

        VIR_DOMAIN_NET_INTERFACE_LINK_STATE_LAST
};

940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956
/* Config that was actually used to bring up interface, after
 * resolving network reference. This is private data, only used within
 * libvirt, but still must maintain backward compatibility, because
 * different versions of libvirt may read the same data file.
 */
typedef struct _virDomainActualNetDef virDomainActualNetDef;
typedef virDomainActualNetDef *virDomainActualNetDefPtr;
struct _virDomainActualNetDef {
    int type; /* enum virDomainNetType */
    union {
        struct {
            char *brname;
        } bridge;
        struct {
            char *linkdev;
            int mode; /* enum virMacvtapMode from util/macvtap.h */
        } direct;
957 958 959
        struct {
            virDomainHostdevDef def;
        } hostdev;
960
    } data;
961
    virNetDevVPortProfilePtr virtPortProfile;
962
    virNetDevBandwidthPtr bandwidth;
963
    virNetDevVlan vlan;
964
    unsigned int class_id; /* class ID for bandwidth 'floor' */
965 966
};

967 968
/* Stores the virtual network interface configuration */
struct _virDomainNetDef {
S
Stefan Berger 已提交
969
    enum virDomainNetType type;
970
    virMacAddr mac;
971
    char *model;
972 973 974
    union {
        struct {
            enum virDomainNetBackendType name; /* which driver backend to use */
975
            enum virDomainNetVirtioTxModeType txmode;
976
            enum virDomainIoEventFd ioeventfd;
977
            enum virDomainVirtioEventIdx event_idx;
978
            unsigned int queues; /* Multiqueue virtio-net */
979 980
        } virtio;
    } driver;
981 982 983 984 985 986 987 988 989 990 991
    union {
        struct {
            char *dev;
            char *ipaddr;
        } ethernet;
        struct {
            char *address;
            int port;
        } socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */
        struct {
            char *name;
992 993 994 995 996 997 998 999 1000 1001
            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;
1002 1003 1004
        } network;
        struct {
            char *brname;
1005
            char *ipaddr;
1006
        } bridge;
D
Daniel Veillard 已提交
1007 1008 1009
        struct {
            char *name;
        } internal;
1010 1011
        struct {
            char *linkdev;
1012
            int mode; /* enum virMacvtapMode from util/macvtap.h */
1013
        } direct;
1014 1015 1016
        struct {
            virDomainHostdevDef def;
        } hostdev;
1017
    } data;
1018 1019
    /* virtPortProfile is used by network/bridge/direct/hostdev */
    virNetDevVPortProfilePtr virtPortProfile;
1020 1021 1022 1023
    struct {
        bool sndbuf_specified;
        unsigned long sndbuf;
    } tune;
1024
    char *script;
1025
    char *ifname;
1026
    virDomainDeviceInfo info;
1027 1028
    char *filter;
    virNWFilterHashTablePtr filterparams;
1029
    virNetDevBandwidthPtr bandwidth;
1030
    virNetDevVlan vlan;
1031
    int linkstate;
1032 1033
};

E
Eric Blake 已提交
1034 1035 1036 1037
/* 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"

1038
enum virDomainChrDeviceType {
1039
    VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL = 0,
1040 1041
    VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL,
    VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE,
1042
    VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL,
1043

1044
    VIR_DOMAIN_CHR_DEVICE_TYPE_LAST
1045 1046
};

G
Guannan Ren 已提交
1047 1048 1049 1050 1051 1052 1053
enum virDomainChrSerialTargetType {
    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA = 0,
    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB,

    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST
};

1054
enum virDomainChrChannelTargetType {
1055 1056
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE = 0,
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD,
1057 1058
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,

1059
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST
1060 1061
};

1062
enum virDomainChrConsoleTargetType {
1063 1064
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE  = 0,
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL,
1065 1066
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN,
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML,
C
Cole Robinson 已提交
1067
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO,
1068 1069
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC,
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_OPENVZ,
1070 1071
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP,
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM,
1072

1073
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST
1074 1075
};

1076
enum virDomainChrType {
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086
    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,
1087
    VIR_DOMAIN_CHR_TYPE_SPICEVMC,
1088

1089
    VIR_DOMAIN_CHR_TYPE_LAST
1090 1091 1092 1093 1094
};

enum virDomainChrTcpProtocol {
    VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW,
    VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET,
1095 1096
    VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNETS, /* secure telnet */
    VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS,
1097

1098
    VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST
1099 1100
};

E
Eric Blake 已提交
1101 1102 1103
enum virDomainChrSpicevmcName {
    VIR_DOMAIN_CHR_SPICEVMC_VDAGENT,
    VIR_DOMAIN_CHR_SPICEVMC_SMARTCARD,
1104
    VIR_DOMAIN_CHR_SPICEVMC_USBREDIR,
E
Eric Blake 已提交
1105

1106
    VIR_DOMAIN_CHR_SPICEVMC_LAST
E
Eric Blake 已提交
1107 1108
};

1109 1110 1111 1112 1113
/* The host side information for a character device.  */
typedef struct _virDomainChrSourceDef virDomainChrSourceDef;
typedef virDomainChrSourceDef *virDomainChrSourceDefPtr;
struct _virDomainChrSourceDef {
    int type; /* virDomainChrType */
1114
    union {
E
Eric Blake 已提交
1115
        /* no <source> for null, vc, stdio */
1116 1117 1118 1119 1120 1121
        struct {
            char *path;
        } file; /* pty, file, pipe, or device */
        struct {
            char *host;
            char *service;
1122
            bool listen;
1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
            int protocol;
        } tcp;
        struct {
            char *bindHost;
            char *bindService;
            char *connectHost;
            char *connectService;
        } udp;
        struct {
            char *path;
1133
            bool listen;
1134
        } nix;
E
Eric Blake 已提交
1135
        int spicevmc;
1136
    } data;
1137 1138 1139 1140 1141
};

/* A complete character device, both host and domain views.  */
struct _virDomainChrDef {
    int deviceType;
G
Guannan Ren 已提交
1142 1143

    bool targetTypeAttr;
1144 1145 1146 1147 1148 1149 1150 1151
    int targetType;
    union {
        int port; /* parallel, serial, console */
        virSocketAddrPtr addr; /* guestfwd */
        char *name; /* virtio */
    } target;

    virDomainChrSourceDef source;
1152 1153

    virDomainDeviceInfo info;
1154 1155 1156

    size_t nseclabels;
    virSecurityDeviceLabelDefPtr *seclabels;
1157 1158
};

E
Eric Blake 已提交
1159 1160 1161 1162 1163
enum virDomainSmartcardType {
    VIR_DOMAIN_SMARTCARD_TYPE_HOST,
    VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES,
    VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH,

1164
    VIR_DOMAIN_SMARTCARD_TYPE_LAST
E
Eric Blake 已提交
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183
};

# 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 已提交
1184 1185 1186 1187 1188
struct _virDomainHubDef {
    int type;
    virDomainDeviceInfo info;
};

1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215
enum virDomainTPMModel {
    VIR_DOMAIN_TPM_MODEL_TIS,

    VIR_DOMAIN_TPM_MODEL_LAST
};

enum virDomainTPMBackendType {
    VIR_DOMAIN_TPM_TYPE_PASSTHROUGH,

    VIR_DOMAIN_TPM_TYPE_LAST
};

# define VIR_DOMAIN_TPM_DEFAULT_DEVICE "/dev/tpm0"

typedef struct _virDomainTPMDef virDomainTPMDef;
typedef virDomainTPMDef *virDomainTPMDefPtr;
struct _virDomainTPMDef {
    enum virDomainTPMBackendType type;
    virDomainDeviceInfo info;
    enum virDomainTPMModel model;
    union {
        struct {
            virDomainChrSourceDef source;
        } passthrough;
    } data;
};

1216 1217 1218 1219
enum virDomainInputType {
    VIR_DOMAIN_INPUT_TYPE_MOUSE,
    VIR_DOMAIN_INPUT_TYPE_TABLET,

1220
    VIR_DOMAIN_INPUT_TYPE_LAST
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233
};

enum virDomainInputBus {
    VIR_DOMAIN_INPUT_BUS_PS2,
    VIR_DOMAIN_INPUT_BUS_USB,
    VIR_DOMAIN_INPUT_BUS_XEN,

    VIR_DOMAIN_INPUT_BUS_LAST
};

struct _virDomainInputDef {
    int type;
    int bus;
1234
    virDomainDeviceInfo info;
1235 1236
};

1237 1238 1239 1240 1241 1242 1243
enum virDomainSoundCodecType {
    VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
    VIR_DOMAIN_SOUND_CODEC_TYPE_MICRO,

    VIR_DOMAIN_SOUND_CODEC_TYPE_LAST
};

1244 1245 1246 1247
enum virDomainSoundModel {
    VIR_DOMAIN_SOUND_MODEL_SB16,
    VIR_DOMAIN_SOUND_MODEL_ES1370,
    VIR_DOMAIN_SOUND_MODEL_PCSPK,
D
Daniel P. Berrange 已提交
1248
    VIR_DOMAIN_SOUND_MODEL_AC97,
1249
    VIR_DOMAIN_SOUND_MODEL_ICH6,
1250 1251 1252 1253

    VIR_DOMAIN_SOUND_MODEL_LAST
};

1254 1255 1256 1257 1258
struct _virDomainSoundCodecDef {
    int type;
    int cad;
};

1259 1260
struct _virDomainSoundDef {
    int model;
1261
    virDomainDeviceInfo info;
1262

1263
    size_t ncodecs;
1264
    virDomainSoundCodecDefPtr *codecs;
1265 1266
};

R
Richard Jones 已提交
1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278
enum virDomainWatchdogModel {
    VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB,
    VIR_DOMAIN_WATCHDOG_MODEL_IB700,

    VIR_DOMAIN_WATCHDOG_MODEL_LAST
};

enum virDomainWatchdogAction {
    VIR_DOMAIN_WATCHDOG_ACTION_RESET,
    VIR_DOMAIN_WATCHDOG_ACTION_SHUTDOWN,
    VIR_DOMAIN_WATCHDOG_ACTION_POWEROFF,
    VIR_DOMAIN_WATCHDOG_ACTION_PAUSE,
H
Hu Tao 已提交
1279
    VIR_DOMAIN_WATCHDOG_ACTION_DUMP,
R
Richard Jones 已提交
1280 1281 1282 1283 1284 1285 1286 1287
    VIR_DOMAIN_WATCHDOG_ACTION_NONE,

    VIR_DOMAIN_WATCHDOG_ACTION_LAST
};

struct _virDomainWatchdogDef {
    int model;
    int action;
1288
    virDomainDeviceInfo info;
R
Richard Jones 已提交
1289 1290
};

1291 1292 1293 1294 1295 1296 1297

enum virDomainVideoType {
    VIR_DOMAIN_VIDEO_TYPE_VGA,
    VIR_DOMAIN_VIDEO_TYPE_CIRRUS,
    VIR_DOMAIN_VIDEO_TYPE_VMVGA,
    VIR_DOMAIN_VIDEO_TYPE_XEN,
    VIR_DOMAIN_VIDEO_TYPE_VBOX,
1298
    VIR_DOMAIN_VIDEO_TYPE_QXL,
1299 1300 1301 1302 1303

    VIR_DOMAIN_VIDEO_TYPE_LAST
};


1304 1305 1306
typedef struct _virDomainVideoAccelDef virDomainVideoAccelDef;
typedef virDomainVideoAccelDef *virDomainVideoAccelDefPtr;
struct _virDomainVideoAccelDef {
1307 1308
    bool support3d;
    bool support2d;
1309 1310 1311
};


1312 1313
struct _virDomainVideoDef {
    int type;
1314 1315
    unsigned int ram;  /* kibibytes (multiples of 1024) */
    unsigned int vram; /* kibibytes (multiples of 1024) */
1316
    unsigned int heads;
1317
    bool primary;
1318
    virDomainVideoAccelDefPtr accel;
1319
    virDomainDeviceInfo info;
1320 1321
};

1322
/* graphics console modes */
1323 1324 1325
enum virDomainGraphicsType {
    VIR_DOMAIN_GRAPHICS_TYPE_SDL,
    VIR_DOMAIN_GRAPHICS_TYPE_VNC,
1326 1327
    VIR_DOMAIN_GRAPHICS_TYPE_RDP,
    VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
1328
    VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
1329

1330
    VIR_DOMAIN_GRAPHICS_TYPE_LAST
1331 1332
};

1333 1334 1335 1336 1337 1338 1339 1340 1341
enum virDomainGraphicsVNCSharePolicy {
    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
};

1342 1343 1344 1345 1346 1347 1348 1349 1350
enum virDomainGraphicsAuthConnectedType {
    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
};

1351 1352 1353 1354
typedef struct _virDomainGraphicsAuthDef virDomainGraphicsAuthDef;
typedef virDomainGraphicsAuthDef *virDomainGraphicsAuthDefPtr;
struct _virDomainGraphicsAuthDef {
    char *passwd;
1355
    bool expires; /* Whether there is an expiry time set */
1356
    time_t validTo;  /* seconds since epoch */
1357
    int connected; /* action if connected */
1358 1359
};

1360 1361 1362 1363 1364 1365 1366
enum virDomainGraphicsSpiceChannelName {
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MAIN,
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_DISPLAY,
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_INPUT,
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_CURSOR,
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_PLAYBACK,
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_RECORD,
E
Eric Blake 已提交
1367
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_SMARTCARD,
1368
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_USBREDIR,
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379

    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST
};

enum virDomainGraphicsSpiceChannelMode {
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY,
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE,
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE,

    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_LAST
};
1380

1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418
enum virDomainGraphicsSpiceImageCompression {
    VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_GLZ,
    VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_AUTO_LZ,
    VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_QUIC,
    VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_GLZ,
    VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_LZ,
    VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_OFF,

    VIR_DOMAIN_GRAPHICS_SPICE_IMAGE_COMPRESSION_LAST
};

enum virDomainGraphicsSpiceJpegCompression {
    VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_AUTO,
    VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_NEVER,
    VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_ALWAYS,

    VIR_DOMAIN_GRAPHICS_SPICE_JPEG_COMPRESSION_LAST
};

enum virDomainGraphicsSpiceZlibCompression {
    VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_AUTO,
    VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_NEVER,
    VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_ALWAYS,

    VIR_DOMAIN_GRAPHICS_SPICE_ZLIB_COMPRESSION_LAST
};

enum virDomainGraphicsSpicePlaybackCompression {
    VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_ON,
    VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_OFF,

    VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
};

P
Peng Zhou 已提交
1419 1420 1421 1422 1423 1424 1425 1426
enum virDomainGraphicsSpiceMouseMode {
    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
};

1427 1428 1429 1430 1431 1432 1433 1434 1435
enum virDomainGraphicsSpiceStreamingMode {
    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_FILTER,
    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_ALL,
    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_OFF,

    VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST
};

1436 1437 1438 1439 1440 1441 1442 1443
enum virDomainGraphicsSpiceClipboardCopypaste {
    VIR_DOMAIN_GRAPHICS_SPICE_CLIPBOARD_COPYPASTE_DEFAULT = 0,
    VIR_DOMAIN_GRAPHICS_SPICE_CLIPBOARD_COPYPASTE_YES,
    VIR_DOMAIN_GRAPHICS_SPICE_CLIPBOARD_COPYPASTE_NO,

    VIR_DOMAIN_GRAPHICS_SPICE_CLIPBOARD_COPYPASTE_LAST
};

1444 1445 1446 1447 1448
enum virDomainGraphicsListenType {
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE = 0,
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS,
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK,

1449
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
1450 1451
};

M
Marc-André Lureau 已提交
1452 1453 1454
enum virDomainHubType {
    VIR_DOMAIN_HUB_TYPE_USB,

1455
    VIR_DOMAIN_HUB_TYPE_LAST
M
Marc-André Lureau 已提交
1456 1457
};

1458 1459 1460 1461 1462 1463
typedef struct _virDomainGraphicsListenDef virDomainGraphicsListenDef;
typedef virDomainGraphicsListenDef *virDomainGraphicsListenDefPtr;
struct _virDomainGraphicsListenDef {
    int type;   /* enum virDomainGraphicsListenType */
    char *address;
    char *network;
1464
    bool fromConfig;    /* true if the @address is config file originated */
1465 1466
};

1467
struct _virDomainGraphicsDef {
M
Michal Privoznik 已提交
1468 1469 1470 1471 1472
    /* 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.
     */
1473 1474 1475 1476
    int type;
    union {
        struct {
            int port;
M
Martin Kletzander 已提交
1477
            int websocket;
1478
            bool autoport;
1479
            char *keymap;
1480
            char *socket;
1481
            virDomainGraphicsAuthDef auth;
1482
            int sharePolicy;
1483 1484 1485 1486
        } vnc;
        struct {
            char *display;
            char *xauth;
1487
            bool fullscreen;
1488
        } sdl;
1489 1490
        struct {
            int port;
1491 1492 1493
            bool autoport;
            bool replaceUser;
            bool multiUser;
1494 1495 1496
        } rdp;
        struct {
            char *display;
1497
            bool fullscreen;
1498
        } desktop;
1499 1500 1501
        struct {
            int port;
            int tlsPort;
P
Peng Zhou 已提交
1502
            int mousemode;
1503
            char *keymap;
1504
            virDomainGraphicsAuthDef auth;
1505
            bool autoport;
1506
            int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
1507
            int defaultMode; /* enum virDomainGraphicsSpiceChannelMode */
1508 1509 1510 1511
            int image;
            int jpeg;
            int zlib;
            int playback;
1512
            int streaming;
1513
            int copypaste;
1514
        } spice;
1515
    } data;
1516 1517 1518 1519 1520
    /* 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;
1521 1522
};

1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537
enum virDomainRedirdevBus {
    VIR_DOMAIN_REDIRDEV_BUS_USB,

    VIR_DOMAIN_REDIRDEV_BUS_LAST
};

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

    union {
        virDomainChrSourceDef chr;
    } source;

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

1539 1540 1541 1542 1543
struct _virDomainRedirFilterUsbDevDef {
    int usbClass;
    int vendor;
    int product;
    int version;
1544
    bool allow;
1545 1546 1547 1548 1549 1550 1551
};

struct _virDomainRedirFilterDef {
    size_t nusbdevs;
    virDomainRedirFilterUsbDevDefPtr *usbdevs;
};

1552 1553 1554 1555 1556 1557 1558 1559
enum virDomainMemDump {
    VIR_DOMAIN_MEM_DUMP_DEFAULT = 0,
    VIR_DOMAIN_MEM_DUMP_ON,
    VIR_DOMAIN_MEM_DUMP_OFF,

    VIR_DOMAIN_MEM_DUMP_LAST,
};

1560 1561 1562
enum {
    VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
    VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
1563
    VIR_DOMAIN_MEMBALLOON_MODEL_NONE,
1564 1565 1566 1567 1568 1569 1570

    VIR_DOMAIN_MEMBALLOON_MODEL_LAST
};

struct _virDomainMemballoonDef {
    int model;
    virDomainDeviceInfo info;
1571
    unsigned int period; /* seconds between collections */
1572 1573
};

L
Li Zhang 已提交
1574 1575 1576
struct _virDomainNVRAMDef {
    virDomainDeviceInfo info;
};
1577

1578
enum virDomainSmbiosMode {
1579
    VIR_DOMAIN_SMBIOS_NONE = 0,
1580 1581 1582 1583 1584 1585 1586
    VIR_DOMAIN_SMBIOS_EMULATE,
    VIR_DOMAIN_SMBIOS_HOST,
    VIR_DOMAIN_SMBIOS_SYSINFO,

    VIR_DOMAIN_SMBIOS_LAST
};

1587

1588
# define VIR_DOMAIN_MAX_BOOT_DEVS 4
1589 1590 1591 1592 1593 1594 1595

enum virDomainBootOrder {
    VIR_DOMAIN_BOOT_FLOPPY,
    VIR_DOMAIN_BOOT_CDROM,
    VIR_DOMAIN_BOOT_DISK,
    VIR_DOMAIN_BOOT_NET,

1596
    VIR_DOMAIN_BOOT_LAST
1597 1598
};

1599 1600 1601 1602
enum virDomainBootMenu {
    VIR_DOMAIN_BOOT_MENU_DEFAULT = 0,
    VIR_DOMAIN_BOOT_MENU_ENABLED,
    VIR_DOMAIN_BOOT_MENU_DISABLED,
1603 1604

    VIR_DOMAIN_BOOT_MENU_LAST
1605 1606
};

1607 1608 1609 1610
enum virDomainFeature {
    VIR_DOMAIN_FEATURE_ACPI,
    VIR_DOMAIN_FEATURE_APIC,
    VIR_DOMAIN_FEATURE_PAE,
J
Jim Fehlig 已提交
1611
    VIR_DOMAIN_FEATURE_HAP,
1612
    VIR_DOMAIN_FEATURE_VIRIDIAN,
1613
    VIR_DOMAIN_FEATURE_PRIVNET,
1614
    VIR_DOMAIN_FEATURE_HYPERV,
1615 1616 1617 1618

    VIR_DOMAIN_FEATURE_LAST
};

1619 1620 1621 1622
enum virDomainFeatureState {
    VIR_DOMAIN_FEATURE_STATE_DEFAULT = 0,
    VIR_DOMAIN_FEATURE_STATE_ON,
    VIR_DOMAIN_FEATURE_STATE_OFF,
1623

1624
    VIR_DOMAIN_FEATURE_STATE_LAST
1625 1626
};

1627 1628
enum virDomainHyperv {
    VIR_DOMAIN_HYPERV_RELAXED = 0,
1629 1630
    VIR_DOMAIN_HYPERV_VAPIC,
    VIR_DOMAIN_HYPERV_SPINLOCKS,
1631 1632 1633 1634

    VIR_DOMAIN_HYPERV_LAST
};

1635 1636 1637 1638 1639 1640 1641 1642 1643
enum virDomainLifecycleAction {
    VIR_DOMAIN_LIFECYCLE_DESTROY,
    VIR_DOMAIN_LIFECYCLE_RESTART,
    VIR_DOMAIN_LIFECYCLE_RESTART_RENAME,
    VIR_DOMAIN_LIFECYCLE_PRESERVE,

    VIR_DOMAIN_LIFECYCLE_LAST
};

1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654
enum virDomainLifecycleCrashAction {
    VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY,
    VIR_DOMAIN_LIFECYCLE_CRASH_RESTART,
    VIR_DOMAIN_LIFECYCLE_CRASH_RESTART_RENAME,
    VIR_DOMAIN_LIFECYCLE_CRASH_PRESERVE,
    VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY,
    VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART,

    VIR_DOMAIN_LIFECYCLE_CRASH_LAST
};

1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666
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)

1667 1668 1669 1670 1671
enum virDomainPMState {
    VIR_DOMAIN_PM_STATE_DEFAULT = 0,
    VIR_DOMAIN_PM_STATE_ENABLED,
    VIR_DOMAIN_PM_STATE_DISABLED,

1672
    VIR_DOMAIN_PM_STATE_LAST
1673 1674
};

M
Michal Privoznik 已提交
1675 1676 1677 1678 1679 1680 1681 1682 1683 1684
enum virDomainBIOSUseserial {
    VIR_DOMAIN_BIOS_USESERIAL_DEFAULT = 0,
    VIR_DOMAIN_BIOS_USESERIAL_YES,
    VIR_DOMAIN_BIOS_USESERIAL_NO
};

typedef struct _virDomainBIOSDef virDomainBIOSDef;
typedef virDomainBIOSDef *virDomainBIOSDefPtr;
struct _virDomainBIOSDef {
    int useserial;
1685 1686 1687
    /* reboot-timeout parameters */
    bool rt_set;
    int rt_delay;
M
Michal Privoznik 已提交
1688 1689
};

1690 1691 1692 1693 1694
/* Operating system configuration data & machine / arch */
typedef struct _virDomainOSDef virDomainOSDef;
typedef virDomainOSDef *virDomainOSDefPtr;
struct _virDomainOSDef {
    char *type;
1695
    virArch arch;
1696
    char *machine;
1697
    size_t nBootDevs;
1698
    int bootDevs[VIR_DOMAIN_BOOT_LAST];
1699
    /* enum virDomainBootMenu */
1700
    int bootmenu;
1701
    char *init;
1702
    char **initargv;
1703 1704 1705
    char *kernel;
    char *initrd;
    char *cmdline;
1706
    char *dtb;
1707 1708 1709 1710
    char *root;
    char *loader;
    char *bootloader;
    char *bootloaderArgs;
1711
    int smbios_mode;
1712

M
Michal Privoznik 已提交
1713
    virDomainBIOSDef bios;
1714 1715
};

1716 1717 1718 1719 1720 1721
enum virDomainTimerNameType {
    VIR_DOMAIN_TIMER_NAME_PLATFORM = 0,
    VIR_DOMAIN_TIMER_NAME_PIT,
    VIR_DOMAIN_TIMER_NAME_RTC,
    VIR_DOMAIN_TIMER_NAME_HPET,
    VIR_DOMAIN_TIMER_NAME_TSC,
P
Paolo Bonzini 已提交
1722
    VIR_DOMAIN_TIMER_NAME_KVMCLOCK,
1723

1724
    VIR_DOMAIN_TIMER_NAME_LAST
1725 1726
};

1727 1728 1729 1730
enum virDomainTimerTrackType {
    VIR_DOMAIN_TIMER_TRACK_BOOT = 0,
    VIR_DOMAIN_TIMER_TRACK_GUEST,
    VIR_DOMAIN_TIMER_TRACK_WALL,
1731

1732
    VIR_DOMAIN_TIMER_TRACK_LAST
1733 1734 1735 1736 1737 1738 1739 1740
};

enum virDomainTimerTickpolicyType {
    VIR_DOMAIN_TIMER_TICKPOLICY_DELAY = 0,
    VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP,
    VIR_DOMAIN_TIMER_TICKPOLICY_MERGE,
    VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD,

1741
    VIR_DOMAIN_TIMER_TICKPOLICY_LAST
1742 1743 1744 1745 1746 1747 1748
};

enum virDomainTimerModeType {
    VIR_DOMAIN_TIMER_MODE_AUTO = 0,
    VIR_DOMAIN_TIMER_MODE_NATIVE,
    VIR_DOMAIN_TIMER_MODE_EMULATE,
    VIR_DOMAIN_TIMER_MODE_PARAVIRT,
1749
    VIR_DOMAIN_TIMER_MODE_SMPSAFE,
1750

1751
    VIR_DOMAIN_TIMER_MODE_LAST
1752 1753
};

O
Osier Yang 已提交
1754
enum virDomainCpuPlacementMode {
1755
    VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC = 0,
O
Osier Yang 已提交
1756 1757
    VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO,

1758
    VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST
O
Osier Yang 已提交
1759 1760
};

1761 1762 1763 1764 1765 1766 1767 1768
typedef struct _virDomainTimerCatchupDef virDomainTimerCatchupDef;
typedef virDomainTimerCatchupDef *virDomainTimerCatchupDefPtr;
struct _virDomainTimerCatchupDef {
    unsigned long threshold;
    unsigned long slew;
    unsigned long limit;
};

1769 1770 1771 1772 1773 1774 1775
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 */

1776 1777 1778 1779
    virDomainTimerCatchupDef catchup;

    /* track is only valid for name='platform|rtc' */
    int track;  /* host|guest */
1780 1781 1782 1783 1784 1785

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

1786 1787 1788
enum virDomainClockOffsetType {
    VIR_DOMAIN_CLOCK_OFFSET_UTC = 0,
    VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME = 1,
1789
    VIR_DOMAIN_CLOCK_OFFSET_VARIABLE = 2,
1790
    VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE = 3,
1791

1792
    VIR_DOMAIN_CLOCK_OFFSET_LAST
1793 1794
};

1795 1796 1797 1798
enum virDomainClockBasis {
    VIR_DOMAIN_CLOCK_BASIS_UTC = 0,
    VIR_DOMAIN_CLOCK_BASIS_LOCALTIME = 1,

1799
    VIR_DOMAIN_CLOCK_BASIS_LAST
1800 1801
};

1802 1803 1804 1805
typedef struct _virDomainClockDef virDomainClockDef;
typedef virDomainClockDef *virDomainClockDefPtr;
struct _virDomainClockDef {
    int offset;
1806

1807
    union {
1808 1809 1810
        /* Bug-compatibility-mode for Xen utc|localtime */
        int utc_reset;
        /* Adjustment in seconds, relative to UTC or LOCALTIME, when
1811
         * offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE */
1812 1813 1814
        struct {
            long long adjustment;
            int basis;
1815 1816 1817 1818 1819

            /* Store the base date (-rtc base=$date, in seconds
             * since the Epoch) of guest process, internal only
             */
            unsigned long long basedate;
1820
        } variable;
1821 1822 1823 1824 1825

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

1827
    size_t ntimers;
1828
    virDomainTimerDefPtr *timers;
1829 1830
};

1831
# define VIR_DOMAIN_CPUMASK_LEN 1024
1832

E
Eric Blake 已提交
1833 1834 1835
typedef struct _virDomainVcpuPinDef virDomainVcpuPinDef;
typedef virDomainVcpuPinDef *virDomainVcpuPinDefPtr;
struct _virDomainVcpuPinDef {
1836
    int vcpuid;
H
Hu Tao 已提交
1837
    virBitmapPtr cpumask;
1838 1839
};

H
Hu Tao 已提交
1840 1841
void virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr def);
void virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def, int nvcpupin);
1842 1843 1844 1845

virDomainVcpuPinDefPtr *virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src,
                                                int nvcpupin);

E
Eric Blake 已提交
1846
int virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
1847 1848 1849
                                int nvcpupin,
                                int vcpu);

E
Eric Blake 已提交
1850
virDomainVcpuPinDefPtr virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
1851 1852 1853
                                                  int nvcpupin,
                                                  int vcpu);

1854 1855 1856 1857 1858 1859 1860
typedef struct _virBlkioDeviceWeight virBlkioDeviceWeight;
typedef virBlkioDeviceWeight *virBlkioDeviceWeightPtr;
struct _virBlkioDeviceWeight {
    char *path;
    unsigned int weight;
};

1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877
enum virDomainRNGModel {
    VIR_DOMAIN_RNG_MODEL_VIRTIO,

    VIR_DOMAIN_RNG_MODEL_LAST
};

enum virDomainRNGBackend {
    VIR_DOMAIN_RNG_BACKEND_RANDOM,
    VIR_DOMAIN_RNG_BACKEND_EGD,
    /* VIR_DOMAIN_RNG_BACKEND_POOL, */

    VIR_DOMAIN_RNG_BACKEND_LAST
};

struct _virDomainRNGDef {
    int model;
    int backend;
1878 1879
    unsigned int rate; /* bytes per period */
    unsigned int period; /* milliseconds */
1880 1881 1882 1883 1884 1885 1886 1887 1888 1889

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

    virDomainDeviceInfo info;
};

1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904
struct _virDomainIdMapEntry {
    unsigned int start;
    unsigned int target;
    unsigned int count;
};

struct _virDomainIdMapDef {
    size_t nuidmap;
    virDomainIdMapEntryPtr uidmap;

    size_t ngidmap;
    virDomainIdMapEntryPtr gidmap;
};


1905 1906 1907
void virBlkioDeviceWeightArrayClear(virBlkioDeviceWeightPtr deviceWeights,
                                    int ndevices);

1908 1909 1910 1911 1912
typedef struct _virDomainResourceDef virDomainResourceDef;
typedef virDomainResourceDef *virDomainResourceDefPtr;
struct _virDomainResourceDef {
    char *partition;
};
1913

1914 1915 1916 1917 1918 1919
/*
 * Guest VM main configuration
 *
 * NB: if adding to this struct, virDomainDefCheckABIStability
 * may well need an update
 */
1920 1921 1922 1923 1924 1925 1926
typedef struct _virDomainDef virDomainDef;
typedef virDomainDef *virDomainDefPtr;
struct _virDomainDef {
    int virtType;
    int id;
    unsigned char uuid[VIR_UUID_BUFLEN];
    char *name;
1927
    char *title;
1928
    char *description;
1929

1930 1931
    struct {
        unsigned int weight;
1932 1933 1934

        size_t ndevices;
        virBlkioDeviceWeightPtr devices;
1935 1936
    } blkio;

1937
    struct {
1938 1939 1940
        unsigned long long max_balloon; /* in kibibytes */
        unsigned long long cur_balloon; /* in kibibytes */
        bool hugepage_backed;
1941
        bool nosharepages;
1942
        bool locked;
1943
        int dump_core; /* enum virDomainMemDump */
1944 1945 1946 1947
        unsigned long long hard_limit; /* in kibibytes */
        unsigned long long soft_limit; /* in kibibytes */
        unsigned long long min_guarantee; /* in kibibytes */
        unsigned long long swap_hard_limit; /* in kibibytes */
1948
    } mem;
E
Eric Blake 已提交
1949 1950
    unsigned short vcpus;
    unsigned short maxvcpus;
O
Osier Yang 已提交
1951
    int placement_mode;
H
Hu Tao 已提交
1952
    virBitmapPtr cpumask;
1953

1954 1955
    struct {
        unsigned long shares;
1956 1957
        unsigned long long period;
        long long quota;
1958 1959
        unsigned long long emulator_period;
        long long emulator_quota;
1960
        int nvcpupin;
E
Eric Blake 已提交
1961
        virDomainVcpuPinDefPtr *vcpupin;
T
Tang Chen 已提交
1962
        virDomainVcpuPinDefPtr emulatorpin;
1963 1964
    } cputune;

G
Gao feng 已提交
1965
    virNumaTuneDef numatune;
1966
    virDomainResourceDefPtr resource;
1967
    virDomainIdMapDef idmap;
1968

1969 1970 1971 1972 1973
    /* These 3 are based on virDomainLifeCycleAction enum flags */
    int onReboot;
    int onPoweroff;
    int onCrash;

1974 1975
    int onLockFailure; /* enum virDomainLockFailureAction */

1976 1977 1978 1979 1980 1981
    struct {
        /* These options are actually type of enum virDomainPMState */
        int s3;
        int s4;
    } pm;

1982 1983 1984
    virDomainOSDef os;
    char *emulator;
    int features;
1985
    /* enum virDomainFeatureState */
1986
    int apic_eoi;
1987 1988
    /* These options are of type virDomainFeatureState */
    int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
1989
    unsigned int hyperv_spinlocks;
1990

1991
    virDomainClockDef clock;
1992

1993
    size_t ngraphics;
1994
    virDomainGraphicsDefPtr *graphics;
1995

1996
    size_t ndisks;
1997 1998
    virDomainDiskDefPtr *disks;

1999
    size_t ncontrollers;
2000 2001
    virDomainControllerDefPtr *controllers;

2002
    size_t nfss;
2003 2004
    virDomainFSDefPtr *fss;

2005
    size_t nnets;
2006 2007
    virDomainNetDefPtr *nets;

2008
    size_t ninputs;
2009 2010
    virDomainInputDefPtr *inputs;

2011
    size_t nsounds;
2012 2013
    virDomainSoundDefPtr *sounds;

2014
    size_t nvideos;
2015 2016
    virDomainVideoDefPtr *videos;

2017
    size_t nhostdevs;
2018 2019
    virDomainHostdevDefPtr *hostdevs;

2020
    size_t nredirdevs;
2021 2022
    virDomainRedirdevDefPtr *redirdevs;

2023
    size_t nsmartcards;
E
Eric Blake 已提交
2024 2025
    virDomainSmartcardDefPtr *smartcards;

2026
    size_t nserials;
2027 2028
    virDomainChrDefPtr *serials;

2029
    size_t nparallels;
2030 2031
    virDomainChrDefPtr *parallels;

2032
    size_t nchannels;
2033 2034
    virDomainChrDefPtr *channels;

2035
    size_t nconsoles;
2036 2037
    virDomainChrDefPtr *consoles;

2038
    size_t nleases;
2039 2040
    virDomainLeaseDefPtr *leases;

2041
    size_t nhubs;
M
Marc-André Lureau 已提交
2042 2043
    virDomainHubDefPtr *hubs;

2044 2045 2046
    size_t nseclabels;
    virSecurityLabelDefPtr *seclabels;

2047
    /* Only 1 */
R
Richard Jones 已提交
2048
    virDomainWatchdogDefPtr watchdog;
2049
    virDomainMemballoonDefPtr memballoon;
L
Li Zhang 已提交
2050
    virDomainNVRAMDefPtr nvram;
2051
    virDomainTPMDefPtr tpm;
2052
    virCPUDefPtr cpu;
2053
    virSysinfoDefPtr sysinfo;
2054
    virDomainRedirFilterDefPtr redirfilter;
2055
    virDomainRNGDefPtr rng;
2056 2057 2058

    void *namespaceData;
    virDomainXMLNamespace ns;
2059 2060 2061

    /* Application-specific custom metadata */
    xmlNodePtr metadata;
2062 2063
};

2064 2065 2066 2067 2068 2069
enum virDomainTaintFlags {
    VIR_DOMAIN_TAINT_CUSTOM_ARGV,      /* Custom ARGV passthrough from XML */
    VIR_DOMAIN_TAINT_CUSTOM_MONITOR,   /* Custom monitor commands issued */
    VIR_DOMAIN_TAINT_HIGH_PRIVILEGES,  /* Running with undesirably high privileges */
    VIR_DOMAIN_TAINT_SHELL_SCRIPTS,    /* Network configuration using opaque shell scripts */
    VIR_DOMAIN_TAINT_DISK_PROBING,     /* Relying on potentially unsafe disk format probing */
2070
    VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH,  /* Externally launched guest domain */
2071
    VIR_DOMAIN_TAINT_HOST_CPU,         /* Host CPU passthrough in use */
2072 2073 2074 2075

    VIR_DOMAIN_TAINT_LAST
};

2076
/* Guest VM runtime state */
J
Jiri Denemark 已提交
2077 2078 2079 2080 2081 2082
typedef struct _virDomainStateReason virDomainStateReason;
struct _virDomainStateReason {
    int state;
    int reason;
};

2083 2084 2085
typedef struct _virDomainObj virDomainObj;
typedef virDomainObj *virDomainObjPtr;
struct _virDomainObj {
2086
    virObjectLockable parent;
2087

2088
    pid_t pid;
J
Jiri Denemark 已提交
2089
    virDomainStateReason state;
2090 2091 2092

    unsigned int autostart : 1;
    unsigned int persistent : 1;
2093
    unsigned int updated : 1;
2094 2095 2096

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

2098
    virDomainSnapshotObjListPtr snapshots;
C
Chris Lalancette 已提交
2099 2100
    virDomainSnapshotObjPtr current_snapshot;

2101 2102
    bool hasManagedSave;

2103 2104
    void *privateData;
    void (*privateDataFreeFunc)(void *);
2105 2106

    int taint;
2107 2108
};

2109 2110
typedef struct _virDomainObjList virDomainObjList;
typedef virDomainObjList *virDomainObjListPtr;
2111

2112 2113 2114
typedef bool (*virDomainObjListFilter)(virConnectPtr conn,
                                       virDomainDefPtr def);

2115 2116 2117

/* This structure holds various callbacks and data needed
 * while parsing and creating domain XMLs */
2118 2119
typedef struct _virDomainXMLOption virDomainXMLOption;
typedef virDomainXMLOption *virDomainXMLOptionPtr;
2120 2121 2122 2123 2124 2125

typedef void *(*virDomainXMLPrivateDataAllocFunc)(void);
typedef void (*virDomainXMLPrivateDataFreeFunc)(void *);
typedef int (*virDomainXMLPrivateDataFormatFunc)(virBufferPtr, void *);
typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr, void *);

2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136
typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def,
                                             virCapsPtr caps,
                                             void *opaque);
typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev,
                                                   virDomainDefPtr def,
                                                   virCapsPtr caps,
                                                   void *opaque);

typedef struct _virDomainDefParserConfig virDomainDefParserConfig;
typedef virDomainDefParserConfig *virDomainDefParserConfigPtr;
struct _virDomainDefParserConfig {
2137
    /* driver domain definition callbacks */
2138 2139 2140
    virDomainDefPostParseCallback domainPostParseCallback;
    virDomainDeviceDefPostParseCallback devicesPostParseCallback;

2141
    /* private data for the callbacks */
2142 2143
    void *priv;
    virFreeCallback privFree;
2144 2145 2146

    /* data */
    bool hasWideScsiBus;
2147
    unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
2148 2149
};

2150 2151 2152 2153 2154 2155 2156 2157 2158
typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks;
typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr;
struct _virDomainXMLPrivateDataCallbacks {
    virDomainXMLPrivateDataAllocFunc  alloc;
    virDomainXMLPrivateDataFreeFunc   free;
    virDomainXMLPrivateDataFormatFunc format;
    virDomainXMLPrivateDataParseFunc  parse;
};

2159 2160 2161
virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config,
                                            virDomainXMLPrivateDataCallbacksPtr priv,
                                            virDomainXMLNamespacePtr xmlns);
2162

2163 2164
void virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt, virMacAddrPtr mac);

2165
virDomainXMLNamespacePtr
2166
virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
2167 2168
    ATTRIBUTE_NONNULL(1);

2169 2170 2171 2172 2173
int
virDomainDefPostParse(virDomainDefPtr def,
                      virCapsPtr caps,
                      virDomainXMLOptionPtr xmlopt);

2174
static inline bool
D
Daniel P. Berrange 已提交
2175
virDomainObjIsActive(virDomainObjPtr dom)
2176 2177 2178 2179
{
    return dom->def->id != -1;
}

2180
virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps)
2181
    ATTRIBUTE_NONNULL(1);
2182

2183
virDomainObjListPtr virDomainObjListNew(void);
2184

2185 2186 2187 2188 2189 2190
virDomainObjPtr virDomainObjListFindByID(const virDomainObjListPtr doms,
                                         int id);
virDomainObjPtr virDomainObjListFindByUUID(const virDomainObjListPtr doms,
                                           const unsigned char *uuid);
virDomainObjPtr virDomainObjListFindByName(const virDomainObjListPtr doms,
                                           const char *name);
2191

2192 2193
bool virDomainObjTaint(virDomainObjPtr obj,
                       enum virDomainTaintFlags taint);
2194

2195
void virDomainResourceDefFree(virDomainResourceDefPtr resource);
2196 2197 2198
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def);
void virDomainDiskDefFree(virDomainDiskDefPtr def);
2199
void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
2200
void virDomainDiskHostDefFree(virDomainDiskHostDefPtr def);
H
Han Cheng 已提交
2201 2202 2203
int virDomainDeviceFindControllerModel(virDomainDefPtr def,
                                       virDomainDeviceInfoPtr info,
                                       int controllerType);
2204 2205 2206
virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
                                                 int bus,
                                                 char *dst);
2207
void virDomainControllerDefFree(virDomainControllerDefPtr def);
2208
void virDomainFSDefFree(virDomainFSDefPtr def);
2209
void virDomainActualNetDefFree(virDomainActualNetDefPtr def);
2210
void virDomainNetDefFree(virDomainNetDefPtr def);
E
Eric Blake 已提交
2211
void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def);
2212
void virDomainChrDefFree(virDomainChrDefPtr def);
2213
void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def);
2214 2215
int virDomainChrSourceDefCopy(virDomainChrSourceDefPtr src,
                              virDomainChrSourceDefPtr dest);
2216
void virDomainSoundCodecDefFree(virDomainSoundCodecDefPtr def);
2217
void virDomainSoundDefFree(virDomainSoundDefPtr def);
2218
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
L
Li Zhang 已提交
2219
void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
R
Richard Jones 已提交
2220
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
2221
void virDomainVideoDefFree(virDomainVideoDefPtr def);
2222 2223
virDomainHostdevDefPtr virDomainHostdevDefAlloc(void);
void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
2224
void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
M
Marc-André Lureau 已提交
2225
void virDomainHubDefFree(virDomainHubDefPtr def);
2226
void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def);
2227
void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def);
2228
void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
2229
virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
2230
                                             const virDomainDefPtr def,
2231 2232
                                             virCapsPtr caps,
                                             virDomainXMLOptionPtr xmlopt);
2233 2234
int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
                                  int type);
2235 2236
int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
                            virDomainDeviceInfoPtr src);
2237
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
2238
void virDomainDefClearPCIAddresses(virDomainDefPtr def);
2239
void virDomainDefClearCCWAddresses(virDomainDefPtr def);
D
Daniel P. Berrange 已提交
2240
void virDomainDefClearDeviceAliases(virDomainDefPtr def);
2241
void virDomainTPMDefFree(virDomainTPMDefPtr def);
2242

2243
typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
2244 2245
                                           virDomainDeviceDefPtr dev,
                                           virDomainDeviceInfoPtr info,
2246 2247 2248 2249 2250 2251
                                           void *opaque);

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

2252 2253
void virDomainDefFree(virDomainDefPtr vm);

M
Michal Novotny 已提交
2254 2255
virDomainChrDefPtr virDomainChrDefNew(void);

2256 2257 2258 2259
virDomainDefPtr virDomainDefNew(const char *name,
                                const unsigned char *uuid,
                                int id);

2260 2261 2262 2263
enum {
    VIR_DOMAIN_OBJ_LIST_ADD_LIVE = (1 << 0),
    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1),
};
2264 2265
virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms,
                                    const virDomainDefPtr def,
2266
                                    virDomainXMLOptionPtr xmlopt,
2267 2268
                                    unsigned int flags,
                                    virDomainDefPtr *oldDef);
2269 2270
void virDomainObjAssignDef(virDomainObjPtr domain,
                           const virDomainDefPtr def,
2271 2272
                           bool live,
                           virDomainDefPtr *oldDef);
2273
int virDomainObjSetDefTransient(virCapsPtr caps,
2274
                                virDomainXMLOptionPtr xmlopt,
2275 2276
                                virDomainObjPtr domain,
                                bool live);
2277 2278
virDomainDefPtr
virDomainObjGetPersistentDef(virCapsPtr caps,
2279
                             virDomainXMLOptionPtr xmlopt,
2280
                             virDomainObjPtr domain);
2281 2282 2283

int
virDomainLiveConfigHelperMethod(virCapsPtr caps,
2284
                                virDomainXMLOptionPtr xmlopt,
2285 2286 2287 2288
                                virDomainObjPtr dom,
                                unsigned int *flags,
                                virDomainDefPtr *persistentDef);

2289 2290 2291 2292 2293 2294 2295
virDomainDefPtr virDomainDefCopy(virDomainDefPtr src,
                                 virCapsPtr caps,
                                 virDomainXMLOptionPtr xmlopt,
                                 bool migratable);
virDomainDefPtr virDomainObjCopyPersistentDef(virDomainObjPtr dom,
                                              virCapsPtr caps,
                                              virDomainXMLOptionPtr xmlopt);
2296

2297 2298
void virDomainObjListRemove(virDomainObjListPtr doms,
                            virDomainObjPtr dom);
2299 2300
void virDomainObjListRemoveLocked(virDomainObjListPtr doms,
                                  virDomainObjPtr dom);
2301

2302
virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr,
2303
                                              virDomainDefPtr def,
2304 2305
                                              virCapsPtr caps,
                                              virDomainXMLOptionPtr xmlopt,
L
Laine Stump 已提交
2306
                                              unsigned int flags);
2307 2308
virDomainDefPtr virDomainDefParseString(const char *xmlStr,
                                        virCapsPtr caps,
2309
                                        virDomainXMLOptionPtr xmlopt,
M
Matthias Bolte 已提交
2310
                                        unsigned int expectedVirtTypes,
L
Laine Stump 已提交
2311
                                        unsigned int flags);
2312 2313
virDomainDefPtr virDomainDefParseFile(const char *filename,
                                      virCapsPtr caps,
2314
                                      virDomainXMLOptionPtr xmlopt,
M
Matthias Bolte 已提交
2315
                                      unsigned int expectedVirtTypes,
L
Laine Stump 已提交
2316
                                      unsigned int flags);
2317
virDomainDefPtr virDomainDefParseNode(xmlDocPtr doc,
2318
                                      xmlNodePtr root,
2319 2320
                                      virCapsPtr caps,
                                      virDomainXMLOptionPtr xmlopt,
M
Matthias Bolte 已提交
2321
                                      unsigned int expectedVirtTypes,
L
Laine Stump 已提交
2322
                                      unsigned int flags);
2323

2324 2325 2326
bool virDomainDefCheckABIStability(virDomainDefPtr src,
                                   virDomainDefPtr dst);

2327
int virDomainDefAddImplicitControllers(virDomainDefPtr def);
2328

2329
char *virDomainDefFormat(virDomainDefPtr def,
L
Laine Stump 已提交
2330
                         unsigned int flags);
2331 2332 2333
int virDomainDefFormatInternal(virDomainDefPtr def,
                               unsigned int flags,
                               virBufferPtr buf);
2334

2335 2336 2337
int virDomainDefCompatibleDevice(virDomainDefPtr def,
                                 virDomainDeviceDefPtr dev);

2338
int virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list,
H
Hu Tao 已提交
2339
                        int *nvcpupin,
2340 2341 2342 2343
                        unsigned char *cpumap,
                        int maplen,
                        int vcpu);

E
Eric Blake 已提交
2344
int virDomainVcpuPinDel(virDomainDefPtr def, int vcpu);
2345

2346 2347 2348 2349 2350 2351
int virDomainEmulatorPinAdd(virDomainDefPtr def,
                              unsigned char *cpumap,
                              int maplen);

int virDomainEmulatorPinDel(virDomainDefPtr def);

2352 2353
void virDomainRNGDefFree(virDomainRNGDefPtr def);

2354 2355 2356
int virDomainDiskIndexByName(virDomainDefPtr def, const char *name,
                             bool allow_ambiguous);
const char *virDomainDiskPathByName(virDomainDefPtr, const char *name);
2357 2358 2359 2360
int virDomainDiskInsert(virDomainDefPtr def,
                        virDomainDiskDefPtr disk);
void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
                                   virDomainDiskDefPtr disk);
2361 2362
int virDomainDiskDefAssignAddress(virDomainXMLOptionPtr xmlopt,
                                  virDomainDiskDefPtr def);
2363

2364 2365 2366 2367
virDomainDiskDefPtr
virDomainDiskRemove(virDomainDefPtr def, size_t i);
virDomainDiskDefPtr
virDomainDiskRemoveByName(virDomainDefPtr def, const char *name);
E
Eric Blake 已提交
2368
bool virDomainHasDiskMirror(virDomainObjPtr vm);
2369

2370 2371
int virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net);
virDomainNetDefPtr virDomainNetFind(virDomainDefPtr def, const char *device);
2372
int virDomainNetInsert(virDomainDefPtr def, virDomainNetDefPtr net);
2373
virDomainNetDefPtr virDomainNetRemove(virDomainDefPtr def, size_t i);
2374
void virDomainNetRemoveHostdev(virDomainDefPtr def, virDomainNetDefPtr net);
2375

L
Laine Stump 已提交
2376
int virDomainHostdevInsert(virDomainDefPtr def, virDomainHostdevDefPtr hostdev);
2377 2378
virDomainHostdevDefPtr
virDomainHostdevRemove(virDomainDefPtr def, size_t i);
L
Laine Stump 已提交
2379 2380 2381
int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
                         virDomainHostdevDefPtr *found);

2382
int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
2383
            ATTRIBUTE_NONNULL(1);
2384
int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t i, int val)
2385 2386
            ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
2387
                                              size_t i)
2388 2389
            ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
2390
                                      size_t i, const char *address,
2391 2392 2393
                                      int len, bool setType)
            ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
2394
                                              size_t i)
2395 2396
            ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
2397
                                      size_t i, const char *network, int len)
2398 2399
            ATTRIBUTE_NONNULL(1);

2400
int virDomainNetGetActualType(virDomainNetDefPtr iface);
2401 2402
const char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface);
const char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface);
2403
int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface);
2404
virDomainHostdevDefPtr virDomainNetGetActualHostdev(virDomainNetDefPtr iface);
2405
virNetDevVPortProfilePtr
2406
virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface);
2407
virNetDevBandwidthPtr
2408
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
2409
virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface);
2410

2411 2412 2413 2414
int virDomainControllerInsert(virDomainDefPtr def,
                              virDomainControllerDefPtr controller);
void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
                                         virDomainControllerDefPtr controller);
2415 2416
int virDomainControllerFind(virDomainDefPtr def, int type, int idx);
virDomainControllerDefPtr virDomainControllerRemove(virDomainDefPtr def, size_t i);
2417 2418 2419 2420 2421 2422 2423 2424

int virDomainLeaseIndex(virDomainDefPtr def,
                        virDomainLeaseDefPtr lease);
int virDomainLeaseInsert(virDomainDefPtr def,
                         virDomainLeaseDefPtr lease);
int virDomainLeaseInsertPreAlloc(virDomainDefPtr def);
void virDomainLeaseInsertPreAlloced(virDomainDefPtr def,
                                    virDomainLeaseDefPtr lease);
2425 2426 2427 2428 2429
virDomainLeaseDefPtr
virDomainLeaseRemoveAt(virDomainDefPtr def, size_t i);
virDomainLeaseDefPtr
virDomainLeaseRemove(virDomainDefPtr def,
                     virDomainLeaseDefPtr lease);
2430

2431 2432 2433 2434 2435 2436 2437 2438
void
virDomainChrGetDomainPtrs(virDomainDefPtr vmdef,
                          virDomainChrDefPtr chr,
                          virDomainChrDefPtr ***arrPtr,
                          size_t **cntPtr);
virDomainChrDefPtr
virDomainChrFind(virDomainDefPtr def,
                 virDomainChrDefPtr target);
2439 2440 2441
bool
virDomainChrEquals(virDomainChrDefPtr src,
                   virDomainChrDefPtr tgt);
2442 2443 2444 2445 2446 2447 2448
int
virDomainChrInsert(virDomainDefPtr vmdef,
                   virDomainChrDefPtr chr);
virDomainChrDefPtr
virDomainChrRemove(virDomainDefPtr vmdef,
                   virDomainChrDefPtr chr);

2449
int virDomainSaveXML(const char *configDir,
2450 2451 2452
                     virDomainDefPtr def,
                     const char *xml);

2453
int virDomainSaveConfig(const char *configDir,
2454
                        virDomainDefPtr def);
2455
int virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
2456
                        const char *statusDir,
2457
                        virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
2458

2459 2460 2461 2462
typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
                                          int newDomain,
                                          void *opaque);

2463 2464 2465 2466
int virDomainObjListLoadAllConfigs(virDomainObjListPtr doms,
                                   const char *configDir,
                                   const char *autostartDir,
                                   int liveStatus,
2467 2468
                                   virCapsPtr caps,
                                   virDomainXMLOptionPtr xmlopt,
2469 2470 2471
                                   unsigned int expectedVirtTypes,
                                   virDomainLoadConfigNotify notify,
                                   void *opaque);
2472

2473
int virDomainDeleteConfig(const char *configDir,
2474
                          const char *autostartDir,
2475 2476
                          virDomainObjPtr dom);

2477
char *virDomainConfigFile(const char *dir,
2478 2479
                          const char *name);

2480 2481 2482 2483
int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
                                int *busIdx,
                                int *devIdx);

2484
virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def);
2485
int virDomainFSIndexByName(virDomainDefPtr def, const char *name);
2486 2487
int virDomainVideoDefaultType(virDomainDefPtr def);
int virDomainVideoDefaultRAM(virDomainDefPtr def, int type);
2488

2489 2490 2491 2492
int virDomainObjListNumOfDomains(virDomainObjListPtr doms,
                                 bool active,
                                 virDomainObjListFilter filter,
                                 virConnectPtr conn);
2493 2494 2495

int virDomainObjListGetActiveIDs(virDomainObjListPtr doms,
                                 int *ids,
2496 2497 2498
                                 int maxids,
                                 virDomainObjListFilter filter,
                                 virConnectPtr conn);
2499 2500
int virDomainObjListGetInactiveNames(virDomainObjListPtr doms,
                                     char **const names,
2501 2502 2503
                                     int maxnames,
                                     virDomainObjListFilter filter,
                                     virConnectPtr conn);
2504

2505 2506 2507 2508 2509 2510 2511
typedef int (*virDomainObjListIterator)(virDomainObjPtr dom,
                                        void *opaque);

int virDomainObjListForEach(virDomainObjListPtr doms,
                            virDomainObjListIterator callback,
                            void *opaque);

E
Eric Blake 已提交
2512 2513 2514 2515 2516 2517 2518 2519 2520
typedef int (*virDomainSmartcardDefIterator)(virDomainDefPtr def,
                                             virDomainSmartcardDefPtr dev,
                                             void *opaque);

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

2521 2522 2523 2524 2525 2526 2527 2528 2529
typedef int (*virDomainChrDefIterator)(virDomainDefPtr def,
                                       virDomainChrDefPtr dev,
                                       void *opaque);

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

2530 2531 2532 2533 2534 2535 2536 2537 2538 2539
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 已提交
2540 2541 2542 2543 2544 2545 2546
void
virDomainObjSetState(virDomainObjPtr obj, virDomainState state, int reason)
        ATTRIBUTE_NONNULL(1);
virDomainState
virDomainObjGetState(virDomainObjPtr obj, int *reason)
        ATTRIBUTE_NONNULL(1);

2547 2548 2549 2550 2551 2552
virSecurityLabelDefPtr
virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model);

virSecurityDeviceLabelDefPtr
virDomainDiskDefGetSecurityLabelDef(virDomainDiskDefPtr def, const char *model);

2553 2554 2555
virSecurityDeviceLabelDefPtr
virDomainChrDefGetSecurityLabelDef(virDomainChrDefPtr def, const char *model);

2556
virSecurityLabelDefPtr
2557
virDomainDefGenSecurityLabelDef(const char *model);
2558

2559
virSecurityDeviceLabelDefPtr
2560 2561 2562 2563
virDomainDiskDefGenSecurityLabelDef(const char *model);

void virSecurityLabelDefFree(virSecurityLabelDefPtr def);
void virSecurityDeviceLabelDefFree(virSecurityDeviceLabelDefPtr def);
2564

2565 2566
typedef const char* (*virEventActionToStringFunc)(int type);
typedef int (*virEventActionFromStringFunc)(const char *type);
2567

2568 2569
VIR_ENUM_DECL(virDomainTaint)

2570 2571
VIR_ENUM_DECL(virDomainVirt)
VIR_ENUM_DECL(virDomainBoot)
2572
VIR_ENUM_DECL(virDomainBootMenu)
2573
VIR_ENUM_DECL(virDomainFeature)
2574
VIR_ENUM_DECL(virDomainFeatureState)
2575
VIR_ENUM_DECL(virDomainLifecycle)
2576
VIR_ENUM_DECL(virDomainLifecycleCrash)
2577
VIR_ENUM_DECL(virDomainPMState)
2578
VIR_ENUM_DECL(virDomainDevice)
2579
VIR_ENUM_DECL(virDomainDeviceAddress)
2580 2581
VIR_ENUM_DECL(virDomainDisk)
VIR_ENUM_DECL(virDomainDiskDevice)
J
J.B. Joret 已提交
2582
VIR_ENUM_DECL(virDomainDiskGeometryTrans)
2583
VIR_ENUM_DECL(virDomainDiskBus)
2584
VIR_ENUM_DECL(virDomainDiskCache)
2585
VIR_ENUM_DECL(virDomainDiskErrorPolicy)
M
MORITA Kazutaka 已提交
2586
VIR_ENUM_DECL(virDomainDiskProtocol)
2587
VIR_ENUM_DECL(virDomainDiskProtocolTransport)
M
Matthias Dahl 已提交
2588
VIR_ENUM_DECL(virDomainDiskIo)
2589
VIR_ENUM_DECL(virDomainDiskSecretType)
2590
VIR_ENUM_DECL(virDomainDeviceSGIO)
2591
VIR_ENUM_DECL(virDomainDiskTray)
O
Osier Yang 已提交
2592
VIR_ENUM_DECL(virDomainDiskDiscard)
2593
VIR_ENUM_DECL(virDomainDiskSourcePoolMode)
2594
VIR_ENUM_DECL(virDomainIoEventFd)
2595
VIR_ENUM_DECL(virDomainVirtioEventIdx)
O
Osier Yang 已提交
2596
VIR_ENUM_DECL(virDomainDiskCopyOnRead)
2597
VIR_ENUM_DECL(virDomainController)
J
Ján Tomko 已提交
2598
VIR_ENUM_DECL(virDomainControllerModelPCI)
2599
VIR_ENUM_DECL(virDomainControllerModelSCSI)
M
Marc-André Lureau 已提交
2600
VIR_ENUM_DECL(virDomainControllerModelUSB)
2601
VIR_ENUM_DECL(virDomainFS)
2602
VIR_ENUM_DECL(virDomainFSDriverType)
2603
VIR_ENUM_DECL(virDomainFSAccessMode)
2604
VIR_ENUM_DECL(virDomainFSWrpolicy)
2605
VIR_ENUM_DECL(virDomainNet)
2606
VIR_ENUM_DECL(virDomainNetBackend)
2607
VIR_ENUM_DECL(virDomainNetVirtioTxMode)
2608
VIR_ENUM_DECL(virDomainNetInterfaceLinkState)
2609
VIR_ENUM_DECL(virDomainChrDevice)
2610
VIR_ENUM_DECL(virDomainChrChannelTarget)
2611
VIR_ENUM_DECL(virDomainChrConsoleTarget)
G
Guannan Ren 已提交
2612
VIR_ENUM_DECL(virDomainChrSerialTarget)
E
Eric Blake 已提交
2613
VIR_ENUM_DECL(virDomainSmartcard)
2614
VIR_ENUM_DECL(virDomainChr)
2615
VIR_ENUM_DECL(virDomainChrTcpProtocol)
E
Eric Blake 已提交
2616
VIR_ENUM_DECL(virDomainChrSpicevmc)
2617
VIR_ENUM_DECL(virDomainSoundCodec)
2618
VIR_ENUM_DECL(virDomainSoundModel)
2619
VIR_ENUM_DECL(virDomainMemDump)
2620
VIR_ENUM_DECL(virDomainMemballoonModel)
2621
VIR_ENUM_DECL(virDomainSmbiosMode)
R
Richard Jones 已提交
2622 2623
VIR_ENUM_DECL(virDomainWatchdogModel)
VIR_ENUM_DECL(virDomainWatchdogAction)
2624
VIR_ENUM_DECL(virDomainVideo)
2625 2626
VIR_ENUM_DECL(virDomainHostdevMode)
VIR_ENUM_DECL(virDomainHostdevSubsys)
2627
VIR_ENUM_DECL(virDomainHostdevCaps)
2628
VIR_ENUM_DECL(virDomainPciRombarMode)
M
Marc-André Lureau 已提交
2629
VIR_ENUM_DECL(virDomainHub)
2630
VIR_ENUM_DECL(virDomainRedirdevBus)
2631 2632 2633
VIR_ENUM_DECL(virDomainInput)
VIR_ENUM_DECL(virDomainInputBus)
VIR_ENUM_DECL(virDomainGraphics)
2634
VIR_ENUM_DECL(virDomainGraphicsListen)
2635
VIR_ENUM_DECL(virDomainGraphicsAuthConnected)
2636 2637
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelName)
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelMode)
2638 2639 2640 2641
VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceJpegCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
VIR_ENUM_DECL(virDomainGraphicsSpicePlaybackCompression)
2642
VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
2643
VIR_ENUM_DECL(virDomainGraphicsSpiceClipboardCopypaste)
P
Peng Zhou 已提交
2644
VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode)
2645
VIR_ENUM_DECL(virDomainGraphicsVNCSharePolicy)
2646
VIR_ENUM_DECL(virDomainHyperv)
2647 2648
VIR_ENUM_DECL(virDomainRNGModel)
VIR_ENUM_DECL(virDomainRNGBackend)
2649 2650
VIR_ENUM_DECL(virDomainTPMModel)
VIR_ENUM_DECL(virDomainTPMBackend)
2651 2652
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState)
J
Jiri Denemark 已提交
2653 2654 2655 2656 2657 2658 2659
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)
2660
VIR_ENUM_DECL(virDomainPMSuspendedReason)
J
Jiri Denemark 已提交
2661 2662 2663 2664

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

2665
VIR_ENUM_DECL(virDomainSeclabel)
2666
VIR_ENUM_DECL(virDomainClockOffset)
2667
VIR_ENUM_DECL(virDomainClockBasis)
2668

2669
VIR_ENUM_DECL(virDomainTimerName)
2670
VIR_ENUM_DECL(virDomainTimerTrack)
2671 2672
VIR_ENUM_DECL(virDomainTimerTickpolicy)
VIR_ENUM_DECL(virDomainTimerMode)
O
Osier Yang 已提交
2673
VIR_ENUM_DECL(virDomainCpuPlacementMode)
2674

2675
VIR_ENUM_DECL(virDomainStartupPolicy)
2676

O
Osier Yang 已提交
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710
# define VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE   \
                (VIR_CONNECT_LIST_DOMAINS_ACTIVE | \
                 VIR_CONNECT_LIST_DOMAINS_INACTIVE)

# define VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT   \
                (VIR_CONNECT_LIST_DOMAINS_PERSISTENT | \
                 VIR_CONNECT_LIST_DOMAINS_TRANSIENT)

# define VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE     \
                (VIR_CONNECT_LIST_DOMAINS_RUNNING | \
                 VIR_CONNECT_LIST_DOMAINS_PAUSED  | \
                 VIR_CONNECT_LIST_DOMAINS_SHUTOFF | \
                 VIR_CONNECT_LIST_DOMAINS_OTHER)

# define VIR_CONNECT_LIST_DOMAINS_FILTERS_MANAGEDSAVE   \
                (VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE | \
                 VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE)

# define VIR_CONNECT_LIST_DOMAINS_FILTERS_AUTOSTART   \
                (VIR_CONNECT_LIST_DOMAINS_AUTOSTART | \
                 VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)

# define VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT       \
                (VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT | \
                 VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT)

# define VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL                   \
                (VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE      | \
                 VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT  | \
                 VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE       | \
                 VIR_CONNECT_LIST_DOMAINS_FILTERS_MANAGEDSAVE | \
                 VIR_CONNECT_LIST_DOMAINS_FILTERS_AUTOSTART   | \
                 VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT)

2711 2712 2713
int virDomainObjListExport(virDomainObjListPtr doms,
                           virConnectPtr conn,
                           virDomainPtr **domains,
2714
                           virDomainObjListFilter filter,
2715
                           unsigned int flags);
O
Osier Yang 已提交
2716

2717 2718 2719
virDomainVcpuPinDefPtr virDomainLookupVcpuPin(virDomainDefPtr def,
                                              int vcpuid);

2720 2721 2722 2723 2724 2725
int
virDomainDefMaybeAddController(virDomainDefPtr def,
                               int type,
                               int idx,
                               int model);

2726 2727
char *virDomainDefGetDefaultEmulator(virDomainDefPtr def, virCapsPtr caps);

2728 2729
int virDomainDefFindDevice(virDomainDefPtr def,
                           const char *devAlias,
2730 2731
                           virDomainDeviceDefPtr dev,
                           bool reportError);
2732

2733 2734 2735
bool virDomainDiskSourceIsBlockType(virDomainDiskDefPtr def)
    ATTRIBUTE_NONNULL(1);

2736 2737
void virDomainChrSourceDefClear(virDomainChrSourceDefPtr def);

2738
#endif /* __DOMAIN_CONF_H */