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_conf.h"
34
# include "qemu_capabilities.h"
35
# include "qemu_migration_params.h"
36
# include "virmdev.h"
37
# include "virchrdev.h"
38
# include "virobject.h"
39
# include "logging/log_manager.h"
40

41
# define QEMU_DOMAIN_FORMAT_LIVE_FLAGS \
42
    (VIR_DOMAIN_XML_SECURE)
43

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

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

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

63 64 65
/* Only 1 job is allowed at any time
 * A job includes *all* monitor commands, even those just querying
 * information, not merely actions */
66
typedef enum {
67
    QEMU_JOB_NONE = 0,  /* Always set to 0 for easy if (jobActive) conditions */
68 69 70 71
    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 */
72
    QEMU_JOB_ABORT,         /* Abort current async job */
73
    QEMU_JOB_MIGRATION_OP,  /* Operation influencing outgoing migration */
74

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

    QEMU_JOB_LAST
80
} qemuDomainJob;
81
VIR_ENUM_DECL(qemuDomainJob)
82

83 84 85 86 87 88 89 90 91
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;
VIR_ENUM_DECL(qemuDomainAgentJob)

92 93 94 95
/* 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.
 */
96
typedef enum {
97 98 99 100 101
    QEMU_ASYNC_JOB_NONE = 0,
    QEMU_ASYNC_JOB_MIGRATION_OUT,
    QEMU_ASYNC_JOB_MIGRATION_IN,
    QEMU_ASYNC_JOB_SAVE,
    QEMU_ASYNC_JOB_DUMP,
102
    QEMU_ASYNC_JOB_SNAPSHOT,
103
    QEMU_ASYNC_JOB_START,
104 105

    QEMU_ASYNC_JOB_LAST
106
} qemuDomainAsyncJob;
107
VIR_ENUM_DECL(qemuDomainAsyncJob)
108

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

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

128 129 130 131 132 133 134 135

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

J
Jiri Denemark 已提交
136 137 138
typedef struct _qemuDomainJobInfo qemuDomainJobInfo;
typedef qemuDomainJobInfo *qemuDomainJobInfoPtr;
struct _qemuDomainJobInfo {
139
    qemuDomainJobStatus status;
140
    virDomainJobOperation operation;
J
Jiri Denemark 已提交
141
    unsigned long long started; /* When the async job started */
142
    unsigned long long stopped; /* When the domain's CPUs were stopped */
143 144 145 146
    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 已提交
147 148
    /* Computed values */
    unsigned long long timeElapsed;
J
Jiri Denemark 已提交
149
    long long timeDelta; /* delta = received - sent, i.e., the difference
150 151 152 153 154
                            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 已提交
155
    /* Raw values from QEMU */
156 157 158
    qemuDomainJobStatsType statsType;
    union {
        qemuMonitorMigrationStats mig;
159
        qemuMonitorDumpStats dump;
160
    } stats;
161
    qemuDomainMirrorStats mirrorStats;
J
Jiri Denemark 已提交
162 163
};

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

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

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

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

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

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


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

222 223 224 225 226 227 228 229 230 231

typedef enum {
    QEMU_DOMAIN_NS_MOUNT = 0,
    QEMU_DOMAIN_NS_LAST
} qemuDomainNamespace;
VIR_ENUM_DECL(qemuDomainNamespace)

bool qemuDomainNamespaceEnabled(virDomainObjPtr vm,
                                qemuDomainNamespace ns);

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

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

274
    qemuDomainJobObj job;
275

276 277
    virBitmapPtr namespaces;

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

    qemuAgentPtr agent;
    bool agentError;

287
    bool beingDestroyed;
288
    char *pidfile;
289

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

293
    virQEMUCapsPtr qemuCaps;
294
    char *lockState;
295 296

    bool fakeReboot;
297
    virTristateBool allowReboot;
298 299

    int jobs_queued;
300 301

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

307
    virChrdevsPtr devs;
308 309 310 311

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

    virCgroupPtr cgroup;
314

315 316
    virPerfPtr perf;

317 318
    qemuDomainUnpluggingDevice unplug;

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

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

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

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

    /* 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;
339 340 341

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

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

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

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

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

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

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

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

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

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

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

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

381
# define QEMU_DOMAIN_DISK_PRIVATE(disk) \
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
    ((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 */
    bool blockjob;

    /* for some synchronous block jobs, we need to notify the owner */
    int blockJobType;   /* type of the block job from the event */
    int blockJobStatus; /* status of the finished block job */
397
    char *blockJobError; /* block job completed event error */
398
    bool blockJobSync; /* the block job needs synchronized termination */
399 400

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

403 404 405
    /* information about the device */
    bool tray; /* device has tray */
    bool removable; /* device media can be removed/changed */
406 407

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

411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
# 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);

428 429 430 431 432
typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
struct _qemuDomainVcpuPrivate {
    virObject parent;

433
    pid_t tid; /* vcpu thread id */
434
    int enable_id; /* order in which the vcpus were enabled in qemu */
435
    int qemu_id; /* ID reported by qemu as 'CPU' in query-cpus */
436
    char *alias;
437
    virTristateBool halted;
438 439 440 441 442 443

    /* information for hotpluggable cpus */
    char *type;
    int socket_id;
    int core_id;
    int thread_id;
444
    int node_id;
445
    int vcpus;
446 447
};

448
# define QEMU_DOMAIN_VCPU_PRIVATE(vcpu) \
449 450 451
    ((qemuDomainVcpuPrivatePtr) (vcpu)->privateData)


452 453
struct qemuDomainDiskInfo {
    bool removable;
454
    bool tray;
455
    bool tray_open;
456
    bool empty;
457
    int io_status;
458
    char *nodename;
459 460
};

461
# define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
462
    ((qemuDomainChrSourcePrivatePtr) (dev)->privateData)
463

464 465 466
typedef struct _qemuDomainChrSourcePrivate qemuDomainChrSourcePrivate;
typedef qemuDomainChrSourcePrivate *qemuDomainChrSourcePrivatePtr;
struct _qemuDomainChrSourcePrivate {
467 468 469 470 471 472 473 474
    virObject parent;

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


J
Ján Tomko 已提交
475 476 477 478 479
typedef struct _qemuDomainVsockPrivate qemuDomainVsockPrivate;
typedef qemuDomainVsockPrivate *qemuDomainVsockPrivatePtr;
struct _qemuDomainVsockPrivate {
    virObject parent;

480
    int vhostfd;
J
Ján Tomko 已提交
481 482 483
};


C
Chen Fan 已提交
484 485
typedef enum {
    QEMU_PROCESS_EVENT_WATCHDOG = 0,
486
    QEMU_PROCESS_EVENT_GUESTPANIC,
487
    QEMU_PROCESS_EVENT_DEVICE_DELETED,
488
    QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED,
489
    QEMU_PROCESS_EVENT_SERIAL_CHANGED,
490
    QEMU_PROCESS_EVENT_BLOCK_JOB,
491
    QEMU_PROCESS_EVENT_MONITOR_EOF,
492
    QEMU_PROCESS_EVENT_PR_DISCONNECT,
493
    QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED,
C
Chen Fan 已提交
494 495 496 497 498

    QEMU_PROCESS_EVENT_LAST
} qemuProcessEventType;

struct qemuProcessEvent {
499
    virDomainObjPtr vm;
C
Chen Fan 已提交
500
    qemuProcessEventType eventType;
501
    int action;
502
    int status;
503
    void *data;
504 505
};

506 507
void qemuProcessEventFree(struct qemuProcessEvent *event);

508 509 510
typedef struct _qemuDomainLogContext qemuDomainLogContext;
typedef qemuDomainLogContext *qemuDomainLogContextPtr;

511 512 513 514
typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie;
typedef qemuDomainSaveCookie *qemuDomainSaveCookiePtr;
struct _qemuDomainSaveCookie {
    virObject parent;
515 516

    virCPUDefPtr cpu;
517 518 519 520
};

qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm);

521
const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
522
                                            int phase);
523
int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
524 525
                                      const char *phase);

526
void qemuDomainEventFlush(int timer, void *opaque);
527

528 529
void qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm);
530

531
int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
532
                          virDomainObjPtr obj,
533
                          qemuDomainJob job)
534
    ATTRIBUTE_RETURN_CHECK;
535 536 537 538 539 540 541 542 543
int qemuDomainObjBeginAgentJob(virQEMUDriverPtr driver,
                               virDomainObjPtr obj,
                               qemuDomainAgentJob agentJob)
    ATTRIBUTE_RETURN_CHECK;
int qemuDomainObjBeginJobWithAgent(virQEMUDriverPtr driver,
                                   virDomainObjPtr obj,
                                   qemuDomainJob job,
                                   qemuDomainAgentJob agentJob)
    ATTRIBUTE_RETURN_CHECK;
544
int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
545
                               virDomainObjPtr obj,
546
                               qemuDomainAsyncJob asyncJob,
547 548
                               virDomainJobOperation operation,
                               unsigned long apiFlags)
549
    ATTRIBUTE_RETURN_CHECK;
550 551 552 553
int qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                qemuDomainAsyncJob asyncJob)
    ATTRIBUTE_RETURN_CHECK;
554 555 556 557
int qemuDomainObjBeginJobNowait(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                qemuDomainJob job)
    ATTRIBUTE_RETURN_CHECK;
558

559 560
void qemuDomainObjEndJob(virQEMUDriverPtr driver,
                         virDomainObjPtr obj);
561 562 563
void qemuDomainObjEndAgentJob(virDomainObjPtr obj);
void qemuDomainObjEndJobWithAgent(virQEMUDriverPtr driver,
                                  virDomainObjPtr obj);
564 565
void qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver,
                              virDomainObjPtr obj);
566
void qemuDomainObjAbortAsyncJob(virDomainObjPtr obj);
567
void qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
J
Jiri Denemark 已提交
568 569
                              virDomainObjPtr obj,
                              int phase);
570 571
void qemuDomainObjSetAsyncJobMask(virDomainObjPtr obj,
                                  unsigned long long allowedJobs);
572
void qemuDomainObjRestoreJob(virDomainObjPtr obj,
573
                             qemuDomainJobObjPtr job);
574
void qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver,
575
                                  virDomainObjPtr obj);
576
void qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj);
577

578 579
qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);
580
void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
581 582
                               virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
583 584
int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
                             virDomainObjPtr obj)
585 586
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_RETURN_CHECK;
587
int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
588
                                   virDomainObjPtr obj,
589
                                   qemuDomainAsyncJob asyncJob)
590
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
D
Daniel P. Berrange 已提交
591 592


593
qemuAgentPtr qemuDomainObjEnterAgent(virDomainObjPtr obj)
594
    ATTRIBUTE_NONNULL(1);
595 596
void qemuDomainObjExitAgent(virDomainObjPtr obj, qemuAgentPtr agent)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
D
Daniel P. Berrange 已提交
597 598


599 600
void qemuDomainObjEnterRemote(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1);
601 602 603
int qemuDomainObjExitRemote(virDomainObjPtr obj,
                            bool checkActive)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
604

605 606 607 608
virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
                                  virDomainDefPtr src,
                                  unsigned int flags);

609
int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
610 611 612 613
                           virDomainDefPtr vm,
                           unsigned int flags,
                           virBuffer *buf);

614
char *qemuDomainDefFormatXML(virQEMUDriverPtr driver,
615
                             virDomainDefPtr vm,
616
                             unsigned int flags);
617

618
char *qemuDomainFormatXML(virQEMUDriverPtr driver,
619
                          virDomainObjPtr vm,
620
                          unsigned int flags);
621

622
char *qemuDomainDefFormatLive(virQEMUDriverPtr driver,
623
                              virDomainDefPtr def,
624
                              virCPUDefPtr origCPU,
625 626
                              bool inactive,
                              bool compatible);
627

628
void qemuDomainObjTaint(virQEMUDriverPtr driver,
629
                        virDomainObjPtr obj,
630
                        virDomainTaintFlags taint,
631
                        qemuDomainLogContextPtr logCtxt);
632

633
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
634
                             virDomainObjPtr obj,
635
                             qemuDomainLogContextPtr logCtxt);
636
void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
637
                                 virDomainObjPtr obj,
638
                                 virDomainDiskDefPtr disk,
639
                                 qemuDomainLogContextPtr logCtxt);
640 641 642
void qemuDomainObjCheckHostdevTaint(virQEMUDriverPtr driver,
                                    virDomainObjPtr obj,
                                    virDomainHostdevDefPtr disk,
643
                                    qemuDomainLogContextPtr logCtxt);
644
void qemuDomainObjCheckNetTaint(virQEMUDriverPtr driver,
645
                                virDomainObjPtr obj,
646
                                virDomainNetDefPtr net,
647
                                qemuDomainLogContextPtr logCtxt);
648

649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
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);
664

665 666
virLogManagerPtr qemuDomainLogContextGetManager(qemuDomainLogContextPtr ctxt);

667 668 669 670 671
int qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
                               virDomainObjPtr vm,
                               const char *fmt,
                               ...) ATTRIBUTE_FMT_PRINTF(3, 4);

672
const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
673 674 675

int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
                                    virDomainSnapshotObjPtr snapshot,
676
                                    virCapsPtr caps,
677
                                    virDomainXMLOptionPtr xmlopt,
678 679
                                    char *snapshotDir);

680
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
681 682 683 684 685
                                   virDomainObjPtr vm,
                                   virDomainSnapshotObjPtr snap,
                                   const char *op,
                                   bool try_all);

686
int qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
687 688 689 690 691
                              virDomainObjPtr vm,
                              virDomainSnapshotObjPtr snap,
                              bool update_current,
                              bool metadata_only);

692 693 694
typedef struct _virQEMUSnapRemove virQEMUSnapRemove;
typedef virQEMUSnapRemove *virQEMUSnapRemovePtr;
struct _virQEMUSnapRemove {
695
    virQEMUDriverPtr driver;
696 697 698 699 700 701
    virDomainObjPtr vm;
    int err;
    bool metadata_only;
    bool current;
};

702 703 704
int qemuDomainSnapshotDiscardAll(void *payload,
                                 const void *name,
                                 void *data);
705

706
int qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver,
707 708
                                         virDomainObjPtr vm);

709
void qemuDomainRemoveInactive(virQEMUDriverPtr driver,
710 711
                              virDomainObjPtr vm);

712 713 714
void qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

715 716 717
void qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver,
                                       virDomainObjPtr vm);

718
void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
719 720 721
                             virDomainObjPtr vm,
                             bool value);

722
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
723
                          qemuDomainJob job);
M
Michal Privoznik 已提交
724

725 726 727 728 729
int qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     size_t diskIndex,
                                     bool cold_boot);

730
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
M
Michal Privoznik 已提交
731
                                virDomainObjPtr vm,
732
                                unsigned int flags);
733

734
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
735
                                 virDomainObjPtr vm,
736
                                 virDomainDiskDefPtr disk,
737
                                 bool report_broken);
738

739 740 741
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
                                   virDomainDiskDefPtr orig_disk);

742 743
int qemuDomainStorageFileInit(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
744 745
                              virStorageSourcePtr src,
                              virStorageSourcePtr parent);
746
char *qemuDomainStorageAlias(const char *device, int depth);
747

748 749 750 751 752 753
int qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
                                  virQEMUCapsPtr qemuCaps,
                                  char **backendAlias)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;

754 755 756 757 758 759
void qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm,
                                      virStorageSourcePtr elem);
int qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm,
                                      virStorageSourcePtr elem,
760 761
                                      bool readonly,
                                      bool newSource);
762

763 764 765 766
int qemuDomainCleanupAdd(virDomainObjPtr vm,
                         qemuDomainCleanupCallback cb);
void qemuDomainCleanupRemove(virDomainObjPtr vm,
                             qemuDomainCleanupCallback cb);
767
void qemuDomainCleanupRun(virQEMUDriverPtr driver,
768 769
                          virDomainObjPtr vm);

770 771
void qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv);

772 773
extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks;
extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace;
774
extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
775
extern virDomainABIStability virQEMUDriverDomainABIStability;
776
extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie;
777

778
int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
779
                               virDomainObjPtr vm, int asyncJob);
780

781 782 783 784
int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     int asyncJob);

785 786 787
bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
                                    virDomainDefPtr src,
                                    virDomainDefPtr dst);
788

789 790 791 792
bool qemuDomainCheckABIStability(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm,
                                 virDomainDefPtr dst);

793
bool qemuDomainAgentAvailable(virDomainObjPtr vm,
794 795
                              bool reportError);

J
Jiri Denemark 已提交
796 797
int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
798 799
int qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
J
Jiri Denemark 已提交
800 801 802 803 804 805 806 807 808 809
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);

810
int qemuDomainSupportsBlockJobs(virDomainObjPtr vm)
811
    ATTRIBUTE_NONNULL(1);
812
bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
813 814
bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only)
    ATTRIBUTE_NONNULL(1);
815

816
int qemuDomainAlignMemorySizes(virDomainDefPtr def);
817 818
void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
                                     virDomainMemoryDefPtr mem);
819

820
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
821

822 823 824 825 826 827
bool qemuDomainIsQ35(const virDomainDef *def);
bool qemuDomainIsI440FX(const virDomainDef *def);
bool qemuDomainHasPCIRoot(const virDomainDef *def);
bool qemuDomainHasPCIeRoot(const virDomainDef *def);
bool qemuDomainNeedsFDC(const virDomainDef *def);
bool qemuDomainIsS390CCW(const virDomainDef *def);
828
bool qemuDomainIsARMVirt(const virDomainDef *def);
829
bool qemuDomainIsRISCVVirt(const virDomainDef *def);
830 831 832 833 834 835 836
bool qemuDomainIsPSeries(const virDomainDef *def);
bool qemuDomainHasBuiltinIDE(const virDomainDef *def);

bool qemuDomainMachineIsQ35(const char *machine);
bool qemuDomainMachineIsI440FX(const char *machine);
bool qemuDomainMachineNeedsFDC(const char *machine);
bool qemuDomainMachineIsS390CCW(const char *machine);
837 838
bool qemuDomainMachineIsARMVirt(const char *machine,
                                const virArch arch);
839 840
bool qemuDomainMachineIsRISCVVirt(const char *machine,
                                  const virArch arch);
841 842 843
bool qemuDomainMachineIsPSeries(const char *machine,
                                const virArch arch);
bool qemuDomainMachineHasBuiltinIDE(const char *machine);
844

845 846 847
int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm);

848
unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDefPtr def);
849
int qemuDomainAdjustMaxMemLock(virDomainObjPtr vm);
850

851 852 853 854
int qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
                                       virQEMUCapsPtr qemuCaps,
                                       const virDomainMemoryDef *mem);

855
bool qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm);
856
bool qemuDomainHasVcpuPids(virDomainObjPtr vm);
857
pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid);
858
int qemuDomainValidateVcpuInfo(virDomainObjPtr vm);
859 860
int qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
861 862
                              int asyncJob,
                              bool state);
863 864 865 866
bool qemuDomainGetVcpuHalted(virDomainObjPtr vm, unsigned int vcpu);
int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
                                virDomainObjPtr vm,
                                int asyncJob);
867

868 869 870
bool qemuDomainSupportsNicdev(virDomainDefPtr def,
                              virDomainNetDefPtr net);

871 872
bool qemuDomainNetSupportsMTU(virDomainNetType type);

873 874 875
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
                              virDomainObjPtr vm);

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

J
John Ferlan 已提交
878 879 880 881
char *qemuDomainGetMasterKeyFilePath(const char *libDir);

int qemuDomainMasterKeyReadFile(qemuDomainObjPrivatePtr priv);

882 883 884 885
int qemuDomainWriteMasterKeyFile(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

int qemuDomainMasterKeyCreate(virDomainObjPtr vm);
J
John Ferlan 已提交
886 887 888

void qemuDomainMasterKeyRemove(qemuDomainObjPrivatePtr priv);

889 890
bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivatePtr priv);

891 892 893
void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr *secinfo)
    ATTRIBUTE_NONNULL(1);

894 895
void qemuDomainSecretInfoDestroy(qemuDomainSecretInfoPtr secinfo);

896 897 898
void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
    ATTRIBUTE_NONNULL(1);

899
bool qemuDomainStorageSourceHasAuth(virStorageSourcePtr src)
900 901
    ATTRIBUTE_NONNULL(1);

902 903 904
bool qemuDomainDiskHasEncryptionSecret(virStorageSourcePtr src)
    ATTRIBUTE_NONNULL(1);

905
qemuDomainSecretInfoPtr
906
qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
907 908 909
                           const char *srcAlias,
                           const char *secretUUID);

910 911 912
void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk)
    ATTRIBUTE_NONNULL(1);

913
int qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
914
                                   virDomainHostdevDefPtr hostdev)
915
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
916

917 918 919
void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev)
    ATTRIBUTE_NONNULL(1);

920
int qemuDomainSecretChardevPrepare(virQEMUDriverConfigPtr cfg,
921 922 923 924
                                   qemuDomainObjPrivatePtr priv,
                                   const char *chrAlias,
                                   virDomainChrSourceDefPtr dev)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
925
    ATTRIBUTE_NONNULL(4);
926

927 928 929
void qemuDomainSecretDestroy(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);

930
int qemuDomainSecretPrepare(virQEMUDriverPtr driver,
931
                            virDomainObjPtr vm)
932
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
933

934 935 936
int qemuDomainDefValidateDiskLunSource(const virStorageSource *src)
    ATTRIBUTE_NONNULL(1);

937 938 939
int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
                                    virQEMUCapsPtr qemuCaps);

940 941 942 943
int qemuDomainPrepareChannel(virDomainChrDefPtr chr,
                             const char *domainChannelTargetDir)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

944 945 946 947 948
void qemuDomainPrepareChardevSourceTLS(virDomainChrSourceDefPtr source,
                                       virQEMUDriverConfigPtr cfg)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

void qemuDomainPrepareChardevSource(virDomainDefPtr def,
949
                                    virQEMUDriverConfigPtr cfg)
950 951
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

952 953 954
int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
    ATTRIBUTE_NONNULL(1);

955 956 957
bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

958 959 960
void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

961 962 963 964
int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
                           virDomainObjPtr vm,
                           qemuDomainAsyncJob asyncJob);

965 966 967
bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr video,
                                virQEMUCapsPtr qemuCaps);

968 969 970
int qemuDomainGetHostdevPath(virDomainDefPtr def,
                             virDomainHostdevDefPtr dev,
                             bool teardown,
971 972 973
                             size_t *npaths,
                             char ***path,
                             int **perms);
974

975 976
int qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
                             virSecurityManagerPtr mgr,
977 978 979 980 981
                             virDomainObjPtr vm);

int qemuDomainCreateNamespace(virQEMUDriverPtr driver,
                              virDomainObjPtr vm);

982 983 984
void qemuDomainDestroyNamespace(virQEMUDriverPtr driver,
                                virDomainObjPtr vm);

985 986
bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);

987
int qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
988
                                 virStorageSourcePtr src);
989

990
int qemuDomainNamespaceTeardownDisk(virDomainObjPtr vm,
991
                                    virStorageSourcePtr src);
992

993
int qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
994 995
                                    virDomainHostdevDefPtr hostdev);

996
int qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
997
                                       virDomainHostdevDefPtr hostdev);
998

999
int qemuDomainNamespaceSetupMemory(virDomainObjPtr vm,
M
Michal Privoznik 已提交
1000 1001
                                   virDomainMemoryDefPtr memory);

1002
int qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
M
Michal Privoznik 已提交
1003 1004
                                      virDomainMemoryDefPtr memory);

1005
int qemuDomainNamespaceSetupChardev(virDomainObjPtr vm,
1006 1007
                                    virDomainChrDefPtr chr);

1008
int qemuDomainNamespaceTeardownChardev(virDomainObjPtr vm,
1009
                                       virDomainChrDefPtr chr);
1010

1011
int qemuDomainNamespaceSetupRNG(virDomainObjPtr vm,
1012
                                virDomainRNGDefPtr rng);
1013

1014
int qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
1015
                                   virDomainRNGDefPtr rng);
1016

1017 1018 1019 1020 1021 1022
int qemuDomainNamespaceSetupInput(virDomainObjPtr vm,
                                  virDomainInputDefPtr input);

int qemuDomainNamespaceTeardownInput(virDomainObjPtr vm,
                                     virDomainInputDefPtr input);

1023 1024 1025 1026 1027
virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def,
                                                   const char *nodename,
                                                   virStorageSourcePtr *src,
                                                   unsigned int *idx);

1028 1029 1030 1031
char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
                                        virStorageSourcePtr src,
                                        unsigned int idx);

1032 1033 1034
virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr,
                                                       virDomainDefPtr def);

1035 1036 1037 1038 1039
int
qemuDomainUpdateCPU(virDomainObjPtr vm,
                    virCPUDefPtr cpu,
                    virCPUDefPtr *origCPU);

1040 1041 1042 1043
int
qemuDomainFixupCPUs(virDomainObjPtr vm,
                    virCPUDefPtr *origCPU);

1044 1045 1046 1047
int
qemuDomainUpdateQEMUCaps(virDomainObjPtr vm,
                         virFileCachePtr qemuCapsCache);

1048 1049 1050
char *
qemuDomainGetMachineName(virDomainObjPtr vm);

1051 1052 1053 1054 1055 1056 1057 1058
void
qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPtr buf,
                                         virTristateBool allowReboot);

int
qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt,
                                        virTristateBool *allowReboot);

1059 1060 1061 1062 1063
bool qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
                                    virDomainDeviceInfo info,
                                    virQEMUCapsPtr qemuCaps,
                                    const char *devicename);

1064
int
1065 1066 1067 1068
qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
                                virStorageSourcePtr src,
                                virQEMUDriverConfigPtr cfg,
                                virQEMUCapsPtr qemuCaps)
1069
    ATTRIBUTE_RETURN_CHECK;
1070

1071 1072 1073 1074 1075 1076

int
qemuDomainValidateStorageSource(virStorageSourcePtr src,
                                virQEMUCapsPtr qemuCaps);


1077
int
1078
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
1079 1080 1081
                            qemuDomainObjPrivatePtr priv,
                            virQEMUDriverConfigPtr cfg);

1082 1083 1084 1085 1086 1087
int
qemuDomainDiskCachemodeFlags(int cachemode,
                             bool *writeback,
                             bool *direct,
                             bool *noflush);

1088
char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv);
1089

1090 1091 1092
unsigned int qemuDomainStorageIdNew(qemuDomainObjPrivatePtr priv);
void qemuDomainStorageIdReset(qemuDomainObjPrivatePtr priv);

1093 1094 1095
virDomainEventResumedDetailType
qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason);

J
John Ferlan 已提交
1096 1097 1098
bool
qemuDomainIsUsingNoShutdown(qemuDomainObjPrivatePtr priv);

1099 1100 1101
bool
qemuDomainDiskIsMissingLocalOptional(virDomainDiskDefPtr disk);

1102
#endif /* LIBVIRT_QEMU_DOMAIN_H */