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

22 23
#ifndef LIBVIRT_QEMU_DOMAIN_H
# define LIBVIRT_QEMU_DOMAIN_H
24

25
# include "virthread.h"
26
# include "vircgroup.h"
27
# include "virperf.h"
28
# include "domain_addr.h"
29
# include "domain_conf.h"
30
# include "snapshot_conf.h"
31
# include "qemu_monitor.h"
D
Daniel P. Berrange 已提交
32
# include "qemu_agent.h"
33
# include "qemu_blockjob.h"
34
# include "qemu_conf.h"
35
# include "qemu_capabilities.h"
36
# include "qemu_migration_params.h"
37
# include "virmdev.h"
38
# include "virchrdev.h"
39
# include "virobject.h"
40
# include "logging/log_manager.h"
41

42
# define QEMU_DOMAIN_FORMAT_LIVE_FLAGS \
43
    (VIR_DOMAIN_XML_SECURE)
44

45
# if ULONG_MAX == 4294967295
P
Philipp Hahn 已提交
46
/* QEMU has a 64-bit limit, but we are limited by our historical choice of
47
 * representing bandwidth in a long instead of a 64-bit int.  */
48
#  define QEMU_DOMAIN_MIG_BANDWIDTH_MAX ULONG_MAX
49
# else
50
#  define QEMU_DOMAIN_MIG_BANDWIDTH_MAX (INT64_MAX / (1024 * 1024))
51
# endif
52

C
caoxinhua 已提交
53
# define JOB_MASK(job)                  (job == 0 ? 0 : 1 << (job - 1))
54 55 56
# define QEMU_JOB_DEFAULT_MASK \
    (JOB_MASK(QEMU_JOB_QUERY) | \
     JOB_MASK(QEMU_JOB_DESTROY) | \
57
     JOB_MASK(QEMU_JOB_ABORT))
58

59
/* Jobs which have to be tracked in domain state XML. */
60 61
# define QEMU_DOMAIN_TRACK_JOBS \
    (JOB_MASK(QEMU_JOB_DESTROY) | \
62 63
     JOB_MASK(QEMU_JOB_ASYNC))

64 65 66
/* Only 1 job is allowed at any time
 * A job includes *all* monitor commands, even those just querying
 * information, not merely actions */
67
typedef enum {
68
    QEMU_JOB_NONE = 0,  /* Always set to 0 for easy if (jobActive) conditions */
69 70 71 72
    QEMU_JOB_QUERY,         /* Doesn't change any state */
    QEMU_JOB_DESTROY,       /* Destroys the domain (cannot be masked out) */
    QEMU_JOB_SUSPEND,       /* Suspends (stops vCPUs) the domain */
    QEMU_JOB_MODIFY,        /* May change state */
73
    QEMU_JOB_ABORT,         /* Abort current async job */
74
    QEMU_JOB_MIGRATION_OP,  /* Operation influencing outgoing migration */
75

76
    /* The following two items must always be the last items before JOB_LAST */
77 78
    QEMU_JOB_ASYNC,         /* Asynchronous job */
    QEMU_JOB_ASYNC_NESTED,  /* Normal job within an async job */
79 80

    QEMU_JOB_LAST
81
} qemuDomainJob;
82
VIR_ENUM_DECL(qemuDomainJob);
83

84 85 86 87 88 89 90
typedef enum {
    QEMU_AGENT_JOB_NONE = 0,    /* No agent job. */
    QEMU_AGENT_JOB_QUERY,       /* Does not change state of domain */
    QEMU_AGENT_JOB_MODIFY,      /* May change state of domain */

    QEMU_AGENT_JOB_LAST
} qemuDomainAgentJob;
91
VIR_ENUM_DECL(qemuDomainAgentJob);
92

93 94 95 96
/* Async job consists of a series of jobs that may change state. Independent
 * jobs that do not change state (and possibly others if explicitly allowed by
 * current async job) are allowed to be run even if async job is active.
 */
97
typedef enum {
98 99 100 101 102
    QEMU_ASYNC_JOB_NONE = 0,
    QEMU_ASYNC_JOB_MIGRATION_OUT,
    QEMU_ASYNC_JOB_MIGRATION_IN,
    QEMU_ASYNC_JOB_SAVE,
    QEMU_ASYNC_JOB_DUMP,
103
    QEMU_ASYNC_JOB_SNAPSHOT,
104
    QEMU_ASYNC_JOB_START,
105 106

    QEMU_ASYNC_JOB_LAST
107
} qemuDomainAsyncJob;
108
VIR_ENUM_DECL(qemuDomainAsyncJob);
109

110 111 112
typedef enum {
    QEMU_DOMAIN_JOB_STATUS_NONE = 0,
    QEMU_DOMAIN_JOB_STATUS_ACTIVE,
113
    QEMU_DOMAIN_JOB_STATUS_MIGRATING,
114
    QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED,
115
    QEMU_DOMAIN_JOB_STATUS_PAUSED,
116
    QEMU_DOMAIN_JOB_STATUS_POSTCOPY,
117 118 119 120 121
    QEMU_DOMAIN_JOB_STATUS_COMPLETED,
    QEMU_DOMAIN_JOB_STATUS_FAILED,
    QEMU_DOMAIN_JOB_STATUS_CANCELED,
} qemuDomainJobStatus;

122 123 124
typedef enum {
    QEMU_DOMAIN_JOB_STATS_TYPE_NONE = 0,
    QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION,
125
    QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP,
126
    QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP,
127 128
} qemuDomainJobStatsType;

129 130 131 132 133 134 135 136

typedef struct _qemuDomainMirrorStats qemuDomainMirrorStats;
typedef qemuDomainMirrorStats *qemuDomainMirrorStatsPtr;
struct _qemuDomainMirrorStats {
    unsigned long long transferred;
    unsigned long long total;
};

J
Jiri Denemark 已提交
137 138 139
typedef struct _qemuDomainJobInfo qemuDomainJobInfo;
typedef qemuDomainJobInfo *qemuDomainJobInfoPtr;
struct _qemuDomainJobInfo {
140
    qemuDomainJobStatus status;
141
    virDomainJobOperation operation;
J
Jiri Denemark 已提交
142
    unsigned long long started; /* When the async job started */
143
    unsigned long long stopped; /* When the domain's CPUs were stopped */
144 145 146 147
    unsigned long long sent; /* When the source sent status info to the
                                destination (only for migrations). */
    unsigned long long received; /* When the destination host received status
                                    info from the source (migrations only). */
J
Jiri Denemark 已提交
148 149
    /* Computed values */
    unsigned long long timeElapsed;
J
Jiri Denemark 已提交
150
    long long timeDelta; /* delta = received - sent, i.e., the difference
151 152 153 154 155
                            between the source and the destination time plus
                            the time between the end of Perform phase on the
                            source and the beginning of Finish phase on the
                            destination. */
    bool timeDeltaSet;
J
Jiri Denemark 已提交
156
    /* Raw values from QEMU */
157 158 159
    qemuDomainJobStatsType statsType;
    union {
        qemuMonitorMigrationStats mig;
160
        qemuMonitorDumpStats dump;
161
    } stats;
162
    qemuDomainMirrorStats mirrorStats;
J
Jiri Denemark 已提交
163 164
};

165 166 167
typedef struct _qemuDomainJobObj qemuDomainJobObj;
typedef qemuDomainJobObj *qemuDomainJobObjPtr;
struct _qemuDomainJobObj {
168
    virCond cond;                       /* Use to coordinate jobs */
169 170

    /* The following members are for QEMU_JOB_* */
171
    qemuDomainJob active;               /* Currently running job */
172
    unsigned long long owner;           /* Thread id which set current job */
173
    const char *ownerAPI;               /* The API which owns the job */
J
Jiri Denemark 已提交
174
    unsigned long long started;         /* When the current job started */
175

176 177 178 179 180 181 182
    /* The following members are for QEMU_AGENT_JOB_* */
    qemuDomainAgentJob agentActive;     /* Currently running agent job */
    unsigned long long agentOwner;      /* Thread id which set current agent job */
    const char *agentOwnerAPI;          /* The API which owns the agent job */
    unsigned long long agentStarted;    /* When the current agent job started */

    /* The following members are for QEMU_ASYNC_JOB_* */
183
    virCond asyncCond;                  /* Use to coordinate with async jobs */
184
    qemuDomainAsyncJob asyncJob;        /* Currently active async job */
185
    unsigned long long asyncOwner;      /* Thread which set current async job */
186
    const char *asyncOwnerAPI;          /* The API which owns the async job */
J
Jiri Denemark 已提交
187
    unsigned long long asyncStarted;    /* When the current async job started */
J
Jiri Denemark 已提交
188
    int phase;                          /* Job phase (mainly for migrations) */
189
    unsigned long long mask;            /* Jobs allowed during async job */
J
Jiri Denemark 已提交
190
    qemuDomainJobInfoPtr current;       /* async job progress data */
191
    qemuDomainJobInfoPtr completed;     /* statistics data of a recently completed job */
192
    bool abortJob;                      /* abort of the job requested */
193 194
    bool spiceMigration;                /* we asked for spice migration and we
                                         * should wait for it to finish */
195
    bool spiceMigrated;                 /* spice migration completed */
196 197
    char *error;                        /* job event completion error */
    bool dumpCompleted;                 /* dump completed */
198 199

    qemuMigrationParamsPtr migParams;
200
    unsigned long apiFlags; /* flags passed to the API which started the async job */
201 202
};

203
typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver,
204 205
                                          virDomainObjPtr vm);

J
John Ferlan 已提交
206
# define QEMU_DOMAIN_MASTER_KEY_LEN 32  /* 32 bytes for 256 bit random key */
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222


/* helper data types for async device unplug */
typedef enum {
    QEMU_DOMAIN_UNPLUGGING_DEVICE_STATUS_NONE = 0,
    QEMU_DOMAIN_UNPLUGGING_DEVICE_STATUS_OK,
    QEMU_DOMAIN_UNPLUGGING_DEVICE_STATUS_GUEST_REJECTED,
} qemuDomainUnpluggingDeviceStatus;

typedef struct _qemuDomainUnpluggingDevice qemuDomainUnpluggingDevice;
typedef qemuDomainUnpluggingDevice *qemuDomainUnpluggingDevicePtr;
struct _qemuDomainUnpluggingDevice {
    const char *alias;
    qemuDomainUnpluggingDeviceStatus status;
};

223 224 225 226 227

typedef enum {
    QEMU_DOMAIN_NS_MOUNT = 0,
    QEMU_DOMAIN_NS_LAST
} qemuDomainNamespace;
228
VIR_ENUM_DECL(qemuDomainNamespace);
229 230 231 232

bool qemuDomainNamespaceEnabled(virDomainObjPtr vm,
                                qemuDomainNamespace ns);

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
/* Type of domain secret */
typedef enum {
    VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN = 0,
    VIR_DOMAIN_SECRET_INFO_TYPE_AES,  /* utilize GNUTLS_CIPHER_AES_256_CBC */

    VIR_DOMAIN_SECRET_INFO_TYPE_LAST
} qemuDomainSecretInfoType;

typedef struct _qemuDomainSecretPlain qemuDomainSecretPlain;
typedef struct _qemuDomainSecretPlain *qemuDomainSecretPlainPtr;
struct _qemuDomainSecretPlain {
    char *username;
    uint8_t *secret;
    size_t secretlen;
};

# define QEMU_DOMAIN_AES_IV_LEN 16   /* 16 bytes for 128 bit random */
                                     /*    initialization vector */
typedef struct _qemuDomainSecretAES qemuDomainSecretAES;
typedef struct _qemuDomainSecretAES *qemuDomainSecretAESPtr;
struct _qemuDomainSecretAES {
    char *username;
    char *alias;      /* generated alias for secret */
    char *iv;         /* base64 encoded initialization vector */
    char *ciphertext; /* encoded/encrypted secret */
};

typedef struct _qemuDomainSecretInfo qemuDomainSecretInfo;
typedef qemuDomainSecretInfo *qemuDomainSecretInfoPtr;
struct _qemuDomainSecretInfo {
    qemuDomainSecretInfoType type;
    union {
        qemuDomainSecretPlain plain;
        qemuDomainSecretAES aes;
    } s;
};

270 271 272
typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate;
typedef qemuDomainObjPrivate *qemuDomainObjPrivatePtr;
struct _qemuDomainObjPrivate {
273 274
    virQEMUDriverPtr driver;

275
    qemuDomainJobObj job;
276

277 278
    virBitmapPtr namespaces;

279
    qemuMonitorPtr mon;
280
    virDomainChrSourceDefPtr monConfig;
E
Eric Blake 已提交
281
    bool monJSON;
282 283
    bool monError;
    unsigned long long monStart;
D
Daniel P. Berrange 已提交
284 285 286 287

    qemuAgentPtr agent;
    bool agentError;

288
    bool beingDestroyed;
289
    char *pidfile;
290

291
    virDomainPCIAddressSetPtr pciaddrs;
J
Ján Tomko 已提交
292
    virDomainUSBAddressSetPtr usbaddrs;
293

294
    virQEMUCapsPtr qemuCaps;
295
    char *lockState;
296 297

    bool fakeReboot;
298
    virTristateBool allowReboot;
299 300

    int jobs_queued;
301 302

    unsigned long migMaxBandwidth;
J
Jiri Denemark 已提交
303
    char *origname;
304
    int nbdPort; /* Port used for migration with NBD */
305
    unsigned short migrationPort;
306
    int preMigrationState;
307

308
    virChrdevsPtr devs;
309 310 311 312

    qemuDomainCleanupCallback *cleanupCallbacks;
    size_t ncleanupCallbacks;
    size_t ncleanupCallbacks_max;
313 314

    virCgroupPtr cgroup;
315

316 317
    virPerfPtr perf;

318 319
    qemuDomainUnpluggingDevice unplug;

320
    char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
321 322

    bool hookRun;  /* true if there was a hook run over this domain */
323 324

    /* Bitmaps below hold data from the auto NUMA feature */
325
    virBitmapPtr autoNodeset;
326
    virBitmapPtr autoCpuset;
327 328 329

    bool signalIOError; /* true if the domain condition should be signalled on
                           I/O error */
330 331
    bool signalStop; /* true if the domain condition should be signalled on
                        QMP STOP event */
332
    char *machineName;
333 334
    char *libDir;            /* base path for per-domain files */
    char *channelTargetDir;  /* base path for per-domain channel targets */
J
John Ferlan 已提交
335 336 337 338 339

    /* random masterKey and length for encryption (not to be saved in our */
    /* private XML) - need to restore at process reconnect */
    uint8_t *masterKey;
    size_t masterKeyLen;
340 341 342

    /* note whether memory device alias does not correspond to slot number */
    bool memAliasOrderMismatch;
343

344 345 346
    /* for migrations using TLS with a secret (not to be saved in our */
    /* private XML). */
    qemuDomainSecretInfoPtr migSecinfo;
347

348 349 350
    /* CPU def used to start the domain when it differs from the one actually
     * provided by QEMU. */
    virCPUDefPtr origCPU;
351 352 353

    /* If true virtlogd is used as stdio handler for character devices. */
    bool chardevStdioLogd;
354 355 356

    /* Tracks blockjob state for vm. Valid only while reconnecting to qemu. */
    virTristateBool reconnectBlockjobs;
357 358 359 360

    /* Migration capabilities. Rechecked on reconnect, not to be saved in
     * private XML. */
    virBitmapPtr migrationCaps;
361 362 363

    /* true if qemu-pr-helper process is running for the domain */
    bool prDaemonRunning;
364 365 366

    /* counter for generating node names for qemu disks */
    unsigned long long nodenameindex;
367 368 369 370

    /* qemuProcessStartCPUs stores the reason for starting vCPUs here for the
     * RESUME event handler to use it */
    virDomainRunningReason runningReason;
371 372 373

    /* true if libvirt remembers the original owner for files */
    bool rememberOwner;
374 375 376

    /* true if global -mem-prealloc appears on cmd line */
    bool memPrealloc;
377 378
};

379
# define QEMU_DOMAIN_PRIVATE(vm) \
380
    ((qemuDomainObjPrivatePtr) (vm)->privateData)
381

382
# define QEMU_DOMAIN_DISK_PRIVATE(disk) \
383 384 385 386 387 388 389 390 391 392
    ((qemuDomainDiskPrivatePtr) (disk)->privateData)

typedef struct _qemuDomainDiskPrivate qemuDomainDiskPrivate;
typedef qemuDomainDiskPrivate *qemuDomainDiskPrivatePtr;
struct _qemuDomainDiskPrivate {
    virObject parent;

    /* 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 */
393
    qemuBlockJobDataPtr blockjob;
394 395

    bool migrating; /* the disk is being migrated */
396
    virStorageSourcePtr migrSource; /* disk source object used for NBD migration */
397

398 399 400
    /* information about the device */
    bool tray; /* device has tray */
    bool removable; /* device media can be removed/changed */
401 402

    char *qomName; /* QOM path of the disk (also refers to the block backend) */
403
    char *nodeCopyOnRead; /* nodename of the disk-wide copy-on-read blockdev layer */
404 405
};

406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
# define QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src) \
    ((qemuDomainStorageSourcePrivatePtr) (src)->privateData)

typedef struct _qemuDomainStorageSourcePrivate qemuDomainStorageSourcePrivate;
typedef qemuDomainStorageSourcePrivate *qemuDomainStorageSourcePrivatePtr;
struct _qemuDomainStorageSourcePrivate {
    virObject parent;

    /* data required for authentication to the storage source */
    qemuDomainSecretInfoPtr secinfo;

    /* data required for decryption of encrypted storage source */
    qemuDomainSecretInfoPtr encinfo;
};

virObjectPtr qemuDomainStorageSourcePrivateNew(void);

423 424 425 426 427
typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
struct _qemuDomainVcpuPrivate {
    virObject parent;

428
    pid_t tid; /* vcpu thread id */
429
    int enable_id; /* order in which the vcpus were enabled in qemu */
430
    int qemu_id; /* ID reported by qemu as 'CPU' in query-cpus */
431
    char *alias;
432
    virTristateBool halted;
433 434 435 436 437 438

    /* information for hotpluggable cpus */
    char *type;
    int socket_id;
    int core_id;
    int thread_id;
439
    int node_id;
440
    int vcpus;
441 442
};

443
# define QEMU_DOMAIN_VCPU_PRIVATE(vcpu) \
444 445 446
    ((qemuDomainVcpuPrivatePtr) (vcpu)->privateData)


447 448
struct qemuDomainDiskInfo {
    bool removable;
449
    bool tray;
450
    bool tray_open;
451
    bool empty;
452
    int io_status;
453
    char *nodename;
454 455
};

456
# define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
457
    ((qemuDomainChrSourcePrivatePtr) (dev)->privateData)
458

459 460 461
typedef struct _qemuDomainChrSourcePrivate qemuDomainChrSourcePrivate;
typedef qemuDomainChrSourcePrivate *qemuDomainChrSourcePrivatePtr;
struct _qemuDomainChrSourcePrivate {
462 463 464 465 466 467 468 469
    virObject parent;

    /* for char devices using secret
     * NB: *not* to be written to qemu domain object XML */
    qemuDomainSecretInfoPtr secinfo;
};


J
Ján Tomko 已提交
470 471 472 473 474
typedef struct _qemuDomainVsockPrivate qemuDomainVsockPrivate;
typedef qemuDomainVsockPrivate *qemuDomainVsockPrivatePtr;
struct _qemuDomainVsockPrivate {
    virObject parent;

475
    int vhostfd;
J
Ján Tomko 已提交
476 477 478
};


479 480 481 482 483 484 485 486 487
# define QEMU_DOMAIN_GRAPHICS_PRIVATE(dev) \
    ((qemuDomainGraphicsPrivatePtr) (dev)->privateData)

typedef struct _qemuDomainGraphicsPrivate qemuDomainGraphicsPrivate;
typedef qemuDomainGraphicsPrivate *qemuDomainGraphicsPrivatePtr;
struct _qemuDomainGraphicsPrivate {
    virObject parent;

    char *tlsAlias;
488
    qemuDomainSecretInfoPtr secinfo;
489 490 491
};


C
Chen Fan 已提交
492 493
typedef enum {
    QEMU_PROCESS_EVENT_WATCHDOG = 0,
494
    QEMU_PROCESS_EVENT_GUESTPANIC,
495
    QEMU_PROCESS_EVENT_DEVICE_DELETED,
496
    QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED,
497
    QEMU_PROCESS_EVENT_SERIAL_CHANGED,
498
    QEMU_PROCESS_EVENT_BLOCK_JOB,
499
    QEMU_PROCESS_EVENT_MONITOR_EOF,
500
    QEMU_PROCESS_EVENT_PR_DISCONNECT,
501
    QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED,
C
Chen Fan 已提交
502 503 504 505 506

    QEMU_PROCESS_EVENT_LAST
} qemuProcessEventType;

struct qemuProcessEvent {
507
    virDomainObjPtr vm;
C
Chen Fan 已提交
508
    qemuProcessEventType eventType;
509
    int action;
510
    int status;
511
    void *data;
512 513
};

514 515
void qemuProcessEventFree(struct qemuProcessEvent *event);

516 517 518
typedef struct _qemuDomainLogContext qemuDomainLogContext;
typedef qemuDomainLogContext *qemuDomainLogContextPtr;

519 520 521 522
typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie;
typedef qemuDomainSaveCookie *qemuDomainSaveCookiePtr;
struct _qemuDomainSaveCookie {
    virObject parent;
523 524

    virCPUDefPtr cpu;
525 526 527 528
};

qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm);

529
const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
530
                                            int phase);
531
int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
532 533
                                      const char *phase);

534
void qemuDomainEventFlush(int timer, void *opaque);
535

536 537
void qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm);
538

539
int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
540
                          virDomainObjPtr obj,
541
                          qemuDomainJob job)
542
    ATTRIBUTE_RETURN_CHECK;
543 544 545 546 547 548 549 550 551
int qemuDomainObjBeginAgentJob(virQEMUDriverPtr driver,
                               virDomainObjPtr obj,
                               qemuDomainAgentJob agentJob)
    ATTRIBUTE_RETURN_CHECK;
int qemuDomainObjBeginJobWithAgent(virQEMUDriverPtr driver,
                                   virDomainObjPtr obj,
                                   qemuDomainJob job,
                                   qemuDomainAgentJob agentJob)
    ATTRIBUTE_RETURN_CHECK;
552
int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
553
                               virDomainObjPtr obj,
554
                               qemuDomainAsyncJob asyncJob,
555 556
                               virDomainJobOperation operation,
                               unsigned long apiFlags)
557
    ATTRIBUTE_RETURN_CHECK;
558 559 560 561
int qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                qemuDomainAsyncJob asyncJob)
    ATTRIBUTE_RETURN_CHECK;
562 563 564 565
int qemuDomainObjBeginJobNowait(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                qemuDomainJob job)
    ATTRIBUTE_RETURN_CHECK;
566

567 568
void qemuDomainObjEndJob(virQEMUDriverPtr driver,
                         virDomainObjPtr obj);
569 570 571
void qemuDomainObjEndAgentJob(virDomainObjPtr obj);
void qemuDomainObjEndJobWithAgent(virQEMUDriverPtr driver,
                                  virDomainObjPtr obj);
572 573
void qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver,
                              virDomainObjPtr obj);
574
void qemuDomainObjAbortAsyncJob(virDomainObjPtr obj);
575
void qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
J
Jiri Denemark 已提交
576 577
                              virDomainObjPtr obj,
                              int phase);
578 579
void qemuDomainObjSetAsyncJobMask(virDomainObjPtr obj,
                                  unsigned long long allowedJobs);
580
void qemuDomainObjRestoreJob(virDomainObjPtr obj,
581
                             qemuDomainJobObjPtr job);
582
void qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver,
583
                                  virDomainObjPtr obj);
584
void qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj);
585

586 587
qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);
588
void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
589 590
                               virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
591 592
int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
                             virDomainObjPtr obj)
593 594
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_RETURN_CHECK;
595
int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
596
                                   virDomainObjPtr obj,
597
                                   qemuDomainAsyncJob asyncJob)
598
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
D
Daniel P. Berrange 已提交
599 600


601
qemuAgentPtr qemuDomainObjEnterAgent(virDomainObjPtr obj)
602
    ATTRIBUTE_NONNULL(1);
603 604
void qemuDomainObjExitAgent(virDomainObjPtr obj, qemuAgentPtr agent)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
D
Daniel P. Berrange 已提交
605 606


607 608
void qemuDomainObjEnterRemote(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1);
609 610 611
int qemuDomainObjExitRemote(virDomainObjPtr obj,
                            bool checkActive)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
612

613 614 615 616
virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
                                  virDomainDefPtr src,
                                  unsigned int flags);

617
int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
618 619 620 621
                           virDomainDefPtr vm,
                           unsigned int flags,
                           virBuffer *buf);

622
char *qemuDomainDefFormatXML(virQEMUDriverPtr driver,
623
                             virDomainDefPtr vm,
624
                             unsigned int flags);
625

626
char *qemuDomainFormatXML(virQEMUDriverPtr driver,
627
                          virDomainObjPtr vm,
628
                          unsigned int flags);
629

630
char *qemuDomainDefFormatLive(virQEMUDriverPtr driver,
631
                              virDomainDefPtr def,
632
                              virCPUDefPtr origCPU,
633 634
                              bool inactive,
                              bool compatible);
635

636
void qemuDomainObjTaint(virQEMUDriverPtr driver,
637
                        virDomainObjPtr obj,
638
                        virDomainTaintFlags taint,
639
                        qemuDomainLogContextPtr logCtxt);
640

641
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
642
                             virDomainObjPtr obj,
643
                             qemuDomainLogContextPtr logCtxt);
644
void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
645
                                 virDomainObjPtr obj,
646
                                 virDomainDiskDefPtr disk,
647
                                 qemuDomainLogContextPtr logCtxt);
648 649 650
void qemuDomainObjCheckHostdevTaint(virQEMUDriverPtr driver,
                                    virDomainObjPtr obj,
                                    virDomainHostdevDefPtr disk,
651
                                    qemuDomainLogContextPtr logCtxt);
652
void qemuDomainObjCheckNetTaint(virQEMUDriverPtr driver,
653
                                virDomainObjPtr obj,
654
                                virDomainNetDefPtr net,
655
                                qemuDomainLogContextPtr logCtxt);
656

657 658 659 660 661 662 663 664 665 666 667 668 669 670 671
typedef enum {
    QEMU_DOMAIN_LOG_CONTEXT_MODE_START,
    QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH,
    QEMU_DOMAIN_LOG_CONTEXT_MODE_STOP,
} qemuDomainLogContextMode;

qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
                                                virDomainObjPtr vm,
                                                qemuDomainLogContextMode mode);
int qemuDomainLogContextWrite(qemuDomainLogContextPtr ctxt,
                              const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(2, 3);
ssize_t qemuDomainLogContextRead(qemuDomainLogContextPtr ctxt,
                                 char **msg);
int qemuDomainLogContextGetWriteFD(qemuDomainLogContextPtr ctxt);
void qemuDomainLogContextMarkPosition(qemuDomainLogContextPtr ctxt);
672

673 674
virLogManagerPtr qemuDomainLogContextGetManager(qemuDomainLogContextPtr ctxt);

675 676 677 678 679
int qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
                               virDomainObjPtr vm,
                               const char *fmt,
                               ...) ATTRIBUTE_FMT_PRINTF(3, 4);

680
const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
681 682 683

int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
                                    virDomainSnapshotObjPtr snapshot,
684
                                    virCapsPtr caps,
685
                                    virDomainXMLOptionPtr xmlopt,
686
                                    const char *snapshotDir);
687

688
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
689 690 691 692 693
                                   virDomainObjPtr vm,
                                   virDomainSnapshotObjPtr snap,
                                   const char *op,
                                   bool try_all);

694
int qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
695 696 697 698 699
                              virDomainObjPtr vm,
                              virDomainSnapshotObjPtr snap,
                              bool update_current,
                              bool metadata_only);

700 701 702
typedef struct _virQEMUSnapRemove virQEMUSnapRemove;
typedef virQEMUSnapRemove *virQEMUSnapRemovePtr;
struct _virQEMUSnapRemove {
703
    virQEMUDriverPtr driver;
704 705 706 707 708 709
    virDomainObjPtr vm;
    int err;
    bool metadata_only;
    bool current;
};

710 711 712
int qemuDomainSnapshotDiscardAll(void *payload,
                                 const void *name,
                                 void *data);
713

714
int qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver,
715 716
                                         virDomainObjPtr vm);

717
void qemuDomainRemoveInactive(virQEMUDriverPtr driver,
718 719
                              virDomainObjPtr vm);

720 721 722
void qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

723 724 725
void qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver,
                                       virDomainObjPtr vm);

726
void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
727 728 729
                             virDomainObjPtr vm,
                             bool value);

730
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
731
                          qemuDomainJob job);
M
Michal Privoznik 已提交
732

733 734 735 736 737
int qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     size_t diskIndex,
                                     bool cold_boot);

738
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
M
Michal Privoznik 已提交
739
                                virDomainObjPtr vm,
740
                                unsigned int flags);
741

742
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
743
                                 virDomainObjPtr vm,
744
                                 virDomainDiskDefPtr disk,
745
                                 virStorageSourcePtr disksrc,
746
                                 bool report_broken);
747

748 749 750
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
                                   virDomainDiskDefPtr orig_disk);

751 752
int qemuDomainStorageFileInit(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
753 754
                              virStorageSourcePtr src,
                              virStorageSourcePtr parent);
755
char *qemuDomainStorageAlias(const char *device, int depth);
756

757 758 759 760 761 762
int qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
                                  virQEMUCapsPtr qemuCaps,
                                  char **backendAlias)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;

763 764 765 766 767 768
void qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm,
                                      virStorageSourcePtr elem);
int qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm,
                                      virStorageSourcePtr elem,
769 770
                                      bool readonly,
                                      bool newSource);
771

772 773 774 775
int qemuDomainCleanupAdd(virDomainObjPtr vm,
                         qemuDomainCleanupCallback cb);
void qemuDomainCleanupRemove(virDomainObjPtr vm,
                             qemuDomainCleanupCallback cb);
776
void qemuDomainCleanupRun(virQEMUDriverPtr driver,
777 778
                          virDomainObjPtr vm);

779 780
void qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv);

781 782
extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks;
extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace;
783
extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
784
extern virDomainABIStability virQEMUDriverDomainABIStability;
785
extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie;
786

787
int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
788
                               virDomainObjPtr vm, int asyncJob);
789

790 791 792 793
int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     int asyncJob);

794 795 796
bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
                                    virDomainDefPtr src,
                                    virDomainDefPtr dst);
797

798 799 800 801
bool qemuDomainCheckABIStability(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm,
                                 virDomainDefPtr dst);

802
bool qemuDomainAgentAvailable(virDomainObjPtr vm,
803 804
                              bool reportError);

J
Jiri Denemark 已提交
805 806
int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
807 808
int qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
J
Jiri Denemark 已提交
809 810 811 812 813 814 815 816 817 818
int qemuDomainJobInfoToInfo(qemuDomainJobInfoPtr jobInfo,
                            virDomainJobInfoPtr info)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
                              int *type,
                              virTypedParameterPtr *params,
                              int *nparams)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);

819
int qemuDomainSupportsBlockJobs(virDomainObjPtr vm)
820
    ATTRIBUTE_NONNULL(1);
821
bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
822 823
bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only)
    ATTRIBUTE_NONNULL(1);
824

825
int qemuDomainAlignMemorySizes(virDomainDefPtr def);
826 827
void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
                                     virDomainMemoryDefPtr mem);
828

829
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
830

831 832
/* You should normally avoid these functions and use the variant that
 * doesn't have "Machine" in the name instead. */
833 834
bool qemuDomainMachineIsARMVirt(const char *machine,
                                const virArch arch);
835 836
bool qemuDomainMachineIsPSeries(const char *machine,
                                const virArch arch);
837 838
bool qemuDomainMachineHasBuiltinIDE(const char *machine,
                                    const virArch arch);
A
Andrea Bolognani 已提交
839 840 841 842 843 844 845 846 847 848 849

bool qemuDomainIsQ35(const virDomainDef *def);
bool qemuDomainIsI440FX(const virDomainDef *def);
bool qemuDomainIsS390CCW(const virDomainDef *def);
bool qemuDomainIsARMVirt(const virDomainDef *def);
bool qemuDomainIsRISCVVirt(const virDomainDef *def);
bool qemuDomainIsPSeries(const virDomainDef *def);
bool qemuDomainHasPCIRoot(const virDomainDef *def);
bool qemuDomainHasPCIeRoot(const virDomainDef *def);
bool qemuDomainHasBuiltinIDE(const virDomainDef *def);
bool qemuDomainNeedsFDC(const virDomainDef *def);
850 851
bool qemuDomainSupportsPCI(virDomainDefPtr def,
                           virQEMUCapsPtr qemuCaps);
852

853
void qemuDomainUpdateCurrentMemorySize(virDomainObjPtr vm);
854

855
unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDefPtr def);
856
int qemuDomainAdjustMaxMemLock(virDomainObjPtr vm);
857

858 859 860 861
int qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
                                       virQEMUCapsPtr qemuCaps,
                                       const virDomainMemoryDef *mem);

862
bool qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm);
863
bool qemuDomainHasVcpuPids(virDomainObjPtr vm);
864
pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid);
865
int qemuDomainValidateVcpuInfo(virDomainObjPtr vm);
866 867
int qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
868 869
                              int asyncJob,
                              bool state);
870 871 872 873
bool qemuDomainGetVcpuHalted(virDomainObjPtr vm, unsigned int vcpu);
int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
                                virDomainObjPtr vm,
                                int asyncJob);
874

875 876 877
bool qemuDomainSupportsNicdev(virDomainDefPtr def,
                              virDomainNetDefPtr net);

878 879
bool qemuDomainNetSupportsMTU(virDomainNetType type);

880 881 882
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
                              virDomainObjPtr vm);

P
Peter Krempa 已提交
883 884
virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char *name);

J
John Ferlan 已提交
885 886 887 888
char *qemuDomainGetMasterKeyFilePath(const char *libDir);

int qemuDomainMasterKeyReadFile(qemuDomainObjPrivatePtr priv);

889 890 891 892
int qemuDomainWriteMasterKeyFile(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

int qemuDomainMasterKeyCreate(virDomainObjPtr vm);
J
John Ferlan 已提交
893 894 895

void qemuDomainMasterKeyRemove(qemuDomainObjPrivatePtr priv);

896 897
bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivatePtr priv);

898 899 900
void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr *secinfo)
    ATTRIBUTE_NONNULL(1);

901 902
void qemuDomainSecretInfoDestroy(qemuDomainSecretInfoPtr secinfo);

903 904 905
void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
    ATTRIBUTE_NONNULL(1);

906
bool qemuDomainStorageSourceHasAuth(virStorageSourcePtr src)
907 908
    ATTRIBUTE_NONNULL(1);

909 910 911
bool qemuDomainDiskHasEncryptionSecret(virStorageSourcePtr src)
    ATTRIBUTE_NONNULL(1);

912
qemuDomainSecretInfoPtr
913
qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
914 915 916
                           const char *srcAlias,
                           const char *secretUUID);

917 918 919
void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk)
    ATTRIBUTE_NONNULL(1);

920
int qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
921
                                   virDomainHostdevDefPtr hostdev)
922
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
923

924 925 926
void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev)
    ATTRIBUTE_NONNULL(1);

927
int qemuDomainSecretChardevPrepare(virQEMUDriverConfigPtr cfg,
928 929 930 931
                                   qemuDomainObjPrivatePtr priv,
                                   const char *chrAlias,
                                   virDomainChrSourceDefPtr dev)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
932
    ATTRIBUTE_NONNULL(4);
933

934 935 936
void qemuDomainSecretDestroy(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);

937
int qemuDomainSecretPrepare(virQEMUDriverPtr driver,
938
                            virDomainObjPtr vm)
939
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
940

941 942 943
int qemuDomainDefValidateDiskLunSource(const virStorageSource *src)
    ATTRIBUTE_NONNULL(1);

944 945 946
int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
                                    virQEMUCapsPtr qemuCaps);

947 948 949 950
int qemuDomainPrepareChannel(virDomainChrDefPtr chr,
                             const char *domainChannelTargetDir)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

951 952 953 954 955
void qemuDomainPrepareChardevSourceTLS(virDomainChrSourceDefPtr source,
                                       virQEMUDriverConfigPtr cfg)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

void qemuDomainPrepareChardevSource(virDomainDefPtr def,
956
                                    virQEMUDriverConfigPtr cfg)
957 958
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

959 960 961
int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
    ATTRIBUTE_NONNULL(1);

962 963 964
bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

965 966 967
void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

968 969 970 971
int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
                           virDomainObjPtr vm,
                           qemuDomainAsyncJob asyncJob);

972 973 974
bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr video,
                                virQEMUCapsPtr qemuCaps);

975 976 977
int qemuDomainGetHostdevPath(virDomainDefPtr def,
                             virDomainHostdevDefPtr dev,
                             bool teardown,
978 979 980
                             size_t *npaths,
                             char ***path,
                             int **perms);
981

982 983
int qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
                             virSecurityManagerPtr mgr,
984 985 986 987 988
                             virDomainObjPtr vm);

int qemuDomainCreateNamespace(virQEMUDriverPtr driver,
                              virDomainObjPtr vm);

989 990 991
void qemuDomainDestroyNamespace(virQEMUDriverPtr driver,
                                virDomainObjPtr vm);

992 993
bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);

994
int qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
995
                                 virStorageSourcePtr src);
996

997
int qemuDomainNamespaceTeardownDisk(virDomainObjPtr vm,
998
                                    virStorageSourcePtr src);
999

1000
int qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
1001 1002
                                    virDomainHostdevDefPtr hostdev);

1003
int qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
1004
                                       virDomainHostdevDefPtr hostdev);
1005

1006
int qemuDomainNamespaceSetupMemory(virDomainObjPtr vm,
M
Michal Privoznik 已提交
1007 1008
                                   virDomainMemoryDefPtr memory);

1009
int qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
M
Michal Privoznik 已提交
1010 1011
                                      virDomainMemoryDefPtr memory);

1012
int qemuDomainNamespaceSetupChardev(virDomainObjPtr vm,
1013 1014
                                    virDomainChrDefPtr chr);

1015
int qemuDomainNamespaceTeardownChardev(virDomainObjPtr vm,
1016
                                       virDomainChrDefPtr chr);
1017

1018
int qemuDomainNamespaceSetupRNG(virDomainObjPtr vm,
1019
                                virDomainRNGDefPtr rng);
1020

1021
int qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
1022
                                   virDomainRNGDefPtr rng);
1023

1024 1025 1026 1027 1028 1029
int qemuDomainNamespaceSetupInput(virDomainObjPtr vm,
                                  virDomainInputDefPtr input);

int qemuDomainNamespaceTeardownInput(virDomainObjPtr vm,
                                     virDomainInputDefPtr input);

1030 1031 1032 1033 1034
virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def,
                                                   const char *nodename,
                                                   virStorageSourcePtr *src,
                                                   unsigned int *idx);

1035 1036 1037 1038
char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
                                        virStorageSourcePtr src,
                                        unsigned int idx);

1039 1040 1041
virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr,
                                                       virDomainDefPtr def);

1042 1043 1044 1045 1046
int
qemuDomainUpdateCPU(virDomainObjPtr vm,
                    virCPUDefPtr cpu,
                    virCPUDefPtr *origCPU);

1047 1048 1049 1050
int
qemuDomainFixupCPUs(virDomainObjPtr vm,
                    virCPUDefPtr *origCPU);

1051 1052 1053 1054
int
qemuDomainUpdateQEMUCaps(virDomainObjPtr vm,
                         virFileCachePtr qemuCapsCache);

1055 1056 1057
char *
qemuDomainGetMachineName(virDomainObjPtr vm);

1058 1059 1060 1061 1062 1063 1064 1065
void
qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPtr buf,
                                         virTristateBool allowReboot);

int
qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt,
                                        virTristateBool *allowReboot);

1066 1067 1068 1069 1070
bool
qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
                                     const virDomainDeviceInfo *info,
                                     virQEMUCapsPtr qemuCaps,
                                     const char *devicename);
1071

1072
int
1073 1074 1075 1076
qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
                                virStorageSourcePtr src,
                                virQEMUDriverConfigPtr cfg,
                                virQEMUCapsPtr qemuCaps)
1077
    ATTRIBUTE_RETURN_CHECK;
1078

1079 1080 1081 1082 1083 1084

int
qemuDomainValidateStorageSource(virStorageSourcePtr src,
                                virQEMUCapsPtr qemuCaps);


1085
int
1086
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
1087 1088 1089
                            qemuDomainObjPrivatePtr priv,
                            virQEMUDriverConfigPtr cfg);

1090 1091 1092 1093 1094 1095
int
qemuDomainDiskCachemodeFlags(int cachemode,
                             bool *writeback,
                             bool *direct,
                             bool *noflush);

1096
char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv);
1097

1098 1099 1100
unsigned int qemuDomainStorageIdNew(qemuDomainObjPrivatePtr priv);
void qemuDomainStorageIdReset(qemuDomainObjPrivatePtr priv);

1101 1102 1103
virDomainEventResumedDetailType
qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason);

J
John Ferlan 已提交
1104 1105 1106
bool
qemuDomainIsUsingNoShutdown(qemuDomainObjPrivatePtr priv);

1107 1108 1109
bool
qemuDomainDiskIsMissingLocalOptional(virDomainDiskDefPtr disk);

1110
#endif /* LIBVIRT_QEMU_DOMAIN_H */