qemu_domain.h 22.2 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 24 25 26
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#ifndef __QEMU_DOMAIN_H__
# define __QEMU_DOMAIN_H__

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

41 42 43 44
# define QEMU_DOMAIN_FORMAT_LIVE_FLAGS      \
    (VIR_DOMAIN_XML_SECURE |                \
     VIR_DOMAIN_XML_UPDATE_CPU)

45 46 47
# if ULONG_MAX == 4294967295
/* Qemu has a 64-bit limit, but we are limited by our historical choice of
 * 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

53
# define JOB_MASK(job)                  (1 << (job - 1))
54
# define QEMU_JOB_DEFAULT_MASK          \
55 56 57
    (JOB_MASK(QEMU_JOB_QUERY) |         \
     JOB_MASK(QEMU_JOB_DESTROY) |       \
     JOB_MASK(QEMU_JOB_ABORT))
58

59 60 61 62 63
/* Jobs which have to be tracked in domain state XML. */
# define QEMU_DOMAIN_TRACK_JOBS         \
    (JOB_MASK(QEMU_JOB_DESTROY) |       \
     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

/* 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.
 */
88
typedef enum {
89 90 91 92 93
    QEMU_ASYNC_JOB_NONE = 0,
    QEMU_ASYNC_JOB_MIGRATION_OUT,
    QEMU_ASYNC_JOB_MIGRATION_IN,
    QEMU_ASYNC_JOB_SAVE,
    QEMU_ASYNC_JOB_DUMP,
94
    QEMU_ASYNC_JOB_SNAPSHOT,
95
    QEMU_ASYNC_JOB_START,
96 97

    QEMU_ASYNC_JOB_LAST
98
} qemuDomainAsyncJob;
99
VIR_ENUM_DECL(qemuDomainAsyncJob)
100

J
Jiri Denemark 已提交
101 102 103 104 105
typedef struct _qemuDomainJobInfo qemuDomainJobInfo;
typedef qemuDomainJobInfo *qemuDomainJobInfoPtr;
struct _qemuDomainJobInfo {
    virDomainJobType type;
    unsigned long long started; /* When the async job started */
106
    unsigned long long stopped; /* When the domain's CPUs were stopped */
107 108 109 110
    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 已提交
111 112 113
    /* Computed values */
    unsigned long long timeElapsed;
    unsigned long long timeRemaining;
J
Jiri Denemark 已提交
114
    long long timeDelta; /* delta = received - sent, i.e., the difference
115 116 117 118 119
                            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 已提交
120
    /* Raw values from QEMU */
121
    qemuMonitorMigrationStats stats;
J
Jiri Denemark 已提交
122 123
};

124
struct qemuDomainJobObj {
125
    virCond cond;                       /* Use to coordinate jobs */
126
    qemuDomainJob active;               /* Currently running job */
127
    unsigned long long owner;           /* Thread id which set current job */
128
    const char *ownerAPI;               /* The API which owns the job */
J
Jiri Denemark 已提交
129
    unsigned long long started;         /* When the current job started */
130

131
    virCond asyncCond;                  /* Use to coordinate with async jobs */
132
    qemuDomainAsyncJob asyncJob;        /* Currently active async job */
133
    unsigned long long asyncOwner;      /* Thread which set current async job */
134
    const char *asyncOwnerAPI;          /* The API which owns the async job */
J
Jiri Denemark 已提交
135
    unsigned long long asyncStarted;    /* When the current async job started */
J
Jiri Denemark 已提交
136
    int phase;                          /* Job phase (mainly for migrations) */
137
    unsigned long long mask;            /* Jobs allowed during async job */
138
    bool dump_memory_only;              /* use dump-guest-memory to do dump */
J
Jiri Denemark 已提交
139
    qemuDomainJobInfoPtr current;       /* async job progress data */
140
    qemuDomainJobInfoPtr completed;     /* statistics data of a recently completed job */
141
    bool abortJob;                      /* abort of the job requested */
142 143
    bool spiceMigration;                /* we asked for spice migration and we
                                         * should wait for it to finish */
144
    bool spiceMigrated;                 /* spice migration completed */
145
    bool postcopyEnabled;               /* post-copy migration was enabled */
146 147
};

148
typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver,
149 150
                                          virDomainObjPtr vm);

151 152 153
typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate;
typedef qemuDomainObjPrivate *qemuDomainObjPrivatePtr;
struct _qemuDomainObjPrivate {
154
    struct qemuDomainJobObj job;
155 156

    qemuMonitorPtr mon;
157
    virDomainChrSourceDefPtr monConfig;
E
Eric Blake 已提交
158
    bool monJSON;
159 160
    bool monError;
    unsigned long long monStart;
D
Daniel P. Berrange 已提交
161 162 163 164 165

    qemuAgentPtr agent;
    bool agentError;
    unsigned long long agentStart;

166
    bool gotShutdown;
167
    bool beingDestroyed;
168
    char *pidfile;
169 170 171 172

    int nvcpupids;
    int *vcpupids;

173
    virDomainPCIAddressSetPtr pciaddrs;
J
Ján Tomko 已提交
174
    virDomainCCWAddressSetPtr ccwaddrs;
175
    virDomainVirtioSerialAddrSetPtr vioserialaddrs;
176
    int persistentAddrs;
177

178
    virQEMUCapsPtr qemuCaps;
179
    char *lockState;
180 181

    bool fakeReboot;
182 183

    int jobs_queued;
184 185

    unsigned long migMaxBandwidth;
J
Jiri Denemark 已提交
186
    char *origname;
187
    int nbdPort; /* Port used for migration with NBD */
188
    unsigned short migrationPort;
189
    int preMigrationState;
190

191
    virChrdevsPtr devs;
192 193 194 195

    qemuDomainCleanupCallback *cleanupCallbacks;
    size_t ncleanupCallbacks;
    size_t ncleanupCallbacks_max;
196 197

    virCgroupPtr cgroup;
198

199 200
    virPerfPtr perf;

201 202
    virCond unplugFinished; /* signals that unpluggingDevice was unplugged */
    const char *unpluggingDevice; /* alias of the device that is being unplugged */
203
    char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
204 205

    bool hookRun;  /* true if there was a hook run over this domain */
206 207

    /* Bitmaps below hold data from the auto NUMA feature */
208
    virBitmapPtr autoNodeset;
209
    virBitmapPtr autoCpuset;
210 211 212

    bool signalIOError; /* true if the domain condition should be signalled on
                           I/O error */
213 214
    bool signalStop; /* true if the domain condition should be signalled on
                        QMP STOP event */
215
    char *machineName;
216 217
    char *libDir;            /* base path for per-domain files */
    char *channelTargetDir;  /* base path for per-domain channel targets */
218 219
};

220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
# define QEMU_DOMAIN_DISK_PRIVATE(disk)	\
    ((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 */
    bool blockJobSync; /* the block job needs synchronized termination */
237 238

    bool migrating; /* the disk is being migrated */
239 240
};

C
Chen Fan 已提交
241 242
typedef enum {
    QEMU_PROCESS_EVENT_WATCHDOG = 0,
243
    QEMU_PROCESS_EVENT_GUESTPANIC,
244
    QEMU_PROCESS_EVENT_DEVICE_DELETED,
245
    QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED,
246
    QEMU_PROCESS_EVENT_SERIAL_CHANGED,
247
    QEMU_PROCESS_EVENT_BLOCK_JOB,
248
    QEMU_PROCESS_EVENT_MONITOR_EOF,
C
Chen Fan 已提交
249 250 251 252 253

    QEMU_PROCESS_EVENT_LAST
} qemuProcessEventType;

struct qemuProcessEvent {
254
    virDomainObjPtr vm;
C
Chen Fan 已提交
255
    qemuProcessEventType eventType;
256
    int action;
257
    int status;
258
    void *data;
259 260
};

261 262 263
typedef struct _qemuDomainLogContext qemuDomainLogContext;
typedef qemuDomainLogContext *qemuDomainLogContextPtr;

264
const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
265
                                            int phase);
266
int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
267 268
                                      const char *phase);

269
void qemuDomainEventFlush(int timer, void *opaque);
270

271
void qemuDomainEventQueue(virQEMUDriverPtr driver,
272
                          virObjectEventPtr event);
273 274
void qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm);
275

276
int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
277
                          virDomainObjPtr obj,
278
                          qemuDomainJob job)
279
    ATTRIBUTE_RETURN_CHECK;
280
int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
281
                               virDomainObjPtr obj,
282
                               qemuDomainAsyncJob asyncJob)
283
    ATTRIBUTE_RETURN_CHECK;
284 285 286 287
int qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                qemuDomainAsyncJob asyncJob)
    ATTRIBUTE_RETURN_CHECK;
288

289 290 291 292
void qemuDomainObjEndJob(virQEMUDriverPtr driver,
                         virDomainObjPtr obj);
void qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver,
                              virDomainObjPtr obj);
293
void qemuDomainObjAbortAsyncJob(virDomainObjPtr obj);
294
void qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
J
Jiri Denemark 已提交
295 296
                              virDomainObjPtr obj,
                              int phase);
297 298
void qemuDomainObjSetAsyncJobMask(virDomainObjPtr obj,
                                  unsigned long long allowedJobs);
299 300
void qemuDomainObjRestoreJob(virDomainObjPtr obj,
                             struct qemuDomainJobObj *job);
301
void qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver,
302
                                  virDomainObjPtr obj);
303
void qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj);
304

305 306
qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);
307
void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
308 309
                               virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
310 311
int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
                             virDomainObjPtr obj)
312 313
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_RETURN_CHECK;
314
int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
315
                                   virDomainObjPtr obj,
316
                                   qemuDomainAsyncJob asyncJob)
317
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
D
Daniel P. Berrange 已提交
318 319


320
qemuAgentPtr qemuDomainGetAgent(virDomainObjPtr vm);
321 322 323 324
void qemuDomainObjEnterAgent(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1);
void qemuDomainObjExitAgent(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1);
D
Daniel P. Berrange 已提交
325 326


327 328 329 330
void qemuDomainObjEnterRemote(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1);
void qemuDomainObjExitRemote(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1);
331

332 333 334 335
virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
                                  virDomainDefPtr src,
                                  unsigned int flags);

336
int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
337 338 339 340
                           virDomainDefPtr vm,
                           unsigned int flags,
                           virBuffer *buf);

341
char *qemuDomainDefFormatXML(virQEMUDriverPtr driver,
342
                             virDomainDefPtr vm,
343
                             unsigned int flags);
344

345
char *qemuDomainFormatXML(virQEMUDriverPtr driver,
346
                          virDomainObjPtr vm,
347
                          unsigned int flags);
348

349
char *qemuDomainDefFormatLive(virQEMUDriverPtr driver,
350
                              virDomainDefPtr def,
351 352
                              bool inactive,
                              bool compatible);
353

354
void qemuDomainObjTaint(virQEMUDriverPtr driver,
355
                        virDomainObjPtr obj,
356
                        virDomainTaintFlags taint,
357
                        qemuDomainLogContextPtr logCtxt);
358

359
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
360
                             virDomainObjPtr obj,
361
                             qemuDomainLogContextPtr logCtxt);
362
void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
363
                                 virDomainObjPtr obj,
364
                                 virDomainDiskDefPtr disk,
365
                                 qemuDomainLogContextPtr logCtxt);
366 367 368
void qemuDomainObjCheckHostdevTaint(virQEMUDriverPtr driver,
                                    virDomainObjPtr obj,
                                    virDomainHostdevDefPtr disk,
369
                                    qemuDomainLogContextPtr logCtxt);
370
void qemuDomainObjCheckNetTaint(virQEMUDriverPtr driver,
371
                                virDomainObjPtr obj,
372
                                virDomainNetDefPtr net,
373
                                qemuDomainLogContextPtr logCtxt);
374

375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
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);
void qemuDomainLogContextRef(qemuDomainLogContextPtr ctxt);
void qemuDomainLogContextFree(qemuDomainLogContextPtr ctxt);
392

393 394
virLogManagerPtr qemuDomainLogContextGetManager(qemuDomainLogContextPtr ctxt);

395
const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
396 397 398

int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
                                    virDomainSnapshotObjPtr snapshot,
399
                                    virCapsPtr caps,
400 401
                                    char *snapshotDir);

402
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
403 404 405 406 407
                                   virDomainObjPtr vm,
                                   virDomainSnapshotObjPtr snap,
                                   const char *op,
                                   bool try_all);

408
int qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
409 410 411 412 413
                              virDomainObjPtr vm,
                              virDomainSnapshotObjPtr snap,
                              bool update_current,
                              bool metadata_only);

414 415 416
typedef struct _virQEMUSnapRemove virQEMUSnapRemove;
typedef virQEMUSnapRemove *virQEMUSnapRemovePtr;
struct _virQEMUSnapRemove {
417
    virQEMUDriverPtr driver;
418 419 420 421 422 423
    virDomainObjPtr vm;
    int err;
    bool metadata_only;
    bool current;
};

424 425 426
int qemuDomainSnapshotDiscardAll(void *payload,
                                 const void *name,
                                 void *data);
427

428
int qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver,
429 430
                                         virDomainObjPtr vm);

431
void qemuDomainRemoveInactive(virQEMUDriverPtr driver,
432 433
                              virDomainObjPtr vm);

434
void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
435 436 437
                             virDomainObjPtr vm,
                             bool value);

438
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
439
                          qemuDomainJob job);
M
Michal Privoznik 已提交
440

441
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
M
Michal Privoznik 已提交
442 443
                                virDomainObjPtr vm,
                                bool start_with_state);
444

445
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
446
                                 virDomainObjPtr vm,
447
                                 virDomainDiskDefPtr disk,
448 449
                                 bool force_probe,
                                 bool report_broken);
450

451 452 453 454
bool qemuDomainDiskSourceDiffers(virConnectPtr conn,
                                 virDomainDiskDefPtr disk,
                                 virDomainDiskDefPtr origDisk);

455 456 457
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
                                   virDomainDiskDefPtr orig_disk);

458 459 460
int qemuDomainStorageFileInit(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
                              virStorageSourcePtr src);
461
char *qemuDomainStorageAlias(const char *device, int depth);
462

463 464 465 466 467 468 469 470
void qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm,
                                      virStorageSourcePtr elem);
int qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm,
                                      virStorageSourcePtr elem,
                                      bool readonly);

471 472 473 474
int qemuDomainCleanupAdd(virDomainObjPtr vm,
                         qemuDomainCleanupCallback cb);
void qemuDomainCleanupRemove(virDomainObjPtr vm,
                             qemuDomainCleanupCallback cb);
475
void qemuDomainCleanupRun(virQEMUDriverPtr driver,
476 477
                          virDomainObjPtr vm);

478 479
extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks;
extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace;
480
extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
481

482
int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
483
                               virDomainObjPtr vm, int asyncJob);
484

485 486 487 488
int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     int asyncJob);

489 490 491
bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
                                    virDomainDefPtr src,
                                    virDomainDefPtr dst);
492

493
bool qemuDomainAgentAvailable(virDomainObjPtr vm,
494 495
                              bool reportError);

J
Jiri Denemark 已提交
496 497
int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
498 499
int qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
J
Jiri Denemark 已提交
500 501 502 503 504 505 506 507 508 509
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);

510 511
int qemuDomainSupportsBlockJobs(virDomainObjPtr vm, bool *modern)
    ATTRIBUTE_NONNULL(1);
512
bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
513 514
bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only)
    ATTRIBUTE_NONNULL(1);
515

516
int qemuDomainAlignMemorySizes(virDomainDefPtr def);
517 518
void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
                                     virDomainMemoryDefPtr mem);
519

520
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
521

522 523
bool qemuDomainMachineIsQ35(const virDomainDef *def);
bool qemuDomainMachineIsI440FX(const virDomainDef *def);
524
bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
525
bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
526
bool qemuDomainMachineHasBuiltinIDE(const virDomainDef *def);
527

528 529 530
int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm);

531 532
unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDefPtr def);
bool qemuDomainRequiresMemLock(virDomainDefPtr def);
533
int qemuDomainAdjustMaxMemLock(virDomainObjPtr vm);
534

535 536 537 538
int qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
                                       virQEMUCapsPtr qemuCaps,
                                       const virDomainMemoryDef *mem);

539
bool qemuDomainHasVcpuPids(virDomainObjPtr vm);
540
pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpu);
541 542
int qemuDomainDetectVcpuPids(virQEMUDriverPtr driver, virDomainObjPtr vm,
                             int asyncJob);
543

544 545 546 547 548 549 550 551
bool qemuDomainSupportsNicdev(virDomainDefPtr def,
                              virQEMUCapsPtr qemuCaps,
                              virDomainNetDefPtr net);

bool qemuDomainSupportsNetdev(virDomainDefPtr def,
                              virQEMUCapsPtr qemuCaps,
                              virDomainNetDefPtr net);

J
John Ferlan 已提交
552
int qemuDomainNetVLAN(virDomainNetDefPtr def);
553

554 555 556 557 558 559
int qemuDomainSetPrivatePaths(char **domainLibDir,
                              char **domainChannelTargetDir,
                              const char *confLibDir,
                              const char *confChannelDir,
                              const char *domainName,
                              int domainId);
P
Peter Krempa 已提交
560 561 562

virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char *name);

563
#endif /* __QEMU_DOMAIN_H__ */