2010-12-16 15:23:41 +00:00
|
|
|
/*
|
|
|
|
* qemu_domain.h: QEMU domain private state
|
|
|
|
*
|
2016-02-15 16:44:21 +00:00
|
|
|
* Copyright (C) 2006-2016 Red Hat, Inc.
|
2010-12-16 15:23:41 +00:00
|
|
|
* 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
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-12-16 15:23:41 +00:00
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __QEMU_DOMAIN_H__
|
|
|
|
# define __QEMU_DOMAIN_H__
|
|
|
|
|
2012-12-13 15:49:48 +00:00
|
|
|
# include "virthread.h"
|
2013-03-21 14:40:29 +00:00
|
|
|
# include "vircgroup.h"
|
2016-03-28 13:30:29 +00:00
|
|
|
# include "virperf.h"
|
2014-05-10 16:35:24 +00:00
|
|
|
# include "domain_addr.h"
|
2010-12-16 15:23:41 +00:00
|
|
|
# include "domain_conf.h"
|
2012-08-14 00:09:12 +00:00
|
|
|
# include "snapshot_conf.h"
|
2010-12-16 15:23:41 +00:00
|
|
|
# include "qemu_monitor.h"
|
2011-10-05 17:31:54 +00:00
|
|
|
# include "qemu_agent.h"
|
2010-12-16 16:12:02 +00:00
|
|
|
# include "qemu_conf.h"
|
2012-08-20 16:44:14 +00:00
|
|
|
# include "qemu_capabilities.h"
|
2013-01-02 15:38:51 +00:00
|
|
|
# include "virchrdev.h"
|
2015-05-13 09:20:36 +00:00
|
|
|
# include "virobject.h"
|
2016-02-23 13:05:09 +00:00
|
|
|
# include "logging/log_manager.h"
|
2010-12-16 15:23:41 +00:00
|
|
|
|
2012-10-08 09:58:05 +00:00
|
|
|
# define QEMU_DOMAIN_FORMAT_LIVE_FLAGS \
|
|
|
|
(VIR_DOMAIN_XML_SECURE | \
|
|
|
|
VIR_DOMAIN_XML_UPDATE_CPU)
|
|
|
|
|
2012-03-20 15:56:29 +00:00
|
|
|
# if ULONG_MAX == 4294967295
|
|
|
|
/* Qemu has a 64-bit limit, but we are limited by our historical choice of
|
|
|
|
* representing bandwidth in a long instead of a 64-bit int. */
|
2012-08-03 16:34:06 +00:00
|
|
|
# define QEMU_DOMAIN_MIG_BANDWIDTH_MAX ULONG_MAX
|
2012-03-20 15:56:29 +00:00
|
|
|
# else
|
2012-08-03 16:34:06 +00:00
|
|
|
# define QEMU_DOMAIN_MIG_BANDWIDTH_MAX (INT64_MAX / (1024 * 1024))
|
2012-03-20 15:56:29 +00:00
|
|
|
# endif
|
2011-08-26 18:10:22 +00:00
|
|
|
|
2011-06-30 09:23:50 +00:00
|
|
|
# define JOB_MASK(job) (1 << (job - 1))
|
2014-09-03 11:16:41 +00:00
|
|
|
# define QEMU_JOB_DEFAULT_MASK \
|
2011-07-19 00:27:39 +00:00
|
|
|
(JOB_MASK(QEMU_JOB_QUERY) | \
|
|
|
|
JOB_MASK(QEMU_JOB_DESTROY) | \
|
|
|
|
JOB_MASK(QEMU_JOB_ABORT))
|
2011-06-30 09:23:50 +00:00
|
|
|
|
2012-04-06 17:42:34 +00:00
|
|
|
/* Jobs which have to be tracked in domain state XML. */
|
|
|
|
# define QEMU_DOMAIN_TRACK_JOBS \
|
|
|
|
(JOB_MASK(QEMU_JOB_DESTROY) | \
|
|
|
|
JOB_MASK(QEMU_JOB_ASYNC))
|
|
|
|
|
2010-12-16 15:23:41 +00:00
|
|
|
/* Only 1 job is allowed at any time
|
|
|
|
* A job includes *all* monitor commands, even those just querying
|
|
|
|
* information, not merely actions */
|
2014-06-15 16:32:56 +00:00
|
|
|
typedef enum {
|
2010-12-16 15:23:41 +00:00
|
|
|
QEMU_JOB_NONE = 0, /* Always set to 0 for easy if (jobActive) conditions */
|
2011-06-30 09:23:50 +00:00
|
|
|
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 */
|
2011-07-19 00:27:39 +00:00
|
|
|
QEMU_JOB_ABORT, /* Abort current async job */
|
2011-07-19 00:27:36 +00:00
|
|
|
QEMU_JOB_MIGRATION_OP, /* Operation influencing outgoing migration */
|
2011-06-30 09:23:50 +00:00
|
|
|
|
2011-06-06 08:28:38 +00:00
|
|
|
/* The following two items must always be the last items before JOB_LAST */
|
2011-06-30 09:23:50 +00:00
|
|
|
QEMU_JOB_ASYNC, /* Asynchronous job */
|
|
|
|
QEMU_JOB_ASYNC_NESTED, /* Normal job within an async job */
|
2011-06-06 08:28:38 +00:00
|
|
|
|
|
|
|
QEMU_JOB_LAST
|
2014-06-15 16:32:56 +00:00
|
|
|
} qemuDomainJob;
|
2012-03-16 06:56:19 +00:00
|
|
|
VIR_ENUM_DECL(qemuDomainJob)
|
2011-06-30 09:23:50 +00:00
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*/
|
2014-06-15 16:32:56 +00:00
|
|
|
typedef enum {
|
2011-06-30 09:23:50 +00:00
|
|
|
QEMU_ASYNC_JOB_NONE = 0,
|
|
|
|
QEMU_ASYNC_JOB_MIGRATION_OUT,
|
|
|
|
QEMU_ASYNC_JOB_MIGRATION_IN,
|
|
|
|
QEMU_ASYNC_JOB_SAVE,
|
|
|
|
QEMU_ASYNC_JOB_DUMP,
|
2012-10-08 14:34:19 +00:00
|
|
|
QEMU_ASYNC_JOB_SNAPSHOT,
|
2015-10-21 08:55:43 +00:00
|
|
|
QEMU_ASYNC_JOB_START,
|
2011-06-06 08:28:38 +00:00
|
|
|
|
|
|
|
QEMU_ASYNC_JOB_LAST
|
2014-06-15 16:32:56 +00:00
|
|
|
} qemuDomainAsyncJob;
|
2012-03-16 06:56:19 +00:00
|
|
|
VIR_ENUM_DECL(qemuDomainAsyncJob)
|
2010-12-16 15:23:41 +00:00
|
|
|
|
2014-08-21 13:08:39 +00:00
|
|
|
typedef struct _qemuDomainJobInfo qemuDomainJobInfo;
|
|
|
|
typedef qemuDomainJobInfo *qemuDomainJobInfoPtr;
|
|
|
|
struct _qemuDomainJobInfo {
|
|
|
|
virDomainJobType type;
|
|
|
|
unsigned long long started; /* When the async job started */
|
2014-08-28 14:37:38 +00:00
|
|
|
unsigned long long stopped; /* When the domain's CPUs were stopped */
|
2015-04-23 07:19:12 +00:00
|
|
|
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). */
|
2014-08-21 13:08:39 +00:00
|
|
|
/* Computed values */
|
|
|
|
unsigned long long timeElapsed;
|
|
|
|
unsigned long long timeRemaining;
|
2015-04-27 07:43:27 +00:00
|
|
|
long long timeDelta; /* delta = received - sent, i.e., the difference
|
2015-04-23 07:19:12 +00:00
|
|
|
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;
|
2014-08-21 13:08:39 +00:00
|
|
|
/* Raw values from QEMU */
|
2015-11-26 12:23:08 +00:00
|
|
|
qemuMonitorMigrationStats stats;
|
2014-08-21 13:08:39 +00:00
|
|
|
};
|
|
|
|
|
2011-06-06 08:34:33 +00:00
|
|
|
struct qemuDomainJobObj {
|
2011-06-30 09:23:50 +00:00
|
|
|
virCond cond; /* Use to coordinate jobs */
|
2014-06-15 16:32:56 +00:00
|
|
|
qemuDomainJob active; /* Currently running job */
|
build: avoid non-portable cast of pthread_t
POSIX says pthread_t is opaque. We can't guarantee if it is scaler
or a pointer, nor what size it is; and BSD differs from Linux.
We've also had reports of gcc complaining on attempts to cast it,
if we use a cast to the wrong type (for example, pointers have to be
cast to void* or intptr_t before being narrowed; while casting a
function return of scalar pthread_t to void* triggers a different
warning).
Give up on casts, and use unions to get at decent bits instead. And
rather than futz around with figuring which 32 bits of a potentially
64-bit pointer are most likely to be unique, convert the rest of
the code base to use 64-bit values when using a debug id.
Based on a report by Guido Günther against kFreeBSD, but with a
fix that doesn't regress commit 4d970fd29 for FreeBSD.
* src/util/virthreadpthread.c (virThreadSelfID, virThreadID): Use
union to get at a decent bit representation of thread_t bits.
* src/util/virthread.h (virThreadSelfID, virThreadID): Alter
signature.
* src/util/virthreadwin32.c (virThreadSelfID, virThreadID):
Likewise.
* src/qemu/qemu_domain.h (qemuDomainJobObj): Alter type of owner.
* src/qemu/qemu_domain.c (qemuDomainObjTransferJob)
(qemuDomainObjSetJobPhase, qemuDomainObjReleaseAsyncJob)
(qemuDomainObjBeginNestedJob, qemuDomainObjBeginJobInternal): Fix
clients.
* src/util/virlog.c (virLogFormatString): Likewise.
* src/util/vireventpoll.c (virEventPollInterruptLocked):
Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-02 20:23:02 +00:00
|
|
|
unsigned long long owner; /* Thread id which set current job */
|
2015-03-16 17:18:46 +00:00
|
|
|
const char *ownerAPI; /* The API which owns the job */
|
2015-03-23 11:46:45 +00:00
|
|
|
unsigned long long started; /* When the current job started */
|
2011-06-06 08:34:33 +00:00
|
|
|
|
2011-06-30 09:23:50 +00:00
|
|
|
virCond asyncCond; /* Use to coordinate with async jobs */
|
2014-06-15 16:32:56 +00:00
|
|
|
qemuDomainAsyncJob asyncJob; /* Currently active async job */
|
build: avoid non-portable cast of pthread_t
POSIX says pthread_t is opaque. We can't guarantee if it is scaler
or a pointer, nor what size it is; and BSD differs from Linux.
We've also had reports of gcc complaining on attempts to cast it,
if we use a cast to the wrong type (for example, pointers have to be
cast to void* or intptr_t before being narrowed; while casting a
function return of scalar pthread_t to void* triggers a different
warning).
Give up on casts, and use unions to get at decent bits instead. And
rather than futz around with figuring which 32 bits of a potentially
64-bit pointer are most likely to be unique, convert the rest of
the code base to use 64-bit values when using a debug id.
Based on a report by Guido Günther against kFreeBSD, but with a
fix that doesn't regress commit 4d970fd29 for FreeBSD.
* src/util/virthreadpthread.c (virThreadSelfID, virThreadID): Use
union to get at a decent bit representation of thread_t bits.
* src/util/virthread.h (virThreadSelfID, virThreadID): Alter
signature.
* src/util/virthreadwin32.c (virThreadSelfID, virThreadID):
Likewise.
* src/qemu/qemu_domain.h (qemuDomainJobObj): Alter type of owner.
* src/qemu/qemu_domain.c (qemuDomainObjTransferJob)
(qemuDomainObjSetJobPhase, qemuDomainObjReleaseAsyncJob)
(qemuDomainObjBeginNestedJob, qemuDomainObjBeginJobInternal): Fix
clients.
* src/util/virlog.c (virLogFormatString): Likewise.
* src/util/vireventpoll.c (virEventPollInterruptLocked):
Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-02 20:23:02 +00:00
|
|
|
unsigned long long asyncOwner; /* Thread which set current async job */
|
2015-03-16 17:18:46 +00:00
|
|
|
const char *asyncOwnerAPI; /* The API which owns the async job */
|
2015-03-23 11:46:45 +00:00
|
|
|
unsigned long long asyncStarted; /* When the current async job started */
|
2011-06-06 08:30:54 +00:00
|
|
|
int phase; /* Job phase (mainly for migrations) */
|
2011-06-30 09:23:50 +00:00
|
|
|
unsigned long long mask; /* Jobs allowed during async job */
|
2012-06-12 03:06:33 +00:00
|
|
|
bool dump_memory_only; /* use dump-guest-memory to do dump */
|
2014-08-21 13:08:39 +00:00
|
|
|
qemuDomainJobInfoPtr current; /* async job progress data */
|
2014-08-28 11:52:58 +00:00
|
|
|
qemuDomainJobInfoPtr completed; /* statistics data of a recently completed job */
|
2015-05-15 13:59:49 +00:00
|
|
|
bool abortJob; /* abort of the job requested */
|
2016-02-29 12:18:13 +00:00
|
|
|
bool spiceMigration; /* we asked for spice migration and we
|
|
|
|
* should wait for it to finish */
|
2015-05-25 14:57:49 +00:00
|
|
|
bool spiceMigrated; /* spice migration completed */
|
2014-12-01 15:59:57 +00:00
|
|
|
bool postcopyEnabled; /* post-copy migration was enabled */
|
2011-06-06 08:34:33 +00:00
|
|
|
};
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
typedef void (*qemuDomainCleanupCallback)(virQEMUDriverPtr driver,
|
2012-03-16 06:52:26 +00:00
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2016-03-29 22:22:46 +00:00
|
|
|
# define QEMU_DOMAIN_MASTER_KEY_LEN 32 /* 32 bytes for 256 bit random key */
|
2010-12-16 15:23:41 +00:00
|
|
|
typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate;
|
|
|
|
typedef qemuDomainObjPrivate *qemuDomainObjPrivatePtr;
|
|
|
|
struct _qemuDomainObjPrivate {
|
2011-06-06 08:34:33 +00:00
|
|
|
struct qemuDomainJobObj job;
|
2010-12-16 15:23:41 +00:00
|
|
|
|
|
|
|
qemuMonitorPtr mon;
|
2011-01-07 23:36:25 +00:00
|
|
|
virDomainChrSourceDefPtr monConfig;
|
2013-04-26 02:32:41 +00:00
|
|
|
bool monJSON;
|
2011-05-31 16:34:20 +00:00
|
|
|
bool monError;
|
|
|
|
unsigned long long monStart;
|
2011-10-05 17:31:54 +00:00
|
|
|
|
|
|
|
qemuAgentPtr agent;
|
|
|
|
bool agentError;
|
|
|
|
unsigned long long agentStart;
|
|
|
|
|
2010-12-16 15:23:41 +00:00
|
|
|
bool gotShutdown;
|
2011-12-09 14:33:13 +00:00
|
|
|
bool beingDestroyed;
|
2011-06-17 13:43:54 +00:00
|
|
|
char *pidfile;
|
2010-12-16 15:23:41 +00:00
|
|
|
|
|
|
|
int nvcpupids;
|
|
|
|
int *vcpupids;
|
|
|
|
|
2014-05-10 16:35:24 +00:00
|
|
|
virDomainPCIAddressSetPtr pciaddrs;
|
2014-06-17 14:17:41 +00:00
|
|
|
virDomainCCWAddressSetPtr ccwaddrs;
|
2015-03-02 09:58:48 +00:00
|
|
|
virDomainVirtioSerialAddrSetPtr vioserialaddrs;
|
2010-12-16 15:23:41 +00:00
|
|
|
int persistentAddrs;
|
2011-05-04 11:55:38 +00:00
|
|
|
|
2013-02-01 13:48:58 +00:00
|
|
|
virQEMUCapsPtr qemuCaps;
|
2010-10-26 14:04:46 +00:00
|
|
|
char *lockState;
|
2011-06-15 16:49:58 +00:00
|
|
|
|
|
|
|
bool fakeReboot;
|
2011-08-12 13:29:37 +00:00
|
|
|
|
|
|
|
int jobs_queued;
|
2011-08-26 18:10:22 +00:00
|
|
|
|
|
|
|
unsigned long migMaxBandwidth;
|
2011-10-04 07:11:35 +00:00
|
|
|
char *origname;
|
2013-01-29 12:38:50 +00:00
|
|
|
int nbdPort; /* Port used for migration with NBD */
|
2013-10-11 03:27:13 +00:00
|
|
|
unsigned short migrationPort;
|
2014-02-06 13:30:59 +00:00
|
|
|
int preMigrationState;
|
2011-10-06 10:24:47 +00:00
|
|
|
|
2013-01-02 15:38:52 +00:00
|
|
|
virChrdevsPtr devs;
|
2012-03-16 06:52:26 +00:00
|
|
|
|
|
|
|
qemuDomainCleanupCallback *cleanupCallbacks;
|
|
|
|
size_t ncleanupCallbacks;
|
|
|
|
size_t ncleanupCallbacks_max;
|
2013-03-21 14:40:29 +00:00
|
|
|
|
|
|
|
virCgroupPtr cgroup;
|
2013-07-11 15:11:02 +00:00
|
|
|
|
2016-03-28 13:30:29 +00:00
|
|
|
virPerfPtr perf;
|
|
|
|
|
2013-07-11 15:11:02 +00:00
|
|
|
virCond unplugFinished; /* signals that unpluggingDevice was unplugged */
|
|
|
|
const char *unpluggingDevice; /* alias of the device that is being unplugged */
|
2013-07-19 13:08:29 +00:00
|
|
|
char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
|
2014-02-04 15:42:13 +00:00
|
|
|
|
|
|
|
bool hookRun; /* true if there was a hook run over this domain */
|
2015-03-27 09:11:00 +00:00
|
|
|
|
|
|
|
/* Bitmaps below hold data from the auto NUMA feature */
|
2014-12-12 14:23:12 +00:00
|
|
|
virBitmapPtr autoNodeset;
|
2015-03-27 09:11:00 +00:00
|
|
|
virBitmapPtr autoCpuset;
|
2015-05-29 06:38:44 +00:00
|
|
|
|
|
|
|
bool signalIOError; /* true if the domain condition should be signalled on
|
|
|
|
I/O error */
|
2016-01-05 21:19:28 +00:00
|
|
|
bool signalStop; /* true if the domain condition should be signalled on
|
|
|
|
QMP STOP event */
|
2016-02-01 15:50:54 +00:00
|
|
|
char *machineName;
|
2016-02-26 08:15:55 +00:00
|
|
|
char *libDir; /* base path for per-domain files */
|
|
|
|
char *channelTargetDir; /* base path for per-domain channel targets */
|
2016-03-29 22:22:46 +00:00
|
|
|
|
|
|
|
/* 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;
|
2010-12-16 15:23:41 +00:00
|
|
|
};
|
|
|
|
|
2015-05-13 09:20:36 +00:00
|
|
|
# define QEMU_DOMAIN_DISK_PRIVATE(disk) \
|
|
|
|
((qemuDomainDiskPrivatePtr) (disk)->privateData)
|
|
|
|
|
|
|
|
typedef struct _qemuDomainDiskPrivate qemuDomainDiskPrivate;
|
|
|
|
typedef qemuDomainDiskPrivate *qemuDomainDiskPrivatePtr;
|
|
|
|
struct _qemuDomainDiskPrivate {
|
|
|
|
virObject parent;
|
|
|
|
|
|
|
|
/* ideally we want a smarter way to interlock block jobs on single qemu disk
|
|
|
|
* in the future, but for now we just disallow any concurrent job on a
|
|
|
|
* single disk */
|
|
|
|
bool blockjob;
|
|
|
|
|
|
|
|
/* for some synchronous block jobs, we need to notify the owner */
|
|
|
|
int blockJobType; /* type of the block job from the event */
|
|
|
|
int blockJobStatus; /* status of the finished block job */
|
|
|
|
bool blockJobSync; /* the block job needs synchronized termination */
|
2015-05-11 18:10:06 +00:00
|
|
|
|
|
|
|
bool migrating; /* the disk is being migrated */
|
2015-05-13 09:20:36 +00:00
|
|
|
};
|
|
|
|
|
2013-06-07 10:23:32 +00:00
|
|
|
typedef enum {
|
|
|
|
QEMU_PROCESS_EVENT_WATCHDOG = 0,
|
2013-06-07 10:23:34 +00:00
|
|
|
QEMU_PROCESS_EVENT_GUESTPANIC,
|
2014-05-26 15:02:05 +00:00
|
|
|
QEMU_PROCESS_EVENT_DEVICE_DELETED,
|
2014-09-17 17:07:50 +00:00
|
|
|
QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED,
|
2014-11-13 13:09:39 +00:00
|
|
|
QEMU_PROCESS_EVENT_SERIAL_CHANGED,
|
2015-03-13 16:00:03 +00:00
|
|
|
QEMU_PROCESS_EVENT_BLOCK_JOB,
|
2016-02-11 14:32:48 +00:00
|
|
|
QEMU_PROCESS_EVENT_MONITOR_EOF,
|
2013-06-07 10:23:32 +00:00
|
|
|
|
|
|
|
QEMU_PROCESS_EVENT_LAST
|
|
|
|
} qemuProcessEventType;
|
|
|
|
|
|
|
|
struct qemuProcessEvent {
|
2011-02-14 16:09:39 +00:00
|
|
|
virDomainObjPtr vm;
|
2013-06-07 10:23:32 +00:00
|
|
|
qemuProcessEventType eventType;
|
2011-02-14 16:09:39 +00:00
|
|
|
int action;
|
2015-03-13 16:00:03 +00:00
|
|
|
int status;
|
2014-05-26 15:02:05 +00:00
|
|
|
void *data;
|
2011-02-14 16:09:39 +00:00
|
|
|
};
|
|
|
|
|
2015-11-12 12:43:29 +00:00
|
|
|
typedef struct _qemuDomainLogContext qemuDomainLogContext;
|
|
|
|
typedef qemuDomainLogContext *qemuDomainLogContextPtr;
|
|
|
|
|
2014-06-15 16:32:56 +00:00
|
|
|
const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
|
2011-06-06 08:30:54 +00:00
|
|
|
int phase);
|
2014-06-15 16:32:56 +00:00
|
|
|
int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
|
2011-06-06 08:30:54 +00:00
|
|
|
const char *phase);
|
|
|
|
|
2011-07-08 21:58:28 +00:00
|
|
|
void qemuDomainEventFlush(int timer, void *opaque);
|
2011-02-14 16:09:39 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainEventQueue(virQEMUDriverPtr driver,
|
2013-11-22 14:38:05 +00:00
|
|
|
virObjectEventPtr event);
|
2016-02-17 23:12:33 +00:00
|
|
|
void qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
2010-12-16 15:23:41 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
|
2011-06-06 08:28:38 +00:00
|
|
|
virDomainObjPtr obj,
|
2014-06-15 16:32:56 +00:00
|
|
|
qemuDomainJob job)
|
2011-06-30 09:23:50 +00:00
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
|
2011-06-06 08:28:38 +00:00
|
|
|
virDomainObjPtr obj,
|
2014-06-15 16:32:56 +00:00
|
|
|
qemuDomainAsyncJob asyncJob)
|
2011-06-30 09:23:50 +00:00
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
2016-01-28 12:57:12 +00:00
|
|
|
int qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj,
|
|
|
|
qemuDomainAsyncJob asyncJob)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
2011-06-30 09:23:50 +00:00
|
|
|
|
qemu: completely rework reference counting
There is one problem that causes various errors in the daemon. When
domain is waiting for a job, it is unlocked while waiting on the
condition. However, if that domain is for example transient and being
removed in another API (e.g. cancelling incoming migration), it get's
unref'd. If the first call, that was waiting, fails to get the job, it
unref's the domain object, and because it was the last reference, it
causes clearing of the whole domain object. However, when finishing the
call, the domain must be unlocked, but there is no way for the API to
know whether it was cleaned or not (unless there is some ugly temporary
variable, but let's scratch that).
The root cause is that our APIs don't ref the objects they are using and
all use the implicit reference that the object has when it is in the
domain list. That reference can be removed when the API is waiting for
a job. And because each domain doesn't do its ref'ing, it results in
the ugly checking of the return value of virObjectUnref() that we have
everywhere.
This patch changes qemuDomObjFromDomain() to ref the domain (using
virDomainObjListFindByUUIDRef()) and adds qemuDomObjEndAPI() which
should be the only function in which the return value of
virObjectUnref() is checked. This makes all reference counting
deterministic and makes the code a bit clearer.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-12-04 13:41:36 +00:00
|
|
|
void qemuDomainObjEndJob(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj);
|
|
|
|
void qemuDomainObjEndAsyncJob(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj);
|
2012-11-08 13:49:55 +00:00
|
|
|
void qemuDomainObjAbortAsyncJob(virDomainObjPtr obj);
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
|
2011-06-06 08:30:54 +00:00
|
|
|
virDomainObjPtr obj,
|
|
|
|
int phase);
|
2011-06-30 09:23:50 +00:00
|
|
|
void qemuDomainObjSetAsyncJobMask(virDomainObjPtr obj,
|
|
|
|
unsigned long long allowedJobs);
|
2011-07-04 21:33:39 +00:00
|
|
|
void qemuDomainObjRestoreJob(virDomainObjPtr obj,
|
|
|
|
struct qemuDomainJobObj *job);
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver,
|
2011-06-06 08:28:38 +00:00
|
|
|
virDomainObjPtr obj);
|
2012-04-06 16:55:46 +00:00
|
|
|
void qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj);
|
2011-06-06 08:34:33 +00:00
|
|
|
|
2015-03-31 15:24:50 +00:00
|
|
|
qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
|
qemu: fix crash when mixing sync and async monitor jobs
Currently, we attempt to run sync job and async job at the same time. It
means that the monitor commands for two jobs can be run in any order.
In the function qemuDomainObjEnterMonitorInternal():
if (priv->job.active == QEMU_JOB_NONE && priv->job.asyncJob) {
if (qemuDomainObjBeginNestedJob(driver, obj) < 0)
We check whether the caller is an async job by priv->job.active and
priv->job.asynJob. But when an async job is running, and a sync job is
also running at the time of the check, then priv->job.active is not
QEMU_JOB_NONE. So we cannot check whether the caller is an async job
in the function qemuDomainObjEnterMonitorInternal(), and must instead
put the burden on the caller to tell us when an async command wants
to do a nested job.
Once the burden is on the caller, then only async monitor enters need
to worry about whether the VM is still running; for sync monitor enter,
the internal return is always 0, so lots of ignore_value can be dropped.
* src/qemu/THREADS.txt: Reflect new rules.
* src/qemu/qemu_domain.h (qemuDomainObjEnterMonitorAsync): New
prototype.
* src/qemu/qemu_process.h (qemuProcessStartCPUs)
(qemuProcessStopCPUs): Add parameter.
* src/qemu/qemu_migration.h (qemuMigrationToFile): Likewise.
(qemuMigrationWaitForCompletion): Make static.
* src/qemu/qemu_domain.c (qemuDomainObjEnterMonitorInternal): Add
parameter.
(qemuDomainObjEnterMonitorAsync): New function.
(qemuDomainObjEnterMonitor, qemuDomainObjEnterMonitorWithDriver):
Update callers.
* src/qemu/qemu_driver.c (qemuDomainSaveInternal)
(qemudDomainCoreDump, doCoreDump, processWatchdogEvent)
(qemudDomainSuspend, qemudDomainResume, qemuDomainSaveImageStartVM)
(qemuDomainSnapshotCreateActive, qemuDomainRevertToSnapshot):
Likewise.
* src/qemu/qemu_process.c (qemuProcessStopCPUs)
(qemuProcessFakeReboot, qemuProcessRecoverMigration)
(qemuProcessRecoverJob, qemuProcessStart): Likewise.
* src/qemu/qemu_migration.c (qemuMigrationToFile)
(qemuMigrationWaitForCompletion, qemuMigrationUpdateJobStatus)
(qemuMigrationJobStart, qemuDomainMigrateGraphicsRelocate)
(doNativeMigrate, doTunnelMigrate, qemuMigrationPerformJob)
(qemuMigrationPerformPhase, qemuMigrationFinish)
(qemuMigrationConfirm): Likewise.
* src/qemu/qemu_hotplug.c: Drop unneeded ignore_value.
2011-07-28 23:18:24 +00:00
|
|
|
virDomainObjPtr obj)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
2014-12-12 15:57:21 +00:00
|
|
|
int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj)
|
2014-12-16 09:40:58 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
|
qemu: fix crash when mixing sync and async monitor jobs
Currently, we attempt to run sync job and async job at the same time. It
means that the monitor commands for two jobs can be run in any order.
In the function qemuDomainObjEnterMonitorInternal():
if (priv->job.active == QEMU_JOB_NONE && priv->job.asyncJob) {
if (qemuDomainObjBeginNestedJob(driver, obj) < 0)
We check whether the caller is an async job by priv->job.active and
priv->job.asynJob. But when an async job is running, and a sync job is
also running at the time of the check, then priv->job.active is not
QEMU_JOB_NONE. So we cannot check whether the caller is an async job
in the function qemuDomainObjEnterMonitorInternal(), and must instead
put the burden on the caller to tell us when an async command wants
to do a nested job.
Once the burden is on the caller, then only async monitor enters need
to worry about whether the VM is still running; for sync monitor enter,
the internal return is always 0, so lots of ignore_value can be dropped.
* src/qemu/THREADS.txt: Reflect new rules.
* src/qemu/qemu_domain.h (qemuDomainObjEnterMonitorAsync): New
prototype.
* src/qemu/qemu_process.h (qemuProcessStartCPUs)
(qemuProcessStopCPUs): Add parameter.
* src/qemu/qemu_migration.h (qemuMigrationToFile): Likewise.
(qemuMigrationWaitForCompletion): Make static.
* src/qemu/qemu_domain.c (qemuDomainObjEnterMonitorInternal): Add
parameter.
(qemuDomainObjEnterMonitorAsync): New function.
(qemuDomainObjEnterMonitor, qemuDomainObjEnterMonitorWithDriver):
Update callers.
* src/qemu/qemu_driver.c (qemuDomainSaveInternal)
(qemudDomainCoreDump, doCoreDump, processWatchdogEvent)
(qemudDomainSuspend, qemudDomainResume, qemuDomainSaveImageStartVM)
(qemuDomainSnapshotCreateActive, qemuDomainRevertToSnapshot):
Likewise.
* src/qemu/qemu_process.c (qemuProcessStopCPUs)
(qemuProcessFakeReboot, qemuProcessRecoverMigration)
(qemuProcessRecoverJob, qemuProcessStart): Likewise.
* src/qemu/qemu_migration.c (qemuMigrationToFile)
(qemuMigrationWaitForCompletion, qemuMigrationUpdateJobStatus)
(qemuMigrationJobStart, qemuDomainMigrateGraphicsRelocate)
(doNativeMigrate, doTunnelMigrate, qemuMigrationPerformJob)
(qemuMigrationPerformPhase, qemuMigrationFinish)
(qemuMigrationConfirm): Likewise.
* src/qemu/qemu_hotplug.c: Drop unneeded ignore_value.
2011-07-28 23:18:24 +00:00
|
|
|
virDomainObjPtr obj,
|
2014-06-15 16:32:56 +00:00
|
|
|
qemuDomainAsyncJob asyncJob)
|
qemu: fix crash when mixing sync and async monitor jobs
Currently, we attempt to run sync job and async job at the same time. It
means that the monitor commands for two jobs can be run in any order.
In the function qemuDomainObjEnterMonitorInternal():
if (priv->job.active == QEMU_JOB_NONE && priv->job.asyncJob) {
if (qemuDomainObjBeginNestedJob(driver, obj) < 0)
We check whether the caller is an async job by priv->job.active and
priv->job.asynJob. But when an async job is running, and a sync job is
also running at the time of the check, then priv->job.active is not
QEMU_JOB_NONE. So we cannot check whether the caller is an async job
in the function qemuDomainObjEnterMonitorInternal(), and must instead
put the burden on the caller to tell us when an async command wants
to do a nested job.
Once the burden is on the caller, then only async monitor enters need
to worry about whether the VM is still running; for sync monitor enter,
the internal return is always 0, so lots of ignore_value can be dropped.
* src/qemu/THREADS.txt: Reflect new rules.
* src/qemu/qemu_domain.h (qemuDomainObjEnterMonitorAsync): New
prototype.
* src/qemu/qemu_process.h (qemuProcessStartCPUs)
(qemuProcessStopCPUs): Add parameter.
* src/qemu/qemu_migration.h (qemuMigrationToFile): Likewise.
(qemuMigrationWaitForCompletion): Make static.
* src/qemu/qemu_domain.c (qemuDomainObjEnterMonitorInternal): Add
parameter.
(qemuDomainObjEnterMonitorAsync): New function.
(qemuDomainObjEnterMonitor, qemuDomainObjEnterMonitorWithDriver):
Update callers.
* src/qemu/qemu_driver.c (qemuDomainSaveInternal)
(qemudDomainCoreDump, doCoreDump, processWatchdogEvent)
(qemudDomainSuspend, qemudDomainResume, qemuDomainSaveImageStartVM)
(qemuDomainSnapshotCreateActive, qemuDomainRevertToSnapshot):
Likewise.
* src/qemu/qemu_process.c (qemuProcessStopCPUs)
(qemuProcessFakeReboot, qemuProcessRecoverMigration)
(qemuProcessRecoverJob, qemuProcessStart): Likewise.
* src/qemu/qemu_migration.c (qemuMigrationToFile)
(qemuMigrationWaitForCompletion, qemuMigrationUpdateJobStatus)
(qemuMigrationJobStart, qemuDomainMigrateGraphicsRelocate)
(doNativeMigrate, doTunnelMigrate, qemuMigrationPerformJob)
(qemuMigrationPerformPhase, qemuMigrationFinish)
(qemuMigrationConfirm): Likewise.
* src/qemu/qemu_hotplug.c: Drop unneeded ignore_value.
2011-07-28 23:18:24 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
|
2011-10-05 17:31:54 +00:00
|
|
|
|
|
|
|
|
2015-10-27 06:09:00 +00:00
|
|
|
qemuAgentPtr qemuDomainGetAgent(virDomainObjPtr vm);
|
2013-02-06 18:17:20 +00:00
|
|
|
void qemuDomainObjEnterAgent(virDomainObjPtr obj)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
void qemuDomainObjExitAgent(virDomainObjPtr obj)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2011-10-05 17:31:54 +00:00
|
|
|
|
|
|
|
|
2013-02-06 18:17:20 +00:00
|
|
|
void qemuDomainObjEnterRemote(virDomainObjPtr obj)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
void qemuDomainObjExitRemote(virDomainObjPtr obj)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2010-12-16 16:12:02 +00:00
|
|
|
|
2013-06-11 13:03:17 +00:00
|
|
|
virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
|
|
|
|
virDomainDefPtr src,
|
|
|
|
unsigned int flags);
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
|
2012-05-04 19:00:13 +00:00
|
|
|
virDomainDefPtr vm,
|
|
|
|
unsigned int flags,
|
|
|
|
virBuffer *buf);
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
char *qemuDomainDefFormatXML(virQEMUDriverPtr driver,
|
2011-05-27 10:30:26 +00:00
|
|
|
virDomainDefPtr vm,
|
2012-10-08 09:58:05 +00:00
|
|
|
unsigned int flags);
|
2011-05-27 10:30:26 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
char *qemuDomainFormatXML(virQEMUDriverPtr driver,
|
2011-01-31 10:47:03 +00:00
|
|
|
virDomainObjPtr vm,
|
2012-10-08 09:58:05 +00:00
|
|
|
unsigned int flags);
|
2011-01-31 10:47:03 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
char *qemuDomainDefFormatLive(virQEMUDriverPtr driver,
|
2012-03-09 15:42:46 +00:00
|
|
|
virDomainDefPtr def,
|
2012-05-04 19:23:17 +00:00
|
|
|
bool inactive,
|
|
|
|
bool compatible);
|
2012-03-09 15:42:46 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainObjTaint(virQEMUDriverPtr driver,
|
2011-05-04 10:59:20 +00:00
|
|
|
virDomainObjPtr obj,
|
2014-06-01 00:22:30 +00:00
|
|
|
virDomainTaintFlags taint,
|
2015-11-12 12:56:30 +00:00
|
|
|
qemuDomainLogContextPtr logCtxt);
|
2011-05-04 10:59:20 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
|
2011-05-05 11:48:07 +00:00
|
|
|
virDomainObjPtr obj,
|
2015-11-12 12:56:30 +00:00
|
|
|
qemuDomainLogContextPtr logCtxt);
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
|
2011-05-04 10:59:20 +00:00
|
|
|
virDomainObjPtr obj,
|
2011-05-05 11:48:07 +00:00
|
|
|
virDomainDiskDefPtr disk,
|
2015-11-12 12:56:30 +00:00
|
|
|
qemuDomainLogContextPtr logCtxt);
|
2014-09-09 22:51:02 +00:00
|
|
|
void qemuDomainObjCheckHostdevTaint(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj,
|
|
|
|
virDomainHostdevDefPtr disk,
|
2015-11-12 12:56:30 +00:00
|
|
|
qemuDomainLogContextPtr logCtxt);
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainObjCheckNetTaint(virQEMUDriverPtr driver,
|
2011-05-04 10:59:20 +00:00
|
|
|
virDomainObjPtr obj,
|
2011-05-05 11:48:07 +00:00
|
|
|
virDomainNetDefPtr net,
|
2015-11-12 12:56:30 +00:00
|
|
|
qemuDomainLogContextPtr logCtxt);
|
2011-05-04 10:59:20 +00:00
|
|
|
|
2015-11-12 12:43:29 +00:00
|
|
|
typedef enum {
|
|
|
|
QEMU_DOMAIN_LOG_CONTEXT_MODE_START,
|
|
|
|
QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH,
|
|
|
|
QEMU_DOMAIN_LOG_CONTEXT_MODE_STOP,
|
|
|
|
} qemuDomainLogContextMode;
|
|
|
|
|
|
|
|
qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
qemuDomainLogContextMode mode);
|
|
|
|
int qemuDomainLogContextWrite(qemuDomainLogContextPtr ctxt,
|
|
|
|
const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(2, 3);
|
|
|
|
ssize_t qemuDomainLogContextRead(qemuDomainLogContextPtr ctxt,
|
|
|
|
char **msg);
|
|
|
|
int qemuDomainLogContextGetWriteFD(qemuDomainLogContextPtr ctxt);
|
|
|
|
void qemuDomainLogContextMarkPosition(qemuDomainLogContextPtr ctxt);
|
|
|
|
void qemuDomainLogContextRef(qemuDomainLogContextPtr ctxt);
|
|
|
|
void qemuDomainLogContextFree(qemuDomainLogContextPtr ctxt);
|
2011-05-05 11:38:04 +00:00
|
|
|
|
2016-02-23 13:05:09 +00:00
|
|
|
virLogManagerPtr qemuDomainLogContextGetManager(qemuDomainLogContextPtr ctxt);
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver);
|
2011-09-21 19:08:51 +00:00
|
|
|
|
|
|
|
int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
|
|
|
|
virDomainSnapshotObjPtr snapshot,
|
2016-02-04 22:55:05 +00:00
|
|
|
virCapsPtr caps,
|
2011-09-21 19:08:51 +00:00
|
|
|
char *snapshotDir);
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
|
2011-09-21 19:08:51 +00:00
|
|
|
virDomainObjPtr vm,
|
|
|
|
virDomainSnapshotObjPtr snap,
|
|
|
|
const char *op,
|
|
|
|
bool try_all);
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
|
2011-09-21 19:08:51 +00:00
|
|
|
virDomainObjPtr vm,
|
|
|
|
virDomainSnapshotObjPtr snap,
|
|
|
|
bool update_current,
|
|
|
|
bool metadata_only);
|
|
|
|
|
2012-11-28 17:29:44 +00:00
|
|
|
typedef struct _virQEMUSnapRemove virQEMUSnapRemove;
|
|
|
|
typedef virQEMUSnapRemove *virQEMUSnapRemovePtr;
|
|
|
|
struct _virQEMUSnapRemove {
|
2012-11-28 16:43:10 +00:00
|
|
|
virQEMUDriverPtr driver;
|
2011-09-21 19:08:51 +00:00
|
|
|
virDomainObjPtr vm;
|
|
|
|
int err;
|
|
|
|
bool metadata_only;
|
|
|
|
bool current;
|
|
|
|
};
|
|
|
|
|
2016-02-12 09:03:50 +00:00
|
|
|
int qemuDomainSnapshotDiscardAll(void *payload,
|
|
|
|
const void *name,
|
|
|
|
void *data);
|
2011-09-21 19:08:51 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainSnapshotDiscardAllMetadata(virQEMUDriverPtr driver,
|
2011-09-21 19:08:51 +00:00
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainRemoveInactive(virQEMUDriverPtr driver,
|
2011-09-21 19:08:51 +00:00
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
|
2011-09-28 10:10:13 +00:00
|
|
|
virDomainObjPtr vm,
|
|
|
|
bool value);
|
|
|
|
|
2011-09-29 13:14:13 +00:00
|
|
|
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
|
2014-06-15 16:32:56 +00:00
|
|
|
qemuDomainJob job);
|
2011-10-18 08:51:06 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
|
2011-10-18 08:51:06 +00:00
|
|
|
virDomainObjPtr vm,
|
|
|
|
bool start_with_state);
|
2013-07-29 12:51:15 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
2014-02-07 17:42:27 +00:00
|
|
|
virDomainObjPtr vm,
|
storage: cache backing chain while qemu domain is live
Technically, we should not be re-probing any file that qemu might
be currently writing to. As such, we should cache the backing
file chain prior to starting qemu. This patch adds the cache,
but does not use it until the next patch.
Ultimately, we want to also store the chain in domain XML, so that
it is remembered across libvirtd restarts, and so that the only
kosher way to modify the backing chain of an offline domain will be
through libvirt API calls, but we aren't there yet. So for now, we
merely invalidate the cache any time we do a live operation that
alters the chain (block-pull, block-commit, external disk snapshot),
as well as tear down the cache when the domain is not running.
* src/conf/domain_conf.h (_virDomainDiskDef): New field.
* src/conf/domain_conf.c (virDomainDiskDefFree): Clean new field.
* src/qemu/qemu_domain.h (qemuDomainDetermineDiskChain): New
prototype.
* src/qemu/qemu_domain.c (qemuDomainDetermineDiskChain): New
function.
* src/qemu/qemu_driver.c (qemuDomainAttachDeviceDiskLive)
(qemuDomainChangeDiskMediaLive): Pre-populate chain.
(qemuDomainSnapshotCreateSingleDiskActive): Uncache chain before
snapshot.
* src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Update
chain after block pull.
2012-10-09 22:08:14 +00:00
|
|
|
virDomainDiskDefPtr disk,
|
2014-09-11 16:59:32 +00:00
|
|
|
bool force_probe,
|
|
|
|
bool report_broken);
|
2012-03-16 06:52:26 +00:00
|
|
|
|
2015-09-15 11:41:42 +00:00
|
|
|
bool qemuDomainDiskSourceDiffers(virConnectPtr conn,
|
|
|
|
virDomainDiskDefPtr disk,
|
|
|
|
virDomainDiskDefPtr origDisk);
|
|
|
|
|
2015-09-15 13:25:18 +00:00
|
|
|
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
|
|
|
|
virDomainDiskDefPtr orig_disk);
|
|
|
|
|
2014-06-30 13:48:45 +00:00
|
|
|
int qemuDomainStorageFileInit(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr src);
|
2014-12-12 16:53:33 +00:00
|
|
|
char *qemuDomainStorageAlias(const char *device, int depth);
|
2014-06-30 13:48:45 +00:00
|
|
|
|
2016-02-29 14:39:57 +00:00
|
|
|
void qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr elem);
|
|
|
|
int qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr elem,
|
|
|
|
bool readonly);
|
|
|
|
|
2012-03-16 06:52:26 +00:00
|
|
|
int qemuDomainCleanupAdd(virDomainObjPtr vm,
|
|
|
|
qemuDomainCleanupCallback cb);
|
|
|
|
void qemuDomainCleanupRemove(virDomainObjPtr vm,
|
|
|
|
qemuDomainCleanupCallback cb);
|
2012-11-28 16:43:10 +00:00
|
|
|
void qemuDomainCleanupRun(virQEMUDriverPtr driver,
|
2012-03-16 06:52:26 +00:00
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2013-03-05 15:17:24 +00:00
|
|
|
extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks;
|
|
|
|
extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace;
|
2013-02-19 16:33:52 +00:00
|
|
|
extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
|
2013-03-05 15:17:24 +00:00
|
|
|
|
2013-07-19 13:08:29 +00:00
|
|
|
int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
|
2014-08-12 02:54:42 +00:00
|
|
|
virDomainObjPtr vm, int asyncJob);
|
2013-07-19 13:08:29 +00:00
|
|
|
|
2015-01-19 12:21:09 +00:00
|
|
|
int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
int asyncJob);
|
|
|
|
|
qemu: Introduce qemuDomainDefCheckABIStability
https://bugzilla.redhat.com/show_bug.cgi?id=994364
Whenever we check for ABI stability, we have new xml (e.g. provided by
user, or obtained from snapshot, whatever) which we compare to old xml
and see if ABI won't break. However, if the new xml was produced via
virDomainGetXMLDesc(..., VIR_DOMAIN_XML_MIGRATABLE) it lacks some
devices, e.g. 'pci-root' controller. Hence, the ABI stability check
fails even though it is stable. Moreover, we can't simply fix
virDomainDefCheckABIStability because removing the correct devices is
task for the driver. For instance, qemu driver wants to remove the usb
controller too, while LXC driver doesn't. That's why we need special
qemu wrapper over virDomainDefCheckABIStability which removes the
correct devices from domain XML, produces MIGRATABLE xml and calls the
check ABI stability function.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2013-10-10 08:53:56 +00:00
|
|
|
bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
|
|
|
|
virDomainDefPtr src,
|
|
|
|
virDomainDefPtr dst);
|
2014-02-27 10:45:13 +00:00
|
|
|
|
2015-02-27 13:06:47 +00:00
|
|
|
bool qemuDomainAgentAvailable(virDomainObjPtr vm,
|
2014-02-27 10:45:13 +00:00
|
|
|
bool reportError);
|
|
|
|
|
2014-08-21 13:08:39 +00:00
|
|
|
int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2014-08-28 14:37:38 +00:00
|
|
|
int qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2014-08-21 13:08:39 +00:00
|
|
|
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);
|
|
|
|
|
2015-03-31 15:29:35 +00:00
|
|
|
int qemuDomainSupportsBlockJobs(virDomainObjPtr vm, bool *modern)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2015-03-13 16:22:04 +00:00
|
|
|
bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
|
2015-05-13 07:47:21 +00:00
|
|
|
bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2015-03-13 16:22:04 +00:00
|
|
|
|
2015-02-18 13:31:47 +00:00
|
|
|
int qemuDomainAlignMemorySizes(virDomainDefPtr def);
|
2015-07-31 14:00:20 +00:00
|
|
|
void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
|
|
|
|
virDomainMemoryDefPtr mem);
|
2015-02-18 13:31:47 +00:00
|
|
|
|
2016-01-08 15:21:30 +00:00
|
|
|
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
|
2015-04-24 14:43:38 +00:00
|
|
|
|
2015-04-28 09:21:52 +00:00
|
|
|
bool qemuDomainMachineIsQ35(const virDomainDef *def);
|
|
|
|
bool qemuDomainMachineIsI440FX(const virDomainDef *def);
|
2015-06-22 13:20:55 +00:00
|
|
|
bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
|
2015-09-02 20:02:14 +00:00
|
|
|
bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
|
2015-11-21 18:58:56 +00:00
|
|
|
bool qemuDomainMachineHasBuiltinIDE(const virDomainDef *def);
|
2015-04-28 09:21:52 +00:00
|
|
|
|
2015-05-27 13:51:52 +00:00
|
|
|
int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2015-11-24 12:51:11 +00:00
|
|
|
unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDefPtr def);
|
|
|
|
bool qemuDomainRequiresMemLock(virDomainDefPtr def);
|
2015-12-10 17:39:14 +00:00
|
|
|
int qemuDomainAdjustMaxMemLock(virDomainObjPtr vm);
|
2015-11-06 14:51:33 +00:00
|
|
|
|
2015-10-08 04:06:15 +00:00
|
|
|
int qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
|
|
|
|
virQEMUCapsPtr qemuCaps,
|
|
|
|
const virDomainMemoryDef *mem);
|
|
|
|
|
2015-11-11 13:20:04 +00:00
|
|
|
bool qemuDomainHasVcpuPids(virDomainObjPtr vm);
|
2015-11-12 15:45:12 +00:00
|
|
|
pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpu);
|
2015-12-15 13:45:33 +00:00
|
|
|
int qemuDomainDetectVcpuPids(virQEMUDriverPtr driver, virDomainObjPtr vm,
|
|
|
|
int asyncJob);
|
2015-11-11 13:20:04 +00:00
|
|
|
|
2016-02-15 16:44:21 +00:00
|
|
|
bool qemuDomainSupportsNicdev(virDomainDefPtr def,
|
|
|
|
virQEMUCapsPtr qemuCaps,
|
|
|
|
virDomainNetDefPtr net);
|
|
|
|
|
|
|
|
bool qemuDomainSupportsNetdev(virDomainDefPtr def,
|
|
|
|
virQEMUCapsPtr qemuCaps,
|
|
|
|
virDomainNetDefPtr net);
|
|
|
|
|
2016-02-16 15:11:34 +00:00
|
|
|
int qemuDomainNetVLAN(virDomainNetDefPtr def);
|
2016-02-15 16:44:21 +00:00
|
|
|
|
2016-04-03 19:59:46 +00:00
|
|
|
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2016-04-03 19:51:29 +00:00
|
|
|
void qemuDomainClearPrivatePaths(virDomainObjPtr vm);
|
2016-02-26 15:29:58 +00:00
|
|
|
|
|
|
|
virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char *name);
|
|
|
|
|
2016-03-29 22:22:46 +00:00
|
|
|
char *qemuDomainGetMasterKeyFilePath(const char *libDir);
|
|
|
|
|
|
|
|
int qemuDomainMasterKeyReadFile(qemuDomainObjPrivatePtr priv);
|
|
|
|
|
|
|
|
int qemuDomainMasterKeyCreate(qemuDomainObjPrivatePtr priv);
|
|
|
|
|
|
|
|
void qemuDomainMasterKeyRemove(qemuDomainObjPrivatePtr priv);
|
|
|
|
|
2010-12-16 15:23:41 +00:00
|
|
|
#endif /* __QEMU_DOMAIN_H__ */
|