[PATCH libvirt-dbus 0/2] Introduce libivirt-dbus systemd unit
by Katerina Koukiou
For distributions that are using systemd introduce a
libvirt-dbus.service and have 'libvirt' group as supplementary
group for the spawned libvirt-dbus process. This will allow ubuntu
users (SocketMode is 0660 in newer ubuntu), to use system connection
without extra configuration.
Katerina Koukiou (2):
meson: generate systemd unit file for libvirt-dbus
systemd: use SupplementaryGroups=libvirt so that ubuntu users can use
the system connection
data/system/libvirt-dbus.service.in | 22 ++++++++++++++++
data/system/meson.build | 30 +++++++++++++++++-----
data/system/org.libvirt-systemd.service.in | 5 ++++
libvirt-dbus.spec.in | 4 ++-
meson.build | 12 +++++++++
meson_options.txt | 1 +
6 files changed, 67 insertions(+), 7 deletions(-)
create mode 100644 data/system/libvirt-dbus.service.in
create mode 100644 data/system/org.libvirt-systemd.service.in
--
2.26.2
4 years, 2 months
[PATCH] qemu_validate: Only allow none address for watchdog ib700
by Han Han
Since QEMU 1.5.3, the ib700 watchdog device has no options for address,
and not address in device tree:
$ /usr/libexec/qemu-kvm -version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-175.el7), Copyright (c) 2003-2008 Fabrice Bellard
$ /usr/libexec/qemu-kvm -device ib700,\?
$ virsh qemu-monitor-command seabios --hmp info qtree|grep ib700 -A 2
dev: ib700, id "watchdog0"
dev: isa-serial, id "serial0"
index = 0
So only allow it to use none address.
https://bugzilla.redhat.com/show_bug.cgi?id=1509908
Signed-off-by: Han Han <hhan(a)redhat.com>
---
src/qemu/qemu_validate.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 488f258d00..0e5ca81ab4 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1637,8 +1637,7 @@ qemuValidateDomainWatchdogDef(const virDomainWatchdogDef *dev,
break;
case VIR_DOMAIN_WATCHDOG_MODEL_IB700:
- if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
- dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) {
+ if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("%s model of watchdog can go only on ISA bus"),
virDomainWatchdogModelTypeToString(dev->model));
--
2.27.0
4 years, 2 months
[GSoC] Take migration in Salt virt module to the next level
by Radostin Stoyanov
Hello again libvirt community!
This summer, I once again worked on a GSoC project with libvirt. This
time, the goal of my project was to improve the libvirt integration with
SaltStack and, in particular, the support for VM migration.
SaltStack is an incredibly valuable tool that helps with automation and
infrastructure management. This is accomplished with master/minion
topology where a master acts as a central control bus for the clients
(minions), and the minions connect back to the master. The Salt virt
module provides support for core cloud operations such as VM lifecycle
management, including VM migration, by allowing minions to connect with
libvirt virtualization host.
The Salt virt.migrate interface allows users to migrate a VM from one
host to another. However, the implementation of this function used to be
based on the virsh command-line tool (instead of the libvirt Python API
bindings), which had resulted in an increased code complexity (e.g.,
string concatenation, invoking Popen.subprocess, etc) and had a limited
number of migration options exposed to users.
My project was roughly separated into three phases. The aim of the first
phase was to improve the test coverage of the virt module by increasing
the number of integration tests (i.e., before applying any major code
changes). However, SaltStack is designed to run on different platforms,
and it has been extended over the years to support many applications and
tools. Consequently, the SaltStack test suite has grown in complexity
and number of dependencies as well. As a result, not all of them (e.g.,
libvirt and qemu) are available in the Jenkins CI environment. In
addition, our goal was to only be able to effectively test VM lifecycle
management features (start, destroy, list, etc.) but also to test VM
migration. To achieve this we packaged libvirt, qemu, and all required
SaltStack minion dependencies in a container image that allows us to
spawn multiple virtualization host instances on a single machine (with
low virtualization overhead).
In the second phase of the project, now with a test environment in
place, we were able to refactor the virt.migrate implementation to
utilize the Python bindings of libvirt and add support for additional
migration options (described in the “What's new?” section below).
The third phase was primarily focused on refining the set patches,
resolving merge conflicts with upstream changes or other related PRs.
One of the major challenges was to revisit the set of tests to make them
compatible with pytest as well to collaborate with the SaltStack
community to ensure that all proposed changes will be easy to maintain
in the future.
Contributions
============
Although the development work was done in several iterations, with code
reviews on regular basis, the final result was consolidated in a single
GitHub pull request: https://github.com/saltstack/salt/pull/57947
What’s new?
===========
https://docs.saltstack.com/en/master/ref/modules/all/salt.modules.virt.ht...
The virt.migrate interface of SaltStack has been extended to support
target URI format:
$ salt src virt.migrate guest qemu+ssh://dst/system
$ salt src virt.migrate guest qemu+tcp://dst/system
$ salt src virt.migrate guest qemu+tls://dst/system
with preserved backward compatibility:
$ salt src virt.migrate guest dst
$ salt src virt.migrate guest dst True
Support for the following migration options was introduced:
Disable live migration
$ salt src virt.migrate guest qemu+ssh://dst/system live=False
Leave the migrated VM transient on destination host
$ salt src virt.migrate guest qemu+ssh://dst/system persistent=False
Leave the domain defined on the source host
$ salt src virt.migrate guest qemu+ssh://dst/system undefinesource=False
Offline migration
$ salt src virt.migrate guest qemu+ssh://dst/system offline=False
Set maximum bandwidth (in MiB/s)
$ salt src virt.migrate guest qemu+tls://dst/system max_bandwidth=10
Set maximum tolerable downtime for live-migration (i.e. a number of
milliseconds the VM is allowed to be down at the end of live migration)
$ salt src virt.migrate guest qemu+tls://dst/system max_downtime=100
Set a number of parallel network connections for live migration
$ salt src virt.migrate guest qemu+tls://dst/system parallel_connections=10
Live migration with enabled compression
$ salt src virt.migrate guest qemu+tls://dst/system \
compressed=True \
comp_methods=mt \
comp_mt_level=5 \
comp_mt_threads=4 \
comp_mt_dthreads=4
$ salt src virt.migrate guest qemu+tls://dst/system \
compressed=True \
comp_methods=xbzrle \
comp_xbzrle_cache=1024
Migrate non-shared storage
(Full disk copy)
$ salt src virt.migrate guest qemu+tls://dst/system copy_storage=all
(Incremental copy)
$ salt src virt.migrate guest qemu+tls://dst/system copy_storage=inc
Using post-copy migration
$ salt src virt.migrate guest qemu+tls://dst/system postcopy=True
$ salt src virt.migrate_start_postcopy guest
Using post-copy migration with bandwidth limit (MiB/s)
$ salt src virt.migrate guest qemu+tls://dst/system \
postcopy=True \
postcopy_bandwidth=1
$ salt src virt.migrate_start_postcopy guest
Acknowledgments
===============
I would like to sincerely thank all those who provided me with their
time, assistance, and guidance during the course of this project, for
which I am enormously grateful.
I would like to thank Cedric Bosdonnat (cbosdo), Pedro Algarvio
(s0undt3ch), Wayne Werner (waynew), Charles McMarrow (cmcmarrow) and
Daniel Wozniak (dwoz) who offered a huge amount of support, expertise,
guidance and code reviews.
I would also like to thank Michal Privoznik (mprivozn), Martin
Kletzander (mkletzan) and the rest of the libvirt and SaltStack
communities who have been extremely supportive.
Best wishes,
Radostin
4 years, 2 months
[GSoC PATCH 3/9] Jailhouse driver: Implementation of ConnectGetType
by Prakhar Bansal
---
src/jailhouse/jailhouse_driver.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/jailhouse/jailhouse_driver.c b/src/jailhouse/jailhouse_driver.c
index ac9da4c85d..75bf41fc11 100644
--- a/src/jailhouse/jailhouse_driver.c
+++ b/src/jailhouse/jailhouse_driver.c
@@ -32,8 +32,10 @@
#include "viralloc.h"
#include "virfile.h"
#include "virlog.h"
+#include "virutil.h"
#include "vircommand.h"
#include "virpidfile.h"
+#include "access/viraccessapicheck.h"
#define VIR_FROM_THIS VIR_FROM_JAILHOUSE
@@ -241,16 +243,19 @@ jailhouseStateInitialize(bool privileged G_GNUC_UNUSED,
static const char *
jailhouseConnectGetType(virConnectPtr conn)
{
- UNUSED(conn);
- return NULL;
+ if (virConnectGetTypeEnsureACL(conn) < 0)
+ return NULL;
+ return "JAILHOUSE";
}
static char *
jailhouseConnectGetHostname(virConnectPtr conn)
{
- UNUSED(conn);
- return NULL;
+ if (virConnectGetHostnameEnsureACL(conn) < 0)
+ return NULL;
+
+ return virGetHostname();
}
static int
@@ -263,7 +268,7 @@ jailhouseNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
static int
jailhouseConnectListAllDomains(virConnectPtr conn,
- virDomainPtr ** domain, unsigned int flags)
+ virDomainPtr **domain, unsigned int flags)
{
UNUSED(conn);
UNUSED(domain);
@@ -300,7 +305,6 @@ jailhouseDomainCreate(virDomainPtr domain)
{
UNUSED(domain);
return -1;
-
}
static int
@@ -350,18 +354,18 @@ static virHypervisorDriver jailhouseHypervisorDriver = {
.connectOpen = jailhouseConnectOpen, /* 6.3.0 */
.connectClose = jailhouseConnectClose, /* 6.3.0 */
.connectListAllDomains = jailhouseConnectListAllDomains, /* 6.3.0 */
- .domainLookupByID = jailhouseDomainLookupByID, /* 6.3.0 */
- .domainLookupByUUID = jailhouseDomainLookupByUUID, /* 6.3.0 */
- .domainLookupByName = jailhouseDomainLookupByName, /* 6.3.0 */
- .domainGetXMLDesc = jailhouseDomainGetXMLDesc, /* 6.3.0 */
- .domainCreate = jailhouseDomainCreate, /* 6.3.0 */
.connectGetType = jailhouseConnectGetType, /* 6.3.0 */
.connectGetHostname = jailhouseConnectGetHostname, /* 6.3.0 */
- .nodeGetInfo = jailhouseNodeGetInfo, /* 6.3.0 */
+ .domainCreate = jailhouseDomainCreate, /* 6.3.0 */
.domainShutdown = jailhouseDomainShutdown, /* 6.3.0 */
.domainDestroy = jailhouseDomainDestroy, /* 6.3.0 */
.domainGetInfo = jailhouseDomainGetInfo, /* 6.3.0 */
.domainGetState = jailhouseDomainGetState, /* 6.3.0 */
+ .domainLookupByID = jailhouseDomainLookupByID, /* 6.3.0 */
+ .domainLookupByUUID = jailhouseDomainLookupByUUID, /* 6.3.0 */
+ .domainLookupByName = jailhouseDomainLookupByName, /* 6.3.0 */
+ .domainGetXMLDesc = jailhouseDomainGetXMLDesc, /* 6.3.0 */
+ .nodeGetInfo = jailhouseNodeGetInfo, /* 6.3.0 */
};
--
2.17.1
4 years, 2 months
[PATCH] tests/meson: fix mock library link on MacOS
by Scott Shambarger
MacOS can not pre-load modules, so mock libraries must be built
as shared libraries (without asneeded striping, and undefined
symbols allowed).
Signed-off-by: Scott Shambarger <scott-libvirt(a)shambarger.net>
---
tests/meson.build | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/meson.build b/tests/meson.build
index b5f6e2267a..d7476452ba 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -120,9 +120,13 @@ if conf.has('WITH_SECDRIVER_SELINUX')
endif
foreach mock : mock_libs
- shared_module(
+ shared_library(
mock['name'],
mock.get('sources', [ '@0@.c'.format(mock['name']) ]),
+ override_options: [
+ 'b_asneeded=false',
+ 'b_lundef=false',
+ ],
dependencies: [
tests_dep,
mock.get('deps', []),
--
2.24.3 (Apple Git-128)
4 years, 2 months
[GSoC PATCH 0/9] Libvirt Driver for Jailhouse Hypervisor
by Prakhar Bansal
From: Prakhar Bansal <itsprakhar(a)gmail.com>
My name is Prakhar Bansal and I am a graduate student at Iowa State
University, Iowa, USA. During the last 3 months of GSoC'20, I worked on
adding support for a new driver for the Jailhouse hypervisor. Following is
the implementation of various Libvirt driver callbacks in the driver
pertaining to hypervisor connection and domain lifecycle. This driver is a
state driver which initializes the driver state during the libvirtd daemon
start and uses it during many connection lifecycles. Please check the
design doc for the driver(check the project's link at GSOC-2020 website)
for more details.
Prakhar Bansal (9):
Jailhouse driver: first commit with skeleton code
Jailhouse driver: Implementation of ConnectOpen
Jailhouse driver: Implementation of ConnectGetType
Jailhouse driver: Implementation of DomainCreate* callbacks
Jailhouse driver: Implementation of DomainInfo/State/List
Jailhouse driver: Implementation of DomainLookup* callbacks
Jailhouse driver: Implementation of DomainShutdown/Destroy callbacks
Jailhouse driver: Fixes for creation of cells, fetching cell info,
disabling jailhouse hypervisor
Jailhouse driver: Add events to events queue in
DomainCreate/Shutdown/Destroy
include/libvirt/virterror.h | 1 +
libvirt.spec.in | 7 +
m4/virt-driver-jailhouse.m4 | 42 ++
meson.build | 4 +
meson_options.txt | 1 +
po/POTFILES.in | 2 +
src/conf/domain_conf.c | 1 +
src/conf/domain_conf.h | 1 +
src/jailhouse/Makefile.inc.am | 47 ++
src/jailhouse/jailhouse.conf | 10 +
src/jailhouse/jailhouse_api.c | 458 +++++++++++++++
src/jailhouse/jailhouse_api.h | 103 ++++
src/jailhouse/jailhouse_driver.c | 837 +++++++++++++++++++++++++++
src/jailhouse/jailhouse_driver.h | 82 +++
src/jailhouse/libvirtd_jailhouse.aug | 43 ++
src/jailhouse/meson.build | 49 ++
src/meson.build | 1 +
src/qemu/qemu_command.c | 1 +
src/remote/remote_daemon.c | 4 +
src/remote/remote_daemon_dispatch.c | 3 +-
src/util/virerror.c | 1 +
21 files changed, 1697 insertions(+), 1 deletion(-)
create mode 100644 m4/virt-driver-jailhouse.m4
create mode 100644 src/jailhouse/Makefile.inc.am
create mode 100644 src/jailhouse/jailhouse.conf
create mode 100644 src/jailhouse/jailhouse_api.c
create mode 100644 src/jailhouse/jailhouse_api.h
create mode 100644 src/jailhouse/jailhouse_driver.c
create mode 100644 src/jailhouse/jailhouse_driver.h
create mode 100644 src/jailhouse/libvirtd_jailhouse.aug
create mode 100644 src/jailhouse/meson.build
--
2.17.1
4 years, 2 months
[PATCH] qemu: Validate memory hotplug in domainValidateCallback instead of cmd line generator
by Michal Privoznik
When editing a domain with hotplug enabled, I removed the only
NUMA node it had and got no error. I got the error later though,
when starting the domain. This is not as user friendly as it can
be. Move the validation call out from command line generator and
into domain validator (which is called prior to starting cmd line
generation anyway).
When doing this, I had to remove memory-hotplug-nonuma xml2xml
test case because there is no way the test case can succeed,
obviously.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_command.c | 3 --
src/qemu/qemu_domain.c | 2 ++
src/qemu/qemu_validate.c | 3 ++
tests/qemuxml2argvtest.c | 2 +-
.../memory-hotplug-nonuma.xml | 28 -------------------
tests/qemuxml2xmltest.c | 14 ++++++----
6 files changed, 14 insertions(+), 38 deletions(-)
delete mode 100644 tests/qemuxml2xmloutdata/memory-hotplug-nonuma.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6798febf8d..bd98b0a97c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7123,9 +7123,6 @@ qemuBuildMemCommandLine(virCommandPtr cmd,
virQEMUCapsPtr qemuCaps,
qemuDomainObjPrivatePtr priv)
{
- if (qemuDomainDefValidateMemoryHotplug(def, qemuCaps, NULL) < 0)
- return -1;
-
virCommandAddArg(cmd, "-m");
if (virDomainDefHasMemoryHotplug(def)) {
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 21f24fceed..aa0f5c1a2d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8468,6 +8468,8 @@ qemuCheckMemoryDimmConflict(const virDomainDef *def,
return false;
}
+
+
static int
qemuDomainDefValidateMemoryHotplugDevice(const virDomainMemoryDef *mem,
const virDomainDef *def)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index c4b86326ad..6f3fee5427 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -916,6 +916,9 @@ qemuValidateDomainDef(const virDomainDef *def,
}
}
+ if (qemuDomainDefValidateMemoryHotplug(def, qemuCaps, NULL) < 0)
+ return -1;
+
if (qemuValidateDomainDefClockTimers(def, qemuCaps) < 0)
return -1;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 01839cb88c..e93948e3fc 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2931,7 +2931,7 @@ mymain(void)
DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM);
DO_TEST_FAILURE("memory-align-fail", NONE);
- DO_TEST_FAILURE("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
+ DO_TEST_PARSE_ERROR("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
DO_TEST("memory-hotplug", NONE);
DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nonuma.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nonuma.xml
deleted file mode 100644
index 7c277f01a3..0000000000
--- a/tests/qemuxml2xmloutdata/memory-hotplug-nonuma.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<domain type='qemu'>
- <name>QEMUGuest1</name>
- <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
- <maxMemory slots='9' unit='KiB'>1233456789</maxMemory>
- <memory unit='KiB'>219136</memory>
- <currentMemory unit='KiB'>219136</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='i686' machine='pc'>hvm</type>
- <boot dev='hd'/>
- </os>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>destroy</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-i386</emulator>
- <controller type='usb' index='0'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
- </controller>
- <controller type='pci' index='0' model='pci-root'/>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <memballoon model='virtio'>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
- </memballoon>
- </devices>
-</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index a07e2b7553..6eb008c8d2 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -303,18 +303,21 @@ mymain(void)
DO_TEST("pages-discard", NONE);
DO_TEST("pages-discard-hugepages", QEMU_CAPS_OBJECT_MEMORY_FILE);
- DO_TEST("pages-dimm-discard", NONE);
+ DO_TEST("pages-dimm-discard", QEMU_CAPS_DEVICE_PC_DIMM);
DO_TEST("hugepages-default", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("hugepages-default-2M", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("hugepages-default-system-size", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("hugepages-nodeset", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("hugepages-numa-default-2M", QEMU_CAPS_OBJECT_MEMORY_FILE);
- DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_OBJECT_MEMORY_FILE);
+ DO_TEST("hugepages-numa-default-dimm", QEMU_CAPS_DEVICE_PC_DIMM,
+ QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("hugepages-numa-nodeset", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("hugepages-numa-nodeset-part", QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("hugepages-shared", QEMU_CAPS_OBJECT_MEMORY_FILE);
- DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE);
- DO_TEST("hugepages-memaccess2", QEMU_CAPS_OBJECT_MEMORY_FILE);
+ DO_TEST("hugepages-memaccess", QEMU_CAPS_DEVICE_PC_DIMM,
+ QEMU_CAPS_OBJECT_MEMORY_FILE);
+ DO_TEST("hugepages-memaccess2", QEMU_CAPS_DEVICE_PC_DIMM,
+ QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("hugepages-nvdimm", QEMU_CAPS_DEVICE_NVDIMM,
QEMU_CAPS_OBJECT_MEMORY_FILE);
DO_TEST("nosharepages", NONE);
@@ -1260,8 +1263,7 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64");
DO_TEST("memory-hotplug", NONE);
- DO_TEST("memory-hotplug-nonuma", NONE);
- DO_TEST("memory-hotplug-dimm", NONE);
+ DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM);
DO_TEST("memory-hotplug-nvdimm", QEMU_CAPS_DEVICE_NVDIMM);
DO_TEST("memory-hotplug-nvdimm-access", QEMU_CAPS_DEVICE_NVDIMM);
DO_TEST("memory-hotplug-nvdimm-label", QEMU_CAPS_DEVICE_NVDIMM);
--
2.26.2
4 years, 2 months
[PATCH] virmigraiton: `qemuMigrationJobPhase` transformed for more generic use
by Prathamesh Chavan
`qemuMigrationJobPhase` was transformed into `virMigrationJobPhase`
and a common util file `virmigration` was created to store its
defination.
This is one of the initial steps we are taking towards making
more and more code hypervisor agnostic. And this shall
be followed by transformation of similar structs in the future.
Signed-off-by: Prathamesh Chavan <pc44800(a)gmail.com>
---
This new version is sent specifically so that this
patch is sent out separately.
Previous version of this patch and related discussion can be found
here[1].
[1]: https://www.redhat.com/archives/libvir-list/2020-August/msg00478.html
src/hypervisor/meson.build | 1 +
src/hypervisor/virmigration.c | 41 +++++++++++++++++++
src/hypervisor/virmigration.h | 38 ++++++++++++++++++
src/libvirt_private.syms | 4 ++
src/qemu/MIGRATION.txt | 8 ++--
src/qemu/qemu_domainjob.c | 4 +-
src/qemu/qemu_migration.c | 74 +++++++++++++++++------------------
src/qemu/qemu_migration.h | 17 +-------
src/qemu/qemu_process.c | 48 +++++++++++------------
9 files changed, 151 insertions(+), 84 deletions(-)
create mode 100644 src/hypervisor/virmigration.c
create mode 100644 src/hypervisor/virmigration.h
diff --git a/src/hypervisor/meson.build b/src/hypervisor/meson.build
index 85149c683e..c81bdfa2fc 100644
--- a/src/hypervisor/meson.build
+++ b/src/hypervisor/meson.build
@@ -3,6 +3,7 @@ hypervisor_sources = [
'domain_driver.c',
'virclosecallbacks.c',
'virhostdev.c',
+ 'virmigration.c',
]
hypervisor_lib = static_library(
diff --git a/src/hypervisor/virmigration.c b/src/hypervisor/virmigration.c
new file mode 100644
index 0000000000..2cad5a6b1b
--- /dev/null
+++ b/src/hypervisor/virmigration.c
@@ -0,0 +1,41 @@
+/*
+ * virmigration.c: hypervisor migration handling
+ *
+ * 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
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "virmigration.h"
+#include "domain_driver.h"
+#include "virlog.h"
+
+#define VIR_FROM_THIS VIR_FROM_DOMAIN
+
+VIR_LOG_INIT("util.migration");
+
+VIR_ENUM_IMPL(virMigrationJobPhase,
+ VIR_MIGRATION_PHASE_LAST,
+ "none",
+ "perform2",
+ "begin3",
+ "perform3",
+ "perform3_done",
+ "confirm3_cancelled",
+ "confirm3",
+ "prepare",
+ "finish2",
+ "finish3",
+);
diff --git a/src/hypervisor/virmigration.h b/src/hypervisor/virmigration.h
new file mode 100644
index 0000000000..e03d71c1bb
--- /dev/null
+++ b/src/hypervisor/virmigration.h
@@ -0,0 +1,38 @@
+/*
+ * virmigration.h: hypervisor migration handling
+ *
+ * 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
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "virenum.h"
+
+
+typedef enum {
+ VIR_MIGRATION_PHASE_NONE = 0,
+ VIR_MIGRATION_PHASE_PERFORM2,
+ VIR_MIGRATION_PHASE_BEGIN3,
+ VIR_MIGRATION_PHASE_PERFORM3,
+ VIR_MIGRATION_PHASE_PERFORM3_DONE,
+ VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED,
+ VIR_MIGRATION_PHASE_CONFIRM3,
+ VIR_MIGRATION_PHASE_PREPARE,
+ VIR_MIGRATION_PHASE_FINISH2,
+ VIR_MIGRATION_PHASE_FINISH3,
+
+ VIR_MIGRATION_PHASE_LAST
+} virMigrationJobPhase;
+VIR_ENUM_DECL(virMigrationJobPhase);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 01c2e710cd..cf78c2f27a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1474,6 +1474,10 @@ virHostdevUpdateActiveSCSIDevices;
virHostdevUpdateActiveUSBDevices;
+# hypervisor/virmigration.h
+virMigrationJobPhaseTypeFromString;
+virMigrationJobPhaseTypeToString;
+
# libvirt_internal.h
virConnectSupportsFeature;
virDomainMigrateBegin3;
diff --git a/src/qemu/MIGRATION.txt b/src/qemu/MIGRATION.txt
index e861fd001e..dd044c6064 100644
--- a/src/qemu/MIGRATION.txt
+++ b/src/qemu/MIGRATION.txt
@@ -74,7 +74,7 @@ The sequence of calling qemuMigrationJob* helper methods is as follows:
migration type and version) has to start migration job and keep it active:
qemuMigrationJobStart(driver, vm, QEMU_JOB_MIGRATION_{IN,OUT});
- qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_*);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_*);
...do work...
qemuMigrationJobContinue(vm);
@@ -82,7 +82,7 @@ The sequence of calling qemuMigrationJob* helper methods is as follows:
if (!qemuMigrationJobIsActive(vm, QEMU_JOB_MIGRATION_{IN,OUT}))
return;
- qemuMigrationJobStartPhase(driver, vm, QEMU_MIGRATION_PHASE_*);
+ qemuMigrationJobStartPhase(driver, vm, VIR_MIGRATION_PHASE_*);
...do work...
qemuMigrationJobContinue(vm);
@@ -90,11 +90,11 @@ The sequence of calling qemuMigrationJob* helper methods is as follows:
if (!qemuMigrationJobIsActive(vm, QEMU_JOB_MIGRATION_{IN,OUT}))
return;
- qemuMigrationJobStartPhase(driver, vm, QEMU_MIGRATION_PHASE_*);
+ qemuMigrationJobStartPhase(driver, vm, VIR_MIGRATION_PHASE_*);
...do work...
qemuMigrationJobFinish(driver, vm);
While migration job is running (i.e., after qemuMigrationJobStart* but before
qemuMigrationJob{Continue,Finish}), migration phase can be advanced using
- qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_*);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_*);
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index 52d3031baf..47c1da2bfe 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -70,7 +70,7 @@ qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
switch (job) {
case QEMU_ASYNC_JOB_MIGRATION_OUT:
case QEMU_ASYNC_JOB_MIGRATION_IN:
- return qemuMigrationJobPhaseTypeToString(phase);
+ return virMigrationJobPhaseTypeToString(phase);
case QEMU_ASYNC_JOB_SAVE:
case QEMU_ASYNC_JOB_DUMP:
@@ -96,7 +96,7 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
switch (job) {
case QEMU_ASYNC_JOB_MIGRATION_OUT:
case QEMU_ASYNC_JOB_MIGRATION_IN:
- return qemuMigrationJobPhaseTypeFromString(phase);
+ return virMigrationJobPhaseTypeFromString(phase);
case QEMU_ASYNC_JOB_SAVE:
case QEMU_ASYNC_JOB_DUMP:
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 142faa2cf9..a6f1da97bd 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -67,8 +67,8 @@
VIR_LOG_INIT("qemu.qemu_migration");
-VIR_ENUM_IMPL(qemuMigrationJobPhase,
- QEMU_MIGRATION_PHASE_LAST,
+VIR_ENUM_IMPL(virMigrationJobPhase,
+ VIR_MIGRATION_PHASE_LAST,
"none",
"perform2",
"begin3",
@@ -91,13 +91,13 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
static void
qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- qemuMigrationJobPhase phase)
+ virMigrationJobPhase phase)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
static void
qemuMigrationJobStartPhase(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- qemuMigrationJobPhase phase)
+ virMigrationJobPhase phase)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
static void
@@ -2023,13 +2023,13 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm,
" was closed; canceling the migration",
vm->def->name);
- switch ((qemuMigrationJobPhase) priv->job.phase) {
- case QEMU_MIGRATION_PHASE_BEGIN3:
+ switch ((virMigrationJobPhase) priv->job.phase) {
+ case VIR_MIGRATION_PHASE_BEGIN3:
/* just forget we were about to migrate */
qemuDomainObjDiscardAsyncJob(driver, vm);
break;
- case QEMU_MIGRATION_PHASE_PERFORM3_DONE:
+ case VIR_MIGRATION_PHASE_PERFORM3_DONE:
VIR_WARN("Migration of domain %s finished but we don't know if the"
" domain was successfully started on destination or not",
vm->def->name);
@@ -2039,19 +2039,19 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm,
qemuDomainObjDiscardAsyncJob(driver, vm);
break;
- case QEMU_MIGRATION_PHASE_PERFORM3:
+ case VIR_MIGRATION_PHASE_PERFORM3:
/* cannot be seen without an active migration API; unreachable */
- case QEMU_MIGRATION_PHASE_CONFIRM3:
- case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED:
+ case VIR_MIGRATION_PHASE_CONFIRM3:
+ case VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED:
/* all done; unreachable */
- case QEMU_MIGRATION_PHASE_PREPARE:
- case QEMU_MIGRATION_PHASE_FINISH2:
- case QEMU_MIGRATION_PHASE_FINISH3:
+ case VIR_MIGRATION_PHASE_PREPARE:
+ case VIR_MIGRATION_PHASE_FINISH2:
+ case VIR_MIGRATION_PHASE_FINISH3:
/* incoming migration; unreachable */
- case QEMU_MIGRATION_PHASE_PERFORM2:
+ case VIR_MIGRATION_PHASE_PERFORM2:
/* single phase outgoing migration; unreachable */
- case QEMU_MIGRATION_PHASE_NONE:
- case QEMU_MIGRATION_PHASE_LAST:
+ case VIR_MIGRATION_PHASE_NONE:
+ case VIR_MIGRATION_PHASE_LAST:
/* unreachable */
;
}
@@ -2087,7 +2087,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver,
* change protection.
*/
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
- qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_BEGIN3);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_BEGIN3);
if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
return NULL;
@@ -2546,7 +2546,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
flags) < 0)
goto cleanup;
- qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PREPARE);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PREPARE);
/* Domain starts inactive, even if the domain XML had an id field. */
vm->def->id = -1;
@@ -3007,10 +3007,9 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
- qemuMigrationJobSetPhase(driver, vm,
- retcode == 0
- ? QEMU_MIGRATION_PHASE_CONFIRM3
- : QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED);
+ qemuMigrationJobSetPhase(driver, vm, retcode == 0
+ ? VIR_MIGRATION_PHASE_CONFIRM3
+ : VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED);
if (!(mig = qemuMigrationEatCookie(driver, vm->def, priv->origname, priv,
cookiein, cookieinlen,
@@ -3100,7 +3099,7 @@ qemuMigrationSrcConfirm(virQEMUDriverPtr driver,
unsigned int flags,
int cancelled)
{
- qemuMigrationJobPhase phase;
+ virMigrationJobPhase phase;
virQEMUDriverConfigPtr cfg = NULL;
int ret = -1;
@@ -3110,9 +3109,9 @@ qemuMigrationSrcConfirm(virQEMUDriverPtr driver,
goto cleanup;
if (cancelled)
- phase = QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED;
+ phase = VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED;
else
- phase = QEMU_MIGRATION_PHASE_CONFIRM3;
+ phase = VIR_MIGRATION_PHASE_CONFIRM3;
qemuMigrationJobStartPhase(driver, vm, phase);
virCloseCallbacksUnset(driver->closeCallbacks, vm,
@@ -4059,7 +4058,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr driver,
* until the migration is complete.
*/
VIR_DEBUG("Perform %p", sconn);
- qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM2);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM2);
if (flags & VIR_MIGRATE_TUNNELLED)
ret = qemuMigrationSrcPerformTunnel(driver, vm, st, NULL,
NULL, 0, NULL, NULL,
@@ -4297,7 +4296,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
* confirm migration completion.
*/
VIR_DEBUG("Perform3 %p uri=%s", sconn, NULLSTR(uri));
- qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM3);
VIR_FREE(cookiein);
cookiein = g_steal_pointer(&cookieout);
cookieinlen = cookieoutlen;
@@ -4322,8 +4321,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
if (ret < 0) {
virErrorPreserveLast(&orig_err);
} else {
- qemuMigrationJobSetPhase(driver, vm,
- QEMU_MIGRATION_PHASE_PERFORM3_DONE);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM3_DONE);
}
/* If Perform returns < 0, then we need to cancel the VM
@@ -4687,7 +4685,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
migParams, flags, dname, resource,
&v3proto);
} else {
- qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM2);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM2);
ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
cookieout, cookieoutlen,
flags, resource, NULL, NULL, 0, NULL,
@@ -4772,7 +4770,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
return ret;
}
- qemuMigrationJobStartPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3);
+ qemuMigrationJobStartPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM3);
virCloseCallbacksUnset(driver->closeCallbacks, vm,
qemuMigrationSrcCleanup);
@@ -4786,7 +4784,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
goto endjob;
}
- qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE);
+ qemuMigrationJobSetPhase(driver, vm, VIR_MIGRATION_PHASE_PERFORM3_DONE);
if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
qemuMigrationSrcCleanup) < 0)
@@ -5019,8 +5017,8 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver,
ignore_value(virTimeMillisNow(&timeReceived));
qemuMigrationJobStartPhase(driver, vm,
- v3proto ? QEMU_MIGRATION_PHASE_FINISH3
- : QEMU_MIGRATION_PHASE_FINISH2);
+ v3proto ? VIR_MIGRATION_PHASE_FINISH3
+ : VIR_MIGRATION_PHASE_FINISH2);
qemuDomainCleanupRemove(vm, qemuMigrationDstPrepareCleanup);
g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree);
@@ -5498,14 +5496,14 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
static void
qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- qemuMigrationJobPhase phase)
+ virMigrationJobPhase phase)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
if (phase < priv->job.phase) {
VIR_ERROR(_("migration protocol going backwards %s => %s"),
- qemuMigrationJobPhaseTypeToString(priv->job.phase),
- qemuMigrationJobPhaseTypeToString(phase));
+ virMigrationJobPhaseTypeToString(priv->job.phase),
+ virMigrationJobPhaseTypeToString(phase));
return;
}
@@ -5515,7 +5513,7 @@ qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
static void
qemuMigrationJobStartPhase(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- qemuMigrationJobPhase phase)
+ virMigrationJobPhase phase)
{
qemuMigrationJobSetPhase(driver, vm, phase);
}
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index b6f88d3fd9..b05f5254b4 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -24,6 +24,7 @@
#include "qemu_conf.h"
#include "qemu_domain.h"
#include "qemu_migration_params.h"
+#include "virmigration.h"
#include "virenum.h"
/*
@@ -87,22 +88,6 @@
NULL
-typedef enum {
- QEMU_MIGRATION_PHASE_NONE = 0,
- QEMU_MIGRATION_PHASE_PERFORM2,
- QEMU_MIGRATION_PHASE_BEGIN3,
- QEMU_MIGRATION_PHASE_PERFORM3,
- QEMU_MIGRATION_PHASE_PERFORM3_DONE,
- QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED,
- QEMU_MIGRATION_PHASE_CONFIRM3,
- QEMU_MIGRATION_PHASE_PREPARE,
- QEMU_MIGRATION_PHASE_FINISH2,
- QEMU_MIGRATION_PHASE_FINISH3,
-
- QEMU_MIGRATION_PHASE_LAST
-} qemuMigrationJobPhase;
-VIR_ENUM_DECL(qemuMigrationJobPhase);
-
char *
qemuMigrationSrcBegin(virConnectPtr conn,
virDomainObjPtr vm,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 126fabf5ef..fd29f83e0d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3433,24 +3433,24 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
(state == VIR_DOMAIN_RUNNING &&
reason == VIR_DOMAIN_RUNNING_POSTCOPY);
- switch ((qemuMigrationJobPhase) job->phase) {
- case QEMU_MIGRATION_PHASE_NONE:
- case QEMU_MIGRATION_PHASE_PERFORM2:
- case QEMU_MIGRATION_PHASE_BEGIN3:
- case QEMU_MIGRATION_PHASE_PERFORM3:
- case QEMU_MIGRATION_PHASE_PERFORM3_DONE:
- case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED:
- case QEMU_MIGRATION_PHASE_CONFIRM3:
- case QEMU_MIGRATION_PHASE_LAST:
+ switch ((virMigrationJobPhase) job->phase) {
+ case VIR_MIGRATION_PHASE_NONE:
+ case VIR_MIGRATION_PHASE_PERFORM2:
+ case VIR_MIGRATION_PHASE_BEGIN3:
+ case VIR_MIGRATION_PHASE_PERFORM3:
+ case VIR_MIGRATION_PHASE_PERFORM3_DONE:
+ case VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED:
+ case VIR_MIGRATION_PHASE_CONFIRM3:
+ case VIR_MIGRATION_PHASE_LAST:
/* N/A for incoming migration */
break;
- case QEMU_MIGRATION_PHASE_PREPARE:
+ case VIR_MIGRATION_PHASE_PREPARE:
VIR_DEBUG("Killing unfinished incoming migration for domain %s",
vm->def->name);
return -1;
- case QEMU_MIGRATION_PHASE_FINISH2:
+ case VIR_MIGRATION_PHASE_FINISH2:
/* source domain is already killed so let's just resume the domain
* and hope we are all set */
VIR_DEBUG("Incoming migration finished, resuming domain %s",
@@ -3462,7 +3462,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
}
break;
- case QEMU_MIGRATION_PHASE_FINISH3:
+ case VIR_MIGRATION_PHASE_FINISH3:
/* migration finished, we started resuming the domain but didn't
* confirm success or failure yet; killing it seems safest unless
* we already started guest CPUs or we were in post-copy mode */
@@ -3494,22 +3494,22 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED);
bool resume = false;
- switch ((qemuMigrationJobPhase) job->phase) {
- case QEMU_MIGRATION_PHASE_NONE:
- case QEMU_MIGRATION_PHASE_PREPARE:
- case QEMU_MIGRATION_PHASE_FINISH2:
- case QEMU_MIGRATION_PHASE_FINISH3:
- case QEMU_MIGRATION_PHASE_LAST:
+ switch ((virMigrationJobPhase) job->phase) {
+ case VIR_MIGRATION_PHASE_NONE:
+ case VIR_MIGRATION_PHASE_PREPARE:
+ case VIR_MIGRATION_PHASE_FINISH2:
+ case VIR_MIGRATION_PHASE_FINISH3:
+ case VIR_MIGRATION_PHASE_LAST:
/* N/A for outgoing migration */
break;
- case QEMU_MIGRATION_PHASE_BEGIN3:
+ case VIR_MIGRATION_PHASE_BEGIN3:
/* nothing happened so far, just forget we were about to migrate the
* domain */
break;
- case QEMU_MIGRATION_PHASE_PERFORM2:
- case QEMU_MIGRATION_PHASE_PERFORM3:
+ case VIR_MIGRATION_PHASE_PERFORM2:
+ case VIR_MIGRATION_PHASE_PERFORM3:
/* migration is still in progress, let's cancel it and resume the
* domain; however we can only do that before migration enters
* post-copy mode
@@ -3527,7 +3527,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
}
break;
- case QEMU_MIGRATION_PHASE_PERFORM3_DONE:
+ case VIR_MIGRATION_PHASE_PERFORM3_DONE:
/* migration finished but we didn't have a chance to get the result
* of Finish3 step; third party needs to check what to do next; in
* post-copy mode we can use PAUSED_POSTCOPY_FAILED state for this
@@ -3536,7 +3536,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
qemuMigrationAnyPostcopyFailed(driver, vm);
break;
- case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED:
+ case VIR_MIGRATION_PHASE_CONFIRM3_CANCELLED:
/* Finish3 failed, we need to resume the domain, but once we enter
* post-copy mode there's no way back, so let's just mark the domain
* as broken in that case
@@ -3550,7 +3550,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
}
break;
- case QEMU_MIGRATION_PHASE_CONFIRM3:
+ case VIR_MIGRATION_PHASE_CONFIRM3:
/* migration completed, we need to kill the domain here */
*stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
return -1;
--
2.25.1
4 years, 2 months
[libvirt PATCH] meson: Use @BASENAME@ more
by Andrea Bolognani
This patch takes care of just the obvious cases: there are
many more situations where the data we pass to configure_file()
could likely be obtained in a more effective way, but we can
address the low-hanging fruits as a first approximation.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
include/libvirt/meson.build | 2 +-
meson.build | 4 ++--
po/meson.build | 2 +-
src/network/meson.build | 4 ++--
tools/meson.build | 10 +++++-----
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/include/libvirt/meson.build b/include/libvirt/meson.build
index 4b77a222f0..601b729c22 100644
--- a/include/libvirt/meson.build
+++ b/include/libvirt/meson.build
@@ -25,7 +25,7 @@ include_conf.merge_from(conf)
libvirt_common_h = configure_file(
input: libvirt_common_h_in,
- output: 'libvirt-common.h',
+ output: '@BASENAME@',
configuration: include_conf,
)
diff --git a/meson.build b/meson.build
index 35e3da6e55..d146fb3d11 100644
--- a/meson.build
+++ b/meson.build
@@ -106,7 +106,7 @@ configmake_conf.set_quoted('SYSCONFDIR', sysconfdir)
configure_file(
input: 'configmake.h.in',
- output: 'configmake.h',
+ output: '@BASENAME@',
configuration: configmake_conf,
)
@@ -2335,7 +2335,7 @@ run_conf = configuration_data()
run_conf.set('abs_builddir', meson.build_root())
configure_file(
input: 'run.in',
- output: 'run',
+ output: '@BASENAME@',
configuration: run_conf,
)
run_command('chmod', 'a+x', meson.current_build_dir() / 'run')
diff --git a/po/meson.build b/po/meson.build
index f9677408ec..69d8be726a 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -6,7 +6,7 @@ potfiles_conf.set('BUILDDIR', '')
potfiles = configure_file(
input: 'POTFILES.in',
- output: 'POTFILES',
+ output: '@BASENAME@',
configuration: potfiles_conf,
)
diff --git a/src/network/meson.build b/src/network/meson.build
index 2e031e811f..ae2848697a 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -93,7 +93,7 @@ if conf.has('WITH_NETWORK')
configure_file(
input: 'default.xml.in',
- output: 'default.xml',
+ output: '@BASENAME@',
command: [
'sed', '-e', 's|</name>|</name>\\n <uuid>@0@</uuid>|'.format(uuid),
'@INPUT@',
@@ -105,7 +105,7 @@ if conf.has('WITH_NETWORK')
else
configure_file(
input: 'default.xml.in',
- output: 'default.xml',
+ output: '@BASENAME@',
copy: true,
install: true,
install_dir: confdir / 'qemu' / 'networks',
diff --git a/tools/meson.build b/tools/meson.build
index e18adfa7f2..b8c6802f0a 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -235,7 +235,7 @@ tools_conf.set('sysconfdir', sysconfdir)
configure_file(
input: 'virt-xml-validate.in',
- output: 'virt-xml-validate',
+ output: '@BASENAME@',
configuration: tools_conf,
install: true,
install_dir: bindir,
@@ -244,7 +244,7 @@ configure_file(
configure_file(
input: 'virt-pki-validate.in',
- output: 'virt-pki-validate',
+ output: '@BASENAME@',
configuration: tools_conf,
install: true,
install_dir: bindir,
@@ -254,7 +254,7 @@ configure_file(
if conf.has('WITH_SANLOCK')
configure_file(
input: 'virt-sanlock-cleanup.in',
- output: 'virt-sanlock-cleanup',
+ output: '@BASENAME@',
configuration: tools_conf,
install: true,
install_dir: sbindir,
@@ -264,7 +264,7 @@ endif
configure_file(
input: 'libvirt-guests.sh.in',
- output: 'libvirt-guests.sh',
+ output: '@BASENAME@',
configuration: tools_conf,
install: true,
install_dir: libexecdir,
@@ -280,7 +280,7 @@ if init_script == 'systemd'
configure_file(
input: 'libvirt-guests.service.in',
- output: 'libvirt-guests.service',
+ output: '@BASENAME@',
configuration: tools_conf,
install: true,
install_dir: prefix / 'lib' / 'systemd' / 'system',
--
2.26.2
4 years, 2 months
[PATCH] RNG: Allow interleaving of /domain/cpu/numa/cell children
by Michal Privoznik
So far, the <cell/> element can have two types of children
elements: <distances/> and <cache/> (which can be repeated more
times). However, there is no reason to require specific order in
input XML. Allow elements to be interleaved.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/schemas/cputypes.rng | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng
index ba30dbf9ff..a1cae23161 100644
--- a/docs/schemas/cputypes.rng
+++ b/docs/schemas/cputypes.rng
@@ -146,16 +146,18 @@
<ref name="virYesNo"/>
</attribute>
</optional>
- <optional>
- <element name="distances">
- <oneOrMore>
- <ref name="numaDistance"/>
- </oneOrMore>
- </element>
- </optional>
- <zeroOrMore>
- <ref name="numaCache"/>
- </zeroOrMore>
+ <interleave>
+ <optional>
+ <element name="distances">
+ <oneOrMore>
+ <ref name="numaDistance"/>
+ </oneOrMore>
+ </element>
+ </optional>
+ <zeroOrMore>
+ <ref name="numaCache"/>
+ </zeroOrMore>
+ </interleave>
</element>
</define>
--
2.26.2
4 years, 2 months