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

#ifndef __DOMAIN_CONF_H
26
# define __DOMAIN_CONF_H
27

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

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

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
/* forward declarations of all device types, required by
 * virDomainDeviceDef
 */
typedef struct _virDomainDiskDef virDomainDiskDef;
typedef virDomainDiskDef *virDomainDiskDefPtr;

typedef struct _virDomainControllerDef virDomainControllerDef;
typedef virDomainControllerDef *virDomainControllerDefPtr;

typedef struct _virDomainLeaseDef virDomainLeaseDef;
typedef virDomainLeaseDef *virDomainLeaseDefPtr;

typedef struct _virDomainFSDef virDomainFSDef;
typedef virDomainFSDef *virDomainFSDefPtr;

typedef struct _virDomainNetDef virDomainNetDef;
typedef virDomainNetDef *virDomainNetDefPtr;

typedef struct _virDomainInputDef virDomainInputDef;
typedef virDomainInputDef *virDomainInputDefPtr;

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

79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
typedef struct _virDomainSoundDef virDomainSoundDef;
typedef virDomainSoundDef *virDomainSoundDefPtr;

typedef struct _virDomainVideoDef virDomainVideoDef;
typedef virDomainVideoDef *virDomainVideoDefPtr;

typedef struct _virDomainHostdevDef virDomainHostdevDef;
typedef virDomainHostdevDef *virDomainHostdevDefPtr;

typedef struct _virDomainWatchdogDef virDomainWatchdogDef;
typedef virDomainWatchdogDef *virDomainWatchdogDefPtr;

typedef struct _virDomainGraphicsDef virDomainGraphicsDef;
typedef virDomainGraphicsDef *virDomainGraphicsDefPtr;

typedef struct _virDomainHubDef virDomainHubDef;
typedef virDomainHubDef *virDomainHubDefPtr;

typedef struct _virDomainRedirdevDef virDomainRedirdevDef;
typedef virDomainRedirdevDef *virDomainRedirdevDefPtr;

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

typedef struct _virDomainRedirFilterDef virDomainRedirFilterDef;
typedef virDomainRedirFilterDef *virDomainRedirFilterDefPtr;

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

typedef struct _virDomainChrDef virDomainChrDef;
typedef virDomainChrDef *virDomainChrDefPtr;

typedef struct _virDomainMemballoonDef virDomainMemballoonDef;
typedef virDomainMemballoonDef *virDomainMemballoonDefPtr;

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

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

typedef struct _virDomainSnapshotObjList virDomainSnapshotObjList;
typedef virDomainSnapshotObjList *virDomainSnapshotObjListPtr;

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

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

typedef struct _virDomainIdMapDef virDomainIdMapDef;
typedef virDomainIdMapDef *virDomainIdMapDefPtr;

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

M
Michele Paolino 已提交
136 137 138 139 140 141
/* forward declarations virDomainChrSourceDef, required by
 * virDomainNetDef
 */
typedef struct _virDomainChrSourceDef virDomainChrSourceDef;
typedef virDomainChrSourceDef *virDomainChrSourceDefPtr;

142 143 144
typedef struct _virDomainShmemDef virDomainShmemDef;
typedef virDomainShmemDef *virDomainShmemDefPtr;

145 146 147
typedef struct _virDomainTPMDef virDomainTPMDef;
typedef virDomainTPMDef *virDomainTPMDefPtr;

148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
/* 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 已提交
167
    VIR_DOMAIN_DEVICE_NVRAM,
168
    VIR_DOMAIN_DEVICE_RNG,
169
    VIR_DOMAIN_DEVICE_SHMEM,
170
    VIR_DOMAIN_DEVICE_TPM,
171
    VIR_DOMAIN_DEVICE_PANIC,
172

173
    VIR_DOMAIN_DEVICE_LAST
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
} 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 已提交
197
        virDomainNVRAMDefPtr nvram;
198
        virDomainRNGDefPtr rng;
199
        virDomainShmemDefPtr shmem;
200
        virDomainTPMDefPtr tpm;
201
        virDomainPanicDefPtr panic;
202 203 204
    } data;
};

205 206
/* Different types of hypervisor */
/* NB: Keep in sync with virDomainVirtTypeToString impl */
207
typedef enum {
208 209 210 211 212 213 214 215 216 217
    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,
218
    VIR_DOMAIN_VIRT_VBOX,
219
    VIR_DOMAIN_VIRT_PHYP,
D
Dmitry Guryanov 已提交
220
    VIR_DOMAIN_VIRT_PARALLELS,
R
Roman Bogorodskiy 已提交
221
    VIR_DOMAIN_VIRT_BHYVE,
222

223
    VIR_DOMAIN_VIRT_LAST
224
} virDomainVirtType;
225

226
typedef enum {
227 228
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
229
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE,
230
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL,
E
Eric Blake 已提交
231
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID,
232
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB,
233
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
234
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
235
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
236
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO,
H
Hu Tao 已提交
237
    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA,
238 239

    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
240
} virDomainDeviceAddressType;
241

242 243 244 245 246
typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
struct _virDomainDeviceDriveAddress {
    unsigned int controller;
    unsigned int bus;
247
    unsigned int target;
248 249 250
    unsigned int unit;
};

251 252 253 254 255
typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress;
typedef virDomainDeviceVirtioSerialAddress *virDomainDeviceVirtioSerialAddressPtr;
struct _virDomainDeviceVirtioSerialAddress {
    unsigned int controller;
    unsigned int bus;
256
    unsigned int port;
257 258
};

259 260 261 262 263 264 265 266 267 268 269 270 271
# 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 已提交
272 273 274 275 276 277 278
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
typedef virDomainDeviceCcidAddress *virDomainDeviceCcidAddressPtr;
struct _virDomainDeviceCcidAddress {
    unsigned int controller;
    unsigned int slot;
};

279 280 281 282
typedef struct _virDomainDeviceUSBAddress virDomainDeviceUSBAddress;
typedef virDomainDeviceUSBAddress *virDomainDeviceUSBAddressPtr;
struct _virDomainDeviceUSBAddress {
    unsigned int bus;
283
    char *port;
284 285
};

286 287 288 289 290 291 292
typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress;
typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr;
struct _virDomainDeviceSpaprVioAddress {
    unsigned long long reg;
    bool has_reg;
};

293
typedef enum {
294 295 296 297
    VIR_DOMAIN_CONTROLLER_MASTER_NONE,
    VIR_DOMAIN_CONTROLLER_MASTER_USB,

    VIR_DOMAIN_CONTROLLER_MASTER_LAST
298
} virDomainControllerMaster;
299 300 301 302 303 304 305

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

H
Hu Tao 已提交
306 307 308 309 310 311 312
typedef struct _virDomainDeviceISAAddress virDomainDeviceISAAddress;
typedef virDomainDeviceISAAddress *virDomainDeviceISAAddressPtr;
struct _virDomainDeviceISAAddress {
    unsigned int iobase;
    unsigned int irq;
};

313 314 315
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
struct _virDomainDeviceInfo {
316 317 318 319
    /* If adding to this struct, ensure that
     * virDomainDeviceInfoIsSet() is updated
     * to consider the new fields
     */
D
Daniel P. Berrange 已提交
320
    char *alias;
321
    int type; /* virDomainDeviceAddressType */
322
    union {
323
        virDevicePCIAddress pci;
324
        virDomainDeviceDriveAddress drive;
325
        virDomainDeviceVirtioSerialAddress vioserial;
E
Eric Blake 已提交
326
        virDomainDeviceCcidAddress ccid;
327
        virDomainDeviceUSBAddress usb;
328
        virDomainDeviceSpaprVioAddress spaprvio;
329
        virDomainDeviceCCWAddress ccw;
H
Hu Tao 已提交
330
        virDomainDeviceISAAddress isa;
331
    } addr;
332 333 334 335
    int mastertype;
    union {
        virDomainDeviceUSBMaster usb;
    } master;
336 337
    /* rombar and romfile are only used for pci hostdev and network
     * devices. */
J
Ján Tomko 已提交
338
    int rombar;         /* enum virTristateSwitch */
339
    char *romfile;
340 341
    /* bootIndex is only used for disk, network interface, hostdev
     * and redirdev devices */
342
    int bootIndex;
343 344
};

345

346 347 348 349 350 351 352 353
typedef struct _virDomainHostdevOrigStates virDomainHostdevOrigStates;
typedef virDomainHostdevOrigStates *virDomainHostdevOrigStatesPtr;
struct _virDomainHostdevOrigStates {
    union {
        struct {
            /* Does the device need to unbind from stub when
             * reattaching to host?
             */
354
            bool unbind_from_stub;
355 356 357 358

            /* Does it need to use remove_slot when reattaching
             * the device to host?
             */
359
            bool remove_slot;
360 361 362 363

            /* Does it need to reprobe driver for the device when
             * reattaching to host?
             */
364
            bool reprobe;
365 366 367 368 369 370
        } pci;

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

371 372 373 374 375 376 377
struct _virDomainLeaseDef {
    char *lockspace;
    char *key;
    char *path;
    unsigned long long offset;
};

378

379
typedef enum {
380 381 382
    VIR_DOMAIN_HOSTDEV_MODE_SUBSYS,
    VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES,

383
    VIR_DOMAIN_HOSTDEV_MODE_LAST
384
} virDomainHostdevMode;
385

386
typedef enum {
387 388
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
H
Han Cheng 已提交
389
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI,
390 391

    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
392
} virDomainHostdevSubsysType;
393

394 395
/* the backend driver used for PCI hostdev devices */
typedef enum {
396
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automaticaly, prefer VFIO */
397 398
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM,    /* force legacy kvm style */
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO,   /* force vfio */
399
    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN,    /* force legacy xen style, use pciback */
400 401

    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST
402
} virDomainHostdevSubsysPCIBackendType;
403

404
VIR_ENUM_DECL(virDomainHostdevSubsysPCIBackend)
405

406 407 408 409 410 411 412 413 414
typedef enum {
    VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE,
    VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI,

    VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST,
} virDomainHostdevSCSIProtocolType;

VIR_ENUM_DECL(virDomainHostdevSubsysSCSIProtocol)

415 416 417 418 419 420 421 422 423 424 425 426
typedef struct _virDomainHostdevSubsysUSB virDomainHostdevSubsysUSB;
typedef virDomainHostdevSubsysUSB *virDomainHostdevSubsysUSBPtr;
struct _virDomainHostdevSubsysUSB {
    bool autoAddress; /* bus/device were filled automatically based
                         on vendor/product */
    unsigned bus;
    unsigned device;

    unsigned vendor;
    unsigned product;
};

427 428 429 430 431 432 433
typedef struct _virDomainHostdevSubsysPCI virDomainHostdevSubsysPCI;
typedef virDomainHostdevSubsysPCI *virDomainHostdevSubsysPCIPtr;
struct _virDomainHostdevSubsysPCI {
    virDevicePCIAddress addr; /* host address */
    int backend; /* enum virDomainHostdevSubsysPCIBackendType */
};

434 435 436
typedef struct _virDomainHostdevSubsysSCSIHost virDomainHostdevSubsysSCSIHost;
typedef virDomainHostdevSubsysSCSIHost *virDomainHostdevSubsysSCSIHostPtr;
struct _virDomainHostdevSubsysSCSIHost {
437 438 439 440
    char *adapter;
    unsigned bus;
    unsigned target;
    unsigned unit;
441 442
};

443 444 445 446 447 448 449 450 451
typedef struct _virDomainHostdevSubsysSCSIiSCSI virDomainHostdevSubsysSCSIiSCSI;
typedef virDomainHostdevSubsysSCSIiSCSI *virDomainHostdevSubsysSCSIiSCSIPtr;
struct _virDomainHostdevSubsysSCSIiSCSI {
    char *path;
    size_t nhosts;
    virStorageNetHostDefPtr hosts;
    virStorageAuthDefPtr auth;
};

452 453 454
typedef struct _virDomainHostdevSubsysSCSI virDomainHostdevSubsysSCSI;
typedef virDomainHostdevSubsysSCSI *virDomainHostdevSubsysSCSIPtr;
struct _virDomainHostdevSubsysSCSI {
455
    int protocol; /* enum virDomainHostdevSCSIProtocolType */
456
    int sgio; /* enum virDomainDeviceSGIO */
457
    int rawio; /* enum virTristateBool */
458 459
    union {
        virDomainHostdevSubsysSCSIHost host;
460
        virDomainHostdevSubsysSCSIiSCSI iscsi;
461
    } u;
462 463
};

464 465 466
typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
typedef virDomainHostdevSubsys *virDomainHostdevSubsysPtr;
struct _virDomainHostdevSubsys {
467
    int type; /* enum virDomainHostdevSubsysType */
468
    union {
469
        virDomainHostdevSubsysUSB usb;
470
        virDomainHostdevSubsysPCI pci;
471
        virDomainHostdevSubsysSCSI scsi;
472 473 474
    } u;
};

475

476
typedef enum {
477 478
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE,
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC,
479
    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET,
480 481

    VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST
482
} virDomainHostdevCapsType;
483

484 485 486 487 488 489 490
typedef struct _virDomainNetIpDef virDomainNetIpDef;
typedef virDomainNetIpDef *virDomainNetIpDefPtr;
struct _virDomainNetIpDef {
    virSocketAddr address;       /* ipv4 or ipv6 address */
    unsigned int prefix; /* number of 1 bits in the net mask */
};

491 492 493 494 495 496 497 498 499 500 501
typedef struct _virDomainHostdevCaps virDomainHostdevCaps;
typedef virDomainHostdevCaps *virDomainHostdevCapsPtr;
struct _virDomainHostdevCaps {
    int type; /* enum virDOmainHostdevCapsType */
    union {
        struct {
            char *block;
        } storage;
        struct {
            char *chardev;
        } misc;
502 503
        struct {
            char *iface;
504 505
            size_t nips;
            virDomainNetIpDefPtr *ips;
506
            size_t nroutes;
507
            virNetworkRouteDefPtr *routes;
508
        } net;
509 510 511 512
    } u;
};


513 514
/* basic device for direct passthrough */
struct _virDomainHostdevDef {
515
    virDomainDeviceDef parent; /* higher level Def containing this */
516
    int mode; /* enum virDomainHostdevMode */
517
    int startupPolicy; /* enum virDomainStartupPolicy */
518
    bool managed;
519
    bool missing;
O
Osier Yang 已提交
520
    bool readonly;
521
    bool shareable;
522
    union {
523
        virDomainHostdevSubsys subsys;
524
        virDomainHostdevCaps caps;
525 526
    } source;
    virDomainHostdevOrigStates origstates;
527
    virDomainDeviceInfoPtr info; /* Guest address */
528 529
};

530

E
Eric Blake 已提交
531 532
/* Types of disk frontend (guest view).  For backends (host view), see
 * virStorageType in util/virstoragefile.h */
533
typedef enum {
534 535 536
    VIR_DOMAIN_DISK_DEVICE_DISK,
    VIR_DOMAIN_DISK_DEVICE_CDROM,
    VIR_DOMAIN_DISK_DEVICE_FLOPPY,
537
    VIR_DOMAIN_DISK_DEVICE_LUN,
538 539

    VIR_DOMAIN_DISK_DEVICE_LAST
540
} virDomainDiskDevice;
541

542
typedef enum {
543 544 545 546 547
    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,
548
    VIR_DOMAIN_DISK_BUS_USB,
549
    VIR_DOMAIN_DISK_BUS_UML,
550
    VIR_DOMAIN_DISK_BUS_SATA,
551
    VIR_DOMAIN_DISK_BUS_SD,
552 553

    VIR_DOMAIN_DISK_BUS_LAST
554
} virDomainDiskBus;
555

556
typedef enum {
557 558 559 560
    VIR_DOMAIN_DISK_CACHE_DEFAULT,
    VIR_DOMAIN_DISK_CACHE_DISABLE,
    VIR_DOMAIN_DISK_CACHE_WRITETHRU,
    VIR_DOMAIN_DISK_CACHE_WRITEBACK,
561
    VIR_DOMAIN_DISK_CACHE_DIRECTSYNC,
562
    VIR_DOMAIN_DISK_CACHE_UNSAFE,
563 564

    VIR_DOMAIN_DISK_CACHE_LAST
565
} virDomainDiskCache;
566

567
typedef enum {
568 569
    VIR_DOMAIN_DISK_ERROR_POLICY_DEFAULT,
    VIR_DOMAIN_DISK_ERROR_POLICY_STOP,
570
    VIR_DOMAIN_DISK_ERROR_POLICY_REPORT,
571
    VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE,
572
    VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE,
573 574

    VIR_DOMAIN_DISK_ERROR_POLICY_LAST
575
} virDomainDiskErrorPolicy;
576

M
MORITA Kazutaka 已提交
577

578
typedef enum {
579 580 581 582
    VIR_DOMAIN_DISK_TRAY_CLOSED,
    VIR_DOMAIN_DISK_TRAY_OPEN,

    VIR_DOMAIN_DISK_TRAY_LAST
583
} virDomainDiskTray;
584

585
typedef enum {
J
J.B. Joret 已提交
586 587 588 589 590 591
    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
592
} virDomainDiskGeometryTrans;
J
J.B. Joret 已提交
593

594
typedef enum {
M
Matthias Dahl 已提交
595 596 597 598 599
    VIR_DOMAIN_DISK_IO_DEFAULT,
    VIR_DOMAIN_DISK_IO_NATIVE,
    VIR_DOMAIN_DISK_IO_THREADS,

    VIR_DOMAIN_DISK_IO_LAST
600
} virDomainDiskIo;
M
Matthias Dahl 已提交
601

602
typedef enum {
603 604 605 606 607 608
    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
609
} virDomainStartupPolicy;
610

611

612
typedef enum {
613 614 615
    VIR_DOMAIN_DEVICE_SGIO_DEFAULT = 0,
    VIR_DOMAIN_DEVICE_SGIO_FILTERED,
    VIR_DOMAIN_DEVICE_SGIO_UNFILTERED,
O
Osier Yang 已提交
616

617
    VIR_DOMAIN_DEVICE_SGIO_LAST
618
} virDomainDeviceSGIO;
O
Osier Yang 已提交
619

620
typedef enum {
O
Osier Yang 已提交
621
    VIR_DOMAIN_DISK_DISCARD_DEFAULT = 0,
O
Osier Yang 已提交
622 623
    VIR_DOMAIN_DISK_DISCARD_UNMAP,
    VIR_DOMAIN_DISK_DISCARD_IGNORE,
O
Osier Yang 已提交
624 625

    VIR_DOMAIN_DISK_DISCARD_LAST
626
} virDomainDiskDiscard;
O
Osier Yang 已提交
627

L
Lei Li 已提交
628 629 630 631 632 633 634 635
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;
636 637 638 639 640 641 642
    unsigned long long total_bytes_sec_max;
    unsigned long long read_bytes_sec_max;
    unsigned long long write_bytes_sec_max;
    unsigned long long total_iops_sec_max;
    unsigned long long read_iops_sec_max;
    unsigned long long write_iops_sec_max;
    unsigned long long size_iops_sec;
L
Lei Li 已提交
643 644 645
};
typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;

646

647 648 649 650 651 652 653 654 655 656
typedef enum {
    VIR_DOMAIN_DISK_MIRROR_STATE_NONE = 0, /* No job, or job still not synced */
    VIR_DOMAIN_DISK_MIRROR_STATE_READY, /* Job in second phase */
    VIR_DOMAIN_DISK_MIRROR_STATE_ABORT, /* Job aborted, waiting for event */
    VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT, /* Job pivoted, waiting for event */

    VIR_DOMAIN_DISK_MIRROR_STATE_LAST
} virDomainDiskMirrorState;


657 658
/* Stores the virtual disk configuration */
struct _virDomainDiskDef {
659
    virStorageSourcePtr src; /* non-NULL.  XXX Allow NULL for empty cdrom? */
660 661 662 663 664

    int device; /* enum virDomainDiskDevice */
    int bus; /* enum virDomainDiskBus */
    char *dst;
    int tray_status; /* enum virDomainDiskTray */
J
Ján Tomko 已提交
665
    int removable; /* enum virTristateSwitch */
L
Lei Li 已提交
666

667 668 669 670
    /* ideally we want a smarter way to interlock block jobs on single qemu disk
     * in the future, but for now we just disallow any concurrent job on a
     * single disk */
    bool blockjob;
671
    virStorageSourcePtr mirror;
672
    int mirrorState; /* enum virDomainDiskMirrorState */
E
Eric Blake 已提交
673
    int mirrorJob; /* virDomainBlockJobType */
674

J
J.B. Joret 已提交
675 676 677 678
    struct {
        unsigned int cylinders;
        unsigned int heads;
        unsigned int sectors;
679
        int trans; /* enum virDomainDiskGeometryTrans */
J
J.B. Joret 已提交
680 681
    } geometry;

682 683 684
    struct {
        unsigned int logical_block_size;
        unsigned int physical_block_size;
V
Viktor Mihajlovski 已提交
685
    } blockio;
686

L
Lei Li 已提交
687 688
    virDomainBlockIoTuneInfo blkdeviotune;

689
    char *serial;
O
Osier Yang 已提交
690
    char *wwn;
691 692
    char *vendor;
    char *product;
693
    int cachemode; /* enum virDomainDiskCache */
694 695
    int error_policy;  /* enum virDomainDiskErrorPolicy */
    int rerror_policy; /* enum virDomainDiskErrorPolicy */
696
    int iomode; /* enum virDomainDiskIo */
J
Ján Tomko 已提交
697 698 699
    int ioeventfd; /* enum virTristateSwitch */
    int event_idx; /* enum virTristateSwitch */
    int copy_on_read; /* enum virTristateSwitch */
700
    int snapshot; /* virDomainSnapshotLocation, snapshot_conf.h */
701
    int startupPolicy; /* enum virDomainStartupPolicy */
702
    bool transient;
703
    virDomainDeviceInfo info;
704
    int rawio; /* enum virTristateBool */
705
    int sgio; /* enum virDomainDeviceSGIO */
O
Osier Yang 已提交
706
    int discard; /* enum virDomainDiskDiscard */
707
    unsigned int iothread; /* unused = 0, > 0 specific thread # */
708
    char *domain_name; /* backend domain name */
709 710 711
};


712
typedef enum {
713 714 715 716
    VIR_DOMAIN_CONTROLLER_TYPE_IDE,
    VIR_DOMAIN_CONTROLLER_TYPE_FDC,
    VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
    VIR_DOMAIN_CONTROLLER_TYPE_SATA,
717
    VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
E
Eric Blake 已提交
718
    VIR_DOMAIN_CONTROLLER_TYPE_CCID,
719
    VIR_DOMAIN_CONTROLLER_TYPE_USB,
J
Ján Tomko 已提交
720
    VIR_DOMAIN_CONTROLLER_TYPE_PCI,
721 722

    VIR_DOMAIN_CONTROLLER_TYPE_LAST
723
} virDomainControllerType;
724

725

726
typedef enum {
J
Ján Tomko 已提交
727
    VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT,
L
Laine Stump 已提交
728
    VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT,
J
Ján Tomko 已提交
729
    VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE,
730
    VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE,
J
Ján Tomko 已提交
731 732

    VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST
733
} virDomainControllerModelPCI;
J
Ján Tomko 已提交
734

735
typedef enum {
736 737 738 739 740
    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,
741
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
742
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI,
743
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078,
744

745
    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
746
} virDomainControllerModelSCSI;
747

748
typedef enum {
M
Marc-André Lureau 已提交
749 750 751 752 753 754 755 756 757
    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 已提交
758
    VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI,
759
    VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE,
M
Marc-André Lureau 已提交
760 761

    VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST
762
} virDomainControllerModelUSB;
M
Marc-André Lureau 已提交
763

764 765 766 767 768 769 770
typedef struct _virDomainVirtioSerialOpts virDomainVirtioSerialOpts;
typedef virDomainVirtioSerialOpts *virDomainVirtioSerialOptsPtr;
struct _virDomainVirtioSerialOpts {
    int ports;   /* -1 == undef */
    int vectors; /* -1 == undef */
};

771 772 773
typedef struct _virDomainPCIControllerOpts virDomainPCIControllerOpts;
typedef virDomainPCIControllerOpts *virDomainPCIControllerOptsPtr;
struct _virDomainPCIControllerOpts {
774 775 776 777
    bool pcihole64;
    unsigned long pcihole64size;
};

778 779 780
/* Stores the virtual disk controller configuration */
struct _virDomainControllerDef {
    int type;
781
    unsigned int idx;
782
    int model; /* -1 == undef */
783
    unsigned int queues;
784 785
    unsigned int cmd_per_lun;
    unsigned int max_sectors;
786 787
    union {
        virDomainVirtioSerialOpts vioserial;
788
        virDomainPCIControllerOpts pciopts;
789
    } opts;
790 791 792 793
    virDomainDeviceInfo info;
};


G
Giuseppe Scrivano 已提交
794
/* Types of disk backends */
795
typedef enum {
796 797 798 799 800 801
    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 */
802 803

    VIR_DOMAIN_FS_TYPE_LAST
804
} virDomainFSType;
805

806
/* Filesystem driver type */
807
typedef enum {
808 809 810
    VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT = 0,
    VIR_DOMAIN_FS_DRIVER_TYPE_PATH,
    VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE,
811
    VIR_DOMAIN_FS_DRIVER_TYPE_LOOP,
812
    VIR_DOMAIN_FS_DRIVER_TYPE_NBD,
D
Dmitry Guryanov 已提交
813
    VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP,
814 815

    VIR_DOMAIN_FS_DRIVER_TYPE_LAST
816
} virDomainFSDriverType;
817

818
/* Filesystem mount access mode  */
819
typedef enum {
820 821 822 823 824
    VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH,
    VIR_DOMAIN_FS_ACCESSMODE_MAPPED,
    VIR_DOMAIN_FS_ACCESSMODE_SQUASH,

    VIR_DOMAIN_FS_ACCESSMODE_LAST
825
} virDomainFSAccessMode;
826

827
/* Filesystem Write policy */
828
typedef enum {
829 830 831 832
    VIR_DOMAIN_FS_WRPOLICY_DEFAULT = 0,
    VIR_DOMAIN_FS_WRPOLICY_IMMEDIATE,

    VIR_DOMAIN_FS_WRPOLICY_LAST
833
} virDomainFSWrpolicy;
834

835 836 837
/* Allow 2 MB ram usage */
# define VIR_DOMAIN_FS_RAM_DEFAULT_USAGE (1024 * 2)

838 839
struct _virDomainFSDef {
    int type;
840 841
    int fsdriver; /* enum virDomainFSDriverType */
    int accessmode; /* enum virDomainFSAccessMode */
842
    int wrpolicy; /* enum virDomainFSWrpolicy */
843
    int format; /* virStorageFileFormat */
844
    unsigned long long usage; /* in bytes */
845 846
    char *src;
    char *dst;
847
    bool readonly;
848
    virDomainDeviceInfo info;
849 850
    unsigned long long space_hard_limit; /* in bytes */
    unsigned long long space_soft_limit; /* in bytes */
851
    bool symlinksResolved;
852 853 854
};


855
/* network config types */
856
typedef enum {
857 858
    VIR_DOMAIN_NET_TYPE_USER,
    VIR_DOMAIN_NET_TYPE_ETHERNET,
M
Michele Paolino 已提交
859
    VIR_DOMAIN_NET_TYPE_VHOSTUSER,
860 861 862 863 864
    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 已提交
865
    VIR_DOMAIN_NET_TYPE_INTERNAL,
866
    VIR_DOMAIN_NET_TYPE_DIRECT,
867
    VIR_DOMAIN_NET_TYPE_HOSTDEV,
868

869
    VIR_DOMAIN_NET_TYPE_LAST
870
} virDomainNetType;
871

872
/* the backend driver used for virtio interfaces */
873
typedef enum {
874 875 876 877
    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 */

878
    VIR_DOMAIN_NET_BACKEND_TYPE_LAST
879
} virDomainNetBackendType;
880

881
/* the TX algorithm used for virtio interfaces */
882
typedef enum {
883 884 885 886
    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,

887
    VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST
888
} virDomainNetVirtioTxModeType;
889

890
/* link interface states */
891
typedef enum {
892 893 894 895 896
        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
897
} virDomainNetInterfaceLinkState;
898

899 900 901 902 903 904 905 906 907 908 909 910
/* 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;
911
            int macTableManager; /* enum virNetworkBridgeMACTableManagerType */
912 913 914 915 916
        } bridge;
        struct {
            char *linkdev;
            int mode; /* enum virMacvtapMode from util/macvtap.h */
        } direct;
917 918 919
        struct {
            virDomainHostdevDef def;
        } hostdev;
920
    } data;
921
    virNetDevVPortProfilePtr virtPortProfile;
922
    virNetDevBandwidthPtr bandwidth;
923
    virNetDevVlan vlan;
924
    int trustGuestRxFilters; /* enum virTristateBool */
925
    unsigned int class_id; /* class ID for bandwidth 'floor' */
926 927
};

928 929
/* Stores the virtual network interface configuration */
struct _virDomainNetDef {
930
    virDomainNetType type;
931
    virMacAddr mac;
932
    char *model;
933 934
    union {
        struct {
935 936
            virDomainNetBackendType name; /* which driver backend to use */
            virDomainNetVirtioTxModeType txmode;
J
Ján Tomko 已提交
937 938
            virTristateSwitch ioeventfd;
            virTristateSwitch event_idx;
939
            unsigned int queues; /* Multiqueue virtio-net */
940 941 942 943 944 945 946
            struct {
                virTristateSwitch csum;
                virTristateSwitch gso;
                virTristateSwitch tso4;
                virTristateSwitch tso6;
                virTristateSwitch ecn;
                virTristateSwitch ufo;
947
                virTristateSwitch mrg_rxbuf;
948 949 950 951 952 953 954 955
            } host;
            struct {
                virTristateSwitch csum;
                virTristateSwitch tso4;
                virTristateSwitch tso6;
                virTristateSwitch ecn;
                virTristateSwitch ufo;
            } guest;
956 957
        } virtio;
    } driver;
958 959 960 961
    struct {
        char *tap;
        char *vhost;
    } backend;
962 963 964 965
    union {
        struct {
            char *dev;
        } ethernet;
M
Michele Paolino 已提交
966
        virDomainChrSourceDefPtr vhostuser;
967 968 969 970 971 972
        struct {
            char *address;
            int port;
        } socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */
        struct {
            char *name;
973 974 975 976 977 978 979 980 981 982
            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;
983 984 985 986
        } network;
        struct {
            char *brname;
        } bridge;
D
Daniel Veillard 已提交
987 988 989
        struct {
            char *name;
        } internal;
990 991
        struct {
            char *linkdev;
992
            int mode; /* enum virMacvtapMode from util/macvtap.h */
993
        } direct;
994 995 996
        struct {
            virDomainHostdevDef def;
        } hostdev;
997
    } data;
998 999
    /* virtPortProfile is used by network/bridge/direct/hostdev */
    virNetDevVPortProfilePtr virtPortProfile;
1000 1001 1002 1003
    struct {
        bool sndbuf_specified;
        unsigned long sndbuf;
    } tune;
1004
    char *script;
1005
    char *domain_name; /* backend domain name */
1006
    char *ifname;
1007 1008
    char *ifname_guest;
    char *ifname_guest_actual;
1009
    virDomainDeviceInfo info;
1010 1011
    char *filter;
    virNWFilterHashTablePtr filterparams;
1012
    virNetDevBandwidthPtr bandwidth;
1013
    virNetDevVlan vlan;
1014
    int trustGuestRxFilters; /* enum virTristateBool */
1015
    int linkstate;
1016 1017
    size_t nips;
    virDomainNetIpDefPtr *ips;
1018
    size_t nroutes;
1019
    virNetworkRouteDefPtr *routes;
1020 1021
};

E
Eric Blake 已提交
1022 1023 1024 1025
/* 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"

1026 1027 1028 1029 1030 1031 1032 1033 1034 1035
typedef enum {
    VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT = 0,
    VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED,
    VIR_DOMAIN_CHR_DEVICE_STATE_DISCONNECTED,

    VIR_DOMAIN_CHR_DEVICE_STATE_LAST
} virDomainChrDeviceState;

VIR_ENUM_DECL(virDomainChrDeviceState)

1036
typedef enum {
1037
    VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL = 0,
1038 1039
    VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL,
    VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE,
1040
    VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL,
1041

1042
    VIR_DOMAIN_CHR_DEVICE_TYPE_LAST
1043
} virDomainChrDeviceType;
1044

1045
typedef enum {
G
Guannan Ren 已提交
1046 1047 1048 1049
    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA = 0,
    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB,

    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST
1050
} virDomainChrSerialTargetType;
G
Guannan Ren 已提交
1051

1052
typedef enum {
1053 1054
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE = 0,
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD,
1055 1056
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,

1057
    VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST
1058
} virDomainChrChannelTargetType;
1059

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

1071
    VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST
1072
} virDomainChrConsoleTargetType;
1073

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

1089
    VIR_DOMAIN_CHR_TYPE_LAST
1090
} virDomainChrType;
1091

1092
typedef enum {
1093 1094
    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
} virDomainChrTcpProtocol;
1100

1101
typedef enum {
E
Eric Blake 已提交
1102 1103
    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
1107
} virDomainChrSpicevmcName;
E
Eric Blake 已提交
1108

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

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

    bool targetTypeAttr;
1149 1150 1151 1152
    int targetType; /* enum virDomainChrConsoleTargetType ||
                       enum virDomainChrChannelTargetType ||
                       enum virDomainChrSerialTargetType according to deviceType */

1153 1154 1155 1156 1157 1158
    union {
        int port; /* parallel, serial, console */
        virSocketAddrPtr addr; /* guestfwd */
        char *name; /* virtio */
    } target;

1159 1160
    virDomainChrDeviceState state;

1161
    virDomainChrSourceDef source;
1162 1163

    virDomainDeviceInfo info;
1164 1165 1166

    size_t nseclabels;
    virSecurityDeviceLabelDefPtr *seclabels;
1167 1168
};

1169
typedef enum {
E
Eric Blake 已提交
1170 1171 1172 1173
    VIR_DOMAIN_SMARTCARD_TYPE_HOST,
    VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES,
    VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH,

1174
    VIR_DOMAIN_SMARTCARD_TYPE_LAST
1175
} virDomainSmartcardType;
E
Eric Blake 已提交
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193

# 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 已提交
1194 1195 1196 1197 1198
struct _virDomainHubDef {
    int type;
    virDomainDeviceInfo info;
};

1199
typedef enum {
1200 1201 1202
    VIR_DOMAIN_TPM_MODEL_TIS,

    VIR_DOMAIN_TPM_MODEL_LAST
1203
} virDomainTPMModel;
1204

1205
typedef enum {
1206 1207 1208
    VIR_DOMAIN_TPM_TYPE_PASSTHROUGH,

    VIR_DOMAIN_TPM_TYPE_LAST
1209
} virDomainTPMBackendType;
1210 1211 1212 1213

# define VIR_DOMAIN_TPM_DEFAULT_DEVICE "/dev/tpm0"

struct _virDomainTPMDef {
1214
    virDomainTPMBackendType type;
1215
    virDomainDeviceInfo info;
1216
    virDomainTPMModel model;
1217 1218 1219 1220 1221 1222 1223
    union {
        struct {
            virDomainChrSourceDef source;
        } passthrough;
    } data;
};

1224
typedef enum {
1225 1226
    VIR_DOMAIN_INPUT_TYPE_MOUSE,
    VIR_DOMAIN_INPUT_TYPE_TABLET,
L
Li Zhang 已提交
1227
    VIR_DOMAIN_INPUT_TYPE_KBD,
1228

1229
    VIR_DOMAIN_INPUT_TYPE_LAST
1230
} virDomainInputType;
1231

1232
typedef enum {
1233 1234 1235 1236 1237
    VIR_DOMAIN_INPUT_BUS_PS2,
    VIR_DOMAIN_INPUT_BUS_USB,
    VIR_DOMAIN_INPUT_BUS_XEN,

    VIR_DOMAIN_INPUT_BUS_LAST
1238
} virDomainInputBus;
1239 1240 1241 1242

struct _virDomainInputDef {
    int type;
    int bus;
1243
    virDomainDeviceInfo info;
1244 1245
};

1246
typedef enum {
1247 1248 1249 1250
    VIR_DOMAIN_SOUND_CODEC_TYPE_DUPLEX,
    VIR_DOMAIN_SOUND_CODEC_TYPE_MICRO,

    VIR_DOMAIN_SOUND_CODEC_TYPE_LAST
1251
} virDomainSoundCodecType;
1252

1253
typedef enum {
1254 1255 1256
    VIR_DOMAIN_SOUND_MODEL_SB16,
    VIR_DOMAIN_SOUND_MODEL_ES1370,
    VIR_DOMAIN_SOUND_MODEL_PCSPK,
D
Daniel P. Berrange 已提交
1257
    VIR_DOMAIN_SOUND_MODEL_AC97,
1258
    VIR_DOMAIN_SOUND_MODEL_ICH6,
1259
    VIR_DOMAIN_SOUND_MODEL_ICH9,
1260
    VIR_DOMAIN_SOUND_MODEL_USB,
1261 1262

    VIR_DOMAIN_SOUND_MODEL_LAST
1263
} virDomainSoundModel;
1264

1265 1266 1267 1268 1269
struct _virDomainSoundCodecDef {
    int type;
    int cad;
};

1270 1271
struct _virDomainSoundDef {
    int model;
1272
    virDomainDeviceInfo info;
1273

1274
    size_t ncodecs;
1275
    virDomainSoundCodecDefPtr *codecs;
1276 1277
};

1278
typedef enum {
R
Richard Jones 已提交
1279 1280 1281 1282
    VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB,
    VIR_DOMAIN_WATCHDOG_MODEL_IB700,

    VIR_DOMAIN_WATCHDOG_MODEL_LAST
1283
} virDomainWatchdogModel;
R
Richard Jones 已提交
1284

1285
typedef enum {
R
Richard Jones 已提交
1286 1287 1288 1289
    VIR_DOMAIN_WATCHDOG_ACTION_RESET,
    VIR_DOMAIN_WATCHDOG_ACTION_SHUTDOWN,
    VIR_DOMAIN_WATCHDOG_ACTION_POWEROFF,
    VIR_DOMAIN_WATCHDOG_ACTION_PAUSE,
H
Hu Tao 已提交
1290
    VIR_DOMAIN_WATCHDOG_ACTION_DUMP,
R
Richard Jones 已提交
1291 1292 1293
    VIR_DOMAIN_WATCHDOG_ACTION_NONE,

    VIR_DOMAIN_WATCHDOG_ACTION_LAST
1294
} virDomainWatchdogAction;
R
Richard Jones 已提交
1295 1296 1297 1298

struct _virDomainWatchdogDef {
    int model;
    int action;
1299
    virDomainDeviceInfo info;
R
Richard Jones 已提交
1300 1301
};

1302

1303
typedef enum {
1304 1305 1306 1307 1308
    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,
1309
    VIR_DOMAIN_VIDEO_TYPE_QXL,
1310 1311

    VIR_DOMAIN_VIDEO_TYPE_LAST
1312
} virDomainVideoType;
1313 1314


1315 1316 1317
typedef struct _virDomainVideoAccelDef virDomainVideoAccelDef;
typedef virDomainVideoAccelDef *virDomainVideoAccelDefPtr;
struct _virDomainVideoAccelDef {
1318 1319
    bool support3d;
    bool support2d;
1320 1321 1322
};


1323 1324
struct _virDomainVideoDef {
    int type;
1325 1326
    unsigned int ram;  /* kibibytes (multiples of 1024) */
    unsigned int vram; /* kibibytes (multiples of 1024) */
1327
    unsigned int vgamem; /* kibibytes (multiples of 1024) */
1328
    unsigned int heads;
1329
    bool primary;
1330
    virDomainVideoAccelDefPtr accel;
1331
    virDomainDeviceInfo info;
1332 1333
};

1334
/* graphics console modes */
1335
typedef enum {
1336 1337
    VIR_DOMAIN_GRAPHICS_TYPE_SDL,
    VIR_DOMAIN_GRAPHICS_TYPE_VNC,
1338 1339
    VIR_DOMAIN_GRAPHICS_TYPE_RDP,
    VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
1340
    VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
1341

1342
    VIR_DOMAIN_GRAPHICS_TYPE_LAST
1343
} virDomainGraphicsType;
1344

1345
typedef enum {
1346 1347 1348 1349 1350 1351
    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
1352
} virDomainGraphicsVNCSharePolicy;
1353

1354
typedef enum {
1355 1356 1357 1358 1359 1360
    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
1361
} virDomainGraphicsAuthConnectedType;
1362

1363 1364 1365 1366
typedef struct _virDomainGraphicsAuthDef virDomainGraphicsAuthDef;
typedef virDomainGraphicsAuthDef *virDomainGraphicsAuthDefPtr;
struct _virDomainGraphicsAuthDef {
    char *passwd;
1367
    bool expires; /* Whether there is an expiry time set */
1368
    time_t validTo;  /* seconds since epoch */
1369
    int connected; /* action if connected */
1370 1371
};

1372
typedef enum {
1373 1374 1375 1376 1377 1378
    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 已提交
1379
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_SMARTCARD,
1380
    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_USBREDIR,
1381 1382

    VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST
1383
} virDomainGraphicsSpiceChannelName;
1384

1385
typedef enum {
1386 1387 1388 1389 1390
    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
1391
} virDomainGraphicsSpiceChannelMode;
1392

1393
typedef enum {
1394 1395 1396 1397 1398 1399 1400 1401 1402
    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
1403
} virDomainGraphicsSpiceImageCompression;
1404

1405
typedef enum {
1406 1407 1408 1409 1410 1411
    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
1412
} virDomainGraphicsSpiceJpegCompression;
1413

1414
typedef enum {
1415 1416 1417 1418 1419 1420
    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
1421
} virDomainGraphicsSpiceZlibCompression;
1422

1423
typedef enum {
P
Peng Zhou 已提交
1424 1425 1426 1427 1428
    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
1429
} virDomainGraphicsSpiceMouseMode;
P
Peng Zhou 已提交
1430

1431
typedef enum {
1432 1433 1434 1435 1436 1437
    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
1438
} virDomainGraphicsSpiceStreamingMode;
1439

1440
typedef enum {
1441 1442 1443 1444
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE = 0,
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS,
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK,

1445
    VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST
1446
} virDomainGraphicsListenType;
1447

1448
typedef enum {
M
Marc-André Lureau 已提交
1449 1450
    VIR_DOMAIN_HUB_TYPE_USB,

1451
    VIR_DOMAIN_HUB_TYPE_LAST
1452
} virDomainHubType;
M
Marc-André Lureau 已提交
1453

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

1463
struct _virDomainGraphicsDef {
M
Michal Privoznik 已提交
1464 1465 1466 1467 1468
    /* 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.
     */
1469 1470 1471 1472
    int type;
    union {
        struct {
            int port;
1473
            bool portReserved;
M
Martin Kletzander 已提交
1474
            int websocket;
1475
            bool autoport;
1476
            char *keymap;
1477
            char *socket;
1478
            virDomainGraphicsAuthDef auth;
1479
            int sharePolicy;
1480 1481 1482 1483
        } vnc;
        struct {
            char *display;
            char *xauth;
1484
            bool fullscreen;
1485
        } sdl;
1486 1487
        struct {
            int port;
1488 1489 1490
            bool autoport;
            bool replaceUser;
            bool multiUser;
1491 1492 1493
        } rdp;
        struct {
            char *display;
1494
            bool fullscreen;
1495
        } desktop;
1496 1497 1498
        struct {
            int port;
            int tlsPort;
1499 1500
            bool portReserved;
            bool tlsPortReserved;
P
Peng Zhou 已提交
1501
            int mousemode;
1502
            char *keymap;
1503
            virDomainGraphicsAuthDef auth;
1504
            bool autoport;
1505
            int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
1506
            int defaultMode; /* enum virDomainGraphicsSpiceChannelMode */
1507 1508 1509 1510
            int image;
            int jpeg;
            int zlib;
            int playback;
1511
            int streaming;
J
Ján Tomko 已提交
1512 1513
            int copypaste; /* enum virTristateBool */
            int filetransfer; /* enum virTristateBool */
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
typedef enum {
1524 1525 1526
    VIR_DOMAIN_REDIRDEV_BUS_USB,

    VIR_DOMAIN_REDIRDEV_BUS_LAST
1527
} virDomainRedirdevBus;
1528 1529 1530 1531 1532 1533 1534 1535 1536 1537

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

    union {
        virDomainChrSourceDef chr;
    } source;

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

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

struct _virDomainRedirFilterDef {
    size_t nusbdevs;
1549
    virDomainRedirFilterUSBDevDefPtr *usbdevs;
1550 1551
};

1552 1553 1554
enum {
    VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO,
    VIR_DOMAIN_MEMBALLOON_MODEL_XEN,
1555
    VIR_DOMAIN_MEMBALLOON_MODEL_NONE,
1556 1557 1558 1559 1560 1561 1562

    VIR_DOMAIN_MEMBALLOON_MODEL_LAST
};

struct _virDomainMemballoonDef {
    int model;
    virDomainDeviceInfo info;
1563
    unsigned int period; /* seconds between collections */
1564 1565
};

L
Li Zhang 已提交
1566 1567 1568
struct _virDomainNVRAMDef {
    virDomainDeviceInfo info;
};
1569

1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584
struct _virDomainShmemDef {
    char *name;
    unsigned long long size;
    struct {
        bool enabled;
        char *path;
    } server;
    struct {
        bool enabled;
        unsigned vectors;
        virTristateSwitch ioeventfd;
    } msi;
    virDomainDeviceInfo info;
};

1585
typedef enum {
1586
    VIR_DOMAIN_SMBIOS_NONE = 0,
1587 1588 1589 1590 1591
    VIR_DOMAIN_SMBIOS_EMULATE,
    VIR_DOMAIN_SMBIOS_HOST,
    VIR_DOMAIN_SMBIOS_SYSINFO,

    VIR_DOMAIN_SMBIOS_LAST
1592
} virDomainSmbiosMode;
1593

1594

1595
# define VIR_DOMAIN_MAX_BOOT_DEVS 4
1596

1597
typedef enum {
1598 1599 1600 1601 1602
    VIR_DOMAIN_BOOT_FLOPPY,
    VIR_DOMAIN_BOOT_CDROM,
    VIR_DOMAIN_BOOT_DISK,
    VIR_DOMAIN_BOOT_NET,

1603
    VIR_DOMAIN_BOOT_LAST
1604
} virDomainBootOrder;
1605

1606
typedef enum {
1607 1608 1609
    VIR_DOMAIN_FEATURE_ACPI,
    VIR_DOMAIN_FEATURE_APIC,
    VIR_DOMAIN_FEATURE_PAE,
J
Jim Fehlig 已提交
1610
    VIR_DOMAIN_FEATURE_HAP,
1611
    VIR_DOMAIN_FEATURE_VIRIDIAN,
1612
    VIR_DOMAIN_FEATURE_PRIVNET,
1613
    VIR_DOMAIN_FEATURE_HYPERV,
1614
    VIR_DOMAIN_FEATURE_KVM,
1615
    VIR_DOMAIN_FEATURE_PVSPINLOCK,
1616
    VIR_DOMAIN_FEATURE_CAPABILITIES,
1617
    VIR_DOMAIN_FEATURE_PMU,
1618 1619

    VIR_DOMAIN_FEATURE_LAST
1620
} virDomainFeature;
1621

1622
typedef enum {
1623
    VIR_DOMAIN_HYPERV_RELAXED = 0,
1624 1625
    VIR_DOMAIN_HYPERV_VAPIC,
    VIR_DOMAIN_HYPERV_SPINLOCKS,
1626 1627

    VIR_DOMAIN_HYPERV_LAST
1628
} virDomainHyperv;
1629

1630 1631 1632 1633 1634 1635
typedef enum {
    VIR_DOMAIN_KVM_HIDDEN = 0,

    VIR_DOMAIN_KVM_LAST
} virDomainKVM;

1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685
typedef enum {
    VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT = 0,
    VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW,
    VIR_DOMAIN_CAPABILITIES_POLICY_DENY,

    VIR_DOMAIN_CAPABILITIES_POLICY_LAST
} virDomainCapabilitiesPolicy;

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

1686
typedef enum {
1687 1688 1689 1690 1691 1692
    VIR_DOMAIN_LIFECYCLE_DESTROY,
    VIR_DOMAIN_LIFECYCLE_RESTART,
    VIR_DOMAIN_LIFECYCLE_RESTART_RENAME,
    VIR_DOMAIN_LIFECYCLE_PRESERVE,

    VIR_DOMAIN_LIFECYCLE_LAST
1693
} virDomainLifecycleAction;
1694

1695
typedef enum {
1696 1697 1698 1699 1700 1701 1702 1703
    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
1704
} virDomainLifecycleCrashAction;
1705

1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717
typedef enum {
    VIR_DOMAIN_LOCK_FAILURE_DEFAULT,
    VIR_DOMAIN_LOCK_FAILURE_POWEROFF,
    VIR_DOMAIN_LOCK_FAILURE_RESTART,
    VIR_DOMAIN_LOCK_FAILURE_PAUSE,
    VIR_DOMAIN_LOCK_FAILURE_IGNORE,

    VIR_DOMAIN_LOCK_FAILURE_LAST
} virDomainLockFailureAction;

VIR_ENUM_DECL(virDomainLockFailure)

M
Michal Privoznik 已提交
1718 1719 1720
typedef struct _virDomainBIOSDef virDomainBIOSDef;
typedef virDomainBIOSDef *virDomainBIOSDefPtr;
struct _virDomainBIOSDef {
J
Ján Tomko 已提交
1721
    int useserial; /* enum virTristateBool */
1722 1723 1724
    /* reboot-timeout parameters */
    bool rt_set;
    int rt_delay;
M
Michal Privoznik 已提交
1725 1726
};

1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742
typedef enum {
    VIR_DOMAIN_LOADER_TYPE_ROM = 0,
    VIR_DOMAIN_LOADER_TYPE_PFLASH,

    VIR_DOMAIN_LOADER_TYPE_LAST
} virDomainLoader;

VIR_ENUM_DECL(virDomainLoader)

typedef struct _virDomainLoaderDef virDomainLoaderDef;
typedef virDomainLoaderDef *virDomainLoaderDefPtr;
struct _virDomainLoaderDef {
    char *path;
    int readonly;   /* enum virTristateBool */
    virDomainLoader type;
    char *nvram;    /* path to non-volatile RAM */
1743
    char *templt;   /* user override of path to master nvram */
1744 1745 1746 1747
};

void virDomainLoaderDefFree(virDomainLoaderDefPtr loader);

1748 1749 1750 1751 1752
/* Operating system configuration data & machine / arch */
typedef struct _virDomainOSDef virDomainOSDef;
typedef virDomainOSDef *virDomainOSDefPtr;
struct _virDomainOSDef {
    char *type;
1753
    virArch arch;
1754
    char *machine;
1755
    size_t nBootDevs;
1756
    int bootDevs[VIR_DOMAIN_BOOT_LAST];
J
Ján Tomko 已提交
1757
    int bootmenu; /* enum virTristateBool */
1758 1759
    unsigned int bm_timeout;
    bool bm_timeout_set;
1760
    char *init;
1761
    char **initargv;
1762 1763 1764
    char *kernel;
    char *initrd;
    char *cmdline;
1765
    char *dtb;
1766
    char *root;
1767
    virDomainLoaderDefPtr loader;
1768 1769
    char *bootloader;
    char *bootloaderArgs;
1770
    int smbios_mode;
1771

M
Michal Privoznik 已提交
1772
    virDomainBIOSDef bios;
1773 1774
};

1775
typedef enum {
1776 1777 1778 1779 1780
    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 已提交
1781
    VIR_DOMAIN_TIMER_NAME_KVMCLOCK,
1782
    VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK,
1783

1784
    VIR_DOMAIN_TIMER_NAME_LAST
1785
} virDomainTimerNameType;
1786

1787
typedef enum {
1788 1789 1790
    VIR_DOMAIN_TIMER_TRACK_BOOT = 0,
    VIR_DOMAIN_TIMER_TRACK_GUEST,
    VIR_DOMAIN_TIMER_TRACK_WALL,
1791

1792
    VIR_DOMAIN_TIMER_TRACK_LAST
1793
} virDomainTimerTrackType;
1794

1795
typedef enum {
1796 1797 1798 1799 1800
    VIR_DOMAIN_TIMER_TICKPOLICY_DELAY = 0,
    VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP,
    VIR_DOMAIN_TIMER_TICKPOLICY_MERGE,
    VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD,

1801
    VIR_DOMAIN_TIMER_TICKPOLICY_LAST
1802
} virDomainTimerTickpolicyType;
1803

1804
typedef enum {
1805 1806 1807 1808
    VIR_DOMAIN_TIMER_MODE_AUTO = 0,
    VIR_DOMAIN_TIMER_MODE_NATIVE,
    VIR_DOMAIN_TIMER_MODE_EMULATE,
    VIR_DOMAIN_TIMER_MODE_PARAVIRT,
1809
    VIR_DOMAIN_TIMER_MODE_SMPSAFE,
1810

1811
    VIR_DOMAIN_TIMER_MODE_LAST
1812
} virDomainTimerModeType;
1813

1814
typedef enum {
1815
    VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC = 0,
O
Osier Yang 已提交
1816 1817
    VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO,

1818
    VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST
1819
} virDomainCpuPlacementMode;
O
Osier Yang 已提交
1820

1821 1822 1823 1824
typedef struct _virDomainThreadSchedParam virDomainThreadSchedParam;
typedef virDomainThreadSchedParam *virDomainThreadSchedParamPtr;
struct _virDomainThreadSchedParam {
    virBitmapPtr ids;
1825
    virProcessSchedPolicy policy;
1826 1827 1828
    int priority;
};

1829 1830 1831 1832 1833 1834 1835 1836
typedef struct _virDomainTimerCatchupDef virDomainTimerCatchupDef;
typedef virDomainTimerCatchupDef *virDomainTimerCatchupDefPtr;
struct _virDomainTimerCatchupDef {
    unsigned long threshold;
    unsigned long slew;
    unsigned long limit;
};

1837 1838 1839 1840 1841 1842 1843
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 */

1844 1845 1846 1847
    virDomainTimerCatchupDef catchup;

    /* track is only valid for name='platform|rtc' */
    int track;  /* host|guest */
1848 1849 1850 1851 1852 1853

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

1854
typedef enum {
1855 1856
    VIR_DOMAIN_CLOCK_OFFSET_UTC = 0,
    VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME = 1,
1857
    VIR_DOMAIN_CLOCK_OFFSET_VARIABLE = 2,
1858
    VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE = 3,
1859

1860
    VIR_DOMAIN_CLOCK_OFFSET_LAST
1861
} virDomainClockOffsetType;
1862

1863
typedef enum {
1864 1865 1866
    VIR_DOMAIN_CLOCK_BASIS_UTC = 0,
    VIR_DOMAIN_CLOCK_BASIS_LOCALTIME = 1,

1867
    VIR_DOMAIN_CLOCK_BASIS_LAST
1868
} virDomainClockBasis;
1869

1870 1871 1872 1873
typedef struct _virDomainClockDef virDomainClockDef;
typedef virDomainClockDef *virDomainClockDefPtr;
struct _virDomainClockDef {
    int offset;
1874

1875
    union {
1876 1877 1878
        /* Bug-compatibility-mode for Xen utc|localtime */
        int utc_reset;
        /* Adjustment in seconds, relative to UTC or LOCALTIME, when
1879
         * offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE */
1880 1881 1882
        struct {
            long long adjustment;
            int basis;
1883 1884 1885 1886 1887 1888 1889

            /* domain start-time adjustment. This is a
             * private/internal read-only value that only exists when
             * a domain is running, and only if the clock
             * offset='variable'
             */
            long long adjustment0;
1890
        } variable;
1891 1892 1893 1894 1895

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

1897
    size_t ntimers;
1898
    virDomainTimerDefPtr *timers;
1899 1900
};

1901
# define VIR_DOMAIN_CPUMASK_LEN 1024
1902

1903 1904 1905
typedef struct _virDomainPinDef virDomainPinDef;
typedef virDomainPinDef *virDomainPinDefPtr;
struct _virDomainPinDef {
1906
    int id;
H
Hu Tao 已提交
1907
    virBitmapPtr cpumask;
1908 1909
};

1910
void virDomainPinDefFree(virDomainPinDefPtr def);
1911
void virDomainPinDefArrayFree(virDomainPinDefPtr *def, int npin);
1912

1913 1914
virDomainPinDefPtr *virDomainPinDefCopy(virDomainPinDefPtr *src,
                                        int npin);
1915

1916
int virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def,
1917 1918 1919
                                int nvcpupin,
                                int vcpu);

1920 1921 1922
virDomainPinDefPtr virDomainVcpuPinFindByVcpu(virDomainPinDefPtr *def,
                                              int nvcpupin,
                                              int vcpu);
1923

1924 1925 1926
typedef struct _virBlkioDevice virBlkioDevice;
typedef virBlkioDevice *virBlkioDevicePtr;
struct _virBlkioDevice {
1927 1928
    char *path;
    unsigned int weight;
1929 1930 1931 1932
    unsigned int riops;
    unsigned int wiops;
    unsigned long long rbps;
    unsigned long long wbps;
1933 1934
};

1935
typedef enum {
1936 1937 1938
    VIR_DOMAIN_RNG_MODEL_VIRTIO,

    VIR_DOMAIN_RNG_MODEL_LAST
1939
} virDomainRNGModel;
1940

1941
typedef enum {
1942 1943 1944 1945 1946
    VIR_DOMAIN_RNG_BACKEND_RANDOM,
    VIR_DOMAIN_RNG_BACKEND_EGD,
    /* VIR_DOMAIN_RNG_BACKEND_POOL, */

    VIR_DOMAIN_RNG_BACKEND_LAST
1947
} virDomainRNGBackend;
1948 1949 1950 1951

struct _virDomainRNGDef {
    int model;
    int backend;
1952 1953
    unsigned int rate; /* bytes per period */
    unsigned int period; /* milliseconds */
1954 1955 1956 1957 1958 1959 1960 1961 1962 1963

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

    virDomainDeviceInfo info;
};

1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978
struct _virDomainIdMapEntry {
    unsigned int start;
    unsigned int target;
    unsigned int count;
};

struct _virDomainIdMapDef {
    size_t nuidmap;
    virDomainIdMapEntryPtr uidmap;

    size_t ngidmap;
    virDomainIdMapEntryPtr gidmap;
};


H
Hu Tao 已提交
1979 1980 1981 1982 1983
struct _virDomainPanicDef {
    virDomainDeviceInfo info;
};


1984
void virBlkioDeviceArrayClear(virBlkioDevicePtr deviceWeights,
1985
                              int ndevices);
1986

1987 1988 1989 1990 1991
typedef struct _virDomainResourceDef virDomainResourceDef;
typedef virDomainResourceDef *virDomainResourceDefPtr;
struct _virDomainResourceDef {
    char *partition;
};
1992

1993
typedef struct _virDomainHugePage virDomainHugePage;
1994 1995
typedef virDomainHugePage *virDomainHugePagePtr;

1996
struct _virDomainHugePage {
1997 1998 1999 2000
    virBitmapPtr nodemask;      /* guest's NUMA node mask */
    unsigned long long size;    /* hugepage size in KiB */
};

2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011
typedef struct _virDomainCputune virDomainCputune;
typedef virDomainCputune *virDomainCputunePtr;

struct _virDomainCputune {
    unsigned long shares;
    bool sharesSpecified;
    unsigned long long period;
    long long quota;
    unsigned long long emulator_period;
    long long emulator_quota;
    size_t nvcpupin;
2012 2013
    virDomainPinDefPtr *vcpupin;
    virDomainPinDefPtr emulatorpin;
2014
    size_t niothreadspin;
2015
    virDomainPinDefPtr *iothreadspin;
2016 2017 2018 2019 2020

    size_t nvcpusched;
    virDomainThreadSchedParamPtr vcpusched;
    size_t niothreadsched;
    virDomainThreadSchedParamPtr iothreadsched;
2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036
};

typedef struct _virDomainBlkiotune virDomainBlkiotune;
typedef virDomainBlkiotune *virDomainBlkiotunePtr;

struct _virDomainBlkiotune {
    unsigned int weight;

    size_t ndevices;
    virBlkioDevicePtr devices;
};

typedef struct _virDomainMemtune virDomainMemtune;
typedef virDomainMemtune *virDomainMemtunePtr;

struct _virDomainMemtune {
2037 2038 2039 2040
    unsigned long long max_balloon; /* in kibibytes, capped at ulong thanks
                                       to virDomainGetMaxMemory */
    unsigned long long cur_balloon; /* in kibibytes, capped at ulong thanks
                                       to virDomainGetInfo */
2041 2042 2043 2044 2045 2046 2047

    virDomainHugePagePtr hugepages;
    size_t nhugepages;

    bool nosharepages;
    bool locked;
    int dump_core; /* enum virTristateSwitch */
2048 2049 2050 2051
    unsigned long long hard_limit; /* in kibibytes, limit at off_t bytes */
    unsigned long long soft_limit; /* in kibibytes, limit at off_t bytes */
    unsigned long long min_guarantee; /* in kibibytes, limit at off_t bytes */
    unsigned long long swap_hard_limit; /* in kibibytes, limit at off_t bytes */
2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062
};

typedef struct _virDomainPowerManagement virDomainPowerManagement;
typedef virDomainPowerManagement *virDomainPowerManagementPtr;

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

2063 2064 2065 2066 2067 2068
/*
 * Guest VM main configuration
 *
 * NB: if adding to this struct, virDomainDefCheckABIStability
 * may well need an update
 */
2069 2070
typedef struct _virDomainDef virDomainDef;
typedef virDomainDef *virDomainDefPtr;
2071 2072 2073 2074 2075
struct _virDomainDef {
    int virtType;
    int id;
    unsigned char uuid[VIR_UUID_BUFLEN];
    char *name;
2076
    char *title;
2077
    char *description;
2078

2079 2080
    virDomainBlkiotune blkio;
    virDomainMemtune mem;
2081

E
Eric Blake 已提交
2082 2083
    unsigned short vcpus;
    unsigned short maxvcpus;
O
Osier Yang 已提交
2084
    int placement_mode;
H
Hu Tao 已提交
2085
    virBitmapPtr cpumask;
2086

2087 2088
    unsigned int iothreads;

2089
    virDomainCputune cputune;
2090

2091
    virDomainNumaPtr numa;
2092
    virDomainResourceDefPtr resource;
2093
    virDomainIdMapDef idmap;
2094

2095 2096 2097 2098 2099
    /* These 3 are based on virDomainLifeCycleAction enum flags */
    int onReboot;
    int onPoweroff;
    int onCrash;

2100 2101
    int onLockFailure; /* enum virDomainLockFailureAction */

2102
    virDomainPowerManagement pm;
2103

2104 2105
    virDomainOSDef os;
    char *emulator;
2106 2107 2108
    /* These three options are of type virTristateSwitch,
     * except VIR_DOMAIN_FEATURE_CAPABILITIES that is of type
     * virDomainCapabilitiesPolicy */
2109
    int features[VIR_DOMAIN_FEATURE_LAST];
2110
    int apic_eoi;
2111
    int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
2112
    int kvm_features[VIR_DOMAIN_KVM_LAST];
2113
    unsigned int hyperv_spinlocks;
2114

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

2118
    virDomainClockDef clock;
2119

2120
    size_t ngraphics;
2121
    virDomainGraphicsDefPtr *graphics;
2122

2123
    size_t ndisks;
2124 2125
    virDomainDiskDefPtr *disks;

2126
    size_t ncontrollers;
2127 2128
    virDomainControllerDefPtr *controllers;

2129
    size_t nfss;
2130 2131
    virDomainFSDefPtr *fss;

2132
    size_t nnets;
2133 2134
    virDomainNetDefPtr *nets;

2135
    size_t ninputs;
2136 2137
    virDomainInputDefPtr *inputs;

2138
    size_t nsounds;
2139 2140
    virDomainSoundDefPtr *sounds;

2141
    size_t nvideos;
2142 2143
    virDomainVideoDefPtr *videos;

2144
    size_t nhostdevs;
2145 2146
    virDomainHostdevDefPtr *hostdevs;

2147
    size_t nredirdevs;
2148 2149
    virDomainRedirdevDefPtr *redirdevs;

2150
    size_t nsmartcards;
E
Eric Blake 已提交
2151 2152
    virDomainSmartcardDefPtr *smartcards;

2153
    size_t nserials;
2154 2155
    virDomainChrDefPtr *serials;

2156
    size_t nparallels;
2157 2158
    virDomainChrDefPtr *parallels;

2159
    size_t nchannels;
2160 2161
    virDomainChrDefPtr *channels;

2162
    size_t nconsoles;
2163 2164
    virDomainChrDefPtr *consoles;

2165
    size_t nleases;
2166 2167
    virDomainLeaseDefPtr *leases;

2168
    size_t nhubs;
M
Marc-André Lureau 已提交
2169 2170
    virDomainHubDefPtr *hubs;

2171 2172 2173
    size_t nseclabels;
    virSecurityLabelDefPtr *seclabels;

2174 2175 2176
    size_t nrngs;
    virDomainRNGDefPtr *rngs;

2177 2178 2179
    size_t nshmems;
    virDomainShmemDefPtr *shmems;

2180
    /* Only 1 */
R
Richard Jones 已提交
2181
    virDomainWatchdogDefPtr watchdog;
2182
    virDomainMemballoonDefPtr memballoon;
L
Li Zhang 已提交
2183
    virDomainNVRAMDefPtr nvram;
2184
    virDomainTPMDefPtr tpm;
2185
    virCPUDefPtr cpu;
2186
    virSysinfoDefPtr sysinfo;
2187
    virDomainRedirFilterDefPtr redirfilter;
H
Hu Tao 已提交
2188
    virDomainPanicDefPtr panic;
2189 2190 2191

    void *namespaceData;
    virDomainXMLNamespace ns;
2192 2193 2194

    /* Application-specific custom metadata */
    xmlNodePtr metadata;
2195 2196
};

2197 2198 2199 2200
unsigned long long virDomainDefGetMemoryInitial(virDomainDefPtr def);
void virDomainDefSetMemoryInitial(virDomainDefPtr def, unsigned long long size);
unsigned long long virDomainDefGetMemoryActual(virDomainDefPtr def);

2201
typedef enum {
2202 2203 2204 2205 2206
    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 */
2207
    VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH,  /* Externally launched guest domain */
2208
    VIR_DOMAIN_TAINT_HOST_CPU,         /* Host CPU passthrough in use */
2209
    VIR_DOMAIN_TAINT_HOOK,             /* Domain (possibly) changed via hook script */
2210 2211

    VIR_DOMAIN_TAINT_LAST
2212
} virDomainTaintFlags;
2213

2214
/* Guest VM runtime state */
J
Jiri Denemark 已提交
2215 2216 2217 2218 2219 2220
typedef struct _virDomainStateReason virDomainStateReason;
struct _virDomainStateReason {
    int state;
    int reason;
};

2221 2222 2223
typedef struct _virDomainObj virDomainObj;
typedef virDomainObj *virDomainObjPtr;
struct _virDomainObj {
2224
    virObjectLockable parent;
2225

2226
    pid_t pid;
J
Jiri Denemark 已提交
2227
    virDomainStateReason state;
2228 2229 2230

    unsigned int autostart : 1;
    unsigned int persistent : 1;
2231
    unsigned int updated : 1;
2232
    unsigned int removing : 1;
2233 2234 2235

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

2237
    virDomainSnapshotObjListPtr snapshots;
C
Chris Lalancette 已提交
2238 2239
    virDomainSnapshotObjPtr current_snapshot;

2240 2241
    bool hasManagedSave;

2242 2243
    void *privateData;
    void (*privateDataFreeFunc)(void *);
2244 2245

    int taint;
2246 2247
};

2248 2249
typedef struct _virDomainObjList virDomainObjList;
typedef virDomainObjList *virDomainObjListPtr;
2250

2251 2252 2253
typedef bool (*virDomainObjListFilter)(virConnectPtr conn,
                                       virDomainDefPtr def);

2254 2255 2256

/* This structure holds various callbacks and data needed
 * while parsing and creating domain XMLs */
2257 2258
typedef struct _virDomainXMLOption virDomainXMLOption;
typedef virDomainXMLOption *virDomainXMLOptionPtr;
2259 2260 2261 2262 2263 2264

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

2265 2266
/* Called once after everything else has been parsed, for adjusting
 * overall domain defaults.  */
2267 2268 2269
typedef int (*virDomainDefPostParseCallback)(virDomainDefPtr def,
                                             virCapsPtr caps,
                                             void *opaque);
2270 2271
/* Called once per device, for adjusting per-device settings while
 * leaving the overall domain otherwise unchanged.  */
2272
typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev,
2273
                                                   const virDomainDef *def,
2274 2275 2276 2277 2278 2279
                                                   virCapsPtr caps,
                                                   void *opaque);

typedef struct _virDomainDefParserConfig virDomainDefParserConfig;
typedef virDomainDefParserConfig *virDomainDefParserConfigPtr;
struct _virDomainDefParserConfig {
2280
    /* driver domain definition callbacks */
2281 2282 2283
    virDomainDefPostParseCallback domainPostParseCallback;
    virDomainDeviceDefPostParseCallback devicesPostParseCallback;

2284
    /* private data for the callbacks */
2285 2286
    void *priv;
    virFreeCallback privFree;
2287 2288

    /* data */
2289
    bool hasWideSCSIBus;
2290
    unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
2291 2292
};

2293 2294 2295 2296 2297 2298 2299 2300 2301
typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks;
typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr;
struct _virDomainXMLPrivateDataCallbacks {
    virDomainXMLPrivateDataAllocFunc  alloc;
    virDomainXMLPrivateDataFreeFunc   free;
    virDomainXMLPrivateDataFormatFunc format;
    virDomainXMLPrivateDataParseFunc  parse;
};

2302 2303 2304
virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config,
                                            virDomainXMLPrivateDataCallbacksPtr priv,
                                            virDomainXMLNamespacePtr xmlns);
2305

2306 2307
void virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt, virMacAddrPtr mac);

2308
virDomainXMLNamespacePtr
2309
virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
2310 2311
    ATTRIBUTE_NONNULL(1);

2312 2313 2314 2315 2316
int
virDomainDefPostParse(virDomainDefPtr def,
                      virCapsPtr caps,
                      virDomainXMLOptionPtr xmlopt);

2317
static inline bool
D
Daniel P. Berrange 已提交
2318
virDomainObjIsActive(virDomainObjPtr dom)
2319 2320 2321 2322
{
    return dom->def->id != -1;
}

2323
virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps)
2324
    ATTRIBUTE_NONNULL(1);
2325

2326
virDomainObjListPtr virDomainObjListNew(void);
2327

2328
virDomainObjPtr virDomainObjListFindByID(virDomainObjListPtr doms,
2329
                                         int id);
2330
virDomainObjPtr virDomainObjListFindByUUID(virDomainObjListPtr doms,
2331
                                           const unsigned char *uuid);
2332 2333
virDomainObjPtr virDomainObjListFindByUUIDRef(virDomainObjListPtr doms,
                                              const unsigned char *uuid);
2334
virDomainObjPtr virDomainObjListFindByName(virDomainObjListPtr doms,
2335
                                           const char *name);
2336

2337
bool virDomainObjTaint(virDomainObjPtr obj,
2338
                       virDomainTaintFlags taint);
2339

H
Hu Tao 已提交
2340
void virDomainPanicDefFree(virDomainPanicDefPtr panic);
2341
void virDomainResourceDefFree(virDomainResourceDefPtr resource);
2342 2343
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def);
2344
virDomainDiskDefPtr virDomainDiskDefNew(void);
2345
void virDomainDiskDefFree(virDomainDiskDefPtr def);
2346
void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
2347 2348 2349 2350 2351 2352 2353 2354 2355 2356
int virDomainDiskGetType(virDomainDiskDefPtr def);
void virDomainDiskSetType(virDomainDiskDefPtr def, int type);
const char *virDomainDiskGetSource(virDomainDiskDefPtr def);
int virDomainDiskSetSource(virDomainDiskDefPtr def, const char *src)
    ATTRIBUTE_RETURN_CHECK;
const char *virDomainDiskGetDriver(virDomainDiskDefPtr def);
int virDomainDiskSetDriver(virDomainDiskDefPtr def, const char *name)
    ATTRIBUTE_RETURN_CHECK;
int virDomainDiskGetFormat(virDomainDiskDefPtr def);
void virDomainDiskSetFormat(virDomainDiskDefPtr def, int format);
H
Han Cheng 已提交
2357 2358 2359
int virDomainDeviceFindControllerModel(virDomainDefPtr def,
                                       virDomainDeviceInfoPtr info,
                                       int controllerType);
2360 2361 2362
virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
                                                 int bus,
                                                 char *dst);
2363
void virDomainControllerDefFree(virDomainControllerDefPtr def);
2364
void virDomainFSDefFree(virDomainFSDefPtr def);
2365
void virDomainActualNetDefFree(virDomainActualNetDefPtr def);
2366
void virDomainNetDefFree(virDomainNetDefPtr def);
E
Eric Blake 已提交
2367
void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def);
2368
void virDomainChrDefFree(virDomainChrDefPtr def);
2369
void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def);
2370 2371
int virDomainChrSourceDefCopy(virDomainChrSourceDefPtr src,
                              virDomainChrSourceDefPtr dest);
2372
void virDomainSoundCodecDefFree(virDomainSoundCodecDefPtr def);
2373
void virDomainSoundDefFree(virDomainSoundDefPtr def);
2374
void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def);
L
Li Zhang 已提交
2375
void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
R
Richard Jones 已提交
2376
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
2377
void virDomainVideoDefFree(virDomainVideoDefPtr def);
2378 2379
virDomainHostdevDefPtr virDomainHostdevDefAlloc(void);
void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
2380
void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
M
Marc-André Lureau 已提交
2381
void virDomainHubDefFree(virDomainHubDefPtr def);
2382
void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def);
2383
void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def);
2384
void virDomainShmemDefFree(virDomainShmemDefPtr def);
2385
void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
2386
virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
2387
                                             const virDomainDef *def,
2388 2389
                                             virCapsPtr caps,
                                             virDomainXMLOptionPtr xmlopt);
2390 2391
int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
                                  int type);
2392
virDomainDeviceInfoPtr virDomainDeviceGetInfo(virDomainDeviceDefPtr device);
2393 2394
int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
                            virDomainDeviceInfoPtr src);
2395
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
2396
void virDomainDefClearPCIAddresses(virDomainDefPtr def);
2397
void virDomainDefClearCCWAddresses(virDomainDefPtr def);
D
Daniel P. Berrange 已提交
2398
void virDomainDefClearDeviceAliases(virDomainDefPtr def);
2399
void virDomainTPMDefFree(virDomainTPMDefPtr def);
2400

2401
typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
2402 2403
                                           virDomainDeviceDefPtr dev,
                                           virDomainDeviceInfoPtr info,
2404 2405 2406 2407 2408 2409
                                           void *opaque);

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

2410 2411 2412 2413
bool virDomainDefHasDeviceAddress(virDomainDefPtr def,
                                  virDomainDeviceInfoPtr info)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

2414 2415
void virDomainDefFree(virDomainDefPtr vm);

M
Michal Novotny 已提交
2416 2417
virDomainChrDefPtr virDomainChrDefNew(void);

2418 2419 2420 2421
virDomainDefPtr virDomainDefNew(void);
virDomainDefPtr virDomainDefNewFull(const char *name,
                                    const unsigned char *uuid,
                                    int id);
2422

2423 2424 2425 2426
enum {
    VIR_DOMAIN_OBJ_LIST_ADD_LIVE = (1 << 0),
    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1),
};
2427
virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms,
2428
                                    virDomainDefPtr def,
2429
                                    virDomainXMLOptionPtr xmlopt,
2430 2431
                                    unsigned int flags,
                                    virDomainDefPtr *oldDef);
2432
void virDomainObjAssignDef(virDomainObjPtr domain,
2433
                           virDomainDefPtr def,
2434 2435
                           bool live,
                           virDomainDefPtr *oldDef);
2436
int virDomainObjSetDefTransient(virCapsPtr caps,
2437
                                virDomainXMLOptionPtr xmlopt,
2438 2439
                                virDomainObjPtr domain,
                                bool live);
2440 2441
virDomainDefPtr
virDomainObjGetPersistentDef(virCapsPtr caps,
2442
                             virDomainXMLOptionPtr xmlopt,
2443
                             virDomainObjPtr domain);
2444 2445 2446

int
virDomainLiveConfigHelperMethod(virCapsPtr caps,
2447
                                virDomainXMLOptionPtr xmlopt,
2448 2449 2450 2451
                                virDomainObjPtr dom,
                                unsigned int *flags,
                                virDomainDefPtr *persistentDef);

2452 2453 2454 2455 2456 2457 2458
virDomainDefPtr virDomainDefCopy(virDomainDefPtr src,
                                 virCapsPtr caps,
                                 virDomainXMLOptionPtr xmlopt,
                                 bool migratable);
virDomainDefPtr virDomainObjCopyPersistentDef(virDomainObjPtr dom,
                                              virCapsPtr caps,
                                              virDomainXMLOptionPtr xmlopt);
2459

2460 2461
void virDomainObjListRemove(virDomainObjListPtr doms,
                            virDomainObjPtr dom);
2462 2463
void virDomainObjListRemoveLocked(virDomainObjListPtr doms,
                                  virDomainObjPtr dom);
2464

2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477
typedef enum {
    /* parse internal domain status information */
    VIR_DOMAIN_DEF_PARSE_STATUS          = 1 << 0,
    VIR_DOMAIN_DEF_PARSE_INACTIVE        = 1 << 1,
    /* parse <actual> element */
    VIR_DOMAIN_DEF_PARSE_ACTUAL_NET      = 1 << 2,
    /* parse original states of host PCI device */
    VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES = 1 << 3,
    VIR_DOMAIN_DEF_PARSE_ALLOW_ROM       = 1 << 4,
    VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT      = 1 << 5,
    VIR_DOMAIN_DEF_PARSE_CLOCK_ADJUST    = 1 << 6,
    /* parse only source half of <disk> */
    VIR_DOMAIN_DEF_PARSE_DISK_SOURCE     = 1 << 7,
2478
    VIR_DOMAIN_DEF_PARSE_VALIDATE        = 1 << 8,
2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496
} virDomainDefParseFlags;

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

2497
virDomainDeviceDefPtr virDomainDeviceDefParse(const char *xmlStr,
2498
                                              const virDomainDef *def,
2499 2500
                                              virCapsPtr caps,
                                              virDomainXMLOptionPtr xmlopt,
L
Laine Stump 已提交
2501
                                              unsigned int flags);
2502 2503 2504 2505
virStorageSourcePtr virDomainDiskDefSourceParse(const char *xmlStr,
                                                const virDomainDef *def,
                                                virDomainXMLOptionPtr xmlopt,
                                                unsigned int flags);
2506 2507
virDomainDefPtr virDomainDefParseString(const char *xmlStr,
                                        virCapsPtr caps,
2508
                                        virDomainXMLOptionPtr xmlopt,
M
Matthias Bolte 已提交
2509
                                        unsigned int expectedVirtTypes,
L
Laine Stump 已提交
2510
                                        unsigned int flags);
2511 2512
virDomainDefPtr virDomainDefParseFile(const char *filename,
                                      virCapsPtr caps,
2513
                                      virDomainXMLOptionPtr xmlopt,
M
Matthias Bolte 已提交
2514
                                      unsigned int expectedVirtTypes,
L
Laine Stump 已提交
2515
                                      unsigned int flags);
2516
virDomainDefPtr virDomainDefParseNode(xmlDocPtr doc,
2517
                                      xmlNodePtr root,
2518 2519
                                      virCapsPtr caps,
                                      virDomainXMLOptionPtr xmlopt,
M
Matthias Bolte 已提交
2520
                                      unsigned int expectedVirtTypes,
L
Laine Stump 已提交
2521
                                      unsigned int flags);
2522 2523 2524 2525 2526
virDomainObjPtr virDomainObjParseFile(const char *filename,
                                      virCapsPtr caps,
                                      virDomainXMLOptionPtr xmlopt,
                                      unsigned int expectedVirtTypes,
                                      unsigned int flags);
2527

2528 2529 2530
bool virDomainDefCheckABIStability(virDomainDefPtr src,
                                   virDomainDefPtr dst);

2531
int virDomainDefAddImplicitControllers(virDomainDefPtr def);
2532

2533 2534
unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags);

2535
char *virDomainDefFormat(virDomainDefPtr def,
L
Laine Stump 已提交
2536
                         unsigned int flags);
2537 2538 2539
int virDomainDefFormatInternal(virDomainDefPtr def,
                               unsigned int flags,
                               virBufferPtr buf);
2540

2541 2542 2543 2544
int virDomainDiskSourceFormat(virBufferPtr buf,
                              virStorageSourcePtr src,
                              int policy,
                              unsigned int flags);
2545

2546 2547 2548 2549
int virDomainNetDefFormat(virBufferPtr buf,
                          virDomainNetDefPtr def,
                          unsigned int flags);

2550 2551 2552 2553 2554 2555
typedef enum {
    VIR_DOMAIN_DEVICE_ACTION_ATTACH,
    VIR_DOMAIN_DEVICE_ACTION_DETACH,
    VIR_DOMAIN_DEVICE_ACTION_UPDATE,
} virDomainDeviceAction;

2556
int virDomainDefCompatibleDevice(virDomainDefPtr def,
2557 2558
                                 virDomainDeviceDefPtr dev,
                                 virDomainDeviceAction action);
2559

2560
int virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
2561
                        size_t *nvcpupin,
2562 2563 2564 2565
                        unsigned char *cpumap,
                        int maplen,
                        int vcpu);

2566
void virDomainVcpuPinDel(virDomainDefPtr def, int vcpu);
2567

2568 2569 2570 2571 2572 2573
int virDomainEmulatorPinAdd(virDomainDefPtr def,
                              unsigned char *cpumap,
                              int maplen);

int virDomainEmulatorPinDel(virDomainDefPtr def);

2574
int virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list,
2575 2576 2577 2578 2579 2580 2581 2582
                             size_t *niothreads,
                             unsigned char *cpumap,
                             int maplen,
                             unsigned int iothread_id);

void virDomainIOThreadsPinDel(virDomainDefPtr def,
                              unsigned int iothread_id);

2583 2584
void virDomainRNGDefFree(virDomainRNGDefPtr def);

2585
bool virDomainDiskDefDstDuplicates(virDomainDefPtr def);
2586 2587 2588 2589
int virDomainDiskIndexByAddress(virDomainDefPtr def,
                                virDevicePCIAddressPtr pci_controller,
                                unsigned int bus, unsigned int target,
                                unsigned int unit);
2590 2591 2592
int virDomainDiskIndexByName(virDomainDefPtr def, const char *name,
                             bool allow_ambiguous);
const char *virDomainDiskPathByName(virDomainDefPtr, const char *name);
2593
int virDomainDiskInsert(virDomainDefPtr def,
2594 2595
                        virDomainDiskDefPtr disk)
    ATTRIBUTE_RETURN_CHECK;
2596 2597
void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
                                   virDomainDiskDefPtr disk);
2598 2599
int virDomainDiskDefAssignAddress(virDomainXMLOptionPtr xmlopt,
                                  virDomainDiskDefPtr def);
2600

2601 2602 2603 2604
virDomainDiskDefPtr
virDomainDiskRemove(virDomainDefPtr def, size_t i);
virDomainDiskDefPtr
virDomainDiskRemoveByName(virDomainDefPtr def, const char *name);
2605
int virDomainDiskSourceParse(xmlNodePtr node,
2606
                             xmlXPathContextPtr ctxt,
2607
                             virStorageSourcePtr src);
2608

E
Eric Blake 已提交
2609
bool virDomainHasDiskMirror(virDomainObjPtr vm);
2610

2611 2612
int virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net);
virDomainNetDefPtr virDomainNetFind(virDomainDefPtr def, const char *device);
2613
bool virDomainHasNet(virDomainDefPtr def, virDomainNetDefPtr net);
2614
int virDomainNetInsert(virDomainDefPtr def, virDomainNetDefPtr net);
2615
virDomainNetDefPtr virDomainNetRemove(virDomainDefPtr def, size_t i);
2616
void virDomainNetRemoveHostdev(virDomainDefPtr def, virDomainNetDefPtr net);
2617

L
Laine Stump 已提交
2618
int virDomainHostdevInsert(virDomainDefPtr def, virDomainHostdevDefPtr hostdev);
2619 2620
virDomainHostdevDefPtr
virDomainHostdevRemove(virDomainDefPtr def, size_t i);
L
Laine Stump 已提交
2621 2622 2623
int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
                         virDomainHostdevDefPtr *found);

2624
int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
2625
            ATTRIBUTE_NONNULL(1);
2626
int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t i, int val)
2627 2628
            ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
2629
                                              size_t i)
2630 2631
            ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
2632
                                      size_t i, const char *address,
2633 2634 2635
                                      int len, bool setType)
            ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
2636
                                              size_t i)
2637 2638
            ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
2639
                                      size_t i, const char *network, int len)
2640 2641
            ATTRIBUTE_NONNULL(1);

2642
int virDomainNetGetActualType(virDomainNetDefPtr iface);
2643
const char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface);
2644
int virDomainNetGetActualBridgeMACTableManager(virDomainNetDefPtr iface);
2645
const char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface);
2646
int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface);
2647
virDomainHostdevDefPtr virDomainNetGetActualHostdev(virDomainNetDefPtr iface);
2648
virNetDevVPortProfilePtr
2649
virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface);
2650
virNetDevBandwidthPtr
2651
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
2652
virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface);
2653
bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
2654 2655 2656 2657
int virDomainNetAppendIpAddress(virDomainNetDefPtr def,
                                const char *address,
                                int family,
                                unsigned int prefix);
2658

2659
int virDomainControllerInsert(virDomainDefPtr def,
2660 2661
                              virDomainControllerDefPtr controller)
    ATTRIBUTE_RETURN_CHECK;
2662 2663
void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
                                         virDomainControllerDefPtr controller);
2664
int virDomainControllerFind(virDomainDefPtr def, int type, int idx);
2665 2666
int virDomainControllerFindByPCIAddress(virDomainDefPtr def,
                                        virDevicePCIAddressPtr addr);
2667
virDomainControllerDefPtr virDomainControllerRemove(virDomainDefPtr def, size_t i);
2668 2669 2670 2671 2672

int virDomainLeaseIndex(virDomainDefPtr def,
                        virDomainLeaseDefPtr lease);
int virDomainLeaseInsert(virDomainDefPtr def,
                         virDomainLeaseDefPtr lease);
2673 2674
int virDomainLeaseInsertPreAlloc(virDomainDefPtr def)
    ATTRIBUTE_RETURN_CHECK;
2675 2676
void virDomainLeaseInsertPreAlloced(virDomainDefPtr def,
                                    virDomainLeaseDefPtr lease);
2677 2678 2679 2680 2681
virDomainLeaseDefPtr
virDomainLeaseRemoveAt(virDomainDefPtr def, size_t i);
virDomainLeaseDefPtr
virDomainLeaseRemove(virDomainDefPtr def,
                     virDomainLeaseDefPtr lease);
2682

2683
void
2684
virDomainChrGetDomainPtrs(const virDomainDef *vmdef,
2685
                          virDomainChrDeviceType type,
2686 2687 2688
                          const virDomainChrDef ***arrPtr,
                          size_t *cntPtr)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
2689 2690 2691
virDomainChrDefPtr
virDomainChrFind(virDomainDefPtr def,
                 virDomainChrDefPtr target);
2692 2693 2694
bool
virDomainChrEquals(virDomainChrDefPtr src,
                   virDomainChrDefPtr tgt);
2695
int
2696 2697 2698 2699 2700
virDomainChrPreAlloc(virDomainDefPtr vmdef,
                     virDomainChrDefPtr chr);
void
virDomainChrInsertPreAlloced(virDomainDefPtr vmdef,
                             virDomainChrDefPtr chr);
2701 2702 2703 2704
virDomainChrDefPtr
virDomainChrRemove(virDomainDefPtr vmdef,
                   virDomainChrDefPtr chr);

2705 2706 2707 2708 2709 2710
int virDomainRNGInsert(virDomainDefPtr def,
                       virDomainRNGDefPtr rng,
                       bool inplace);
ssize_t virDomainRNGFind(virDomainDefPtr def, virDomainRNGDefPtr rng);
virDomainRNGDefPtr virDomainRNGRemove(virDomainDefPtr def, size_t idx);

2711
int virDomainSaveXML(const char *configDir,
2712 2713 2714
                     virDomainDefPtr def,
                     const char *xml);

2715
int virDomainSaveConfig(const char *configDir,
2716
                        virDomainDefPtr def);
2717
int virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
2718
                        const char *statusDir,
2719
                        virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
2720

2721 2722 2723 2724
typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
                                          int newDomain,
                                          void *opaque);

2725 2726 2727 2728
int virDomainObjListLoadAllConfigs(virDomainObjListPtr doms,
                                   const char *configDir,
                                   const char *autostartDir,
                                   int liveStatus,
2729 2730
                                   virCapsPtr caps,
                                   virDomainXMLOptionPtr xmlopt,
2731 2732 2733
                                   unsigned int expectedVirtTypes,
                                   virDomainLoadConfigNotify notify,
                                   void *opaque);
2734

2735
int virDomainDeleteConfig(const char *configDir,
2736
                          const char *autostartDir,
2737 2738
                          virDomainObjPtr dom);

2739
char *virDomainConfigFile(const char *dir,
2740 2741
                          const char *name);

2742 2743 2744 2745
int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
                                int *busIdx,
                                int *devIdx);

2746
virDomainFSDefPtr virDomainGetFilesystemForTarget(virDomainDefPtr def,
2747
                                                  const char *target);
2748
int virDomainFSInsert(virDomainDefPtr def, virDomainFSDefPtr fs);
2749
int virDomainFSIndexByName(virDomainDefPtr def, const char *name);
2750 2751
virDomainFSDefPtr virDomainFSRemove(virDomainDefPtr def, size_t i);

2752
int virDomainVideoDefaultType(const virDomainDef *def);
2753 2754
unsigned int virDomainVideoDefaultRAM(const virDomainDef *def,
                                      const virDomainVideoType type);
2755

2756 2757 2758 2759
int virDomainObjListNumOfDomains(virDomainObjListPtr doms,
                                 bool active,
                                 virDomainObjListFilter filter,
                                 virConnectPtr conn);
2760 2761 2762

int virDomainObjListGetActiveIDs(virDomainObjListPtr doms,
                                 int *ids,
2763 2764 2765
                                 int maxids,
                                 virDomainObjListFilter filter,
                                 virConnectPtr conn);
2766 2767
int virDomainObjListGetInactiveNames(virDomainObjListPtr doms,
                                     char **const names,
2768 2769 2770
                                     int maxnames,
                                     virDomainObjListFilter filter,
                                     virConnectPtr conn);
2771

2772 2773 2774 2775 2776 2777 2778
typedef int (*virDomainObjListIterator)(virDomainObjPtr dom,
                                        void *opaque);

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

E
Eric Blake 已提交
2779 2780 2781 2782 2783 2784 2785 2786 2787
typedef int (*virDomainSmartcardDefIterator)(virDomainDefPtr def,
                                             virDomainSmartcardDefPtr dev,
                                             void *opaque);

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

2788 2789 2790 2791 2792 2793 2794 2795 2796
typedef int (*virDomainChrDefIterator)(virDomainDefPtr def,
                                       virDomainChrDefPtr dev,
                                       void *opaque);

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

2797 2798 2799 2800 2801 2802 2803 2804 2805 2806
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 已提交
2807 2808 2809 2810 2811 2812 2813
void
virDomainObjSetState(virDomainObjPtr obj, virDomainState state, int reason)
        ATTRIBUTE_NONNULL(1);
virDomainState
virDomainObjGetState(virDomainObjPtr obj, int *reason)
        ATTRIBUTE_NONNULL(1);

2814 2815 2816
virSecurityLabelDefPtr
virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model);

2817 2818 2819
virSecurityDeviceLabelDefPtr
virDomainChrDefGetSecurityLabelDef(virDomainChrDefPtr def, const char *model);

2820 2821
typedef const char* (*virEventActionToStringFunc)(int type);
typedef int (*virEventActionFromStringFunc)(const char *type);
2822

2823
VIR_ENUM_DECL(virDomainTaint)
2824 2825 2826
VIR_ENUM_DECL(virDomainVirt)
VIR_ENUM_DECL(virDomainBoot)
VIR_ENUM_DECL(virDomainFeature)
2827 2828
VIR_ENUM_DECL(virDomainCapabilitiesPolicy)
VIR_ENUM_DECL(virDomainCapsFeature)
2829
VIR_ENUM_DECL(virDomainLifecycle)
2830
VIR_ENUM_DECL(virDomainLifecycleCrash)
2831
VIR_ENUM_DECL(virDomainDevice)
2832
VIR_ENUM_DECL(virDomainDeviceAddress)
2833
VIR_ENUM_DECL(virDomainDiskDevice)
J
J.B. Joret 已提交
2834
VIR_ENUM_DECL(virDomainDiskGeometryTrans)
2835
VIR_ENUM_DECL(virDomainDiskBus)
2836
VIR_ENUM_DECL(virDomainDiskCache)
2837
VIR_ENUM_DECL(virDomainDiskErrorPolicy)
M
Matthias Dahl 已提交
2838
VIR_ENUM_DECL(virDomainDiskIo)
2839
VIR_ENUM_DECL(virDomainDeviceSGIO)
2840
VIR_ENUM_DECL(virDomainDiskTray)
O
Osier Yang 已提交
2841
VIR_ENUM_DECL(virDomainDiskDiscard)
2842
VIR_ENUM_DECL(virDomainDiskMirrorState)
2843
VIR_ENUM_DECL(virDomainController)
J
Ján Tomko 已提交
2844
VIR_ENUM_DECL(virDomainControllerModelPCI)
2845
VIR_ENUM_DECL(virDomainControllerModelSCSI)
M
Marc-André Lureau 已提交
2846
VIR_ENUM_DECL(virDomainControllerModelUSB)
2847
VIR_ENUM_DECL(virDomainFS)
2848
VIR_ENUM_DECL(virDomainFSDriver)
2849
VIR_ENUM_DECL(virDomainFSAccessMode)
2850
VIR_ENUM_DECL(virDomainFSWrpolicy)
2851
VIR_ENUM_DECL(virDomainNet)
2852
VIR_ENUM_DECL(virDomainNetBackend)
2853
VIR_ENUM_DECL(virDomainNetVirtioTxMode)
2854
VIR_ENUM_DECL(virDomainNetInterfaceLinkState)
2855
VIR_ENUM_DECL(virDomainChrDevice)
2856
VIR_ENUM_DECL(virDomainChrChannelTarget)
2857
VIR_ENUM_DECL(virDomainChrConsoleTarget)
G
Guannan Ren 已提交
2858
VIR_ENUM_DECL(virDomainChrSerialTarget)
E
Eric Blake 已提交
2859
VIR_ENUM_DECL(virDomainSmartcard)
2860
VIR_ENUM_DECL(virDomainChr)
2861
VIR_ENUM_DECL(virDomainChrTcpProtocol)
E
Eric Blake 已提交
2862
VIR_ENUM_DECL(virDomainChrSpicevmc)
2863
VIR_ENUM_DECL(virDomainSoundCodec)
2864
VIR_ENUM_DECL(virDomainSoundModel)
2865
VIR_ENUM_DECL(virDomainMemballoonModel)
2866
VIR_ENUM_DECL(virDomainSmbiosMode)
R
Richard Jones 已提交
2867 2868
VIR_ENUM_DECL(virDomainWatchdogModel)
VIR_ENUM_DECL(virDomainWatchdogAction)
2869
VIR_ENUM_DECL(virDomainVideo)
2870 2871
VIR_ENUM_DECL(virDomainHostdevMode)
VIR_ENUM_DECL(virDomainHostdevSubsys)
2872
VIR_ENUM_DECL(virDomainHostdevCaps)
M
Marc-André Lureau 已提交
2873
VIR_ENUM_DECL(virDomainHub)
2874
VIR_ENUM_DECL(virDomainRedirdevBus)
2875 2876 2877
VIR_ENUM_DECL(virDomainInput)
VIR_ENUM_DECL(virDomainInputBus)
VIR_ENUM_DECL(virDomainGraphics)
2878
VIR_ENUM_DECL(virDomainGraphicsListen)
2879
VIR_ENUM_DECL(virDomainGraphicsAuthConnected)
2880 2881
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelName)
VIR_ENUM_DECL(virDomainGraphicsSpiceChannelMode)
2882 2883 2884
VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceJpegCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
2885
VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
P
Peng Zhou 已提交
2886
VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode)
2887
VIR_ENUM_DECL(virDomainGraphicsVNCSharePolicy)
2888
VIR_ENUM_DECL(virDomainHyperv)
2889
VIR_ENUM_DECL(virDomainKVM)
2890 2891
VIR_ENUM_DECL(virDomainRNGModel)
VIR_ENUM_DECL(virDomainRNGBackend)
2892 2893
VIR_ENUM_DECL(virDomainTPMModel)
VIR_ENUM_DECL(virDomainTPMBackend)
2894 2895
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState)
J
Jiri Denemark 已提交
2896 2897 2898 2899 2900 2901 2902
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)
2903
VIR_ENUM_DECL(virDomainPMSuspendedReason)
J
Jiri Denemark 已提交
2904 2905 2906 2907

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

2908
VIR_ENUM_DECL(virDomainSeclabel)
2909
VIR_ENUM_DECL(virDomainClockOffset)
2910
VIR_ENUM_DECL(virDomainClockBasis)
2911

2912
VIR_ENUM_DECL(virDomainTimerName)
2913
VIR_ENUM_DECL(virDomainTimerTrack)
2914 2915
VIR_ENUM_DECL(virDomainTimerTickpolicy)
VIR_ENUM_DECL(virDomainTimerMode)
O
Osier Yang 已提交
2916
VIR_ENUM_DECL(virDomainCpuPlacementMode)
2917

2918
VIR_ENUM_DECL(virDomainStartupPolicy)
2919

O
Osier Yang 已提交
2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953
# 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)

2954 2955 2956
int virDomainObjListExport(virDomainObjListPtr doms,
                           virConnectPtr conn,
                           virDomainPtr **domains,
2957
                           virDomainObjListFilter filter,
2958
                           unsigned int flags);
O
Osier Yang 已提交
2959

2960 2961
void virDomainListFree(virDomainPtr *list);

2962 2963 2964 2965 2966
int
virDomainDefMaybeAddController(virDomainDefPtr def,
                               int type,
                               int idx,
                               int model);
2967 2968 2969 2970
int
virDomainDefMaybeAddInput(virDomainDefPtr def,
                          int type,
                          int bus);
2971

2972 2973
char *virDomainDefGetDefaultEmulator(virDomainDefPtr def, virCapsPtr caps);

2974 2975
int virDomainDefFindDevice(virDomainDefPtr def,
                           const char *devAlias,
2976 2977
                           virDomainDeviceDefPtr dev,
                           bool reportError);
2978

2979
bool virDomainDiskSourceIsBlockType(virStorageSourcePtr src)
2980 2981
    ATTRIBUTE_NONNULL(1);

2982 2983
void virDomainChrSourceDefClear(virDomainChrSourceDefPtr def);

2984 2985 2986 2987 2988 2989 2990
char *virDomainObjGetMetadata(virDomainObjPtr vm,
                              int type,
                              const char *uri,
                              virCapsPtr caps,
                              virDomainXMLOptionPtr xmlopt,
                              unsigned int flags);

2991 2992 2993 2994 2995 2996 2997
int virDomainObjSetMetadata(virDomainObjPtr vm,
                            int type,
                            const char *metadata,
                            const char *key,
                            const char *uri,
                            virCapsPtr caps,
                            virDomainXMLOptionPtr xmlopt,
2998
                            const char *stateDir,
2999 3000 3001
                            const char *configDir,
                            unsigned int flags);

3002 3003 3004 3005 3006 3007 3008 3009
int
virDomainParseMemory(const char *xpath,
                     const char *units_xpath,
                     xmlXPathContextPtr ctxt,
                     unsigned long long *mem,
                     bool required,
                     bool capped);

3010 3011 3012
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

3013
#endif /* __DOMAIN_CONF_H */