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
|
|
|
*/
|
|
|
|
|
2018-12-13 14:53:50 +00:00
|
|
|
#ifndef LIBVIRT_QEMU_DOMAIN_H
|
|
|
|
# define LIBVIRT_QEMU_DOMAIN_H
|
2010-12-16 15:23:41 +00:00
|
|
|
|
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"
|
2018-10-17 06:57:08 +00:00
|
|
|
# include "qemu_blockjob.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"
|
2018-02-27 14:45:52 +00:00
|
|
|
# include "qemu_migration_params.h"
|
2017-02-03 12:43:48 +00:00
|
|
|
# include "virmdev.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
|
|
|
|
2017-11-03 12:09:47 +00:00
|
|
|
# define QEMU_DOMAIN_FORMAT_LIVE_FLAGS \
|
2017-06-30 14:55:20 +00:00
|
|
|
(VIR_DOMAIN_XML_SECURE)
|
2012-10-08 09:58:05 +00:00
|
|
|
|
2012-03-20 15:56:29 +00:00
|
|
|
# if ULONG_MAX == 4294967295
|
2017-03-07 17:09:58 +00:00
|
|
|
/* QEMU has a 64-bit limit, but we are limited by our historical choice of
|
2012-03-20 15:56:29 +00:00
|
|
|
* 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
|
|
|
|
2017-07-15 06:42:39 +00:00
|
|
|
# define JOB_MASK(job) (job == 0 ? 0 : 1 << (job - 1))
|
2017-11-03 12:09:47 +00:00
|
|
|
# define QEMU_JOB_DEFAULT_MASK \
|
|
|
|
(JOB_MASK(QEMU_JOB_QUERY) | \
|
|
|
|
JOB_MASK(QEMU_JOB_DESTROY) | \
|
2011-07-19 00:27:39 +00:00
|
|
|
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. */
|
2017-11-03 12:09:47 +00:00
|
|
|
# define QEMU_DOMAIN_TRACK_JOBS \
|
|
|
|
(JOB_MASK(QEMU_JOB_DESTROY) | \
|
2012-04-06 17:42:34 +00:00
|
|
|
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;
|
2019-01-20 16:04:56 +00:00
|
|
|
VIR_ENUM_DECL(qemuDomainJob);
|
2011-06-30 09:23:50 +00:00
|
|
|
|
2018-06-19 06:11:39 +00:00
|
|
|
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;
|
2019-01-20 16:04:56 +00:00
|
|
|
VIR_ENUM_DECL(qemuDomainAgentJob);
|
2018-06-19 06:11:39 +00:00
|
|
|
|
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;
|
2019-01-20 16:04:56 +00:00
|
|
|
VIR_ENUM_DECL(qemuDomainAsyncJob);
|
2010-12-16 15:23:41 +00:00
|
|
|
|
2017-09-01 06:49:20 +00:00
|
|
|
typedef enum {
|
|
|
|
QEMU_DOMAIN_JOB_STATUS_NONE = 0,
|
|
|
|
QEMU_DOMAIN_JOB_STATUS_ACTIVE,
|
2017-09-01 06:49:28 +00:00
|
|
|
QEMU_DOMAIN_JOB_STATUS_MIGRATING,
|
2017-09-01 06:49:31 +00:00
|
|
|
QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED,
|
2017-10-20 08:11:32 +00:00
|
|
|
QEMU_DOMAIN_JOB_STATUS_PAUSED,
|
2017-09-01 06:49:21 +00:00
|
|
|
QEMU_DOMAIN_JOB_STATUS_POSTCOPY,
|
2017-09-01 06:49:20 +00:00
|
|
|
QEMU_DOMAIN_JOB_STATUS_COMPLETED,
|
|
|
|
QEMU_DOMAIN_JOB_STATUS_FAILED,
|
|
|
|
QEMU_DOMAIN_JOB_STATUS_CANCELED,
|
|
|
|
} qemuDomainJobStatus;
|
|
|
|
|
2018-01-26 17:30:50 +00:00
|
|
|
typedef enum {
|
|
|
|
QEMU_DOMAIN_JOB_STATS_TYPE_NONE = 0,
|
|
|
|
QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION,
|
2018-01-27 16:01:25 +00:00
|
|
|
QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP,
|
2018-02-01 21:07:30 +00:00
|
|
|
QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP,
|
2018-01-26 17:30:50 +00:00
|
|
|
} qemuDomainJobStatsType;
|
|
|
|
|
2017-09-01 06:49:30 +00:00
|
|
|
|
|
|
|
typedef struct _qemuDomainMirrorStats qemuDomainMirrorStats;
|
|
|
|
typedef qemuDomainMirrorStats *qemuDomainMirrorStatsPtr;
|
|
|
|
struct _qemuDomainMirrorStats {
|
|
|
|
unsigned long long transferred;
|
|
|
|
unsigned long long total;
|
|
|
|
};
|
|
|
|
|
2014-08-21 13:08:39 +00:00
|
|
|
typedef struct _qemuDomainJobInfo qemuDomainJobInfo;
|
|
|
|
typedef qemuDomainJobInfo *qemuDomainJobInfoPtr;
|
|
|
|
struct _qemuDomainJobInfo {
|
2017-09-01 06:49:20 +00:00
|
|
|
qemuDomainJobStatus status;
|
2017-04-26 10:00:09 +00:00
|
|
|
virDomainJobOperation operation;
|
2014-08-21 13:08:39 +00:00
|
|
|
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;
|
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 */
|
2018-01-26 17:30:50 +00:00
|
|
|
qemuDomainJobStatsType statsType;
|
|
|
|
union {
|
|
|
|
qemuMonitorMigrationStats mig;
|
2018-02-01 21:07:30 +00:00
|
|
|
qemuMonitorDumpStats dump;
|
2018-01-26 17:30:50 +00:00
|
|
|
} stats;
|
2017-09-01 06:49:30 +00:00
|
|
|
qemuDomainMirrorStats mirrorStats;
|
2014-08-21 13:08:39 +00:00
|
|
|
};
|
|
|
|
|
2018-03-29 14:48:34 +00:00
|
|
|
typedef struct _qemuDomainJobObj qemuDomainJobObj;
|
|
|
|
typedef qemuDomainJobObj *qemuDomainJobObjPtr;
|
|
|
|
struct _qemuDomainJobObj {
|
2011-06-30 09:23:50 +00:00
|
|
|
virCond cond; /* Use to coordinate jobs */
|
2018-06-19 06:11:39 +00:00
|
|
|
|
|
|
|
/* The following members are for QEMU_JOB_* */
|
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
|
|
|
|
2018-06-19 06:11:39 +00:00
|
|
|
/* 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_* */
|
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 */
|
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 */
|
2017-11-20 14:51:22 +00:00
|
|
|
char *error; /* job event completion error */
|
|
|
|
bool dumpCompleted; /* dump completed */
|
2018-02-27 14:45:52 +00:00
|
|
|
|
|
|
|
qemuMigrationParamsPtr migParams;
|
2018-03-21 12:01:59 +00:00
|
|
|
unsigned long apiFlags; /* flags passed to the API which started the async job */
|
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 */
|
2016-04-04 15:17:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* 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;
|
qemu_hotplug: Fix a rare race condition when detaching a device twice
https://bugzilla.redhat.com/show_bug.cgi?id=1623389
If a device is detached twice from the same domain the following
race condition may happen:
1) The first DetachDevice() call will issue "device_del" on qemu
monitor, but since the DEVICE_DELETED event did not arrive in
time, the API ends claiming "Device detach request sent
successfully".
2) The second DetachDevice() therefore still find the device in
the domain and thus proceeds to detaching it again. It calls
EnterMonitor() and qemuMonitorSend() trying to issue "device_del"
command again. This gets both domain lock and monitor lock
released.
3) At this point, qemu sends us the DEVICE_DELETED event which is
going to be handled by the event loop which ends up calling
qemuDomainSignalDeviceRemoval() to determine who is going to
remove the device from domain definition. Whether it is the
caller that marked the device for removal or whether it is going
to be the event processing thread.
4) Because the device was marked for removal,
qemuDomainSignalDeviceRemoval() returns true, which means the
event is to be processed by the thread that has marked the device
for removal (and is currently still trying to issue "device_del"
command)
5) The thread finally issues the "device_del" command, which
fails (obviously) and therefore it calls
qemuDomainResetDeviceRemoval() to reset the device marking and
quits immediately after, NOT removing any device from the domain
definition.
At this point, the device is still present in the domain
definition but doesn't exist in qemu anymore. Worse, there is no
way to remove it from the domain definition.
Solution is to note down that we've seen the event and if the
second "device_del" fails, not take it as a failure but carry on
with the usual execution.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
2019-03-14 10:02:52 +00:00
|
|
|
bool eventSeen; /* True if DEVICE_DELETED event arrived. */
|
2016-04-04 15:17:43 +00:00
|
|
|
};
|
|
|
|
|
2016-11-15 10:30:18 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
QEMU_DOMAIN_NS_MOUNT = 0,
|
|
|
|
QEMU_DOMAIN_NS_LAST
|
|
|
|
} qemuDomainNamespace;
|
2019-01-20 16:04:56 +00:00
|
|
|
VIR_ENUM_DECL(qemuDomainNamespace);
|
2016-11-15 10:30:18 +00:00
|
|
|
|
|
|
|
bool qemuDomainNamespaceEnabled(virDomainObjPtr vm,
|
|
|
|
qemuDomainNamespace ns);
|
|
|
|
|
2017-03-03 12:22:16 +00:00
|
|
|
/* Type of domain secret */
|
|
|
|
typedef enum {
|
|
|
|
VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN = 0,
|
|
|
|
VIR_DOMAIN_SECRET_INFO_TYPE_AES, /* utilize GNUTLS_CIPHER_AES_256_CBC */
|
|
|
|
|
|
|
|
VIR_DOMAIN_SECRET_INFO_TYPE_LAST
|
|
|
|
} qemuDomainSecretInfoType;
|
|
|
|
|
|
|
|
typedef struct _qemuDomainSecretPlain qemuDomainSecretPlain;
|
|
|
|
typedef struct _qemuDomainSecretPlain *qemuDomainSecretPlainPtr;
|
|
|
|
struct _qemuDomainSecretPlain {
|
|
|
|
char *username;
|
|
|
|
uint8_t *secret;
|
|
|
|
size_t secretlen;
|
|
|
|
};
|
|
|
|
|
|
|
|
# define QEMU_DOMAIN_AES_IV_LEN 16 /* 16 bytes for 128 bit random */
|
|
|
|
/* initialization vector */
|
|
|
|
typedef struct _qemuDomainSecretAES qemuDomainSecretAES;
|
|
|
|
typedef struct _qemuDomainSecretAES *qemuDomainSecretAESPtr;
|
|
|
|
struct _qemuDomainSecretAES {
|
|
|
|
char *username;
|
|
|
|
char *alias; /* generated alias for secret */
|
|
|
|
char *iv; /* base64 encoded initialization vector */
|
|
|
|
char *ciphertext; /* encoded/encrypted secret */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _qemuDomainSecretInfo qemuDomainSecretInfo;
|
|
|
|
typedef qemuDomainSecretInfo *qemuDomainSecretInfoPtr;
|
|
|
|
struct _qemuDomainSecretInfo {
|
|
|
|
qemuDomainSecretInfoType type;
|
|
|
|
union {
|
|
|
|
qemuDomainSecretPlain plain;
|
|
|
|
qemuDomainSecretAES aes;
|
|
|
|
} s;
|
|
|
|
};
|
|
|
|
|
2010-12-16 15:23:41 +00:00
|
|
|
typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate;
|
|
|
|
typedef qemuDomainObjPrivate *qemuDomainObjPrivatePtr;
|
|
|
|
struct _qemuDomainObjPrivate {
|
2017-07-21 13:46:56 +00:00
|
|
|
virQEMUDriverPtr driver;
|
|
|
|
|
2018-03-29 14:48:34 +00:00
|
|
|
qemuDomainJobObj job;
|
2010-12-16 15:23:41 +00:00
|
|
|
|
2016-11-15 10:30:18 +00:00
|
|
|
virBitmapPtr namespaces;
|
|
|
|
|
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;
|
|
|
|
|
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
|
|
|
|
2014-05-10 16:35:24 +00:00
|
|
|
virDomainPCIAddressSetPtr pciaddrs;
|
2015-08-12 14:52:17 +00:00
|
|
|
virDomainUSBAddressSetPtr usbaddrs;
|
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;
|
2017-10-11 13:57:16 +00:00
|
|
|
virTristateBool allowReboot;
|
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;
|
|
|
|
|
2016-04-04 15:17:43 +00:00
|
|
|
qemuDomainUnpluggingDevice unplug;
|
|
|
|
|
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;
|
2016-10-31 15:49:49 +00:00
|
|
|
|
|
|
|
/* note whether memory device alias does not correspond to slot number */
|
|
|
|
bool memAliasOrderMismatch;
|
2010-12-16 15:23:41 +00:00
|
|
|
|
2017-03-03 12:22:16 +00:00
|
|
|
/* for migrations using TLS with a secret (not to be saved in our */
|
|
|
|
/* private XML). */
|
|
|
|
qemuDomainSecretInfoPtr migSecinfo;
|
2016-09-14 05:28:18 +00:00
|
|
|
|
2017-05-16 11:26:54 +00:00
|
|
|
/* CPU def used to start the domain when it differs from the one actually
|
|
|
|
* provided by QEMU. */
|
|
|
|
virCPUDefPtr origCPU;
|
2017-06-15 06:34:55 +00:00
|
|
|
|
|
|
|
/* If true virtlogd is used as stdio handler for character devices. */
|
|
|
|
bool chardevStdioLogd;
|
2017-09-26 14:37:47 +00:00
|
|
|
|
|
|
|
/* Tracks blockjob state for vm. Valid only while reconnecting to qemu. */
|
|
|
|
virTristateBool reconnectBlockjobs;
|
2017-10-17 19:39:41 +00:00
|
|
|
|
|
|
|
/* Migration capabilities. Rechecked on reconnect, not to be saved in
|
|
|
|
* private XML. */
|
|
|
|
virBitmapPtr migrationCaps;
|
2018-04-19 08:00:36 +00:00
|
|
|
|
|
|
|
/* true if qemu-pr-helper process is running for the domain */
|
|
|
|
bool prDaemonRunning;
|
2017-07-07 12:29:32 +00:00
|
|
|
|
|
|
|
/* counter for generating node names for qemu disks */
|
|
|
|
unsigned long long nodenameindex;
|
2018-09-10 17:41:53 +00:00
|
|
|
|
|
|
|
/* qemuProcessStartCPUs stores the reason for starting vCPUs here for the
|
|
|
|
* RESUME event handler to use it */
|
|
|
|
virDomainRunningReason runningReason;
|
2018-11-13 11:50:41 +00:00
|
|
|
|
|
|
|
/* true if libvirt remembers the original owner for files */
|
|
|
|
bool rememberOwner;
|
2018-11-05 10:48:16 +00:00
|
|
|
|
|
|
|
/* true if global -mem-prealloc appears on cmd line */
|
|
|
|
bool memPrealloc;
|
2016-04-06 12:56:52 +00:00
|
|
|
};
|
|
|
|
|
2017-11-03 12:09:47 +00:00
|
|
|
# define QEMU_DOMAIN_PRIVATE(vm) \
|
2017-03-03 12:22:16 +00:00
|
|
|
((qemuDomainObjPrivatePtr) (vm)->privateData)
|
2016-04-06 12:56:52 +00:00
|
|
|
|
2017-10-17 15:05:47 +00:00
|
|
|
# define QEMU_DOMAIN_DISK_PRIVATE(disk) \
|
2015-05-13 09:20:36 +00:00
|
|
|
((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 */
|
2018-10-17 06:57:08 +00:00
|
|
|
qemuBlockJobDataPtr blockjob;
|
2015-05-11 18:10:06 +00:00
|
|
|
|
|
|
|
bool migrating; /* the disk is being migrated */
|
2018-02-28 14:22:30 +00:00
|
|
|
virStorageSourcePtr migrSource; /* disk source object used for NBD migration */
|
2016-04-06 12:56:52 +00:00
|
|
|
|
2016-05-19 13:29:02 +00:00
|
|
|
/* information about the device */
|
|
|
|
bool tray; /* device has tray */
|
|
|
|
bool removable; /* device media can be removed/changed */
|
2018-06-15 07:12:01 +00:00
|
|
|
|
|
|
|
char *qomName; /* QOM path of the disk (also refers to the block backend) */
|
2018-08-21 12:45:57 +00:00
|
|
|
char *nodeCopyOnRead; /* nodename of the disk-wide copy-on-read blockdev layer */
|
2015-05-13 09:20:36 +00:00
|
|
|
};
|
|
|
|
|
2017-10-05 13:22:09 +00:00
|
|
|
# define QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src) \
|
|
|
|
((qemuDomainStorageSourcePrivatePtr) (src)->privateData)
|
|
|
|
|
|
|
|
typedef struct _qemuDomainStorageSourcePrivate qemuDomainStorageSourcePrivate;
|
|
|
|
typedef qemuDomainStorageSourcePrivate *qemuDomainStorageSourcePrivatePtr;
|
|
|
|
struct _qemuDomainStorageSourcePrivate {
|
|
|
|
virObject parent;
|
|
|
|
|
|
|
|
/* data required for authentication to the storage source */
|
|
|
|
qemuDomainSecretInfoPtr secinfo;
|
|
|
|
|
|
|
|
/* data required for decryption of encrypted storage source */
|
|
|
|
qemuDomainSecretInfoPtr encinfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
virObjectPtr qemuDomainStorageSourcePrivateNew(void);
|
|
|
|
|
2016-06-29 13:40:09 +00:00
|
|
|
typedef struct _qemuDomainVcpuPrivate qemuDomainVcpuPrivate;
|
|
|
|
typedef qemuDomainVcpuPrivate *qemuDomainVcpuPrivatePtr;
|
|
|
|
struct _qemuDomainVcpuPrivate {
|
|
|
|
virObject parent;
|
|
|
|
|
2016-07-01 12:56:14 +00:00
|
|
|
pid_t tid; /* vcpu thread id */
|
2016-07-31 12:05:04 +00:00
|
|
|
int enable_id; /* order in which the vcpus were enabled in qemu */
|
2016-11-21 13:57:54 +00:00
|
|
|
int qemu_id; /* ID reported by qemu as 'CPU' in query-cpus */
|
2016-07-31 12:05:04 +00:00
|
|
|
char *alias;
|
2018-02-06 15:00:45 +00:00
|
|
|
virTristateBool halted;
|
2016-07-31 12:05:04 +00:00
|
|
|
|
|
|
|
/* information for hotpluggable cpus */
|
|
|
|
char *type;
|
|
|
|
int socket_id;
|
|
|
|
int core_id;
|
|
|
|
int thread_id;
|
2017-06-27 14:04:38 +00:00
|
|
|
int node_id;
|
2016-07-31 12:05:04 +00:00
|
|
|
int vcpus;
|
2016-06-29 13:40:09 +00:00
|
|
|
};
|
|
|
|
|
2017-11-03 12:09:47 +00:00
|
|
|
# define QEMU_DOMAIN_VCPU_PRIVATE(vcpu) \
|
2016-06-29 13:40:09 +00:00
|
|
|
((qemuDomainVcpuPrivatePtr) (vcpu)->privateData)
|
|
|
|
|
|
|
|
|
2016-05-20 05:21:04 +00:00
|
|
|
struct qemuDomainDiskInfo {
|
|
|
|
bool removable;
|
2016-05-19 12:57:41 +00:00
|
|
|
bool tray;
|
2016-05-20 05:21:04 +00:00
|
|
|
bool tray_open;
|
2016-05-19 12:57:41 +00:00
|
|
|
bool empty;
|
2016-05-20 05:21:04 +00:00
|
|
|
int io_status;
|
2017-02-23 18:36:52 +00:00
|
|
|
char *nodename;
|
2016-05-20 05:21:04 +00:00
|
|
|
};
|
|
|
|
|
2017-11-03 12:09:47 +00:00
|
|
|
# define QEMU_DOMAIN_CHR_SOURCE_PRIVATE(dev) \
|
2016-10-21 12:31:37 +00:00
|
|
|
((qemuDomainChrSourcePrivatePtr) (dev)->privateData)
|
2016-06-17 10:36:11 +00:00
|
|
|
|
2016-10-21 12:31:37 +00:00
|
|
|
typedef struct _qemuDomainChrSourcePrivate qemuDomainChrSourcePrivate;
|
|
|
|
typedef qemuDomainChrSourcePrivate *qemuDomainChrSourcePrivatePtr;
|
|
|
|
struct _qemuDomainChrSourcePrivate {
|
2016-06-17 10:36:11 +00:00
|
|
|
virObject parent;
|
|
|
|
|
|
|
|
/* for char devices using secret
|
|
|
|
* NB: *not* to be written to qemu domain object XML */
|
|
|
|
qemuDomainSecretInfoPtr secinfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-05-18 11:14:42 +00:00
|
|
|
typedef struct _qemuDomainVsockPrivate qemuDomainVsockPrivate;
|
|
|
|
typedef qemuDomainVsockPrivate *qemuDomainVsockPrivatePtr;
|
|
|
|
struct _qemuDomainVsockPrivate {
|
|
|
|
virObject parent;
|
|
|
|
|
2018-05-22 13:57:47 +00:00
|
|
|
int vhostfd;
|
2018-05-18 11:14:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-01-10 14:50:11 +00:00
|
|
|
# define QEMU_DOMAIN_GRAPHICS_PRIVATE(dev) \
|
|
|
|
((qemuDomainGraphicsPrivatePtr) (dev)->privateData)
|
|
|
|
|
|
|
|
typedef struct _qemuDomainGraphicsPrivate qemuDomainGraphicsPrivate;
|
|
|
|
typedef qemuDomainGraphicsPrivate *qemuDomainGraphicsPrivatePtr;
|
|
|
|
struct _qemuDomainGraphicsPrivate {
|
|
|
|
virObject parent;
|
|
|
|
|
|
|
|
char *tlsAlias;
|
2019-01-14 13:20:01 +00:00
|
|
|
qemuDomainSecretInfoPtr secinfo;
|
2019-01-10 14:50:11 +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,
|
2018-06-27 10:17:59 +00:00
|
|
|
QEMU_PROCESS_EVENT_PR_DISCONNECT,
|
2018-12-24 10:15:12 +00:00
|
|
|
QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED,
|
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
|
|
|
};
|
|
|
|
|
2018-02-02 12:13:46 +00:00
|
|
|
void qemuProcessEventFree(struct qemuProcessEvent *event);
|
|
|
|
|
2015-11-12 12:43:29 +00:00
|
|
|
typedef struct _qemuDomainLogContext qemuDomainLogContext;
|
|
|
|
typedef qemuDomainLogContext *qemuDomainLogContextPtr;
|
|
|
|
|
2017-06-02 20:50:18 +00:00
|
|
|
typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie;
|
|
|
|
typedef qemuDomainSaveCookie *qemuDomainSaveCookiePtr;
|
|
|
|
struct _qemuDomainSaveCookie {
|
|
|
|
virObject parent;
|
2017-06-02 20:52:03 +00:00
|
|
|
|
|
|
|
virCPUDefPtr cpu;
|
2017-06-02 20:50:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm);
|
|
|
|
|
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
|
|
|
|
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;
|
2018-06-19 06:12:11 +00:00
|
|
|
int qemuDomainObjBeginAgentJob(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj,
|
|
|
|
qemuDomainAgentJob agentJob)
|
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
int qemuDomainObjBeginJobWithAgent(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj,
|
|
|
|
qemuDomainJob job,
|
|
|
|
qemuDomainAgentJob agentJob)
|
|
|
|
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,
|
2017-04-26 10:00:09 +00:00
|
|
|
qemuDomainAsyncJob asyncJob,
|
2018-03-21 12:01:59 +00:00
|
|
|
virDomainJobOperation operation,
|
|
|
|
unsigned long apiFlags)
|
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;
|
2018-06-07 08:19:52 +00:00
|
|
|
int qemuDomainObjBeginJobNowait(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj,
|
|
|
|
qemuDomainJob job)
|
|
|
|
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);
|
2018-06-19 06:12:11 +00:00
|
|
|
void qemuDomainObjEndAgentJob(virDomainObjPtr obj);
|
|
|
|
void qemuDomainObjEndJobWithAgent(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj);
|
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 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,
|
2018-03-29 14:48:34 +00:00
|
|
|
qemuDomainJobObjPtr 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
|
|
|
|
|
|
|
|
2016-11-14 14:24:23 +00:00
|
|
|
qemuAgentPtr qemuDomainObjEnterAgent(virDomainObjPtr obj)
|
2013-02-06 18:17:20 +00:00
|
|
|
ATTRIBUTE_NONNULL(1);
|
2016-11-14 14:24:23 +00:00
|
|
|
void qemuDomainObjExitAgent(virDomainObjPtr obj, qemuAgentPtr agent)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
2011-10-05 17:31:54 +00:00
|
|
|
|
|
|
|
|
2013-02-06 18:17:20 +00:00
|
|
|
void qemuDomainObjEnterRemote(virDomainObjPtr obj)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
2018-06-28 09:38:52 +00:00
|
|
|
int qemuDomainObjExitRemote(virDomainObjPtr obj,
|
|
|
|
bool checkActive)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
|
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,
|
2017-05-19 13:20:31 +00:00
|
|
|
virCPUDefPtr origCPU,
|
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);
|
2011-05-05 11:38:04 +00:00
|
|
|
|
2016-02-23 13:05:09 +00:00
|
|
|
virLogManagerPtr qemuDomainLogContextGetManager(qemuDomainLogContextPtr ctxt);
|
|
|
|
|
2016-06-07 14:19:03 +00:00
|
|
|
int qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
const char *fmt,
|
|
|
|
...) ATTRIBUTE_FMT_PRINTF(3, 4);
|
|
|
|
|
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,
|
2019-03-22 04:45:25 +00:00
|
|
|
virDomainMomentObjPtr snapshot,
|
2016-02-04 22:55:05 +00:00
|
|
|
virCapsPtr caps,
|
2017-06-01 22:27:33 +00:00
|
|
|
virDomainXMLOptionPtr xmlopt,
|
2019-03-05 02:25:33 +00:00
|
|
|
const char *snapshotDir);
|
2011-09-21 19:08:51 +00:00
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver,
|
2011-09-21 19:08:51 +00:00
|
|
|
virDomainObjPtr vm,
|
2019-03-22 04:45:25 +00:00
|
|
|
virDomainMomentObjPtr snap,
|
2011-09-21 19:08:51 +00:00
|
|
|
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,
|
2019-03-22 04:45:25 +00:00
|
|
|
virDomainMomentObjPtr snap,
|
2011-09-21 19:08:51 +00:00
|
|
|
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);
|
|
|
|
|
2017-08-15 07:12:43 +00:00
|
|
|
void qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2018-09-21 04:35:09 +00:00
|
|
|
void qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver,
|
|
|
|
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
|
|
|
|
2017-10-03 10:51:47 +00:00
|
|
|
int qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
size_t diskIndex,
|
|
|
|
bool cold_boot);
|
|
|
|
|
2017-10-03 10:38:23 +00:00
|
|
|
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
|
2011-10-18 08:51:06 +00:00
|
|
|
virDomainObjPtr vm,
|
2016-08-01 15:51:28 +00:00
|
|
|
unsigned int flags);
|
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,
|
2019-01-16 14:33:07 +00:00
|
|
|
virStorageSourcePtr disksrc,
|
2014-09-11 16:59:32 +00:00
|
|
|
bool report_broken);
|
2012-03-16 06:52:26 +00:00
|
|
|
|
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,
|
2017-10-16 12:10:09 +00:00
|
|
|
virStorageSourcePtr src,
|
|
|
|
virStorageSourcePtr parent);
|
2014-12-12 16:53:33 +00:00
|
|
|
char *qemuDomainStorageAlias(const char *device, int depth);
|
2014-06-30 13:48:45 +00:00
|
|
|
|
2018-06-26 04:58:47 +00:00
|
|
|
int qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
|
|
|
|
virQEMUCapsPtr qemuCaps,
|
|
|
|
char **backendAlias)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
|
|
|
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
|
|
|
|
|
2016-02-29 14:39:57 +00:00
|
|
|
void qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr elem);
|
|
|
|
int qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr elem,
|
2017-11-22 15:42:53 +00:00
|
|
|
bool readonly,
|
|
|
|
bool newSource);
|
2016-02-29 14:39:57 +00:00
|
|
|
|
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);
|
|
|
|
|
2017-08-23 12:19:36 +00:00
|
|
|
void qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv);
|
|
|
|
|
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;
|
2017-05-19 14:46:27 +00:00
|
|
|
extern virDomainABIStability virQEMUDriverDomainABIStability;
|
2017-06-02 20:50:18 +00:00
|
|
|
extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie;
|
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
|
|
|
|
2017-06-14 11:43:37 +00:00
|
|
|
bool qemuDomainCheckABIStability(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virDomainDefPtr dst);
|
|
|
|
|
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);
|
|
|
|
|
2017-09-13 13:28:46 +00:00
|
|
|
int qemuDomainSupportsBlockJobs(virDomainObjPtr vm)
|
2015-03-31 15:29:35 +00:00
|
|
|
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
|
|
|
|
2018-11-28 16:34:07 +00:00
|
|
|
/* You should normally avoid these functions and use the variant that
|
|
|
|
* doesn't have "Machine" in the name instead. */
|
2018-08-22 09:15:20 +00:00
|
|
|
bool qemuDomainMachineIsARMVirt(const char *machine,
|
|
|
|
const virArch arch);
|
2017-04-18 10:43:58 +00:00
|
|
|
bool qemuDomainMachineIsPSeries(const char *machine,
|
|
|
|
const virArch arch);
|
2018-11-28 15:48:41 +00:00
|
|
|
bool qemuDomainMachineHasBuiltinIDE(const char *machine,
|
|
|
|
const virArch arch);
|
2018-11-28 15:15:31 +00:00
|
|
|
|
|
|
|
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);
|
2018-11-28 16:45:37 +00:00
|
|
|
bool qemuDomainSupportsPCI(virDomainDefPtr def,
|
|
|
|
virQEMUCapsPtr qemuCaps);
|
2015-04-28 09:21:52 +00:00
|
|
|
|
2019-02-07 09:46:20 +00:00
|
|
|
void qemuDomainUpdateCurrentMemorySize(virDomainObjPtr vm);
|
2015-05-27 13:51:52 +00:00
|
|
|
|
2015-11-24 12:51:11 +00:00
|
|
|
unsigned long long qemuDomainGetMemLockLimitBytes(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);
|
|
|
|
|
2016-07-31 12:05:04 +00:00
|
|
|
bool qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm);
|
2015-11-11 13:20:04 +00:00
|
|
|
bool qemuDomainHasVcpuPids(virDomainObjPtr vm);
|
2016-07-01 12:56:14 +00:00
|
|
|
pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid);
|
2016-07-08 13:39:32 +00:00
|
|
|
int qemuDomainValidateVcpuInfo(virDomainObjPtr vm);
|
2016-07-19 14:00:29 +00:00
|
|
|
int qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
2016-08-05 12:48:27 +00:00
|
|
|
int asyncJob,
|
|
|
|
bool state);
|
2016-10-13 11:42:45 +00:00
|
|
|
bool qemuDomainGetVcpuHalted(virDomainObjPtr vm, unsigned int vcpu);
|
|
|
|
int qemuDomainRefreshVcpuHalted(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,
|
|
|
|
virDomainNetDefPtr net);
|
|
|
|
|
2017-01-23 13:32:13 +00:00
|
|
|
bool qemuDomainNetSupportsMTU(virDomainNetType type);
|
|
|
|
|
2016-04-03 19:59:46 +00:00
|
|
|
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
|
|
|
|
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);
|
|
|
|
|
2016-05-02 17:11:24 +00:00
|
|
|
int qemuDomainWriteMasterKeyFile(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
|
|
|
int qemuDomainMasterKeyCreate(virDomainObjPtr vm);
|
2016-03-29 22:22:46 +00:00
|
|
|
|
|
|
|
void qemuDomainMasterKeyRemove(qemuDomainObjPrivatePtr priv);
|
|
|
|
|
2018-05-22 14:36:20 +00:00
|
|
|
bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivatePtr priv);
|
|
|
|
|
2017-03-03 12:22:16 +00:00
|
|
|
void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr *secinfo)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2018-05-28 13:17:01 +00:00
|
|
|
void qemuDomainSecretInfoDestroy(qemuDomainSecretInfoPtr secinfo);
|
|
|
|
|
2016-04-06 19:00:59 +00:00
|
|
|
void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2018-05-22 07:18:34 +00:00
|
|
|
bool qemuDomainStorageSourceHasAuth(virStorageSourcePtr src)
|
2016-06-24 19:47:09 +00:00
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2016-12-22 12:12:49 +00:00
|
|
|
bool qemuDomainDiskHasEncryptionSecret(virStorageSourcePtr src)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2017-03-03 12:22:16 +00:00
|
|
|
qemuDomainSecretInfoPtr
|
2018-02-09 16:14:41 +00:00
|
|
|
qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
|
2017-03-03 12:22:16 +00:00
|
|
|
const char *srcAlias,
|
|
|
|
const char *secretUUID);
|
|
|
|
|
2016-04-06 14:41:33 +00:00
|
|
|
void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2018-02-09 16:14:41 +00:00
|
|
|
int qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
|
2016-04-06 14:41:33 +00:00
|
|
|
virDomainHostdevDefPtr hostdev)
|
2018-02-09 16:14:41 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
2016-04-06 14:41:33 +00:00
|
|
|
|
2016-10-21 23:02:35 +00:00
|
|
|
void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2018-02-09 16:14:41 +00:00
|
|
|
int qemuDomainSecretChardevPrepare(virQEMUDriverConfigPtr cfg,
|
2016-10-21 23:02:35 +00:00
|
|
|
qemuDomainObjPrivatePtr priv,
|
|
|
|
const char *chrAlias,
|
|
|
|
virDomainChrSourceDefPtr dev)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
2018-02-09 16:14:41 +00:00
|
|
|
ATTRIBUTE_NONNULL(4);
|
2016-10-21 23:02:35 +00:00
|
|
|
|
2016-04-06 19:00:59 +00:00
|
|
|
void qemuDomainSecretDestroy(virDomainObjPtr vm)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2018-02-09 16:14:41 +00:00
|
|
|
int qemuDomainSecretPrepare(virQEMUDriverPtr driver,
|
2016-10-21 23:02:35 +00:00
|
|
|
virDomainObjPtr vm)
|
2018-02-09 16:14:41 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
2016-04-06 19:00:59 +00:00
|
|
|
|
2016-05-02 13:26:51 +00:00
|
|
|
int qemuDomainDefValidateDiskLunSource(const virStorageSource *src)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2018-04-19 11:44:04 +00:00
|
|
|
int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
|
|
|
|
virQEMUCapsPtr qemuCaps);
|
|
|
|
|
2016-03-30 14:34:17 +00:00
|
|
|
int qemuDomainPrepareChannel(virDomainChrDefPtr chr,
|
|
|
|
const char *domainChannelTargetDir)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
|
|
2016-10-24 12:05:54 +00:00
|
|
|
void qemuDomainPrepareChardevSourceTLS(virDomainChrSourceDefPtr source,
|
|
|
|
virQEMUDriverConfigPtr cfg)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
|
|
|
|
|
void qemuDomainPrepareChardevSource(virDomainDefPtr def,
|
2017-08-30 19:40:58 +00:00
|
|
|
virQEMUDriverConfigPtr cfg)
|
2016-10-24 12:05:54 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
|
|
2016-09-13 11:40:50 +00:00
|
|
|
int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2016-08-04 11:57:46 +00:00
|
|
|
bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2016-08-04 12:23:25 +00:00
|
|
|
void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2016-09-12 08:24:21 +00:00
|
|
|
int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
qemuDomainAsyncJob asyncJob);
|
|
|
|
|
2016-09-30 12:41:37 +00:00
|
|
|
bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr video,
|
|
|
|
virQEMUCapsPtr qemuCaps);
|
|
|
|
|
2017-02-09 13:14:09 +00:00
|
|
|
int qemuDomainGetHostdevPath(virDomainDefPtr def,
|
|
|
|
virDomainHostdevDefPtr dev,
|
|
|
|
bool teardown,
|
2017-02-08 13:23:30 +00:00
|
|
|
size_t *npaths,
|
|
|
|
char ***path,
|
|
|
|
int **perms);
|
2017-02-09 10:01:29 +00:00
|
|
|
|
2017-02-21 12:11:00 +00:00
|
|
|
int qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
|
|
|
|
virSecurityManagerPtr mgr,
|
2016-11-15 10:30:18 +00:00
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
|
|
|
int qemuDomainCreateNamespace(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2017-03-10 12:34:15 +00:00
|
|
|
void qemuDomainDestroyNamespace(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2017-02-15 09:06:09 +00:00
|
|
|
bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);
|
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
|
2017-02-03 14:53:28 +00:00
|
|
|
virStorageSourcePtr src);
|
2016-11-15 15:53:04 +00:00
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceTeardownDisk(virDomainObjPtr vm,
|
2017-02-03 14:53:28 +00:00
|
|
|
virStorageSourcePtr src);
|
2016-11-16 14:27:47 +00:00
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
|
2016-11-16 14:27:47 +00:00
|
|
|
virDomainHostdevDefPtr hostdev);
|
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
|
2016-11-16 14:27:47 +00:00
|
|
|
virDomainHostdevDefPtr hostdev);
|
2016-11-18 13:53:27 +00:00
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceSetupMemory(virDomainObjPtr vm,
|
2017-02-22 16:37:39 +00:00
|
|
|
virDomainMemoryDefPtr memory);
|
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
|
2017-02-22 16:37:39 +00:00
|
|
|
virDomainMemoryDefPtr memory);
|
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceSetupChardev(virDomainObjPtr vm,
|
2016-11-18 13:53:27 +00:00
|
|
|
virDomainChrDefPtr chr);
|
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceTeardownChardev(virDomainObjPtr vm,
|
2016-11-18 13:53:27 +00:00
|
|
|
virDomainChrDefPtr chr);
|
2016-11-18 14:19:12 +00:00
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceSetupRNG(virDomainObjPtr vm,
|
2017-01-30 19:38:03 +00:00
|
|
|
virDomainRNGDefPtr rng);
|
2016-11-18 14:19:12 +00:00
|
|
|
|
2017-11-24 16:52:15 +00:00
|
|
|
int qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
|
2017-01-30 19:38:03 +00:00
|
|
|
virDomainRNGDefPtr rng);
|
2017-02-22 16:51:05 +00:00
|
|
|
|
2017-11-21 12:55:12 +00:00
|
|
|
int qemuDomainNamespaceSetupInput(virDomainObjPtr vm,
|
|
|
|
virDomainInputDefPtr input);
|
|
|
|
|
|
|
|
int qemuDomainNamespaceTeardownInput(virDomainObjPtr vm,
|
|
|
|
virDomainInputDefPtr input);
|
|
|
|
|
2017-02-22 16:51:05 +00:00
|
|
|
virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def,
|
|
|
|
const char *nodename,
|
|
|
|
virStorageSourcePtr *src,
|
|
|
|
unsigned int *idx);
|
|
|
|
|
2017-02-23 17:13:02 +00:00
|
|
|
char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
|
|
|
|
virStorageSourcePtr src,
|
|
|
|
unsigned int idx);
|
|
|
|
|
2017-02-23 18:14:47 +00:00
|
|
|
virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr,
|
|
|
|
virDomainDefPtr def);
|
|
|
|
|
2017-05-31 10:34:10 +00:00
|
|
|
int
|
|
|
|
qemuDomainUpdateCPU(virDomainObjPtr vm,
|
|
|
|
virCPUDefPtr cpu,
|
|
|
|
virCPUDefPtr *origCPU);
|
|
|
|
|
2017-10-06 12:49:07 +00:00
|
|
|
int
|
|
|
|
qemuDomainFixupCPUs(virDomainObjPtr vm,
|
|
|
|
virCPUDefPtr *origCPU);
|
|
|
|
|
2018-09-20 17:44:48 +00:00
|
|
|
int
|
|
|
|
qemuDomainUpdateQEMUCaps(virDomainObjPtr vm,
|
|
|
|
virFileCachePtr qemuCapsCache);
|
|
|
|
|
2017-07-21 13:51:03 +00:00
|
|
|
char *
|
|
|
|
qemuDomainGetMachineName(virDomainObjPtr vm);
|
|
|
|
|
2017-10-13 10:06:54 +00:00
|
|
|
void
|
|
|
|
qemuDomainObjPrivateXMLFormatAllowReboot(virBufferPtr buf,
|
|
|
|
virTristateBool allowReboot);
|
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt,
|
|
|
|
virTristateBool *allowReboot);
|
|
|
|
|
2019-01-25 11:11:21 +00:00
|
|
|
bool
|
|
|
|
qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
|
|
|
|
const virDomainDeviceInfo *info,
|
|
|
|
virQEMUCapsPtr qemuCaps,
|
|
|
|
const char *devicename);
|
2017-10-11 13:06:07 +00:00
|
|
|
|
2017-10-17 19:39:41 +00:00
|
|
|
int
|
2018-05-29 15:05:05 +00:00
|
|
|
qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
|
|
|
|
virStorageSourcePtr src,
|
|
|
|
virQEMUDriverConfigPtr cfg,
|
|
|
|
virQEMUCapsPtr qemuCaps)
|
2017-12-05 15:40:27 +00:00
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
2017-10-17 19:39:41 +00:00
|
|
|
|
2018-05-29 15:28:11 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainValidateStorageSource(virStorageSourcePtr src,
|
|
|
|
virQEMUCapsPtr qemuCaps);
|
|
|
|
|
|
|
|
|
2017-11-23 16:01:37 +00:00
|
|
|
int
|
2018-02-09 16:14:41 +00:00
|
|
|
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
2017-11-23 16:01:37 +00:00
|
|
|
qemuDomainObjPrivatePtr priv,
|
|
|
|
virQEMUDriverConfigPtr cfg);
|
|
|
|
|
2018-04-04 06:43:06 +00:00
|
|
|
int
|
|
|
|
qemuDomainDiskCachemodeFlags(int cachemode,
|
|
|
|
bool *writeback,
|
|
|
|
bool *direct,
|
|
|
|
bool *noflush);
|
|
|
|
|
2018-05-14 05:28:05 +00:00
|
|
|
char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv);
|
2018-04-18 14:55:14 +00:00
|
|
|
|
2017-07-07 12:29:32 +00:00
|
|
|
unsigned int qemuDomainStorageIdNew(qemuDomainObjPrivatePtr priv);
|
|
|
|
void qemuDomainStorageIdReset(qemuDomainObjPrivatePtr priv);
|
|
|
|
|
2018-09-11 13:13:08 +00:00
|
|
|
virDomainEventResumedDetailType
|
|
|
|
qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason);
|
|
|
|
|
2018-10-16 12:38:27 +00:00
|
|
|
bool
|
|
|
|
qemuDomainIsUsingNoShutdown(qemuDomainObjPrivatePtr priv);
|
|
|
|
|
2018-11-09 09:21:50 +00:00
|
|
|
bool
|
|
|
|
qemuDomainDiskIsMissingLocalOptional(virDomainDiskDefPtr disk);
|
|
|
|
|
2019-02-25 15:24:27 +00:00
|
|
|
int
|
|
|
|
qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg,
|
|
|
|
virDomainDefPtr def);
|
|
|
|
|
2018-12-13 14:53:50 +00:00
|
|
|
#endif /* LIBVIRT_QEMU_DOMAIN_H */
|