[libvirt] [jenkins-ci PATCH] Stop building osinfo-db on CentOS 7
by Fabiano Fidêncio
osinfo-db tests are Python3 only.
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
---
jenkins/projects/osinfo-db.yaml | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/jenkins/projects/osinfo-db.yaml b/jenkins/projects/osinfo-db.yaml
index 87b6748..25a6621 100644
--- a/jenkins/projects/osinfo-db.yaml
+++ b/jenkins/projects/osinfo-db.yaml
@@ -1,7 +1,16 @@
---
- project:
name: osinfo-db
- machines: '{all_machines}'
+ # osinfo-db tests are Python 3 only, so they can't be built on
+ # CentOS 7;
+ machines:
+ - libvirt-debian-8
+ - libvirt-debian-9
+ - libvirt-fedora-28
+ - libvirt-fedora-29
+ - libvirt-fedora-rawhide
+ - libvirt-freebsd-11
+ - libvirt-freebsd-12
title: osinfo database
archive_format: xz
git_url: '{git_urls[osinfo-db][default]}'
--
2.20.1
5 years, 7 months
[libvirt] [jenkins-ci PATCH] guests: Update test dependencies for osinfo-db
by Fabiano Fidêncio
The new dependencies are:
- python3
- python3-libxml2
- python3-pytest
- python3-requests
xmllint has been removed in favour of a own crafted test using
python3-libmlx2
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
---
guests/vars/projects/osinfo-db.yml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/guests/vars/projects/osinfo-db.yml b/guests/vars/projects/osinfo-db.yml
index d9320a4..2c8a333 100644
--- a/guests/vars/projects/osinfo-db.yml
+++ b/guests/vars/projects/osinfo-db.yml
@@ -1,4 +1,7 @@
---
packages:
- intltool
- - xmllint
+ - python3
+ - python3-libxml2
+ - python3-pytest
+ - python3-requests
--
2.20.1
5 years, 7 months
[libvirt] [PATCH] qemufirmwaretest: Produce better message on error
by Michal Privoznik
If qemuFirmwareFetchConfigs() returned more or less paths than
expected all that we see is the following error message:
Expected 5 paths, got 7
While it is technically correct (the best kind of correct), we
can do better:
Unexpected path (i=0). Expected /some/path got /some/other/path
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/qemufirmwaretest.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/tests/qemufirmwaretest.c b/tests/qemufirmwaretest.c
index 340344ebba..2b5cbf649b 100644
--- a/tests/qemufirmwaretest.c
+++ b/tests/qemufirmwaretest.c
@@ -66,6 +66,7 @@ testFWPrecedence(const void *opaque ATTRIBUTE_UNUSED)
PREFIX "/share/qemu/firmware/61-ovmf.json",
PREFIX "/share/qemu/firmware/70-aavmf.json",
};
+ const size_t nexpected = ARRAY_CARDINALITY(expected);
if (VIR_STRDUP(fakehome, abs_srcdir "/qemufirmwaredata/home/user/.config") < 0)
return -1;
@@ -81,17 +82,15 @@ testFWPrecedence(const void *opaque ATTRIBUTE_UNUSED)
}
nfwList = virStringListLength((const char **)fwList);
- if (nfwList != ARRAY_CARDINALITY(expected)) {
- fprintf(stderr, "Expected %zu paths, got %zu\n",
- ARRAY_CARDINALITY(expected), nfwList);
- return -1;
- }
- for (i = 0; i < ARRAY_CARDINALITY(expected); i++) {
- if (STRNEQ_NULLABLE(expected[i], fwList[i])) {
+ for (i = 0; i < MAX(nfwList, nexpected); i++) {
+ const char *e = i < nexpected ? expected[i] : NULL;
+ const char *f = i < nfwList ? fwList[i] : NULL;
+
+ if (STRNEQ_NULLABLE(e, f)) {
fprintf(stderr,
"Unexpected path (i=%zu). Expected %s got %s \n",
- i, expected[i], NULLSTR(fwList[i]));
+ i, NULLSTR(e), NULLSTR(f));
return -1;
}
}
--
2.19.2
5 years, 7 months
[libvirt] [PATCH v2] news: Document kernel requirements for virtual networks
by Michal Privoznik
After 7431b3eb9a05068e4b libvirt requires "filter", "nat" and
"mangle" tables to exist for both IPv4 and IPv6. This fact was
missed in the news.xml and since we don't have any better place
to advertise that let's update old news.
This was refined in 686803a1a2e and since that is not released
yet create a new entry documenting the refinement.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Even though the v1 was ACKed, I'm sending v2 because things have changed
since then. The difference to v1 then is that I've introduced a new news
entry for the current release mentioning the refinement. IMO this
reflects the reality the best: 5.1.0, which is released and doesn't
contain the fix does require all 6 tables (even though Dan created
v5.1.0-maint branch where he backported the fix).
docs/news.xml | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/docs/news.xml b/docs/news.xml
index 5c3028e10b..83e965e0f3 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -124,6 +124,18 @@
Report class information for PCI node device capability.
</summary>
</change>
+ <change>
+ <summary>
+ Split setup of IPv4 and IPv6 top level chain
+ </summary>
+ <description>
+ The requirement resulting from private chains improvement done
+ in <code>v5.1.0</code> was refined so that only tables from
+ corresponding IP version are required. This means that if a
+ network doesn't have <code>IPv6</code> enabled then those
+ tables are not required.
+ </description>
+ </change>
</section>
<section title="Bug fixes">
</section>
@@ -202,7 +214,9 @@
Historically firewall rules for virtual networks were added
straight into the base chains. This works but has a number of
bugs and design limitations. To address them, libvirt now puts
- firewall rules into its own chains.
+ firewall rules into its own chains. Note that with this change the
+ <code>filter</code>, <code>nat</code> and <code>mangle</code> tables
+ are required for both <code>IPv4</code> and <code>IPv6</code>.
</description>
</change>
<change>
--
2.19.2
5 years, 7 months
[libvirt] [PATCH] news: Document kernel requirements for virtual networks
by Michal Privoznik
After 7431b3eb9a05068e4b libvirt requires "filter", "nat" and
"mangle" tables to exist for both IPv4 and IPv6. This fact was
missed in the news.xml and since we don't have any better place
to advertise that let's update old news.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/news.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/news.xml b/docs/news.xml
index 81466c3d55..8321ed8c43 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -146,7 +146,9 @@
Historically firewall rules for virtual networks were added
straight into the base chains. This works but has a number of
bugs and design limitations. To address them, libvirt now puts
- firewall rules into its own chains.
+ firewall rules into its own chains. Note that with this change the
+ <code>filter</code>, <code>nat</code> and <code>mangle</code> tables
+ are required for both <code>IPv4</code> and <code>IPv6</code>.
</description>
</change>
<change>
--
2.19.2
5 years, 7 months
[libvirt] [PATCH libvirt-python v2] Implement virDomainGetStateParams API
by Bjoern Walk
From: Marc Hartmayer <mhartmay(a)linux.ibm.com>
This patch adds the Python binding for the virDomainGetStateParams API.
The Python side can be generated automatically, the C side cannot.
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk(a)linux.ibm.com>
---
Patch series for libvirt is here:
https://www.redhat.com/archives/libvir-list/2019-March/msg01648.html
generator.py | 1 +
libvirt-override-api.xml | 6 +++++
libvirt-override.c | 48 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+)
diff --git a/generator.py b/generator.py
index ffa3ce56..005be502 100755
--- a/generator.py
+++ b/generator.py
@@ -496,6 +496,7 @@ skip_impl = (
'virConnectBaselineHypervisorCPU',
'virDomainGetLaunchSecurityInfo',
'virNodeGetSEVInfo',
+ 'virDomainGetStateParams',
)
lxc_skip_impl = (
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 7f578e01..fab62447 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -754,5 +754,11 @@
<arg name='conn' type='virConnectPtr' info='pointer to hypervisor connection'/>
<arg name='flags' type='int' info='unused, always pass 0'/>
</function>
+ <function name='virDomainGetStateParams' file='python'>
+ <info>Extract domain state and additional information (if available).</info>
+ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
+ <arg name='flags' type='unsigned int' info='extra flags; not used yet, so callers should always pass 0'/>
+ <return type='char *' info="dictionary of state data"/>
+ </function>
</symbols>
</api>
diff --git a/libvirt-override.c b/libvirt-override.c
index c5e2908c..7ae10874 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -9946,6 +9946,51 @@ libvirt_virNodeGetSEVInfo(PyObject *self ATTRIBUTE_UNUSED,
#endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */
+#if LIBVIR_CHECK_VERSION(5, 2, 0)
+static PyObject *
+libvirt_virDomainGetStateParams(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *py_retval = VIR_PY_NONE;
+ PyObject *pyobj_domain;
+ virDomainPtr domain;
+ int state;
+ int reason;
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ unsigned int flags;
+ int c_retval;
+
+ if (!PyArg_ParseTuple(args, (char *)"OI:virDomainGetStateParams",
+ &pyobj_domain, &flags))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virDomainGetStateParams(domain, &state, &reason, ¶ms,
+ &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_retval < 0)
+ goto error;
+
+ if ((py_retval = PyTuple_New(3)) == NULL)
+ goto error;
+
+ VIR_PY_TUPLE_SET_GOTO(py_retval, 0, libvirt_intWrap(state), error);
+ VIR_PY_TUPLE_SET_GOTO(py_retval, 1, libvirt_intWrap(reason), error);
+ VIR_PY_TUPLE_SET_GOTO(py_retval, 2, getPyVirTypedParameter(params, nparams), error);
+
+ return py_retval;
+
+error:
+ Py_XDECREF(py_retval);
+ virTypedParamsFree(params, nparams);
+ return VIR_PY_NONE;
+}
+#endif /* LIBVIR_CHECK_VERSION(5, 2, 0) */
+
+
/************************************************************************
* *
* The registration stuff *
@@ -10192,6 +10237,9 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetLaunchSecurityInfo", libvirt_virDomainGetLaunchSecurityInfo, METH_VARARGS, NULL},
{(char *) "virNodeGetSEVInfo", libvirt_virNodeGetSEVInfo, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */
+#if LIBVIR_CHECK_VERSION(5, 2, 0)
+ {(char *) "virDomainGetStateParams", libvirt_virDomainGetStateParams, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(5, 2, 0) */
{NULL, NULL, 0, NULL}
};
--
2.17.0
5 years, 7 months
[libvirt] [PATCH] test: Avoid use-after-free on virDomainSnapshotDelete
by Eric Blake
The following virsh command was triggering a use-after-free:
$ virsh -c test:///default '
snapshot-create-as test s1
snapshot-create-as test s2
snapshot-delete --children-only test s1
snapshot-current --name test'
Domain snapshot s1 created
Domain snapshot s2 created
Domain snapshot s1 children deleted
error: name in virGetDomainSnapshot must not be NULL
I got lucky on that run - although the error message is quite
unexpected. On other runs, I was able to get a core dump, and
valgrind confirms there is a definitive problem.
The culprit? We were inconsistent about whether we set
vm->current_snapshot, snap->def->current, or both when updating how
the current snapshot was being tracked. As a result, deletion did not
see that snapshot s2 was previously current, and failed to update
vm->current_snapshot, so that the next API using the current snapshot
failed because it referenced stale memory for the now-gone s2 (instead
of the intended s1).
The test driver code was copied from the qemu code (which DOES track
both pieces of state everywhere), but was purposefully simplified
because the test driver does not have to write persistent snapshot
state to the file system. But when you realize that the only reason
snap->def->current needs to exist is when writing out one file per
snapshot for qemu, it's just as easy to state that the test driver
never has to mess with the field (rather than chasing down which
places forgot to set the field), and have vm->current_snapshot be the
sole source of truth in the test driver.
Ideally, I'd get rid of the 'current' member in virDomainSnapshotDef,
as well as the 'current_snapshot' member in virDomainDef, and instead
track the current member in virDomainSnapshotObjList, coupled with
writing ALL snapshot state for qemu in a single file (where I can use
<snapshots current='...'> as a wrapper, rather than
VIR_DOMAIN_SNAPSHOT_FORMAT_INTERNAL to output <current>1</current> XML
on a per-snapshot file basis). But that's a bigger change, so for now
I'm just patching things to avoid the test driver segfault.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/test/test_driver.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 0bb48b4364..8e2a9dcff6 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1,7 +1,7 @@
/*
* test_driver.c: A "mock" hypervisor for use by application unit tests
*
- * Copyright (C) 2006-2015 Red Hat, Inc.
+ * Copyright (C) 2006-2019 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -6441,7 +6441,7 @@ testDomainSnapshotDiscardAll(void *payload,
virDomainSnapshotObjPtr snap = payload;
testSnapRemoveDataPtr curr = data;
- if (snap->def->current)
+ if (curr->vm->current_snapshot == snap)
curr->current = true;
virDomainSnapshotObjListRemove(curr->vm->snapshots, snap);
return 0;
@@ -6508,8 +6508,6 @@ testDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
testDomainSnapshotDiscardAll,
&rem);
if (rem.current) {
- if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)
- snap->def->current = true;
vm->current_snapshot = snap;
}
} else if (snap->nchildren) {
@@ -6542,8 +6540,6 @@ testDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
if (!parentsnap) {
VIR_WARN("missing parent snapshot matching name '%s'",
snap->def->parent);
- } else {
- parentsnap->def->current = true;
}
}
vm->current_snapshot = parentsnap;
@@ -6623,12 +6619,9 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
}
- if (vm->current_snapshot) {
- vm->current_snapshot->def->current = false;
+ if (vm->current_snapshot)
vm->current_snapshot = NULL;
- }
- snap->def->current = true;
config = virDomainDefCopy(snap->def->dom, privconn->caps,
privconn->xmlopt, NULL, true);
if (!config)
--
2.20.1
5 years, 7 months
[libvirt] [PATCH 0/2] tests: qemuxml2argv updates and tweaks
by Andrea Bolognani
Andrea Bolognani (2):
tests: Update aarch64-virt-graphics for virtio-blk
tests: Add s390x-ccw-graphics test case
.../aarch64-virt-graphics.aarch64-latest.args | 9 ++--
.../aarch64-virt-graphics.xml | 3 +-
.../s390x-ccw-graphics.s390x-latest.args | 49 +++++++++++++++++++
...rt-graphics.xml => s390x-ccw-graphics.xml} | 21 +++-----
tests/qemuxml2argvtest.c | 1 +
5 files changed, 62 insertions(+), 21 deletions(-)
create mode 100644 tests/qemuxml2argvdata/s390x-ccw-graphics.s390x-latest.args
copy tests/qemuxml2argvdata/{aarch64-virt-graphics.xml => s390x-ccw-graphics.xml} (61%)
--
2.20.1
5 years, 7 months
[libvirt] [PATCH 00/21] qemu_hotplug: refactor device detach functions to fix one serious and other minor bugs
by Laine Stump
This all started with the observation that we were sending the
DEVICE_REMOVED events for unplugged devices too soon (reported in
https://bugzilla.redhat.com/1658198 ). While noticing that *all* of
the device types send their DEVICE_REMOVED event too early, I also
noticed how eerily similar all the different detach functions are
(they have converged over time, as legacy code supporting old qemus
with different methods of deleting different types of devices has been
removed - pkrempa and mprivozn committed patches just in the last week
that contributed to this convergence and removed some duplicated
code).
I also saw a few other definite bugs, as well as a couple that I think
are bugs, but am not enough informed about zPCI to be certain (I've
Cc'ed the author and reviewers of the original patch adding that code
to the patches so that they can verify, or negate, my suspicions).
Many/most of these patches are either very simple / easily verifiable
code movement / removal / renaming of variables. Patch 20 is a bit
more involved; viewing the new versions of the functions along with
the patch would probably help it go much quicker.
The first two patches in the series eliminate what I'm 99% certain is
erroneous calling of the qemuDomainDetachExtensionDevice() when
detaching a PCI device on S390. The commit log details my reasons for
believing this code should be removed.
The rest of the series eliminates small differences iteratively,
arriving at a set of detach functions which are completely identical
at the end (and only called from one place), and then replaces all
those duplicates with a single block of common code in a higher level
function that calls all of the individual functions (it was their only
caller anyway). This eliminated the inconsistent application of
checking for multifunction PCI devices and for the existence of a
device alias. It also eliminated individual calls to
qemuDomainRemove*Device() calls, and replaced them with a single call
to qemuDomainRemoveDevice().
Eliminating all the calls (except one) to the individual
qemuDomainRemove*Device() functions in turn made it possible to move
the code that builds and queues the DEVICE_REMOVED event into a single
place in the one remaining higher level caller -
qemuDomainRemoveDevice() - thus eliminating the "premature event" for *all*
device types at once.
Laine Stump (21):
qemu_hotplug: remove erroneous call to
qemuDomainDetachExtensionDevice()
qemu_hotplug: remove another erroneous
qemuDomainDetachExtensionDevice() call
qemu_hotplug: remove unnecessary check for valid PCI address
qemu_hotplug: rename a virDomainDeviceInfoPtr to avoid confusion
qemu_hotplug: eliminate multiple identical
qemuDomainDetachHost*Device() functions
qemu_hotplug: eliminate unnecessary call to
qemuDomainDetachNetDevice()
qemu_hotplug: refactor qemuDomainDetachDiskLive and
qemuDomainDetachDiskDevice
qemu_hotplug: don't call DetachThisHostDevice for hostdev network
devices
qemu_hotplug: merge qemuDomainDetachThisHostDevice into
qemuDomainDetachHostDevice
qemu_hotplug: move qemuDomainChangeGraphicsPasswords()
qemu_hotplug: move (almost) all qemuDomainDetach*() functions together
qemu_hotplug: move (Attach|Detach)Lease functions with others of same
type
qemu_hotplug: move qemuDomainDetachDeviceLive() to qemu_hotplug.c
qemu_hotplug: remove extra function in middle of DetachController call
chain
qemu_hotplug: pull qemuDomainUpdateDeviceList out of
qemuDomainDetachDeviceLive
test: replace calls to individual detach functions with one call to
main detach
qemu_hotplug: rename dev to match in qemuDomainDetachDeviceLive
qemu_hotplug: standardize the names/args/calling of
qemuDomainDetach*()
qemu_hotplug: new function qemuDomainRemoveAuditDevice()
qemu_hotplug: consolidate all common detach code in
qemuDomainDetachDeviceLive
qemu_hotplug: delay sending DEVICE_REMOVED event until after *all*
teardown
src/qemu/qemu_driver.c | 102 +--
src/qemu/qemu_hotplug.c | 1407 ++++++++++++++++++---------------------
src/qemu/qemu_hotplug.h | 56 +-
tests/qemuhotplugtest.c | 8 +-
4 files changed, 655 insertions(+), 918 deletions(-)
Yay! jtomko would be proud - more deletions than insertions!!!
--
2.20.1
5 years, 7 months