qemu_domain.h 41.3 KB
Newer Older
1 2 3
/*
 * qemu_domain.h: QEMU domain private state
 *
4
 * Copyright (C) 2006-2019 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
# include "virdomainmomentobjlist.h"
42

43
# define QEMU_DOMAIN_FORMAT_LIVE_FLAGS \
44
    (VIR_DOMAIN_XML_SECURE)
45

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

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

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

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

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

    QEMU_JOB_LAST
82
} qemuDomainJob;
83
VIR_ENUM_DECL(qemuDomainJob);
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;
92
VIR_ENUM_DECL(qemuDomainAgentJob);
93

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

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

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

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

130 131 132 133 134 135 136 137

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

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

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

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

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

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

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

J
John Ferlan 已提交
207
# define QEMU_DOMAIN_MASTER_KEY_LEN 32  /* 32 bytes for 256 bit random key */
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
    bool eventSeen; /* True if DEVICE_DELETED event arrived. */
223 224
};

225 226 227 228 229

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

bool qemuDomainNamespaceEnabled(virDomainObjPtr vm,
                                qemuDomainNamespace ns);

235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
/* 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;
};

272 273 274
typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate;
typedef qemuDomainObjPrivate *qemuDomainObjPrivatePtr;
struct _qemuDomainObjPrivate {
275 276
    virQEMUDriverPtr driver;

277
    qemuDomainJobObj job;
278

279 280
    virBitmapPtr namespaces;

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

    qemuAgentPtr agent;
    bool agentError;

290
    bool beingDestroyed;
291
    char *pidfile;
292

293
    virDomainPCIAddressSetPtr pciaddrs;
J
Ján Tomko 已提交
294
    virDomainUSBAddressSetPtr usbaddrs;
295

296
    virQEMUCapsPtr qemuCaps;
297
    char *lockState;
298 299

    bool fakeReboot;
300
    virTristateBool allowReboot;
301 302

    int jobs_queued;
303 304

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

310
    virChrdevsPtr devs;
311 312 313 314

    qemuDomainCleanupCallback *cleanupCallbacks;
    size_t ncleanupCallbacks;
    size_t ncleanupCallbacks_max;
315 316

    virCgroupPtr cgroup;
317

318 319
    virPerfPtr perf;

320 321
    qemuDomainUnpluggingDevice unplug;

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

    bool hookRun;  /* true if there was a hook run over this domain */
325 326

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

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

    /* 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;
342 343 344

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

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

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

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

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

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

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

    /* counter for generating node names for qemu disks */
    unsigned long long nodenameindex;
369 370 371 372

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

374 375 376 377
    /* qemuProcessStopCPUs stores the reason for pausing vCPUs here for the
     * STOP event handler to use it */
    virDomainPausedReason pausedReason;

378 379
    /* true if libvirt remembers the original owner for files */
    bool rememberOwner;
380 381 382

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

385
# define QEMU_DOMAIN_PRIVATE(vm) \
386
    ((qemuDomainObjPrivatePtr) (vm)->privateData)
387

388
# define QEMU_DOMAIN_DISK_PRIVATE(disk) \
389 390 391 392 393 394 395 396 397 398
    ((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 */
399
    qemuBlockJobDataPtr blockjob;
400 401

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

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

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

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

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

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

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

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


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

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

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

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


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

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


485 486 487 488 489 490 491 492 493
# define QEMU_DOMAIN_GRAPHICS_PRIVATE(dev) \
    ((qemuDomainGraphicsPrivatePtr) (dev)->privateData)

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

    char *tlsAlias;
494
    qemuDomainSecretInfoPtr secinfo;
495 496 497
};


C
Chen Fan 已提交
498 499
typedef enum {
    QEMU_PROCESS_EVENT_WATCHDOG = 0,
500
    QEMU_PROCESS_EVENT_GUESTPANIC,
501
    QEMU_PROCESS_EVENT_DEVICE_DELETED,
502
    QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED,
503
    QEMU_PROCESS_EVENT_SERIAL_CHANGED,
504
    QEMU_PROCESS_EVENT_BLOCK_JOB,
505
    QEMU_PROCESS_EVENT_MONITOR_EOF,
506
    QEMU_PROCESS_EVENT_PR_DISCONNECT,
507
    QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED,
C
Chen Fan 已提交
508 509 510 511 512

    QEMU_PROCESS_EVENT_LAST
} qemuProcessEventType;

struct qemuProcessEvent {
513
    virDomainObjPtr vm;
C
Chen Fan 已提交
514
    qemuProcessEventType eventType;
515
    int action;
516
    int status;
517
    void *data;
518 519
};

520 521
void qemuProcessEventFree(struct qemuProcessEvent *event);

522 523 524
typedef struct _qemuDomainLogContext qemuDomainLogContext;
typedef qemuDomainLogContext *qemuDomainLogContextPtr;

525 526 527 528
typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie;
typedef qemuDomainSaveCookie *qemuDomainSaveCookiePtr;
struct _qemuDomainSaveCookie {
    virObject parent;
529 530

    virCPUDefPtr cpu;
531 532 533 534
};

qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm);

535
const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
536
                                            int phase);
537
int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
538 539
                                      const char *phase);

540
void qemuDomainEventFlush(int timer, void *opaque);
541

542 543
void qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm);
544

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

573 574
void qemuDomainObjEndJob(virQEMUDriverPtr driver,
                         virDomainObjPtr obj);
575 576 577
void qemuDomainObjEndAgentJob(virDomainObjPtr obj);
void qemuDomainObjEndJobWithAgent(virQEMUDriverPtr driver,
                                  virDomainObjPtr obj);
578 579
void qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver,
                              virDomainObjPtr obj);
580
void qemuDomainObjAbortAsyncJob(virDomainObjPtr obj);
581
void qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
J
Jiri Denemark 已提交
582 583
                              virDomainObjPtr obj,
                              int phase);
584 585
void qemuDomainObjSetAsyncJobMask(virDomainObjPtr obj,
                                  unsigned long long allowedJobs);
586
void qemuDomainObjRestoreJob(virDomainObjPtr obj,
587
                             qemuDomainJobObjPtr job);
588
void qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver,
589
                                  virDomainObjPtr obj);
590
void qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj);
591

592 593
qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);
594
void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
595 596
                               virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
597 598
int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
                             virDomainObjPtr obj)
599 600
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_RETURN_CHECK;
601
int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
602
                                   virDomainObjPtr obj,
603
                                   qemuDomainAsyncJob asyncJob)
604
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
D
Daniel P. Berrange 已提交
605 606


607
qemuAgentPtr qemuDomainObjEnterAgent(virDomainObjPtr obj)
608
    ATTRIBUTE_NONNULL(1);
609 610
void qemuDomainObjExitAgent(virDomainObjPtr obj, qemuAgentPtr agent)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
D
Daniel P. Berrange 已提交
611 612


613 614
void qemuDomainObjEnterRemote(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1);
615 616 617
int qemuDomainObjExitRemote(virDomainObjPtr obj,
                            bool checkActive)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
618

619 620 621 622
virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
                                  virDomainDefPtr src,
                                  unsigned int flags);

623
int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
624 625 626 627
                           virDomainDefPtr vm,
                           unsigned int flags,
                           virBuffer *buf);

628
char *qemuDomainDefFormatXML(virQEMUDriverPtr driver,
629
                             virDomainDefPtr vm,
630
                             unsigned int flags);
631

632
char *qemuDomainFormatXML(virQEMUDriverPtr driver,
633
                          virDomainObjPtr vm,
634
                          unsigned int flags);
635

636
char *qemuDomainDefFormatLive(virQEMUDriverPtr driver,
637
                              virDomainDefPtr def,
638
                              virCPUDefPtr origCPU,
639 640
                              bool inactive,
                              bool compatible);
641

642
void qemuDomainObjTaint(virQEMUDriverPtr driver,
643
                        virDomainObjPtr obj,
644
                        virDomainTaintFlags taint,
645
                        qemuDomainLogContextPtr logCtxt);
646

647
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
648
                             virDomainObjPtr obj,
649
                             qemuDomainLogContextPtr logCtxt);
650
void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
651
                                 virDomainObjPtr obj,
652
                                 virDomainDiskDefPtr disk,
653
                                 qemuDomainLogContextPtr logCtxt);
654 655 656
void qemuDomainObjCheckHostdevTaint(virQEMUDriverPtr driver,
                                    virDomainObjPtr obj,
                                    virDomainHostdevDefPtr disk,
657
                                    qemuDomainLogContextPtr logCtxt);
658
void qemuDomainObjCheckNetTaint(virQEMUDriverPtr driver,
659
                                virDomainObjPtr obj,
660
                                virDomainNetDefPtr net,
661
                                qemuDomainLogContextPtr logCtxt);
662

663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
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);
678

679 680
virLogManagerPtr qemuDomainLogContextGetManager(qemuDomainLogContextPtr ctxt);

681 682 683 684 685
int qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
                               virDomainObjPtr vm,
                               const char *fmt,
                               ...) ATTRIBUTE_FMT_PRINTF(3, 4);

686
const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
687 688

int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
689
                                    virDomainMomentObjPtr snapshot,
690
                                    virCapsPtr caps,
691
                                    virDomainXMLOptionPtr xmlopt,
692
                                    const char *snapshotDir);
693

694
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
695
                                   virDomainObjPtr vm,
696
                                   virDomainMomentObjPtr snap,
697 698 699
                                   const char *op,
                                   bool try_all);

700
int qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
701
                              virDomainObjPtr vm,
702
                              virDomainMomentObjPtr snap,
703 704 705
                              bool update_current,
                              bool metadata_only);

706 707 708
typedef struct _virQEMUMomentRemove virQEMUMomentRemove;
typedef virQEMUMomentRemove *virQEMUMomentRemovePtr;
struct _virQEMUMomentRemove {
709
    virQEMUDriverPtr driver;
710 711 712
    virDomainObjPtr vm;
    int err;
    bool metadata_only;
713 714 715 716
    virDomainMomentObjPtr current;
    bool found;
    int (*momentDiscard)(virQEMUDriverPtr, virDomainObjPtr,
                         virDomainMomentObjPtr, bool, bool);
717 718
};

719 720 721
int qemuDomainMomentDiscardAll(void *payload,
                               const void *name,
                               void *data);
722

723
int qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver,
724 725
                                         virDomainObjPtr vm);

726
void qemuDomainRemoveInactive(virQEMUDriverPtr driver,
727 728
                              virDomainObjPtr vm);

729 730 731
void qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

732 733 734
void qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver,
                                       virDomainObjPtr vm);

735
void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
736 737 738
                             virDomainObjPtr vm,
                             bool value);

739
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
740
                          qemuDomainJob job);
M
Michal Privoznik 已提交
741

742 743 744 745 746
int qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     size_t diskIndex,
                                     bool cold_boot);

747
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
M
Michal Privoznik 已提交
748
                                virDomainObjPtr vm,
749
                                unsigned int flags);
750

751
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
752
                                 virDomainObjPtr vm,
753
                                 virDomainDiskDefPtr disk,
754
                                 virStorageSourcePtr disksrc,
755
                                 bool report_broken);
756

757 758 759
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
                                   virDomainDiskDefPtr orig_disk);

760 761
int qemuDomainStorageFileInit(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
762 763
                              virStorageSourcePtr src,
                              virStorageSourcePtr parent);
764
char *qemuDomainStorageAlias(const char *device, int depth);
765

766 767 768 769 770 771
int qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
                                  virQEMUCapsPtr qemuCaps,
                                  char **backendAlias)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;

772 773 774 775 776 777
void qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm,
                                      virStorageSourcePtr elem);
int qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
                                      virDomainObjPtr vm,
                                      virStorageSourcePtr elem,
778 779
                                      bool readonly,
                                      bool newSource);
780

781 782 783 784
int qemuDomainCleanupAdd(virDomainObjPtr vm,
                         qemuDomainCleanupCallback cb);
void qemuDomainCleanupRemove(virDomainObjPtr vm,
                             qemuDomainCleanupCallback cb);
785
void qemuDomainCleanupRun(virQEMUDriverPtr driver,
786 787
                          virDomainObjPtr vm);

788 789
void qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv);

790 791
extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks;
extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace;
792
extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
793
extern virDomainABIStability virQEMUDriverDomainABIStability;
794
extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie;
795

796
int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
797
                               virDomainObjPtr vm, int asyncJob);
798

799 800 801 802
int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     int asyncJob);

803 804 805
bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
                                    virDomainDefPtr src,
                                    virDomainDefPtr dst);
806

807 808 809 810
bool qemuDomainCheckABIStability(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm,
                                 virDomainDefPtr dst);

811
bool qemuDomainAgentAvailable(virDomainObjPtr vm,
812 813
                              bool reportError);

J
Jiri Denemark 已提交
814 815
int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
816 817
int qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
J
Jiri Denemark 已提交
818 819 820 821 822 823 824 825 826 827
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);

828
bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
829 830
bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only)
    ATTRIBUTE_NONNULL(1);
831

832
int qemuDomainAlignMemorySizes(virDomainDefPtr def);
833 834
void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
                                     virDomainMemoryDefPtr mem);
835

836
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
837

838 839
/* You should normally avoid these functions and use the variant that
 * doesn't have "Machine" in the name instead. */
840 841
bool qemuDomainMachineIsARMVirt(const char *machine,
                                const virArch arch);
842 843
bool qemuDomainMachineIsPSeries(const char *machine,
                                const virArch arch);
844 845
bool qemuDomainMachineHasBuiltinIDE(const char *machine,
                                    const virArch arch);
A
Andrea Bolognani 已提交
846 847 848 849 850 851 852 853 854 855 856

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);
857 858
bool qemuDomainSupportsPCI(virDomainDefPtr def,
                           virQEMUCapsPtr qemuCaps);
859

860
void qemuDomainUpdateCurrentMemorySize(virDomainObjPtr vm);
861

862
unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDefPtr def);
863
int qemuDomainAdjustMaxMemLock(virDomainObjPtr vm);
864

865 866 867 868
int qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
                                       virQEMUCapsPtr qemuCaps,
                                       const virDomainMemoryDef *mem);

869
bool qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm);
870
bool qemuDomainHasVcpuPids(virDomainObjPtr vm);
871
pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid);
872
int qemuDomainValidateVcpuInfo(virDomainObjPtr vm);
873 874
int qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
875 876
                              int asyncJob,
                              bool state);
877 878 879 880
bool qemuDomainGetVcpuHalted(virDomainObjPtr vm, unsigned int vcpu);
int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
                                virDomainObjPtr vm,
                                int asyncJob);
881

882 883 884
bool qemuDomainSupportsNicdev(virDomainDefPtr def,
                              virDomainNetDefPtr net);

885 886
bool qemuDomainNetSupportsMTU(virDomainNetType type);

887 888 889
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
                              virDomainObjPtr vm);

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

J
John Ferlan 已提交
892 893 894 895
char *qemuDomainGetMasterKeyFilePath(const char *libDir);

int qemuDomainMasterKeyReadFile(qemuDomainObjPrivatePtr priv);

896 897 898 899
int qemuDomainWriteMasterKeyFile(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

int qemuDomainMasterKeyCreate(virDomainObjPtr vm);
J
John Ferlan 已提交
900 901 902

void qemuDomainMasterKeyRemove(qemuDomainObjPrivatePtr priv);

903 904
bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivatePtr priv);

905 906 907
void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr *secinfo)
    ATTRIBUTE_NONNULL(1);

908 909
void qemuDomainSecretInfoDestroy(qemuDomainSecretInfoPtr secinfo);

910 911 912
void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
    ATTRIBUTE_NONNULL(1);

913
bool qemuDomainStorageSourceHasAuth(virStorageSourcePtr src)
914 915
    ATTRIBUTE_NONNULL(1);

916 917 918
bool qemuDomainDiskHasEncryptionSecret(virStorageSourcePtr src)
    ATTRIBUTE_NONNULL(1);

919
qemuDomainSecretInfoPtr
920
qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
921 922 923
                           const char *srcAlias,
                           const char *secretUUID);

924 925 926
void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk)
    ATTRIBUTE_NONNULL(1);

927
int qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
928
                                   virDomainHostdevDefPtr hostdev)
929
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
930

931 932 933
void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev)
    ATTRIBUTE_NONNULL(1);

934
int qemuDomainSecretChardevPrepare(virQEMUDriverConfigPtr cfg,
935 936 937 938
                                   qemuDomainObjPrivatePtr priv,
                                   const char *chrAlias,
                                   virDomainChrSourceDefPtr dev)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
939
    ATTRIBUTE_NONNULL(4);
940

941 942 943
void qemuDomainSecretDestroy(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);

944
int qemuDomainSecretPrepare(virQEMUDriverPtr driver,
945
                            virDomainObjPtr vm)
946
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
947

948 949 950
int qemuDomainDefValidateDiskLunSource(const virStorageSource *src)
    ATTRIBUTE_NONNULL(1);

951 952 953
int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
                                    virQEMUCapsPtr qemuCaps);

954 955 956 957
int qemuDomainPrepareChannel(virDomainChrDefPtr chr,
                             const char *domainChannelTargetDir)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

958 959 960 961 962
void qemuDomainPrepareChardevSourceTLS(virDomainChrSourceDefPtr source,
                                       virQEMUDriverConfigPtr cfg)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

void qemuDomainPrepareChardevSource(virDomainDefPtr def,
963
                                    virQEMUDriverConfigPtr cfg)
964 965
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

966 967 968
int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
    ATTRIBUTE_NONNULL(1);

969 970 971
bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

972 973 974
void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

975 976 977 978
int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
                           virDomainObjPtr vm,
                           qemuDomainAsyncJob asyncJob);

979 980 981
bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr video,
                                virQEMUCapsPtr qemuCaps);

982 983 984
int qemuDomainGetHostdevPath(virDomainDefPtr def,
                             virDomainHostdevDefPtr dev,
                             bool teardown,
985 986 987
                             size_t *npaths,
                             char ***path,
                             int **perms);
988

989 990
int qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
                             virSecurityManagerPtr mgr,
991 992 993 994 995
                             virDomainObjPtr vm);

int qemuDomainCreateNamespace(virQEMUDriverPtr driver,
                              virDomainObjPtr vm);

996 997 998
void qemuDomainDestroyNamespace(virQEMUDriverPtr driver,
                                virDomainObjPtr vm);

999 1000
bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);

1001
int qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
1002
                                 virStorageSourcePtr src);
1003

1004
int qemuDomainNamespaceTeardownDisk(virDomainObjPtr vm,
1005
                                    virStorageSourcePtr src);
1006

1007
int qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
1008 1009
                                    virDomainHostdevDefPtr hostdev);

1010
int qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
1011
                                       virDomainHostdevDefPtr hostdev);
1012

1013
int qemuDomainNamespaceSetupMemory(virDomainObjPtr vm,
M
Michal Privoznik 已提交
1014 1015
                                   virDomainMemoryDefPtr memory);

1016
int qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
M
Michal Privoznik 已提交
1017 1018
                                      virDomainMemoryDefPtr memory);

1019
int qemuDomainNamespaceSetupChardev(virDomainObjPtr vm,
1020 1021
                                    virDomainChrDefPtr chr);

1022
int qemuDomainNamespaceTeardownChardev(virDomainObjPtr vm,
1023
                                       virDomainChrDefPtr chr);
1024

1025
int qemuDomainNamespaceSetupRNG(virDomainObjPtr vm,
1026
                                virDomainRNGDefPtr rng);
1027

1028
int qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
1029
                                   virDomainRNGDefPtr rng);
1030

1031 1032 1033 1034 1035 1036
int qemuDomainNamespaceSetupInput(virDomainObjPtr vm,
                                  virDomainInputDefPtr input);

int qemuDomainNamespaceTeardownInput(virDomainObjPtr vm,
                                     virDomainInputDefPtr input);

1037 1038 1039 1040 1041
virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def,
                                                   const char *nodename,
                                                   virStorageSourcePtr *src,
                                                   unsigned int *idx);

1042 1043 1044 1045
char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
                                        virStorageSourcePtr src,
                                        unsigned int idx);

1046 1047 1048
virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr,
                                                       virDomainDefPtr def);

1049 1050 1051 1052 1053
int
qemuDomainUpdateCPU(virDomainObjPtr vm,
                    virCPUDefPtr cpu,
                    virCPUDefPtr *origCPU);

1054 1055 1056 1057
int
qemuDomainFixupCPUs(virDomainObjPtr vm,
                    virCPUDefPtr *origCPU);

1058 1059 1060 1061
int
qemuDomainUpdateQEMUCaps(virDomainObjPtr vm,
                         virFileCachePtr qemuCapsCache);

1062 1063 1064
char *
qemuDomainGetMachineName(virDomainObjPtr vm);

1065 1066 1067 1068 1069 1070 1071 1072
void
qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPtr buf,
                                         virTristateBool allowReboot);

int
qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt,
                                        virTristateBool *allowReboot);

1073 1074 1075 1076 1077
bool
qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
                                     const virDomainDeviceInfo *info,
                                     virQEMUCapsPtr qemuCaps,
                                     const char *devicename);
1078

1079
int
1080 1081 1082 1083
qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
                                virStorageSourcePtr src,
                                virQEMUDriverConfigPtr cfg,
                                virQEMUCapsPtr qemuCaps)
1084
    ATTRIBUTE_RETURN_CHECK;
1085

1086 1087 1088 1089 1090 1091

int
qemuDomainValidateStorageSource(virStorageSourcePtr src,
                                virQEMUCapsPtr qemuCaps);


1092
int
1093
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
1094 1095 1096
                            qemuDomainObjPrivatePtr priv,
                            virQEMUDriverConfigPtr cfg);

1097 1098 1099 1100 1101 1102
int
qemuDomainDiskCachemodeFlags(int cachemode,
                             bool *writeback,
                             bool *direct,
                             bool *noflush);

1103
char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv);
1104

1105 1106 1107
unsigned int qemuDomainStorageIdNew(qemuDomainObjPrivatePtr priv);
void qemuDomainStorageIdReset(qemuDomainObjPrivatePtr priv);

1108 1109 1110
virDomainEventResumedDetailType
qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason);

J
John Ferlan 已提交
1111 1112 1113
bool
qemuDomainIsUsingNoShutdown(qemuDomainObjPrivatePtr priv);

1114 1115 1116
bool
qemuDomainDiskIsMissingLocalOptional(virDomainDiskDefPtr disk);

1117 1118 1119 1120
int
qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg,
                            virDomainDefPtr def);

1121 1122 1123
virDomainEventSuspendedDetailType
qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason);

1124
#endif /* LIBVIRT_QEMU_DOMAIN_H */