[libvirt PATCH] tests: Use qemu:///embed to simplify fakerootdir management
by Andrea Bolognani
Now that the QEMU driver natively supports storing all its runtime
data inside an arbitrary directory, we can avoid having multiple
copies of this same logic in the test suite.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
tests/qemuhotplugtest.c | 15 --------------
tests/qemumemlocktest.c | 17 ----------------
tests/qemuxml2argvtest.c | 16 ---------------
tests/qemuxml2xmltest.c | 16 ---------------
tests/testutilsqemu.c | 43 ++++++++++++++--------------------------
5 files changed, 15 insertions(+), 92 deletions(-)
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 9a215ab303..e7443ff4b7 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -594,8 +594,6 @@ testQemuHotplugCpuIndividual(const void *opaque)
return ret;
}
-#define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
-
static int
mymain(void)
@@ -604,18 +602,8 @@ mymain(void)
int ret = 0;
struct qemuHotplugTestData data = {0};
struct testQemuHotplugCpuParams cpudata;
- g_autofree char *fakerootdir = NULL;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
- fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
-
- if (!g_mkdtemp(fakerootdir)) {
- fprintf(stderr, "Cannot create fakerootdir");
- abort();
- }
-
- g_setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, TRUE);
-
if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
@@ -891,9 +879,6 @@ mymain(void)
DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "16-22", true, true, true);
DO_TEST_CPU_INDIVIDUAL("ppc64-modern-individual", "17", true, true, true);
- if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
- virFileDeleteTree(fakerootdir);
-
qemuTestDriverFree(&driver);
virObjectUnref(data.vm);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c
index 3f18fed1c3..0e254bb3ce 100644
--- a/tests/qemumemlocktest.c
+++ b/tests/qemumemlocktest.c
@@ -51,26 +51,13 @@ testCompareMemLock(const void *data)
return ret;
}
-# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
-
static int
mymain(void)
{
int ret = 0;
- char *fakerootdir;
virQEMUCapsPtr qemuCaps = NULL;
- fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
-
- if (!g_mkdtemp(fakerootdir)) {
- fprintf(stderr, "Cannot create fakerootdir");
- abort();
- }
-
- g_setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, TRUE);
-
if (qemuTestDriverInit(&driver) < 0) {
- VIR_FREE(fakerootdir);
return EXIT_FAILURE;
}
@@ -150,11 +137,7 @@ mymain(void)
cleanup:
virObjectUnref(qemuCaps);
- if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
- virFileDeleteTree(fakerootdir);
-
qemuTestDriverFree(&driver);
- VIR_FREE(fakerootdir);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 04febd1b0c..8bd6102d26 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -609,24 +609,12 @@ testInfoSetPaths(struct testQemuInfo *info,
abs_srcdir, info->name, suffix ? suffix : "");
}
-# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
-
static int
mymain(void)
{
int ret = 0;
- char *fakerootdir;
virHashTablePtr capslatest = NULL;
- fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
-
- if (!g_mkdtemp(fakerootdir)) {
- fprintf(stderr, "Cannot create fakerootdir");
- abort();
- }
-
- g_setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, TRUE);
-
/* Set the timezone because we are mocking the time() function.
* If we don't do that, then localtime() may return unpredictable
* results. In order to detect things that just work by a blind
@@ -3232,12 +3220,8 @@ mymain(void)
DO_TEST_CAPS_LATEST("virtio-9p-multidevs");
- if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
- virFileDeleteTree(fakerootdir);
-
VIR_FREE(driver.config->nbdTLSx509certdir);
qemuTestDriverFree(&driver);
- VIR_FREE(fakerootdir);
virHashFree(capslatest);
virFileWrapperClearPrefixes();
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 86f3d2c1f3..6a0adab603 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -126,13 +126,10 @@ testInfoSetStatusPaths(struct testQemuInfo *info)
}
-# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
-
static int
mymain(void)
{
int ret = 0;
- char *fakerootdir;
virQEMUDriverConfigPtr cfg = NULL;
virHashTablePtr capslatest = NULL;
@@ -140,15 +137,6 @@ mymain(void)
if (!capslatest)
return EXIT_FAILURE;
- fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
-
- if (!g_mkdtemp(fakerootdir)) {
- fprintf(stderr, "Cannot create fakerootdir");
- abort();
- }
-
- g_setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, TRUE);
-
/* Required for tpm-emulator tests
*/
virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware",
@@ -1478,12 +1466,8 @@ mymain(void)
DO_TEST_CAPS_LATEST("virtio-9p-multidevs");
- if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
- virFileDeleteTree(fakerootdir);
-
virHashFree(capslatest);
qemuTestDriverFree(&driver);
- VIR_FREE(fakerootdir);
virFileWrapperClearPrefixes();
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 9f9eb4033c..c7983f0014 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -307,11 +307,10 @@ qemuTestParseCapabilitiesArch(virArch arch,
void qemuTestDriverFree(virQEMUDriver *driver)
{
+ if (g_getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
+ virFileDeleteTree(driver->embeddedRoot);
+
virMutexDestroy(&driver->lock);
- if (driver->config) {
- virFileDeleteTree(driver->config->stateDir);
- virFileDeleteTree(driver->config->configDir);
- }
virObjectUnref(driver->qemuCapsCache);
virObjectUnref(driver->xmlopt);
virObjectUnref(driver->caps);
@@ -370,14 +369,21 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache,
}
-# define STATEDIRTEMPLATE abs_builddir "/qemustatedir-XXXXXX"
-# define CONFIGDIRTEMPLATE abs_builddir "/qemuconfigdir-XXXXXX"
+# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
int qemuTestDriverInit(virQEMUDriver *driver)
{
virSecurityManagerPtr mgr = NULL;
- char statedir[] = STATEDIRTEMPLATE;
- char configdir[] = CONFIGDIRTEMPLATE;
+ g_autofree char *fakerootdir = NULL;
+
+ fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
+
+ if (!g_mkdtemp(fakerootdir)) {
+ fprintf(stderr, "Cannot create fakerootdir");
+ abort();
+ }
+
+ g_setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, TRUE);
memset(driver, 0, sizeof(*driver));
@@ -391,35 +397,16 @@ int qemuTestDriverInit(virQEMUDriver *driver)
return -1;
driver->hostarch = virArchFromHost();
- driver->config = virQEMUDriverConfigNew(false, NULL);
+ driver->config = virQEMUDriverConfigNew(false, fakerootdir);
if (!driver->config)
goto error;
- /* Do this early so that qemuTestDriverFree() doesn't see (unlink) the real
- * dirs. */
- VIR_FREE(driver->config->stateDir);
- VIR_FREE(driver->config->configDir);
-
/* Overwrite some default paths so it's consistent for tests. */
VIR_FREE(driver->config->libDir);
VIR_FREE(driver->config->channelTargetDir);
driver->config->libDir = g_strdup("/tmp/lib");
driver->config->channelTargetDir = g_strdup("/tmp/channel");
- if (!g_mkdtemp(statedir)) {
- fprintf(stderr, "Cannot create fake stateDir");
- goto error;
- }
-
- driver->config->stateDir = g_strdup(statedir);
-
- if (!g_mkdtemp(configdir)) {
- fprintf(stderr, "Cannot create fake configDir");
- goto error;
- }
-
- driver->config->configDir = g_strdup(configdir);
-
driver->caps = testQemuCapsInit();
if (!driver->caps)
goto error;
--
2.25.4
4 years, 6 months
[PATCH 0/2] conf: Properly handle placement of <auth> and <encryption> after blockjobs
by Peter Krempa
Peter Krempa (2):
conf: Sanitize handling of <auth> and <encryption> placement for disks
conf: Store 'diskElementAuth' and 'diskElementEnc' properties in
status XML
src/conf/backup_conf.c | 3 +-
src/conf/domain_conf.c | 117 +++++++++++-----------
src/conf/domain_conf.h | 6 +-
src/conf/snapshot_conf.c | 4 +-
src/qemu/qemu_domain.c | 6 +-
src/util/virstoragefile.c | 1 -
src/util/virstoragefile.h | 2 -
tests/qemublocktest.c | 4 +-
tests/qemustatusxml2xmldata/modern-in.xml | 4 +
tests/virstoragetest.c | 3 +-
10 files changed, 81 insertions(+), 69 deletions(-)
--
2.26.2
4 years, 6 months
[PATCH 0/2] qemu: Restrict valid configurations for disk type='lun'
by Peter Krempa
Please see justification in the commits.
This series applies on top of some of the refactors from
https://www.redhat.com/archives/libvir-list/2020-May/msg00188.html
Peter Krempa (2):
qemu: Forbid non-raw images for disk type='lun' with vitio-blk
frontend
qemu: domain: Forbid slice/encryption/copy_on_read with disk
type='lun'
src/qemu/qemu_domain.c | 19 +++++++++++++++++++
src/qemu/qemu_validate.c | 9 ++++-----
tests/qemuxml2argvdata/virtio-lun.args | 4 ++--
tests/qemuxml2argvdata/virtio-lun.xml | 4 ++--
tests/qemuxml2xmloutdata/virtio-lun.xml | 4 ++--
5 files changed, 29 insertions(+), 11 deletions(-)
--
2.26.2
4 years, 6 months
[GSoC] Introduction
by Radostin Stoyanov
Hello everyone,
As a quick introduction, I’m Radostin Stoyanov, a Google Summer of Code
student from University of Cambridge.
In the next few months I’ll be working with my mentors Cédric Bosdonnat,
Pavel Hrdina and Tyler Johnson (Akmod) on the project "Take migration in
Salt virt module to the next level".
In short, the project aim is to refactor some of the existing Salt
migration functions to use the python-libvirt API, as well as to make
available more of the libvirt migration options.
You can find me in IRC as rst0irc.
- Radostin
4 years, 6 months
[PATCH 0/8] qemu: caps: Add detection of default device property values and remove deprecated 'scsi=off'
by Peter Krempa
First part focuses on allowing the device property code to detect the
default values for the properties and the second part then uses it to
remove formatting of the deprecated 'scsi=off' for virti-blk-pci.
Peter Krempa (8):
virQEMUCapsProbeQMPDevices: Split up into logical chunks
virQEMUCapsProbeQMPDeviceProperties: Switch to local implementation
virQEMUCapsProbeQMPObjectTypes: Fold in
virQEMUCapsProbeQMPGenericProps
qemuMonitorJSONGetDeviceProps: Refactor to modern standards
qemuMonitorGetDeviceProps: Return data in a hash table
virQEMUCapsProbeQMPDeviceProperties: Add per-property callbacks
qemu: capabilities: Introduce
QEMU_CAPS_VIRTIO_BLK_SCSI_DEFAULT_DISABLED
qemu: command: Stop formatting of 'scsi=off' for virtio-blk-pci
src/qemu/qemu_capabilities.c | 347 ++++++++++--------
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 4 +-
src/qemu/qemu_monitor.c | 11 +-
src/qemu/qemu_monitor.h | 5 +-
src/qemu/qemu_monitor_json.c | 58 ++-
src/qemu/qemu_monitor_json.h | 7 +-
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.riscv64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
...fault-cpu-kvm-virt-4.2.aarch64-latest.args | 2 +-
...fault-cpu-tcg-virt-4.2.aarch64-latest.args | 2 +-
.../aarch64-virt-graphics.aarch64-latest.args | 2 +-
.../aarch64-virt-headless.aarch64-latest.args | 2 +-
.../disk-aio-io_uring.x86_64-latest.args | 2 +-
...-backing-chains-noindex.x86_64-latest.args | 12 +-
.../disk-cache.x86_64-latest.args | 2 +-
.../disk-cdrom-tray.x86_64-latest.args | 2 +-
.../disk-copy_on_read.x86_64-latest.args | 2 +-
.../disk-detect-zeroes.x86_64-latest.args | 2 +-
.../disk-network-gluster.x86_64-latest.args | 6 +-
.../disk-network-http.x86_64-latest.args | 8 +-
.../disk-network-iscsi.x86_64-latest.args | 8 +-
.../disk-network-nbd.x86_64-latest.args | 10 +-
.../disk-network-rbd.x86_64-latest.args | 12 +-
.../disk-network-sheepdog.x86_64-latest.args | 2 +-
...isk-network-source-auth.x86_64-latest.args | 4 +-
.../disk-network-tlsx509.x86_64-latest.args | 8 +-
.../disk-nvme.x86_64-latest.args | 8 +-
.../disk-shared.x86_64-latest.args | 4 +-
.../disk-slices.x86_64-latest.args | 6 +-
...threads-virtio-scsi-pci.x86_64-latest.args | 2 +-
...luks-disks-source-qcow2.x86_64-latest.args | 12 +-
...ault-cpu-kvm-pseries-2.7.ppc64-latest.args | 2 +-
...ault-cpu-kvm-pseries-3.1.ppc64-latest.args | 2 +-
...ault-cpu-kvm-pseries-4.2.ppc64-latest.args | 2 +-
...ault-cpu-tcg-pseries-2.7.ppc64-latest.args | 2 +-
...ault-cpu-tcg-pseries-3.1.ppc64-latest.args | 2 +-
...ault-cpu-tcg-pseries-4.2.ppc64-latest.args | 2 +-
.../ppc64-pseries-graphics.ppc64-latest.args | 2 +-
.../ppc64-pseries-headless.ppc64-latest.args | 2 +-
.../riscv64-virt-graphics.riscv64-latest.args | 2 +-
.../riscv64-virt-headless.riscv64-latest.args | 2 +-
...vhost-user-fs-hugepages.x86_64-latest.args | 2 +-
...virtio-non-transitional.x86_64-latest.args | 2 +-
...virtio-options-disk-ats.x86_64-latest.args | 8 +-
...rtio-options-disk-iommu.x86_64-latest.args | 4 +-
...tio-options-disk-packed.x86_64-latest.args | 8 +-
.../virtio-options.x86_64-latest.args | 4 +-
.../virtio-transitional.x86_64-latest.args | 4 +-
...-default-cpu-kvm-pc-4.2.x86_64-latest.args | 2 +-
...default-cpu-kvm-q35-4.2.x86_64-latest.args | 2 +-
...-default-cpu-tcg-pc-4.2.x86_64-latest.args | 2 +-
...default-cpu-tcg-q35-4.2.x86_64-latest.args | 2 +-
.../x86_64-pc-graphics.x86_64-latest.args | 2 +-
.../x86_64-pc-headless.x86_64-latest.args | 2 +-
.../x86_64-q35-graphics.x86_64-latest.args | 2 +-
.../x86_64-q35-headless.x86_64-latest.args | 2 +-
60 files changed, 356 insertions(+), 270 deletions(-)
--
2.26.2
4 years, 6 months
[libvirt PATCH 0/2] docs: Use list-tables in reStructuredText
by Andrea Bolognani
It's easier to modify than the ASCII-art alternative.
Andrea Bolognani (2):
docs: Convert existing tables to list-table
docs: Document list-tables as recommended
docs/coding-style.rst | 53 +++++++++++-------
docs/glib-adoption.rst | 123 +++++++++++++++++++++++++++--------------
docs/styleguide.rst | 20 +++++++
3 files changed, 134 insertions(+), 62 deletions(-)
--
2.25.4
4 years, 6 months
[libvirt-ci PATCH 0/2] add a 'go fmt' container for code style checks
by Daniel P. Berrangé
This common container will be used across all our Go based projects
Daniel P. Berrangé (2):
gitlab: rename job for building check-dco container
containers: add a standard container for running go fmt
.gitlab-ci.yml | 7 ++++++-
containers/go-fmt/Dockerfile | 9 +++++++++
containers/go-fmt/README.rst | 20 ++++++++++++++++++++
containers/go-fmt/go-fmt.sh | 24 ++++++++++++++++++++++++
4 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 containers/go-fmt/Dockerfile
create mode 100644 containers/go-fmt/README.rst
create mode 100755 containers/go-fmt/go-fmt.sh
--
2.25.4
4 years, 6 months
[perl PATCH v4 0/3] gitlab: introduce CI coverage
by Daniel P. Berrangé
This series introduces CI jobs for the Perl binding, enabling the switch
over to use of Merge Requests with pre-merge build validation.
v1: https://www.redhat.com/archives/libvir-list/2020-April/msg01157.html
v2: https://www.redhat.com/archives/libvir-list/2020-April/msg01408.html
This is a different approach from v1, because we don't inherit from the
main libvirt container images. Instead we use the libvirt-minimal
project as a dependancy. The cost is that the container build stage is
more expensive, but the main project build stage is cheaper. This is a
net win because the container build stage is cached so is only a penalty
the first time, or when the distro parent image has changes to pull in.
It also makes the CI process of the binding more self-contained avoiding
by avoiding a dep on the container image for libvirt.
Daniel P. Berrangé (3):
gitlab: add CI jobs for validating build across platforms
gitlab: add a simple job that publishes the API docs as HTML
gitlab: add CONTRIBUTING.rst file to indicate use of merge requests
.gitlab-ci.yml | 170 +++++++++++++++++++++++++++
.gitpublish | 4 -
CONTRIBUTING.rst | 28 +++++
ci/README.rst | 12 ++
ci/libvirt-centos-7.Dockerfile | 97 +++++++++++++++
ci/libvirt-centos-8.Dockerfile | 68 +++++++++++
ci/libvirt-debian-10.Dockerfile | 68 +++++++++++
ci/libvirt-debian-9.Dockerfile | 71 +++++++++++
ci/libvirt-debian-sid.Dockerfile | 68 +++++++++++
ci/libvirt-fedora-31.Dockerfile | 66 +++++++++++
ci/libvirt-fedora-32.Dockerfile | 66 +++++++++++
ci/libvirt-fedora-rawhide.Dockerfile | 67 +++++++++++
ci/libvirt-opensuse-151.Dockerfile | 66 +++++++++++
ci/libvirt-ubuntu-1804.Dockerfile | 71 +++++++++++
ci/libvirt-ubuntu-2004.Dockerfile | 68 +++++++++++
ci/refresh | 22 ++++
16 files changed, 1008 insertions(+), 4 deletions(-)
delete mode 100644 .gitpublish
create mode 100644 CONTRIBUTING.rst
create mode 100644 ci/README.rst
create mode 100644 ci/libvirt-centos-7.Dockerfile
create mode 100644 ci/libvirt-centos-8.Dockerfile
create mode 100644 ci/libvirt-debian-10.Dockerfile
create mode 100644 ci/libvirt-debian-9.Dockerfile
create mode 100644 ci/libvirt-debian-sid.Dockerfile
create mode 100644 ci/libvirt-fedora-31.Dockerfile
create mode 100644 ci/libvirt-fedora-32.Dockerfile
create mode 100644 ci/libvirt-fedora-rawhide.Dockerfile
create mode 100644 ci/libvirt-opensuse-151.Dockerfile
create mode 100644 ci/libvirt-ubuntu-1804.Dockerfile
create mode 100644 ci/libvirt-ubuntu-2004.Dockerfile
create mode 100755 ci/refresh
--
2.26.2
4 years, 6 months