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

#ifndef __DOMAIN_CONF_H
#define __DOMAIN_CONF_H

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

#include "internal.h"
#include "capabilities.h"
#include "util.h"
34
#include "threads.h"
35

36 37 38 39 40
/* Private component of virDomainXMLFlags */
typedef enum {
   VIR_DOMAIN_XML_INTERNAL_STATUS = (1<<16), /* dump internal domain status information */
} virDomainXMLInternalFlags;

41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
/* Different types of hypervisor */
/* NB: Keep in sync with virDomainVirtTypeToString impl */
enum virDomainVirtType {
    VIR_DOMAIN_VIRT_QEMU,
    VIR_DOMAIN_VIRT_KQEMU,
    VIR_DOMAIN_VIRT_KVM,
    VIR_DOMAIN_VIRT_XEN,
    VIR_DOMAIN_VIRT_LXC,
    VIR_DOMAIN_VIRT_UML,
    VIR_DOMAIN_VIRT_OPENVZ,
    VIR_DOMAIN_VIRT_VSERVER,
    VIR_DOMAIN_VIRT_LDOM,
    VIR_DOMAIN_VIRT_TEST,
    VIR_DOMAIN_VIRT_VMWARE,
    VIR_DOMAIN_VIRT_HYPERV,
56
    VIR_DOMAIN_VIRT_VBOX,
D
Daniel Veillard 已提交
57
    VIR_DOMAIN_VIRT_ONE,
58
    VIR_DOMAIN_VIRT_PHYP,
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85

    VIR_DOMAIN_VIRT_LAST,
};

/* Two types of disk backends */
enum virDomainDiskType {
    VIR_DOMAIN_DISK_TYPE_BLOCK,
    VIR_DOMAIN_DISK_TYPE_FILE,

    VIR_DOMAIN_DISK_TYPE_LAST
};

/* Three types of disk frontend */
enum virDomainDiskDevice {
    VIR_DOMAIN_DISK_DEVICE_DISK,
    VIR_DOMAIN_DISK_DEVICE_CDROM,
    VIR_DOMAIN_DISK_DEVICE_FLOPPY,

    VIR_DOMAIN_DISK_DEVICE_LAST
};

enum virDomainDiskBus {
    VIR_DOMAIN_DISK_BUS_IDE,
    VIR_DOMAIN_DISK_BUS_FDC,
    VIR_DOMAIN_DISK_BUS_SCSI,
    VIR_DOMAIN_DISK_BUS_VIRTIO,
    VIR_DOMAIN_DISK_BUS_XEN,
86
    VIR_DOMAIN_DISK_BUS_USB,
87
    VIR_DOMAIN_DISK_BUS_UML,
88 89 90 91

    VIR_DOMAIN_DISK_BUS_LAST
};

92 93 94 95 96 97 98 99 100
enum  virDomainDiskCache {
    VIR_DOMAIN_DISK_CACHE_DEFAULT,
    VIR_DOMAIN_DISK_CACHE_DISABLE,
    VIR_DOMAIN_DISK_CACHE_WRITETHRU,
    VIR_DOMAIN_DISK_CACHE_WRITEBACK,

    VIR_DOMAIN_DISK_CACHE_LAST
};

101 102 103 104 105 106 107 108 109 110 111
/* Stores the virtual disk configuration */
typedef struct _virDomainDiskDef virDomainDiskDef;
typedef virDomainDiskDef *virDomainDiskDefPtr;
struct _virDomainDiskDef {
    int type;
    int device;
    int bus;
    char *src;
    char *dst;
    char *driverName;
    char *driverType;
112
    int cachemode;
113 114
    unsigned int readonly : 1;
    unsigned int shared : 1;
115 116 117 118 119
    struct {
        unsigned domain;
        unsigned bus;
        unsigned slot;
    } pci_addr;
120 121
};

122 123 124 125 126 127
static inline int
virDiskHasValidPciAddr(virDomainDiskDefPtr def)
{
    return def->pci_addr.domain || def->pci_addr.domain || def->pci_addr.slot;
}

128

129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
/* Two types of disk backends */
enum virDomainFSType {
    VIR_DOMAIN_FS_TYPE_MOUNT,   /* Better named 'bind' */
    VIR_DOMAIN_FS_TYPE_BLOCK,
    VIR_DOMAIN_FS_TYPE_FILE,
    VIR_DOMAIN_FS_TYPE_TEMPLATE,

    VIR_DOMAIN_FS_TYPE_LAST
};

typedef struct _virDomainFSDef virDomainFSDef;
typedef virDomainFSDef *virDomainFSDefPtr;
struct _virDomainFSDef {
    int type;
    char *src;
    char *dst;
    unsigned int readonly : 1;
};


149 150 151 152 153 154 155 156 157
/* 5 different types of networking config */
enum virDomainNetType {
    VIR_DOMAIN_NET_TYPE_USER,
    VIR_DOMAIN_NET_TYPE_ETHERNET,
    VIR_DOMAIN_NET_TYPE_SERVER,
    VIR_DOMAIN_NET_TYPE_CLIENT,
    VIR_DOMAIN_NET_TYPE_MCAST,
    VIR_DOMAIN_NET_TYPE_NETWORK,
    VIR_DOMAIN_NET_TYPE_BRIDGE,
D
Daniel Veillard 已提交
158
    VIR_DOMAIN_NET_TYPE_INTERNAL,
159 160 161 162 163 164 165 166 167 168

    VIR_DOMAIN_NET_TYPE_LAST,
};


/* Stores the virtual network interface configuration */
typedef struct _virDomainNetDef virDomainNetDef;
typedef virDomainNetDef *virDomainNetDefPtr;
struct _virDomainNetDef {
    int type;
169
    unsigned char mac[VIR_MAC_BUFLEN];
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
    char *model;
    union {
        struct {
            char *dev;
            char *script;
            char *ipaddr;
        } ethernet;
        struct {
            char *address;
            int port;
        } socket; /* any of NET_CLIENT or NET_SERVER or NET_MCAST */
        struct {
            char *name;
        } network;
        struct {
            char *brname;
186
            char *script;
187
            char *ipaddr;
188
        } bridge;
D
Daniel Veillard 已提交
189 190 191
        struct {
            char *name;
        } internal;
192 193
    } data;
    char *ifname;
194 195
    char *nic_name;
    char *hostnet_name;
196 197 198 199 200
    struct {
        unsigned domain;
        unsigned bus;
        unsigned slot;
    } pci_addr;
201
    int vlan;
202 203
};

204 205 206 207 208 209
static inline int
virNetHasValidPciAddr(virDomainNetDefPtr def)
{
    return def->pci_addr.domain || def->pci_addr.domain || def->pci_addr.slot;
}

210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
enum virDomainChrSrcType {
    VIR_DOMAIN_CHR_TYPE_NULL,
    VIR_DOMAIN_CHR_TYPE_VC,
    VIR_DOMAIN_CHR_TYPE_PTY,
    VIR_DOMAIN_CHR_TYPE_DEV,
    VIR_DOMAIN_CHR_TYPE_FILE,
    VIR_DOMAIN_CHR_TYPE_PIPE,
    VIR_DOMAIN_CHR_TYPE_STDIO,
    VIR_DOMAIN_CHR_TYPE_UDP,
    VIR_DOMAIN_CHR_TYPE_TCP,
    VIR_DOMAIN_CHR_TYPE_UNIX,

    VIR_DOMAIN_CHR_TYPE_LAST,
};

enum virDomainChrTcpProtocol {
    VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW,
    VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET,

    VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST,
};

typedef struct _virDomainChrDef virDomainChrDef;
typedef virDomainChrDef *virDomainChrDefPtr;
struct _virDomainChrDef {
    int dstPort;

    int type;
    union {
        struct {
            char *path;
        } file; /* pty, file, pipe, or device */
        struct {
            char *host;
            char *service;
            int listen;
            int protocol;
        } tcp;
        struct {
            char *bindHost;
            char *bindService;
            char *connectHost;
            char *connectService;
        } udp;
        struct {
            char *path;
            int listen;
        } nix;
    } data;
};

enum virDomainInputType {
    VIR_DOMAIN_INPUT_TYPE_MOUSE,
    VIR_DOMAIN_INPUT_TYPE_TABLET,

    VIR_DOMAIN_INPUT_TYPE_LAST,
};

enum virDomainInputBus {
    VIR_DOMAIN_INPUT_BUS_PS2,
    VIR_DOMAIN_INPUT_BUS_USB,
    VIR_DOMAIN_INPUT_BUS_XEN,

    VIR_DOMAIN_INPUT_BUS_LAST
};

typedef struct _virDomainInputDef virDomainInputDef;
typedef virDomainInputDef *virDomainInputDefPtr;
struct _virDomainInputDef {
    int type;
    int bus;
};

enum virDomainSoundModel {
    VIR_DOMAIN_SOUND_MODEL_SB16,
    VIR_DOMAIN_SOUND_MODEL_ES1370,
    VIR_DOMAIN_SOUND_MODEL_PCSPK,
D
Daniel P. Berrange 已提交
287
    VIR_DOMAIN_SOUND_MODEL_AC97,
288 289 290 291 292 293 294 295 296 297

    VIR_DOMAIN_SOUND_MODEL_LAST
};

typedef struct _virDomainSoundDef virDomainSoundDef;
typedef virDomainSoundDef *virDomainSoundDefPtr;
struct _virDomainSoundDef {
    int model;
};

298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317

enum virDomainVideoType {
    VIR_DOMAIN_VIDEO_TYPE_VGA,
    VIR_DOMAIN_VIDEO_TYPE_CIRRUS,
    VIR_DOMAIN_VIDEO_TYPE_VMVGA,
    VIR_DOMAIN_VIDEO_TYPE_XEN,
    VIR_DOMAIN_VIDEO_TYPE_VBOX,

    VIR_DOMAIN_VIDEO_TYPE_LAST
};


typedef struct _virDomainVideoDef virDomainVideoDef;
typedef virDomainVideoDef *virDomainVideoDefPtr;
struct _virDomainVideoDef {
    int type;
    unsigned int vram;
    unsigned int heads;
};

318 319 320 321
/* 3 possible graphics console modes */
enum virDomainGraphicsType {
    VIR_DOMAIN_GRAPHICS_TYPE_SDL,
    VIR_DOMAIN_GRAPHICS_TYPE_VNC,
322 323
    VIR_DOMAIN_GRAPHICS_TYPE_RDP,
    VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342

    VIR_DOMAIN_GRAPHICS_TYPE_LAST,
};

typedef struct _virDomainGraphicsDef virDomainGraphicsDef;
typedef virDomainGraphicsDef *virDomainGraphicsDefPtr;
struct _virDomainGraphicsDef {
    int type;
    union {
        struct {
            int port;
            int autoport : 1;
            char *listenAddr;
            char *keymap;
            char *passwd;
        } vnc;
        struct {
            char *display;
            char *xauth;
343
            int fullscreen;
344
        } sdl;
345 346 347 348 349 350 351 352 353 354 355
        struct {
            int port;
            char *listenAddr;
            int autoport : 1;
            int replaceUser : 1;
            int multiUser : 1;
        } rdp;
        struct {
            char *display;
            int fullscreen : 1;
        } desktop;
356 357 358
    } data;
};

359 360 361
enum virDomainHostdevMode {
    VIR_DOMAIN_HOSTDEV_MODE_SUBSYS,
    VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES,
362

363 364 365 366 367 368 369 370 371 372 373 374 375 376
    VIR_DOMAIN_HOSTDEV_MODE_LAST,
};

enum virDomainHostdevSubsysType {
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB,
    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,

    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
};

typedef struct _virDomainHostdevDef virDomainHostdevDef;
typedef virDomainHostdevDef *virDomainHostdevDefPtr;
struct _virDomainHostdevDef {
    int mode; /* enum virDomainHostdevMode */
377
    unsigned int managed : 1;
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
    union {
        struct {
            int type; /* enum virDomainHostdevBusType */
            union {
                struct {
                    unsigned bus;
                    unsigned device;

                    unsigned vendor;
                    unsigned product;
                } usb;
                struct {
                     unsigned domain;
                     unsigned bus;
                     unsigned slot;
                     unsigned function;
                } pci;
395
            } u;
396 397 398 399 400
        } subsys;
        struct {
            /* TBD: struct capabilities see:
             * https://www.redhat.com/archives/libvir-list/2008-July/msg00429.html
             */
401
            int dummy;
402 403 404 405
        } caps;
    } source;
    char* target;
};
406 407 408 409

/* Flags for the 'type' field in next struct */
enum virDomainDeviceType {
    VIR_DOMAIN_DEVICE_DISK,
410
    VIR_DOMAIN_DEVICE_FS,
411 412 413
    VIR_DOMAIN_DEVICE_NET,
    VIR_DOMAIN_DEVICE_INPUT,
    VIR_DOMAIN_DEVICE_SOUND,
414
    VIR_DOMAIN_DEVICE_VIDEO,
415
    VIR_DOMAIN_DEVICE_HOSTDEV,
416 417

    VIR_DOMAIN_DEVICE_LAST,
418 419 420 421 422 423 424 425
};

typedef struct _virDomainDeviceDef virDomainDeviceDef;
typedef virDomainDeviceDef *virDomainDeviceDefPtr;
struct _virDomainDeviceDef {
    int type;
    union {
        virDomainDiskDefPtr disk;
426
        virDomainFSDefPtr fs;
427 428 429
        virDomainNetDefPtr net;
        virDomainInputDefPtr input;
        virDomainSoundDefPtr sound;
430
        virDomainVideoDefPtr video;
431
        virDomainHostdevDefPtr hostdev;
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
    } data;
};


#define VIR_DOMAIN_MAX_BOOT_DEVS 4

/* 3 possible boot devices */
enum virDomainBootOrder {
    VIR_DOMAIN_BOOT_FLOPPY,
    VIR_DOMAIN_BOOT_CDROM,
    VIR_DOMAIN_BOOT_DISK,
    VIR_DOMAIN_BOOT_NET,

    VIR_DOMAIN_BOOT_LAST,
};

enum virDomainFeature {
    VIR_DOMAIN_FEATURE_ACPI,
    VIR_DOMAIN_FEATURE_APIC,
    VIR_DOMAIN_FEATURE_PAE,

    VIR_DOMAIN_FEATURE_LAST
};

enum virDomainLifecycleAction {
    VIR_DOMAIN_LIFECYCLE_DESTROY,
    VIR_DOMAIN_LIFECYCLE_RESTART,
    VIR_DOMAIN_LIFECYCLE_RESTART_RENAME,
    VIR_DOMAIN_LIFECYCLE_PRESERVE,

    VIR_DOMAIN_LIFECYCLE_LAST
};

/* Operating system configuration data & machine / arch */
typedef struct _virDomainOSDef virDomainOSDef;
typedef virDomainOSDef *virDomainOSDefPtr;
struct _virDomainOSDef {
    char *type;
    char *arch;
    char *machine;
    int nBootDevs;
    int bootDevs[VIR_DOMAIN_BOOT_LAST];
474
    char *init;
475 476 477 478 479 480 481 482 483
    char *kernel;
    char *initrd;
    char *cmdline;
    char *root;
    char *loader;
    char *bootloader;
    char *bootloaderArgs;
};

484 485 486 487 488 489 490
enum virDomainSeclabelType {
    VIR_DOMAIN_SECLABEL_DYNAMIC,
    VIR_DOMAIN_SECLABEL_STATIC,

    VIR_DOMAIN_SECLABEL_LAST,
};

491 492 493 494 495 496 497
/* Security configuration for domain */
typedef struct _virSecurityLabelDef virSecurityLabelDef;
typedef virSecurityLabelDef *virSecurityLabelDefPtr;
struct _virSecurityLabelDef {
    char *model;        /* name of security model */
    char *label;        /* security label string */
    char *imagelabel;   /* security image label string */
498
    int type;
499 500
};

501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
#define VIR_DOMAIN_CPUMASK_LEN 1024

/* Guest VM main configuration */
typedef struct _virDomainDef virDomainDef;
typedef virDomainDef *virDomainDefPtr;
struct _virDomainDef {
    int virtType;
    int id;
    unsigned char uuid[VIR_UUID_BUFLEN];
    char *name;

    unsigned long memory;
    unsigned long maxmem;
    unsigned long vcpus;
    int cpumasklen;
    char *cpumask;

    /* These 3 are based on virDomainLifeCycleAction enum flags */
    int onReboot;
    int onPoweroff;
    int onCrash;

    virDomainOSDef os;
    char *emulator;
    int features;

    int localtime;

529 530
    int ngraphics;
    virDomainGraphicsDefPtr *graphics;
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546

    int ndisks;
    virDomainDiskDefPtr *disks;

    int nfss;
    virDomainFSDefPtr *fss;

    int nnets;
    virDomainNetDefPtr *nets;

    int ninputs;
    virDomainInputDefPtr *inputs;

    int nsounds;
    virDomainSoundDefPtr *sounds;

547 548 549
    int nvideos;
    virDomainVideoDefPtr *videos;

550 551 552 553 554 555 556 557 558 559
    int nhostdevs;
    virDomainHostdevDefPtr *hostdevs;

    int nserials;
    virDomainChrDefPtr *serials;

    int nparallels;
    virDomainChrDefPtr *parallels;

    /* Only 1 */
560
    virDomainChrDefPtr console;
561
    virSecurityLabelDef seclabel;
562 563 564 565 566 567
};

/* Guest VM runtime state */
typedef struct _virDomainObj virDomainObj;
typedef virDomainObj *virDomainObjPtr;
struct _virDomainObj {
568
    virMutex lock;
569

570
    int monitor;
571
    virDomainChrDefPtr monitor_chr;
572
    int monitorWatch;
573 574 575 576 577 578 579 580 581 582 583 584 585
    int pid;
    int state;

    int nvcpupids;
    int *vcpupids;

    unsigned int autostart : 1;
    unsigned int persistent : 1;

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

586 587 588 589 590 591
typedef struct _virDomainObjList virDomainObjList;
typedef virDomainObjList *virDomainObjListPtr;
struct _virDomainObjList {
    unsigned int count;
    virDomainObjPtr *objs;
};
592 593 594 595 596 597 598 599

static inline int
virDomainIsActive(virDomainObjPtr dom)
{
    return dom->def->id != -1;
}


600
virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms,
601
                                  int id);
602
virDomainObjPtr virDomainFindByUUID(const virDomainObjListPtr doms,
603
                                    const unsigned char *uuid);
604
virDomainObjPtr virDomainFindByName(const virDomainObjListPtr doms,
605 606 607 608 609 610
                                    const char *name);


void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def);
void virDomainDiskDefFree(virDomainDiskDefPtr def);
611
void virDomainFSDefFree(virDomainFSDefPtr def);
612 613 614
void virDomainNetDefFree(virDomainNetDefPtr def);
void virDomainChrDefFree(virDomainChrDefPtr def);
void virDomainSoundDefFree(virDomainSoundDefPtr def);
615
void virDomainVideoDefFree(virDomainVideoDefPtr def);
616
void virDomainHostdevDefFree(virDomainHostdevDefPtr def);
617 618 619
void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
void virDomainDefFree(virDomainDefPtr vm);
void virDomainObjFree(virDomainObjPtr vm);
620
void virDomainObjListFree(virDomainObjListPtr vms);
621 622

virDomainObjPtr virDomainAssignDef(virConnectPtr conn,
623
                                   virDomainObjListPtr doms,
624
                                   const virDomainDefPtr def);
625
void virDomainRemoveInactive(virDomainObjListPtr doms,
626 627
                             virDomainObjPtr dom);

628
#ifndef PROXY
629
virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
630
                                              virCapsPtr caps,
631
                                              const virDomainDefPtr def,
632 633
                                              const char *xmlStr,
                                              int flags);
634 635
virDomainDefPtr virDomainDefParseString(virConnectPtr conn,
                                        virCapsPtr caps,
636 637
                                        const char *xmlStr,
                                        int flags);
638 639
virDomainDefPtr virDomainDefParseFile(virConnectPtr conn,
                                      virCapsPtr caps,
640 641
                                      const char *filename,
                                      int flags);
642 643 644
virDomainDefPtr virDomainDefParseNode(virConnectPtr conn,
                                      virCapsPtr caps,
                                      xmlDocPtr doc,
645 646
                                      xmlNodePtr root,
                                      int flags);
647 648 649 650 651 652 653 654 655

virDomainObjPtr virDomainObjParseFile(virConnectPtr conn,
                                      virCapsPtr caps,
                                      const char *filename);
virDomainObjPtr virDomainObjParseNode(virConnectPtr conn,
                                      virCapsPtr caps,
                                      xmlDocPtr xml,
                                      xmlNodePtr root);

656
#endif
657 658 659
char *virDomainDefFormat(virConnectPtr conn,
                         virDomainDefPtr def,
                         int flags);
660 661 662
char *virDomainObjFormat(virConnectPtr conn,
                         virDomainObjPtr obj,
                         int flags);
663 664 665 666 667 668 669 670 671 672

int virDomainCpuSetParse(virConnectPtr conn,
                         const char **str,
                         char sep,
                         char *cpuset,
                         int maxcpu);
char *virDomainCpuSetFormat(virConnectPtr conn,
                            char *cpuset,
                            int maxcpu);

673
int virDomainDiskQSort(const void *a, const void *b);
674 675
int virDomainDiskCompare(virDomainDiskDefPtr a,
                         virDomainDiskDefPtr b);
676

677 678 679 680 681
int virDomainSaveXML(virConnectPtr conn,
                     const char *configDir,
                     virDomainDefPtr def,
                     const char *xml);

682 683
int virDomainSaveConfig(virConnectPtr conn,
                        const char *configDir,
684
                        virDomainDefPtr def);
685 686 687
int virDomainSaveStatus(virConnectPtr conn,
                        const char *statusDir,
                        virDomainObjPtr obj);
688

689 690 691 692
typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
                                          int newDomain,
                                          void *opaque);

693 694
virDomainObjPtr virDomainLoadConfig(virConnectPtr conn,
                                    virCapsPtr caps,
695
                                    virDomainObjListPtr doms,
696 697
                                    const char *configDir,
                                    const char *autostartDir,
698 699 700
                                    const char *name,
                                    virDomainLoadConfigNotify notify,
                                    void *opaque);
701 702 703

int virDomainLoadAllConfigs(virConnectPtr conn,
                            virCapsPtr caps,
704
                            virDomainObjListPtr doms,
705
                            const char *configDir,
706
                            const char *autostartDir,
707
                            int liveStatus,
708 709
                            virDomainLoadConfigNotify notify,
                            void *opaque);
710 711

int virDomainDeleteConfig(virConnectPtr conn,
712 713
                          const char *configDir,
                          const char *autostartDir,
714 715
                          virDomainObjPtr dom);

716 717 718 719
char *virDomainConfigFile(virConnectPtr conn,
                          const char *dir,
                          const char *name);

720 721 722 723
int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
                                int *busIdx,
                                int *devIdx);

724
virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def);
725 726
int virDomainVideoDefaultType(virDomainDefPtr def);
int virDomainVideoDefaultRAM(virDomainDefPtr def, int type);
727

D
Daniel P. Berrange 已提交
728 729
void virDomainObjLock(virDomainObjPtr obj);
void virDomainObjUnlock(virDomainObjPtr obj);
730

731 732 733 734
VIR_ENUM_DECL(virDomainVirt)
VIR_ENUM_DECL(virDomainBoot)
VIR_ENUM_DECL(virDomainFeature)
VIR_ENUM_DECL(virDomainLifecycle)
735
VIR_ENUM_DECL(virDomainDevice)
736 737 738
VIR_ENUM_DECL(virDomainDisk)
VIR_ENUM_DECL(virDomainDiskDevice)
VIR_ENUM_DECL(virDomainDiskBus)
739
VIR_ENUM_DECL(virDomainDiskCache)
740
VIR_ENUM_DECL(virDomainFS)
741 742 743
VIR_ENUM_DECL(virDomainNet)
VIR_ENUM_DECL(virDomainChr)
VIR_ENUM_DECL(virDomainSoundModel)
744
VIR_ENUM_DECL(virDomainVideo)
745 746
VIR_ENUM_DECL(virDomainHostdevMode)
VIR_ENUM_DECL(virDomainHostdevSubsys)
747 748 749
VIR_ENUM_DECL(virDomainInput)
VIR_ENUM_DECL(virDomainInputBus)
VIR_ENUM_DECL(virDomainGraphics)
750 751
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState)
752
VIR_ENUM_DECL(virDomainSeclabel)
753 754

#endif /* __DOMAIN_CONF_H */