qemu_domain.h 42.4 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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#pragma once

#include "virthread.h"
#include "vircgroup.h"
#include "virperf.h"
#include "domain_addr.h"
#include "domain_conf.h"
#include "snapshot_conf.h"
#include "qemu_monitor.h"
#include "qemu_agent.h"
#include "qemu_blockjob.h"
#include "qemu_conf.h"
#include "qemu_capabilities.h"
#include "qemu_migration_params.h"
#include "virmdev.h"
#include "virchrdev.h"
#include "virobject.h"
#include "logging/log_manager.h"
#include "virdomainmomentobjlist.h"
#include "virenum.h"

#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 50 51 52
# define QEMU_DOMAIN_MIG_BANDWIDTH_MAX ULONG_MAX
#else
# define QEMU_DOMAIN_MIG_BANDWIDTH_MAX (INT64_MAX / (1024 * 1024))
#endif
53

54 55
#define JOB_MASK(job)                  (job == 0 ? 0 : 1 << (job - 1))
#define QEMU_JOB_DEFAULT_MASK \
56 57
    (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
#define QEMU_DOMAIN_TRACK_JOBS \
62
    (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);

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 230 231 232
#define QEMU_PROC_MOUNTS "/proc/mounts"
#define QEMU_DEVPREFIX "/dev/"
#define QEMU_DEV_VFIO "/dev/vfio/vfio"
#define QEMU_DEV_SEV "/dev/sev"
#define QEMU_DEVICE_MAPPER_CONTROL_PATH "/dev/mapper/control"


233 234 235 236
typedef enum {
    QEMU_DOMAIN_NS_MOUNT = 0,
    QEMU_DOMAIN_NS_LAST
} qemuDomainNamespace;
237
VIR_ENUM_DECL(qemuDomainNamespace);
238 239 240 241

bool qemuDomainNamespaceEnabled(virDomainObjPtr vm,
                                qemuDomainNamespace ns);

242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
/* 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;
};

258 259
#define QEMU_DOMAIN_AES_IV_LEN 16   /* 16 bytes for 128 bit random */
                                    /*    initialization vector */
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
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;
};

279 280 281
typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate;
typedef qemuDomainObjPrivate *qemuDomainObjPrivatePtr;
struct _qemuDomainObjPrivate {
282 283
    virQEMUDriverPtr driver;

284
    qemuDomainJobObj job;
285

286 287
    virBitmapPtr namespaces;

288
    qemuMonitorPtr mon;
289
    virDomainChrSourceDefPtr monConfig;
290 291
    bool monError;
    unsigned long long monStart;
D
Daniel P. Berrange 已提交
292 293 294 295

    qemuAgentPtr agent;
    bool agentError;

296
    bool beingDestroyed;
297
    char *pidfile;
298

299
    virDomainPCIAddressSetPtr pciaddrs;
J
Ján Tomko 已提交
300
    virDomainUSBAddressSetPtr usbaddrs;
301

302
    virQEMUCapsPtr qemuCaps;
303
    char *lockState;
304 305

    bool fakeReboot;
306
    virTristateBool allowReboot;
307 308

    int jobs_queued;
309 310

    unsigned long migMaxBandwidth;
J
Jiri Denemark 已提交
311
    char *origname;
312
    int nbdPort; /* Port used for migration with NBD */
313
    unsigned short migrationPort;
314
    int preMigrationState;
315

316
    virChrdevsPtr devs;
317 318 319 320

    qemuDomainCleanupCallback *cleanupCallbacks;
    size_t ncleanupCallbacks;
    size_t ncleanupCallbacks_max;
321 322

    virCgroupPtr cgroup;
323

324 325
    virPerfPtr perf;

326 327
    qemuDomainUnpluggingDevice unplug;

328
    char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
329 330

    bool hookRun;  /* true if there was a hook run over this domain */
331 332

    /* Bitmaps below hold data from the auto NUMA feature */
333
    virBitmapPtr autoNodeset;
334
    virBitmapPtr autoCpuset;
335 336 337

    bool signalIOError; /* true if the domain condition should be signalled on
                           I/O error */
338 339
    bool signalStop; /* true if the domain condition should be signalled on
                        QMP STOP event */
340
    char *machineName;
341 342
    char *libDir;            /* base path for per-domain files */
    char *channelTargetDir;  /* base path for per-domain channel targets */
J
John Ferlan 已提交
343 344 345 346 347

    /* 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;
348 349 350

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

352 353 354
    /* for migrations using TLS with a secret (not to be saved in our */
    /* private XML). */
    qemuDomainSecretInfoPtr migSecinfo;
355

356 357 358
    /* CPU def used to start the domain when it differs from the one actually
     * provided by QEMU. */
    virCPUDefPtr origCPU;
359 360 361

    /* If true virtlogd is used as stdio handler for character devices. */
    bool chardevStdioLogd;
362 363 364

    /* Tracks blockjob state for vm. Valid only while reconnecting to qemu. */
    virTristateBool reconnectBlockjobs;
365 366 367 368

    /* Migration capabilities. Rechecked on reconnect, not to be saved in
     * private XML. */
    virBitmapPtr migrationCaps;
369 370 371

    /* true if qemu-pr-helper process is running for the domain */
    bool prDaemonRunning;
372 373 374

    /* counter for generating node names for qemu disks */
    unsigned long long nodenameindex;
375 376 377 378

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

380 381 382 383
    /* qemuProcessStopCPUs stores the reason for pausing vCPUs here for the
     * STOP event handler to use it */
    virDomainPausedReason pausedReason;

384 385
    /* true if libvirt remembers the original owner for files */
    bool rememberOwner;
386 387 388

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

391
#define QEMU_DOMAIN_PRIVATE(vm) \
392
    ((qemuDomainObjPrivatePtr) (vm)->privateData)
393

394
#define QEMU_DOMAIN_DISK_PRIVATE(disk) \
395 396 397 398 399 400 401 402 403 404
    ((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 */
405
    qemuBlockJobDataPtr blockjob;
406 407

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

410 411 412
    /* information about the device */
    bool tray; /* device has tray */
    bool removable; /* device media can be removed/changed */
413 414

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

418
#define QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src) \
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
    ((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);

435 436 437 438 439
typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
struct _qemuDomainVcpuPrivate {
    virObject parent;

440
    pid_t tid; /* vcpu thread id */
441
    int enable_id; /* order in which the vcpus were enabled in qemu */
442
    int qemu_id; /* ID reported by qemu as 'CPU' in query-cpus */
443
    char *alias;
444
    virTristateBool halted;
445 446 447 448 449 450

    /* information for hotpluggable cpus */
    char *type;
    int socket_id;
    int core_id;
    int thread_id;
451
    int node_id;
452
    int vcpus;
453 454
};

455
#define QEMU_DOMAIN_VCPU_PRIVATE(vcpu) \
456 457 458
    ((qemuDomainVcpuPrivatePtr) (vcpu)->privateData)


459 460
struct qemuDomainDiskInfo {
    bool removable;
461
    bool tray;
462
    bool tray_open;
463
    bool empty;
464
    int io_status;
465
    char *nodename;
466 467
};

468
#define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
469
    ((qemuDomainChrSourcePrivatePtr) (dev)->privateData)
470

471 472 473
typedef struct _qemuDomainChrSourcePrivate qemuDomainChrSourcePrivate;
typedef qemuDomainChrSourcePrivate *qemuDomainChrSourcePrivatePtr;
struct _qemuDomainChrSourcePrivate {
474 475 476 477 478 479 480 481
    virObject parent;

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


J
Ján Tomko 已提交
482 483 484 485 486
typedef struct _qemuDomainVsockPrivate qemuDomainVsockPrivate;
typedef qemuDomainVsockPrivate *qemuDomainVsockPrivatePtr;
struct _qemuDomainVsockPrivate {
    virObject parent;

487
    int vhostfd;
J
Ján Tomko 已提交
488 489 490
};


491
#define QEMU_DOMAIN_GRAPHICS_PRIVATE(dev) \
492 493 494 495 496 497 498 499
    ((qemuDomainGraphicsPrivatePtr) (dev)->privateData)

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

    char *tlsAlias;
500
    qemuDomainSecretInfoPtr secinfo;
501 502 503
};


C
Chen Fan 已提交
504 505
typedef enum {
    QEMU_PROCESS_EVENT_WATCHDOG = 0,
506
    QEMU_PROCESS_EVENT_GUESTPANIC,
507
    QEMU_PROCESS_EVENT_DEVICE_DELETED,
508
    QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED,
509
    QEMU_PROCESS_EVENT_SERIAL_CHANGED,
510
    QEMU_PROCESS_EVENT_BLOCK_JOB,
511
    QEMU_PROCESS_EVENT_MONITOR_EOF,
512
    QEMU_PROCESS_EVENT_PR_DISCONNECT,
513
    QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED,
C
Chen Fan 已提交
514 515 516 517 518

    QEMU_PROCESS_EVENT_LAST
} qemuProcessEventType;

struct qemuProcessEvent {
519
    virDomainObjPtr vm;
C
Chen Fan 已提交
520
    qemuProcessEventType eventType;
521
    int action;
522
    int status;
523
    void *data;
524 525
};

526 527
void qemuProcessEventFree(struct qemuProcessEvent *event);

528 529 530
typedef struct _qemuDomainLogContext qemuDomainLogContext;
typedef qemuDomainLogContext *qemuDomainLogContextPtr;

531 532 533 534
typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie;
typedef qemuDomainSaveCookie *qemuDomainSaveCookiePtr;
struct _qemuDomainSaveCookie {
    virObject parent;
535 536

    virCPUDefPtr cpu;
537 538
};

539 540 541 542 543 544 545 546 547 548

typedef struct _qemuDomainXmlNsDef qemuDomainXmlNsDef;
typedef qemuDomainXmlNsDef *qemuDomainXmlNsDefPtr;
struct _qemuDomainXmlNsDef {
    size_t num_args;
    char **args;

    unsigned int num_env;
    char **env_name;
    char **env_value;
549 550 551 552 553 554

    size_t ncapsadd;
    char **capsadd;

    size_t ncapsdel;
    char **capsdel;
555 556 557
};


558 559
qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm);

560
const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
561
                                            int phase);
562
int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
J
Jiri Denemark 已提交
563 564
                                      const char *phase);

565
void qemuDomainEventFlush(int timer, void *opaque);
566

567 568
void qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm);
569

570
int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
571
                          virDomainObjPtr obj,
572
                          qemuDomainJob job)
573
    ATTRIBUTE_RETURN_CHECK;
574 575 576 577 578 579 580 581 582
int qemuDomainObjBeginAgentJob(virQEMUDriverPtr driver,
                               virDomainObjPtr obj,
                               qemuDomainAgentJob agentJob)
    ATTRIBUTE_RETURN_CHECK;
int qemuDomainObjBeginJobWithAgent(virQEMUDriverPtr driver,
                                   virDomainObjPtr obj,
                                   qemuDomainJob job,
                                   qemuDomainAgentJob agentJob)
    ATTRIBUTE_RETURN_CHECK;
583
int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
584
                               virDomainObjPtr obj,
585
                               qemuDomainAsyncJob asyncJob,
586 587
                               virDomainJobOperation operation,
                               unsigned long apiFlags)
588
    ATTRIBUTE_RETURN_CHECK;
589 590 591 592
int qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                qemuDomainAsyncJob asyncJob)
    ATTRIBUTE_RETURN_CHECK;
593 594 595 596
int qemuDomainObjBeginJobNowait(virQEMUDriverPtr driver,
                                virDomainObjPtr obj,
                                qemuDomainJob job)
    ATTRIBUTE_RETURN_CHECK;
597

598 599
void qemuDomainObjEndJob(virQEMUDriverPtr driver,
                         virDomainObjPtr obj);
600 601 602
void qemuDomainObjEndAgentJob(virDomainObjPtr obj);
void qemuDomainObjEndJobWithAgent(virQEMUDriverPtr driver,
                                  virDomainObjPtr obj);
603 604
void qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver,
                              virDomainObjPtr obj);
605
void qemuDomainObjAbortAsyncJob(virDomainObjPtr obj);
606
void qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
J
Jiri Denemark 已提交
607 608
                              virDomainObjPtr obj,
                              int phase);
609 610
void qemuDomainObjSetAsyncJobMask(virDomainObjPtr obj,
                                  unsigned long long allowedJobs);
611
void qemuDomainObjRestoreJob(virDomainObjPtr obj,
612
                             qemuDomainJobObjPtr job);
613
void qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver,
614
                                  virDomainObjPtr obj);
615
void qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj);
616

617 618
qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);
619
void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
620 621
                               virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
622 623
int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
                             virDomainObjPtr obj)
624 625
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_RETURN_CHECK;
626
int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
627
                                   virDomainObjPtr obj,
628
                                   qemuDomainAsyncJob asyncJob)
629
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
D
Daniel P. Berrange 已提交
630 631


632
qemuAgentPtr qemuDomainObjEnterAgent(virDomainObjPtr obj)
633
    ATTRIBUTE_NONNULL(1);
634 635
void qemuDomainObjExitAgent(virDomainObjPtr obj, qemuAgentPtr agent)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
D
Daniel P. Berrange 已提交
636 637


638 639
void qemuDomainObjEnterRemote(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1);
640 641 642
int qemuDomainObjExitRemote(virDomainObjPtr obj,
                            bool checkActive)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
643

644 645 646 647
virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
                                  virDomainDefPtr src,
                                  unsigned int flags);

648
int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
649 650 651 652
                           virDomainDefPtr vm,
                           unsigned int flags,
                           virBuffer *buf);

653
char *qemuDomainDefFormatXML(virQEMUDriverPtr driver,
654
                             virDomainDefPtr vm,
655
                             unsigned int flags);
656

657
char *qemuDomainFormatXML(virQEMUDriverPtr driver,
658
                          virDomainObjPtr vm,
659
                          unsigned int flags);
660

661
char *qemuDomainDefFormatLive(virQEMUDriverPtr driver,
662
                              virDomainDefPtr def,
663
                              virCPUDefPtr origCPU,
664 665
                              bool inactive,
                              bool compatible);
666

667
void qemuDomainObjTaint(virQEMUDriverPtr driver,
668
                        virDomainObjPtr obj,
669
                        virDomainTaintFlags taint,
670
                        qemuDomainLogContextPtr logCtxt);
671

672
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
673
                             virDomainObjPtr obj,
674
                             qemuDomainLogContextPtr logCtxt);
675
void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
676
                                 virDomainObjPtr obj,
677
                                 virDomainDiskDefPtr disk,
678
                                 qemuDomainLogContextPtr logCtxt);
679 680 681
void qemuDomainObjCheckHostdevTaint(virQEMUDriverPtr driver,
                                    virDomainObjPtr obj,
                                    virDomainHostdevDefPtr disk,
682
                                    qemuDomainLogContextPtr logCtxt);
683
void qemuDomainObjCheckNetTaint(virQEMUDriverPtr driver,
684
                                virDomainObjPtr obj,
685
                                virDomainNetDefPtr net,
686
                                qemuDomainLogContextPtr logCtxt);
687

688 689 690 691 692 693 694 695 696 697 698 699 700 701 702
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);
703

704 705
virLogManagerPtr qemuDomainLogContextGetManager(qemuDomainLogContextPtr ctxt);

706 707 708 709 710
int qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
                               virDomainObjPtr vm,
                               const char *fmt,
                               ...) ATTRIBUTE_FMT_PRINTF(3, 4);

711
const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
712 713

int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
714
                                    virDomainMomentObjPtr snapshot,
715
                                    virCapsPtr caps,
716
                                    virDomainXMLOptionPtr xmlopt,
717
                                    const char *snapshotDir);
718

719
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
720
                                   virDomainObjPtr vm,
721
                                   virDomainMomentObjPtr snap,
722 723 724
                                   const char *op,
                                   bool try_all);

725
int qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
726
                              virDomainObjPtr vm,
727
                              virDomainMomentObjPtr snap,
728 729 730
                              bool update_current,
                              bool metadata_only);

731 732 733
typedef struct _virQEMUMomentRemove virQEMUMomentRemove;
typedef virQEMUMomentRemove *virQEMUMomentRemovePtr;
struct _virQEMUMomentRemove {
734
    virQEMUDriverPtr driver;
735 736 737
    virDomainObjPtr vm;
    int err;
    bool metadata_only;
738 739 740 741
    virDomainMomentObjPtr current;
    bool found;
    int (*momentDiscard)(virQEMUDriverPtr, virDomainObjPtr,
                         virDomainMomentObjPtr, bool, bool);
742 743
};

744 745 746
int qemuDomainMomentDiscardAll(void *payload,
                               const void *name,
                               void *data);
747

748
int qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver,
749 750
                                         virDomainObjPtr vm);

751
void qemuDomainRemoveInactive(virQEMUDriverPtr driver,
752 753
                              virDomainObjPtr vm);

754 755 756
void qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

757 758 759
void qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver,
                                       virDomainObjPtr vm);

760
void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
761 762 763
                             virDomainObjPtr vm,
                             bool value);

764
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
765
                          qemuDomainJob job);
M
Michal Privoznik 已提交
766

767 768 769 770 771
int qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     size_t diskIndex,
                                     bool cold_boot);

772
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
M
Michal Privoznik 已提交
773
                                virDomainObjPtr vm,
774
                                unsigned int flags);
775

776
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
777
                                 virDomainObjPtr vm,
778
                                 virDomainDiskDefPtr disk,
779
                                 virStorageSourcePtr disksrc,
780
                                 bool report_broken);
781

782 783 784
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
                                   virDomainDiskDefPtr orig_disk);

785 786
int qemuDomainStorageFileInit(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
787 788
                              virStorageSourcePtr src,
                              virStorageSourcePtr parent);
789
char *qemuDomainStorageAlias(const char *device, int depth);
790

791 792 793 794 795 796
int qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
                                  virQEMUCapsPtr qemuCaps,
                                  char **backendAlias)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
    ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;

797 798 799 800 801 802
int qemuDomainStorageSourceChainAccessAllow(virQEMUDriverPtr driver,
                                            virDomainObjPtr vm,
                                            virStorageSourcePtr src);
int qemuDomainStorageSourceChainAccessRevoke(virQEMUDriverPtr driver,
                                             virDomainObjPtr vm,
                                             virStorageSourcePtr src);
803

804 805 806 807 808 809 810 811
void qemuDomainStorageSourceAccessRevoke(virQEMUDriverPtr driver,
                                         virDomainObjPtr vm,
                                         virStorageSourcePtr elem);
int qemuDomainStorageSourceAccessAllow(virQEMUDriverPtr driver,
                                       virDomainObjPtr vm,
                                       virStorageSourcePtr elem,
                                       bool readonly,
                                       bool newSource);
812

813 814 815 816 817
int qemuDomainPrepareStorageSourceBlockdev(virDomainDiskDefPtr disk,
                                           virStorageSourcePtr src,
                                           qemuDomainObjPrivatePtr priv,
                                           virQEMUDriverConfigPtr cfg);

818 819 820 821
int qemuDomainCleanupAdd(virDomainObjPtr vm,
                         qemuDomainCleanupCallback cb);
void qemuDomainCleanupRemove(virDomainObjPtr vm,
                             qemuDomainCleanupCallback cb);
822
void qemuDomainCleanupRun(virQEMUDriverPtr driver,
823 824
                          virDomainObjPtr vm);

825 826
void qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv);

827 828
extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks;
extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace;
829
extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
830
extern virDomainABIStability virQEMUDriverDomainABIStability;
831
extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie;
832

833
int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
834
                               virDomainObjPtr vm, int asyncJob);
835

836 837 838 839
int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver,
                                     virDomainObjPtr vm,
                                     int asyncJob);

840 841 842
bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
                                    virDomainDefPtr src,
                                    virDomainDefPtr dst);
843

844 845 846 847
bool qemuDomainCheckABIStability(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm,
                                 virDomainDefPtr dst);

848
bool qemuDomainAgentAvailable(virDomainObjPtr vm,
849 850
                              bool reportError);

J
Jiri Denemark 已提交
851 852
int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
853 854
int qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
    ATTRIBUTE_NONNULL(1);
J
Jiri Denemark 已提交
855 856 857 858 859 860 861 862 863 864
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);

865
bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
866 867
bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only)
    ATTRIBUTE_NONNULL(1);
868

869
int qemuDomainAlignMemorySizes(virDomainDefPtr def);
870 871
void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
                                     virDomainMemoryDefPtr mem);
872

873
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
874

875 876
/* You should normally avoid these functions and use the variant that
 * doesn't have "Machine" in the name instead. */
877 878
bool qemuDomainMachineIsARMVirt(const char *machine,
                                const virArch arch);
879 880
bool qemuDomainMachineIsPSeries(const char *machine,
                                const virArch arch);
881 882
bool qemuDomainMachineHasBuiltinIDE(const char *machine,
                                    const virArch arch);
A
Andrea Bolognani 已提交
883 884 885 886 887 888 889 890 891 892 893

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);
894 895
bool qemuDomainSupportsPCI(virDomainDefPtr def,
                           virQEMUCapsPtr qemuCaps);
896

897
void qemuDomainUpdateCurrentMemorySize(virDomainObjPtr vm);
898

899
unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDefPtr def);
900
int qemuDomainAdjustMaxMemLock(virDomainObjPtr vm);
901

902 903 904 905
int qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
                                       virQEMUCapsPtr qemuCaps,
                                       const virDomainMemoryDef *mem);

906
bool qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm);
907
bool qemuDomainHasVcpuPids(virDomainObjPtr vm);
908
pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid);
909
int qemuDomainValidateVcpuInfo(virDomainObjPtr vm);
910 911
int qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
912 913
                              int asyncJob,
                              bool state);
914 915 916 917
bool qemuDomainGetVcpuHalted(virDomainObjPtr vm, unsigned int vcpu);
int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
                                virDomainObjPtr vm,
                                int asyncJob);
918

919 920 921
bool qemuDomainSupportsNicdev(virDomainDefPtr def,
                              virDomainNetDefPtr net);

922 923
bool qemuDomainNetSupportsMTU(virDomainNetType type);

924 925 926
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
                              virDomainObjPtr vm);

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

J
John Ferlan 已提交
929 930 931 932
char *qemuDomainGetMasterKeyFilePath(const char *libDir);

int qemuDomainMasterKeyReadFile(qemuDomainObjPrivatePtr priv);

933 934 935 936
int qemuDomainWriteMasterKeyFile(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

int qemuDomainMasterKeyCreate(virDomainObjPtr vm);
J
John Ferlan 已提交
937 938 939

void qemuDomainMasterKeyRemove(qemuDomainObjPrivatePtr priv);

940 941
bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivatePtr priv);

942 943 944
void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr *secinfo)
    ATTRIBUTE_NONNULL(1);

945 946
void qemuDomainSecretInfoDestroy(qemuDomainSecretInfoPtr secinfo);

947 948 949
void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
    ATTRIBUTE_NONNULL(1);

950
bool qemuDomainStorageSourceHasAuth(virStorageSourcePtr src)
951 952
    ATTRIBUTE_NONNULL(1);

953 954 955
bool qemuDomainDiskHasEncryptionSecret(virStorageSourcePtr src)
    ATTRIBUTE_NONNULL(1);

956
qemuDomainSecretInfoPtr
957
qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
958 959 960
                           const char *srcAlias,
                           const char *secretUUID);

961 962 963
void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk)
    ATTRIBUTE_NONNULL(1);

964
int qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
965
                                   virDomainHostdevDefPtr hostdev)
966
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
967

968 969 970
void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev)
    ATTRIBUTE_NONNULL(1);

971
int qemuDomainSecretChardevPrepare(virQEMUDriverConfigPtr cfg,
972 973 974 975
                                   qemuDomainObjPrivatePtr priv,
                                   const char *chrAlias,
                                   virDomainChrSourceDefPtr dev)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
976
    ATTRIBUTE_NONNULL(4);
977

978 979 980
void qemuDomainSecretDestroy(virDomainObjPtr vm)
    ATTRIBUTE_NONNULL(1);

981
int qemuDomainSecretPrepare(virQEMUDriverPtr driver,
982
                            virDomainObjPtr vm)
983
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
984

985 986 987
int qemuDomainDefValidateDiskLunSource(const virStorageSource *src)
    ATTRIBUTE_NONNULL(1);

988 989 990
int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
                                    virQEMUCapsPtr qemuCaps);

991 992 993 994
int qemuDomainPrepareChannel(virDomainChrDefPtr chr,
                             const char *domainChannelTargetDir)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

995 996 997 998 999
void qemuDomainPrepareChardevSourceTLS(virDomainChrSourceDefPtr source,
                                       virQEMUDriverConfigPtr cfg)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

void qemuDomainPrepareChardevSource(virDomainDefPtr def,
1000
                                    virQEMUDriverConfigPtr cfg)
1001 1002
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

1003 1004 1005
int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
    ATTRIBUTE_NONNULL(1);

1006 1007 1008
bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

1009 1010 1011
void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);

1012 1013 1014 1015
int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
                           virDomainObjPtr vm,
                           qemuDomainAsyncJob asyncJob);

1016 1017 1018
bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr video,
                                virQEMUCapsPtr qemuCaps);

1019 1020 1021
int qemuDomainGetHostdevPath(virDomainDefPtr def,
                             virDomainHostdevDefPtr dev,
                             bool teardown,
1022 1023 1024
                             size_t *npaths,
                             char ***path,
                             int **perms);
1025

1026 1027
int qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
                             virSecurityManagerPtr mgr,
1028 1029 1030 1031 1032
                             virDomainObjPtr vm);

int qemuDomainCreateNamespace(virQEMUDriverPtr driver,
                              virDomainObjPtr vm);

1033 1034 1035
void qemuDomainDestroyNamespace(virQEMUDriverPtr driver,
                                virDomainObjPtr vm);

1036 1037
bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);

1038
int qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
1039
                                 virStorageSourcePtr src);
1040

1041
int qemuDomainNamespaceTeardownDisk(virDomainObjPtr vm,
1042
                                    virStorageSourcePtr src);
1043

1044
int qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
1045 1046
                                    virDomainHostdevDefPtr hostdev);

1047
int qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
1048
                                       virDomainHostdevDefPtr hostdev);
1049

1050
int qemuDomainNamespaceSetupMemory(virDomainObjPtr vm,
M
Michal Privoznik 已提交
1051 1052
                                   virDomainMemoryDefPtr memory);

1053
int qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
M
Michal Privoznik 已提交
1054 1055
                                      virDomainMemoryDefPtr memory);

1056
int qemuDomainNamespaceSetupChardev(virDomainObjPtr vm,
1057 1058
                                    virDomainChrDefPtr chr);

1059
int qemuDomainNamespaceTeardownChardev(virDomainObjPtr vm,
1060
                                       virDomainChrDefPtr chr);
1061

1062
int qemuDomainNamespaceSetupRNG(virDomainObjPtr vm,
1063
                                virDomainRNGDefPtr rng);
1064

1065
int qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
1066
                                   virDomainRNGDefPtr rng);
1067

1068 1069 1070 1071 1072 1073
int qemuDomainNamespaceSetupInput(virDomainObjPtr vm,
                                  virDomainInputDefPtr input);

int qemuDomainNamespaceTeardownInput(virDomainObjPtr vm,
                                     virDomainInputDefPtr input);

1074 1075 1076 1077 1078
virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def,
                                                   const char *nodename,
                                                   virStorageSourcePtr *src,
                                                   unsigned int *idx);

1079 1080 1081 1082
char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
                                        virStorageSourcePtr src,
                                        unsigned int idx);

1083 1084 1085
virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr,
                                                       virDomainDefPtr def);

1086 1087 1088 1089 1090
int
qemuDomainUpdateCPU(virDomainObjPtr vm,
                    virCPUDefPtr cpu,
                    virCPUDefPtr *origCPU);

1091 1092 1093 1094
int
qemuDomainFixupCPUs(virDomainObjPtr vm,
                    virCPUDefPtr *origCPU);

1095 1096 1097 1098
int
qemuDomainUpdateQEMUCaps(virDomainObjPtr vm,
                         virFileCachePtr qemuCapsCache);

1099 1100 1101
char *
qemuDomainGetMachineName(virDomainObjPtr vm);

1102 1103 1104 1105 1106 1107 1108 1109
void
qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPtr buf,
                                         virTristateBool allowReboot);

int
qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt,
                                        virTristateBool *allowReboot);

1110 1111 1112 1113 1114
bool
qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
                                     const virDomainDeviceInfo *info,
                                     virQEMUCapsPtr qemuCaps,
                                     const char *devicename);
1115

1116
int
1117 1118 1119 1120
qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
                                virStorageSourcePtr src,
                                virQEMUDriverConfigPtr cfg,
                                virQEMUCapsPtr qemuCaps)
1121
    ATTRIBUTE_RETURN_CHECK;
1122

1123 1124 1125 1126 1127 1128

int
qemuDomainValidateStorageSource(virStorageSourcePtr src,
                                virQEMUCapsPtr qemuCaps);


1129
int
1130
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
1131 1132 1133
                            qemuDomainObjPrivatePtr priv,
                            virQEMUDriverConfigPtr cfg);

1134 1135 1136 1137 1138 1139
int
qemuDomainDiskCachemodeFlags(int cachemode,
                             bool *writeback,
                             bool *direct,
                             bool *noflush);

1140
char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv);
1141

1142 1143 1144
unsigned int qemuDomainStorageIdNew(qemuDomainObjPrivatePtr priv);
void qemuDomainStorageIdReset(qemuDomainObjPrivatePtr priv);

1145 1146 1147
virDomainEventResumedDetailType
qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason);

J
John Ferlan 已提交
1148 1149 1150
bool
qemuDomainIsUsingNoShutdown(qemuDomainObjPrivatePtr priv);

1151 1152 1153
bool
qemuDomainDiskIsMissingLocalOptional(virDomainDiskDefPtr disk);

1154 1155 1156 1157
int
qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg,
                            virDomainDefPtr def);

1158 1159
virDomainEventSuspendedDetailType
qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason);