2010-12-16 15:23:41 +00:00
|
|
|
/*
|
|
|
|
* qemu_domain.h: QEMU domain private state
|
|
|
|
*
|
2019-03-27 07:12:37 +00:00
|
|
|
* Copyright (C) 2006-2019 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
|
|
|
*/
|
|
|
|
|
2019-06-18 16:12:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-03-16 12:10:24 +00:00
|
|
|
#include <glib-object.h>
|
2019-06-18 16:12:37 +00:00
|
|
|
#include "virthread.h"
|
|
|
|
#include "vircgroup.h"
|
|
|
|
#include "virperf.h"
|
|
|
|
#include "domain_addr.h"
|
|
|
|
#include "domain_conf.h"
|
|
|
|
#include "snapshot_conf.h"
|
|
|
|
#include "qemu_monitor.h"
|
|
|
|
#include "qemu_agent.h"
|
|
|
|
#include "qemu_blockjob.h"
|
2020-06-24 10:45:23 +00:00
|
|
|
#include "qemu_domainjob.h"
|
2019-06-18 16:12:37 +00:00
|
|
|
#include "qemu_conf.h"
|
|
|
|
#include "qemu_capabilities.h"
|
|
|
|
#include "qemu_migration_params.h"
|
2019-08-08 14:55:06 +00:00
|
|
|
#include "qemu_slirp.h"
|
2019-06-18 16:12:37 +00:00
|
|
|
#include "virmdev.h"
|
|
|
|
#include "virchrdev.h"
|
|
|
|
#include "virobject.h"
|
|
|
|
#include "logging/log_manager.h"
|
|
|
|
#include "virdomainmomentobjlist.h"
|
|
|
|
#include "virenum.h"
|
2020-02-12 12:26:11 +00:00
|
|
|
#include "vireventthread.h"
|
2019-06-18 16:12:37 +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
|
|
|
|
2019-06-18 16:12:37 +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. */
|
2019-06-18 16:12:37 +00:00
|
|
|
# define QEMU_DOMAIN_MIG_BANDWIDTH_MAX ULONG_MAX
|
|
|
|
#else
|
|
|
|
# define QEMU_DOMAIN_MIG_BANDWIDTH_MAX (INT64_MAX / (1024 * 1024))
|
|
|
|
#endif
|
2011-08-26 18:10:22 +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);
|
|
|
|
|
2019-06-18 16:12:37 +00:00
|
|
|
#define QEMU_DOMAIN_MASTER_KEY_LEN 32 /* 32 bytes for 256 bit random key */
|
2016-04-04 15:17:43 +00:00
|
|
|
|
2020-06-24 10:45:23 +00:00
|
|
|
void
|
|
|
|
qemuDomainObjSaveStatus(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr obj);
|
|
|
|
|
2019-06-27 13:40:39 +00:00
|
|
|
void qemuDomainSaveStatus(virDomainObjPtr obj);
|
2019-07-04 16:51:36 +00:00
|
|
|
void qemuDomainSaveConfig(virDomainObjPtr obj);
|
2019-06-27 13:40:39 +00:00
|
|
|
|
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
|
|
|
|
2019-06-25 11:21:39 +00:00
|
|
|
#define QEMU_PROC_MOUNTS "/proc/mounts"
|
|
|
|
#define QEMU_DEVPREFIX "/dev/"
|
|
|
|
#define QEMU_DEV_VFIO "/dev/vfio/vfio"
|
|
|
|
#define QEMU_DEV_SEV "/dev/sev"
|
|
|
|
#define QEMU_DEVICE_MAPPER_CONTROL_PATH "/dev/mapper/control"
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2019-06-18 16:12:37 +00:00
|
|
|
#define QEMU_DOMAIN_AES_IV_LEN 16 /* 16 bytes for 128 bit random */
|
|
|
|
/* initialization vector */
|
2017-03-03 12:22:16 +00:00
|
|
|
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;
|
|
|
|
|
2020-02-12 12:26:11 +00:00
|
|
|
virEventThread *eventThread;
|
|
|
|
|
2010-12-16 15:23:41 +00:00
|
|
|
qemuMonitorPtr mon;
|
2011-01-07 23:36:25 +00:00
|
|
|
virDomainChrSourceDefPtr monConfig;
|
2011-05-31 16:34:20 +00:00
|
|
|
bool monError;
|
|
|
|
unsigned long long monStart;
|
Add API to change qemu agent response timeout
Some layered products such as oVirt have requested a way to avoid being
blocked by guest agent commands when querying a loaded vm. For example,
many guest agent commands are polled periodically to monitor changes,
and rather than blocking the calling process, they'd prefer to simply
time out when an agent query is taking too long.
This patch adds a way for the user to specify a custom agent timeout
that is applied to all agent commands.
One special case to note here is the 'guest-sync' command. 'guest-sync'
is issued internally prior to calling any other command. (For example,
when libvirt wants to call 'guest-get-fsinfo', we first call
'guest-sync' and then call 'guest-get-fsinfo').
Previously, the 'guest-sync' command used a 5-second timeout
(VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT), whereas the actual command that
followed always blocked indefinitely
(VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK). As part of this patch, if a
custom timeout is specified that is shorter than
5 seconds, this new timeout is also used for 'guest-sync'. If there is
no custom timeout or if the custom timeout is longer than 5 seconds, we
will continue to use the 5-second timeout.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-11-13 22:06:09 +00:00
|
|
|
int agentTimeout;
|
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;
|
2019-12-19 08:02:06 +00:00
|
|
|
bool pausedShutdown;
|
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
|
|
|
|
2018-10-09 13:41:51 +00:00
|
|
|
/* qemuProcessStopCPUs stores the reason for pausing vCPUs here for the
|
|
|
|
* STOP event handler to use it */
|
|
|
|
virDomainPausedReason pausedReason;
|
|
|
|
|
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;
|
2018-11-29 11:50:09 +00:00
|
|
|
|
|
|
|
/* running block jobs */
|
|
|
|
virHashTablePtr blockjobs;
|
2019-08-08 14:55:00 +00:00
|
|
|
|
2019-08-08 14:55:07 +00:00
|
|
|
bool disableSlirp;
|
2019-11-15 15:23:44 +00:00
|
|
|
|
|
|
|
/* Until we add full support for backing chains for pflash drives, these
|
|
|
|
* pointers hold the temporary virStorageSources for creating the -blockdev
|
|
|
|
* commandline for pflash drives. */
|
|
|
|
virStorageSourcePtr pflash0;
|
|
|
|
virStorageSourcePtr pflash1;
|
2019-09-18 09:27:05 +00:00
|
|
|
|
|
|
|
/* running backup job */
|
|
|
|
virDomainBackupDefPtr backup;
|
2020-02-25 09:55:08 +00:00
|
|
|
|
|
|
|
bool dbusDaemonRunning;
|
2020-02-25 09:55:11 +00:00
|
|
|
|
|
|
|
/* list of Ids to migrate */
|
|
|
|
char **dbusVMStateIds;
|
|
|
|
/* true if -object dbus-vmstate was added */
|
|
|
|
bool dbusVMState;
|
2020-09-22 12:39:27 +00:00
|
|
|
|
|
|
|
/* prevent deletion of <transient> disk overlay files between startup and
|
|
|
|
* succesful setup of the overlays */
|
|
|
|
bool inhibitDiskTransientDelete;
|
2016-04-06 12:56:52 +00:00
|
|
|
};
|
|
|
|
|
2019-06-18 16:12:37 +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
|
|
|
|
2019-06-18 16:12:37 +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
|
|
|
};
|
|
|
|
|
2019-06-18 16:12:37 +00:00
|
|
|
#define QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src) \
|
2017-10-05 13:22:09 +00:00
|
|
|
((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;
|
2020-03-09 07:19:02 +00:00
|
|
|
|
|
|
|
/* secure passthrough of the http cookie */
|
|
|
|
qemuDomainSecretInfoPtr httpcookie;
|
2020-06-29 13:10:42 +00:00
|
|
|
|
|
|
|
/* key for decrypting TLS certificate */
|
|
|
|
qemuDomainSecretInfoPtr tlsKeySecret;
|
2017-10-05 13:22:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
virObjectPtr qemuDomainStorageSourcePrivateNew(void);
|
2020-05-22 10:29:10 +00:00
|
|
|
qemuDomainStorageSourcePrivatePtr
|
|
|
|
qemuDomainStorageSourcePrivateFetch(virStorageSourcePtr src);
|
2017-10-05 13:22:09 +00:00
|
|
|
|
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
|
|
|
|
2019-08-29 12:47:10 +00:00
|
|
|
/* copy of the data that qemu returned */
|
|
|
|
virJSONValuePtr props;
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2019-06-18 16:12:37 +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
|
|
|
};
|
|
|
|
|
2019-06-18 16:12:37 +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-09-23 10:44:36 +00:00
|
|
|
#define QEMU_DOMAIN_VIDEO_PRIVATE(dev) \
|
|
|
|
((qemuDomainVideoPrivatePtr) (dev)->privateData)
|
|
|
|
|
|
|
|
typedef struct _qemuDomainVideoPrivate qemuDomainVideoPrivate;
|
|
|
|
typedef qemuDomainVideoPrivate *qemuDomainVideoPrivatePtr;
|
|
|
|
struct _qemuDomainVideoPrivate {
|
|
|
|
virObject parent;
|
|
|
|
|
2019-09-23 10:44:37 +00:00
|
|
|
int vhost_user_fd;
|
2019-09-23 10:44:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-06-18 16:12:37 +00:00
|
|
|
#define QEMU_DOMAIN_GRAPHICS_PRIVATE(dev) \
|
2019-01-10 14:50:11 +00:00
|
|
|
((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
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-08-08 14:55:02 +00:00
|
|
|
#define QEMU_DOMAIN_NETWORK_PRIVATE(dev) \
|
|
|
|
((qemuDomainNetworkPrivatePtr) (dev)->privateData)
|
|
|
|
|
|
|
|
typedef struct _qemuDomainNetworkPrivate qemuDomainNetworkPrivate;
|
|
|
|
typedef qemuDomainNetworkPrivate *qemuDomainNetworkPrivatePtr;
|
|
|
|
struct _qemuDomainNetworkPrivate {
|
|
|
|
virObject parent;
|
|
|
|
|
2019-08-08 14:55:06 +00:00
|
|
|
qemuSlirpPtr slirp;
|
2019-08-08 14:55:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-12-10 12:53:10 +00:00
|
|
|
#define QEMU_DOMAIN_FS_PRIVATE(dev) \
|
|
|
|
((qemuDomainFSPrivatePtr) (dev)->privateData)
|
|
|
|
|
|
|
|
typedef struct _qemuDomainFSPrivate qemuDomainFSPrivate;
|
|
|
|
typedef qemuDomainFSPrivate *qemuDomainFSPrivatePtr;
|
|
|
|
struct _qemuDomainFSPrivate {
|
|
|
|
virObject parent;
|
|
|
|
|
2019-11-01 11:34:52 +00:00
|
|
|
char *vhostuser_fs_sock;
|
2019-12-10 12:53:10 +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,
|
2018-12-05 09:40:45 +00:00
|
|
|
QEMU_PROCESS_EVENT_JOB_STATUS_CHANGE,
|
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,
|
qemu: support Panic Crashloaded event handling
Pvpanic device supports bit 1 as crashloaded event, it means that
guest actually panicked and run kexec to handle error by guest side.
Handle crashloaded as a lifecyle event in libvirt.
Test case:
Guest side:
before testing, we need make sure kdump is enabled,
1, build new pvpanic driver (with commit from upstream
e0b9a42735f2672ca2764cfbea6e55a81098d5ba
191941692a3d1b6a9614502b279be062926b70f5)
2, insmod new kmod
3, enable crash_kexec_post_notifiers,
# echo 1 > /sys/module/kernel/parameters/crash_kexec_post_notifiers
4, trigger kernel panic
# echo 1 > /proc/sys/kernel/sysrq
# echo c > /proc/sysrq-trigger
Host side:
1, build new qemu with pvpanic patches (with commit from upstream
600d7b47e8f5085919fd1d1157f25950ea8dbc11
7dc58deea79a343ac3adc5cadb97215086054c86)
2, build libvirt with this patch
3, handle lifecycle event and trigger guest side panic
# virsh event stretch --event lifecycle
event 'lifecycle' for domain stretch: Crashed Crashloaded
events received: 1
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2020-02-04 07:41:00 +00:00
|
|
|
QEMU_PROCESS_EVENT_GUEST_CRASHLOADED,
|
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);
|
|
|
|
|
2020-03-16 12:10:24 +00:00
|
|
|
#define QEMU_TYPE_DOMAIN_LOG_CONTEXT qemu_domain_log_context_get_type()
|
|
|
|
G_DECLARE_FINAL_TYPE(qemuDomainLogContext, qemu_domain_log_context, QEMU, DOMAIN_LOG_CONTEXT, GObject);
|
2015-11-12 12:43:29 +00:00
|
|
|
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;
|
2019-08-08 14:55:07 +00:00
|
|
|
bool slirpHelper;
|
2017-06-02 20:50:18 +00:00
|
|
|
};
|
|
|
|
|
2020-01-13 10:06:39 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuDomainSaveCookie, virObjectUnref);
|
2019-06-17 13:07:00 +00:00
|
|
|
|
|
|
|
typedef struct _qemuDomainXmlNsDef qemuDomainXmlNsDef;
|
|
|
|
typedef qemuDomainXmlNsDef *qemuDomainXmlNsDefPtr;
|
|
|
|
struct _qemuDomainXmlNsDef {
|
|
|
|
size_t num_args;
|
|
|
|
char **args;
|
|
|
|
|
|
|
|
unsigned int num_env;
|
|
|
|
char **env_name;
|
|
|
|
char **env_value;
|
2019-06-17 15:17:56 +00:00
|
|
|
|
|
|
|
size_t ncapsadd;
|
|
|
|
char **capsadd;
|
|
|
|
|
|
|
|
size_t ncapsdel;
|
|
|
|
char **capsdel;
|
2019-06-17 13:07:00 +00:00
|
|
|
};
|
|
|
|
|
2020-07-16 11:48:34 +00:00
|
|
|
typedef struct _qemuDomainJobPrivate qemuDomainJobPrivate;
|
|
|
|
typedef qemuDomainJobPrivate *qemuDomainJobPrivatePtr;
|
|
|
|
struct _qemuDomainJobPrivate {
|
|
|
|
bool spiceMigration; /* we asked for spice migration and we
|
|
|
|
* should wait for it to finish */
|
|
|
|
bool spiceMigrated; /* spice migration completed */
|
|
|
|
bool dumpCompleted; /* dump completed */
|
|
|
|
qemuMigrationParamsPtr migParams;
|
|
|
|
};
|
|
|
|
|
2020-02-12 12:26:11 +00:00
|
|
|
int qemuDomainObjStartWorker(virDomainObjPtr dom);
|
|
|
|
void qemuDomainObjStopWorker(virDomainObjPtr dom);
|
|
|
|
|
2019-09-20 09:03:08 +00:00
|
|
|
virDomainObjPtr qemuDomainObjFromDomain(virDomainPtr domain);
|
2019-06-17 13:07:00 +00:00
|
|
|
|
2017-06-02 20:50:18 +00:00
|
|
|
qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm);
|
|
|
|
|
2011-07-08 21:58:28 +00:00
|
|
|
void qemuDomainEventFlush(int timer, void *opaque);
|
2011-02-14 16:09:39 +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)
|
2019-10-14 12:25:14 +00:00
|
|
|
G_GNUC_WARN_UNUSED_RESULT;
|
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)
|
2019-10-14 12:25:14 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
|
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)
|
2019-10-14 12:25:14 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
|
2010-12-16 16:12:02 +00:00
|
|
|
|
2013-06-11 13:03:17 +00:00
|
|
|
virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
|
2019-08-02 15:36:56 +00:00
|
|
|
virQEMUCapsPtr qemuCaps,
|
2013-06-11 13:03:17 +00:00
|
|
|
virDomainDefPtr src,
|
|
|
|
unsigned int flags);
|
|
|
|
|
2012-11-28 16:43:10 +00:00
|
|
|
int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
|
2019-08-05 14:05:20 +00:00
|
|
|
virQEMUCapsPtr qemuCaps,
|
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,
|
2019-08-05 14:05:20 +00:00
|
|
|
virQEMUCapsPtr qemuCaps,
|
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,
|
2019-08-05 14:05:20 +00:00
|
|
|
virQEMUCapsPtr qemuCaps,
|
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,
|
2020-10-04 17:51:27 +00:00
|
|
|
qemuDomainLogContextPtr logCtxt,
|
|
|
|
bool incomingMigration);
|
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,
|
2019-10-15 11:35:07 +00:00
|
|
|
const char *fmt, ...) G_GNUC_PRINTF(2, 3);
|
2015-11-12 12:43:29 +00:00
|
|
|
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,
|
2019-10-15 11:35:07 +00:00
|
|
|
...) G_GNUC_PRINTF(3, 4);
|
2016-06-07 14:19:03 +00:00
|
|
|
|
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,
|
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);
|
|
|
|
|
2019-03-27 07:12:37 +00:00
|
|
|
typedef struct _virQEMUMomentRemove virQEMUMomentRemove;
|
|
|
|
typedef virQEMUMomentRemove *virQEMUMomentRemovePtr;
|
|
|
|
struct _virQEMUMomentRemove {
|
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;
|
2019-03-27 07:12:37 +00:00
|
|
|
virDomainMomentObjPtr current;
|
|
|
|
bool found;
|
|
|
|
int (*momentDiscard)(virQEMUDriverPtr, virDomainObjPtr,
|
|
|
|
virDomainMomentObjPtr, bool, bool);
|
2011-09-21 19:08:51 +00:00
|
|
|
};
|
|
|
|
|
2019-03-27 07:12:37 +00:00
|
|
|
int qemuDomainMomentDiscardAll(void *payload,
|
2020-10-21 11:31:16 +00:00
|
|
|
const char *name,
|
2019-03-27 07:12:37 +00:00
|
|
|
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);
|
|
|
|
|
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
|
|
|
|
2019-09-04 14:58:08 +00:00
|
|
|
int qemuDomainStorageSourceValidateDepth(virStorageSourcePtr src,
|
|
|
|
int add,
|
|
|
|
const char *diskdst);
|
|
|
|
|
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);
|
|
|
|
|
2019-12-03 14:17:23 +00:00
|
|
|
void qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr src,
|
|
|
|
virStorageSourcePtr parentSrc,
|
|
|
|
uid_t *uid,
|
|
|
|
gid_t *gid);
|
|
|
|
|
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
|
|
|
|
2020-01-17 13:28:14 +00:00
|
|
|
const char *
|
|
|
|
qemuDomainDiskGetTopNodename(virDomainDiskDefPtr disk)
|
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2018-06-26 04:58:47 +00:00
|
|
|
int qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
|
|
|
|
virQEMUCapsPtr qemuCaps,
|
|
|
|
char **backendAlias)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
2019-10-14 12:25:14 +00:00
|
|
|
ATTRIBUTE_NONNULL(3) G_GNUC_WARN_UNUSED_RESULT;
|
2018-06-26 04:58:47 +00:00
|
|
|
|
2019-04-18 08:18:51 +00:00
|
|
|
int qemuDomainStorageSourceChainAccessAllow(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr src);
|
|
|
|
int qemuDomainStorageSourceChainAccessRevoke(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr src);
|
2019-04-18 08:04:26 +00:00
|
|
|
|
2019-04-18 07:41:38 +00:00
|
|
|
void qemuDomainStorageSourceAccessRevoke(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr elem);
|
|
|
|
int qemuDomainStorageSourceAccessAllow(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr elem,
|
|
|
|
bool readonly,
|
2020-02-27 10:20:51 +00:00
|
|
|
bool newSource,
|
|
|
|
bool chainTop);
|
2016-02-29 14:39:57 +00:00
|
|
|
|
2018-10-09 09:06:39 +00:00
|
|
|
int qemuDomainPrepareStorageSourceBlockdev(virDomainDiskDefPtr disk,
|
|
|
|
virStorageSourcePtr src,
|
|
|
|
qemuDomainObjPrivatePtr priv,
|
|
|
|
virQEMUDriverConfigPtr cfg);
|
|
|
|
|
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;
|
2019-08-20 21:39:24 +00:00
|
|
|
extern virXMLNamespace 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,
|
2019-08-02 15:36:56 +00:00
|
|
|
virQEMUCapsPtr qemuCaps,
|
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
|
|
|
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);
|
|
|
|
|
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);
|
2020-09-15 02:42:56 +00:00
|
|
|
int 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
|
|
|
|
2019-09-26 11:15:47 +00:00
|
|
|
unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDefPtr def,
|
|
|
|
bool forceVFIO);
|
|
|
|
int qemuDomainAdjustMaxMemLock(virDomainObjPtr vm,
|
|
|
|
bool forceVFIO);
|
2019-09-03 20:09:46 +00:00
|
|
|
int qemuDomainAdjustMaxMemLockHostdev(virDomainObjPtr vm,
|
|
|
|
virDomainHostdevDefPtr hostdev);
|
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);
|
|
|
|
|
2020-03-06 13:44:43 +00:00
|
|
|
void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr secinfo)
|
2017-03-03 12:22:16 +00:00
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
2020-03-16 08:47:17 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuDomainSecretInfo, qemuDomainSecretInfoFree);
|
|
|
|
|
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);
|
|
|
|
|
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);
|
|
|
|
|
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);
|
|
|
|
|
2019-10-22 13:26:14 +00:00
|
|
|
void qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
|
2016-09-13 11:40:50 +00:00
|
|
|
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);
|
|
|
|
|
2019-09-16 15:14:48 +00:00
|
|
|
bool qemuDomainNeedsVFIO(const virDomainDef *def);
|
|
|
|
|
2019-09-17 09:47:59 +00:00
|
|
|
int qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
|
|
|
|
char **path,
|
|
|
|
int *perms);
|
2017-02-09 10:01:29 +00:00
|
|
|
|
2017-02-22 16:51:05 +00:00
|
|
|
virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def,
|
|
|
|
const char *nodename,
|
2020-07-15 10:29:34 +00:00
|
|
|
virStorageSourcePtr *src);
|
2017-02-22 16:51:05 +00:00
|
|
|
|
2017-02-23 17:13:02 +00:00
|
|
|
char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
|
2019-10-08 13:14:22 +00:00
|
|
|
void
|
2018-05-29 15:05:05 +00:00
|
|
|
qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
|
2019-10-08 13:14:22 +00:00
|
|
|
virStorageSourcePtr src);
|
2017-10-17 19:39:41 +00:00
|
|
|
|
2018-05-29 15:28:11 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainValidateStorageSource(virStorageSourcePtr src,
|
2020-05-05 15:00:41 +00:00
|
|
|
virQEMUCapsPtr qemuCaps,
|
|
|
|
bool maskBlockdev);
|
2018-05-29 15:28:11 +00:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2020-09-10 10:32:04 +00:00
|
|
|
int
|
|
|
|
qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev,
|
|
|
|
qemuDomainObjPrivatePtr priv);
|
|
|
|
|
2018-05-14 05:28:05 +00:00
|
|
|
char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv);
|
2018-04-18 14:55:14 +00:00
|
|
|
|
2019-03-21 12:54:20 +00:00
|
|
|
bool qemuDomainDefHasManagedPR(virDomainObjPtr vm);
|
|
|
|
|
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-10-22 13:26:14 +00:00
|
|
|
void
|
2019-10-15 08:31:22 +00:00
|
|
|
qemuDomainNVRAMPathFormat(virQEMUDriverConfigPtr cfg,
|
|
|
|
virDomainDefPtr def,
|
|
|
|
char **path);
|
|
|
|
|
2019-10-22 13:26:14 +00:00
|
|
|
void
|
2019-02-25 15:24:27 +00:00
|
|
|
qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr cfg,
|
|
|
|
virDomainDefPtr def);
|
|
|
|
|
2018-10-09 13:45:50 +00:00
|
|
|
virDomainEventSuspendedDetailType
|
|
|
|
qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason);
|
2019-09-12 22:25:21 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainValidateActualNetDef(const virDomainNetDef *net,
|
|
|
|
virQEMUCapsPtr qemuCaps);
|
2019-09-26 11:54:15 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainSupportsCheckpointsBlockjobs(virDomainObjPtr vm)
|
2019-10-14 12:25:14 +00:00
|
|
|
G_GNUC_WARN_UNUSED_RESULT;
|
2019-10-18 12:33:00 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainMakeCPUMigratable(virCPUDefPtr cpu);
|
2019-11-15 15:25:26 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainInitializePflashStorageSource(virDomainObjPtr vm);
|
2020-04-17 09:09:58 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
qemuDomainDiskBlockJobIsSupported(virDomainObjPtr vm,
|
|
|
|
virDomainDiskDefPtr disk);
|
2020-06-10 18:35:51 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainDefNumaCPUsRectify(virDomainDefPtr def,
|
|
|
|
virQEMUCapsPtr qemuCaps);
|
2020-08-17 05:07:19 +00:00
|
|
|
|
|
|
|
void qemuDomainRemoveInactiveJob(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
|
|
|
void qemuDomainRemoveInactiveJobLocked(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm);
|
2020-07-16 09:17:47 +00:00
|
|
|
|
2020-08-24 15:38:05 +00:00
|
|
|
int virQEMUFileOpenAs(uid_t fallback_uid,
|
|
|
|
gid_t fallback_gid,
|
|
|
|
bool dynamicOwnership,
|
|
|
|
const char *path,
|
|
|
|
int oflags,
|
|
|
|
bool *needUnlink);
|
|
|
|
|
2020-07-16 09:17:47 +00:00
|
|
|
int
|
|
|
|
qemuDomainOpenFile(virQEMUDriverPtr driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
const char *path,
|
|
|
|
int oflags,
|
|
|
|
bool *needUnlink);
|
2020-07-16 09:40:34 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainFileWrapperFDClose(virDomainObjPtr vm,
|
|
|
|
virFileWrapperFdPtr fd);
|
2020-10-08 14:22:50 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
qemuDomainInterfaceSetDefaultQDisc(virQEMUDriverPtr driver,
|
|
|
|
virDomainNetDefPtr net);
|