[libvirt] [jenkins-ci PATCH] lcitool: Don't warn when using package manager directly
by Andrea Bolognani
We only do this when performing operations that the
corresponding Ansible module doesn't support, so we know
what we're doing and don't want warnings to show up.
Note that while only the dnf and yum modules complain at
the moment, we might as well use warn=no everywhere so that
we're already covered in case in the future the pkgng module
starts detecting this as well.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/playbooks/update/tasks/base.yml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/guests/playbooks/update/tasks/base.yml b/guests/playbooks/update/tasks/base.yml
index 8fe114e..e0efe5d 100644
--- a/guests/playbooks/update/tasks/base.yml
+++ b/guests/playbooks/update/tasks/base.yml
@@ -52,11 +52,15 @@
- name: Update installed packages
shell: '{{ package_manager }} update && {{ package_manager }} upgrade -y'
+ args:
+ warn: no
when:
- package_format == 'pkg'
- name: Clean up packages after update
shell: '{{ package_manager }} clean packages -y && {{ package_manager }} autoremove -y'
+ args:
+ warn: no
when:
- package_format == 'rpm'
@@ -69,6 +73,8 @@
- name: Clean up packages after update
shell: '{{ package_manager }} clean -y && {{ package_manager }} autoremove -y'
+ args:
+ warn: no
when:
- package_format == 'pkg'
--
2.21.0
5 years, 4 months
[libvirt] [PATCHv2] virt-xml-validate: Allow input to be read from stdin
by Johannes Holmberg
Signed-off-by: Johannes Holmberg <johannes.holmberg(a)dataductus.se>
---
Changes from v1:
- Quotes around $TMPFILE everywhere.
- Explicit -n checks in if statements
- Fixed one instance of incorrect indentation
- Signed-off-by line in commit message
tools/virt-xml-validate.in | 46 ++++++++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 12 deletions(-)
diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in
index 64aeaaaa33..5cb7dcd276 100644
--- a/tools/virt-xml-validate.in
+++ b/tools/virt-xml-validate.in
@@ -16,7 +16,17 @@
set -e
-case $1 in
+TMPFILE=
+
+cleanup() {
+ if [ -n "$TMPFILE" ]; then
+ rm -f "$TMPFILE"
+ fi
+}
+
+trap cleanup EXIT
+
+case "$1" in
-h | --h | --he | --hel | --help)
cat <<EOF
Usage:
@@ -34,7 +44,7 @@ $0 (libvirt) @VERSION@
EOF
exit ;;
--) shift ;;
- -*)
+ -?*)
echo "$0: unrecognized option '$1'" >&2
exit 1 ;;
esac
@@ -42,18 +52,27 @@ esac
XMLFILE="$1"
TYPE="$2"
-if [ -z "$XMLFILE" ]; then
- echo "syntax: $0 XMLFILE [TYPE]" >&2
- exit 1
-fi
+if [ "$XMLFILE" = "-" ]; then
+ TMPFILE=`mktemp --tmpdir virt-xml.XXXX`
+ cat > "$TMPFILE"
+else
+ if [ -z "$XMLFILE" ]; then
+ echo "syntax: $0 XMLFILE [TYPE]" >&2
+ exit 1
+ fi
-if [ ! -f "$XMLFILE" ]; then
- echo "$0: document $XMLFILE does not exist" >&2
- exit 2
+ if [ ! -f "$XMLFILE" ]; then
+ echo "$0: document $XMLFILE does not exist" >&2
+ exit 2
+ fi
fi
if [ -z "$TYPE" ]; then
- ROOT=`xmllint --stream --debug "$XMLFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'`
+ if [ -n "$TMPFILE" ]; then
+ ROOT=`xmllint --stream --debug - < "$TMPFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'`
+ else
+ ROOT=`xmllint --stream --debug "$XMLFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'`
+ fi
case "$ROOT" in
*domainsnapshot*) # Must come first, since *domain* is a substring
TYPE="domainsnapshot"
@@ -101,6 +120,9 @@ if [ ! -f "$SCHEMA" ]; then
exit 4
fi
-xmllint --noout --relaxng "$SCHEMA" "$XMLFILE"
-
+if [ -n "$TMPFILE" ]; then
+ xmllint --noout --relaxng "$SCHEMA" - < "$TMPFILE"
+else
+ xmllint --noout --relaxng "$SCHEMA" "$XMLFILE"
+fi
exit
--
2.17.1
5 years, 4 months
[libvirt] [PATCH 0/4] test_driver: implement virDomainSaveImageGetXMLDesc and virDomainSaveImageDefineXML
by Ilias Stamatis
While implementing virDomainSaveImageGetXMLDesc and
virDomainSaveImageDefineXML for the test driver, I realized that there
exists already code for saving and loading test images which can be
reused. However, it needed to be extracted from testDomainSaveFlags and
testDomainRestoreFlags into separate functions. The new functions are
inspired by the corresponding QEMU driver code where e.g.
qemuDomainSaveImageOpen serves as a helper used by other functions.
This series of patches initially extracts the code mentioned above into
separate functions and then provides the test driver with
implementations for virDomainSaveImageGetXMLDesc and
virDomainSaveImageDefineXML which make use of the newly introduced
functions.
Ilias Stamatis (4):
test_driver: extract image saving code into a separate function
test_driver: extract image loading code into a separate function
test_driver: implement virDomainSaveImageDefineXML
test_driver: implement virDomainSaveImageGetXMLDesc
src/test/test_driver.c | 281 ++++++++++++++++++++++++++++-------------
1 file changed, 193 insertions(+), 88 deletions(-)
--
2.21.0
5 years, 4 months
[libvirt] QMP; unsigned 64-bit ints; JSON standards compliance
by Daniel P. Berrangé
The QEMU QMP service is based on JSON which is nice because that is a
widely supported "standard" data format.....
....except QEMU's implementation (and indeed most impls) are not strictly
standards compliant.
Specifically the problem is around representing 64-bit integers, whether
signed or unsigned.
The JSON standard declares that largest integer is 2^53-1 and the
likewise the smallest is -(2^53-1):
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-number.max_...
A crazy limit inherited from its javascript origins IIUC.
QEMU, and indeed many applications, want to handle 64-bit integers.
The C JSON library impls have traditionally mapped integers to the
data type 'long long int' which gives a min/max of -(2^63) / 2^63-1.
QEMU however /really/ needs 64-bit unsigned integers, ie a max 2^64-1.
Libvirt has historically used the YAJL library which uses 'long long int'
and thus can't officially go beyond 2^63-1 values. Fortunately it lets
libvirt get at the raw json string, so libvirt can re-parse the value
to get an 'unsigned long long'.
We recently tried to switch to Jansson because YAJL has a dead upstream
for many years and countless unanswered bugs & patches. Unfortunately we
forgot about this need for 2^64-1 max, and Jansson also uses 'long long int'
and raises a fatal parse error for unsigned 64-bit values above 2^63-1. It
also provides no backdoor for libvirt todo its own integer parsing. Thus
we had to abort our switch to jansson as it broke parsing QEMU's JSON:
https://bugzilla.redhat.com/show_bug.cgi?id=1614569
Other JSON libraries we've investigated have similar problems. I imagine
the same may well be true of non-C based JOSN impls, though I've not
investigated in any detail.
Essentially libvirt is stuck with either using the dead YAJL library
forever, or writing its own JSON parser (most likely copying QEMU's
JSON code into libvirt's git).
This feels like a very unappealing situation to be in as not being
able to use a JSON library of our choice is loosing one of the key
benefits of using a standard data format.
Thus I'd like to see a solution to this to allow QMP to be reliably
consumed by any JSON library that exists.
I can think of some options:
1. Encode unsigned 64-bit integers as signed 64-bit integers.
This follows the example that most C libraries map JSON ints
to 'long long int'. This is still relying on undefined
behaviour as apps don't need to support > 2^53-1.
Apps would need to cast back to 'unsigned long long' for
those QMP fields they know are supposed to be unsigned.
2. Encode all 64-bit integers as a pair of 32-bit integers.
This is fully compliant with the JSON spec as each half
is fully within the declared limits. App has to split or
assemble the 2 pieces from/to a signed/unsigned 64-bit
int as needed.
3. Encode all 64-bit integers as strings
The application has todo all parsing/formatting client
side.
None of these changes are backwards compatible, so I doubt we could make
the change transparently in QMP. Instead we would have to have a
QMP greeting message capability where the client can request enablement
of the enhanced integer handling.
Any of the three options above would likely work for libvirt, but I
would have a slight preference for either 2 or 3, so that we become
100% standards compliant.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
5 years, 4 months
[libvirt] [PATCH 0/9] Grab modify job for changing domain XML
by Michal Privoznik
This is an alternative proposal to:
https://www.redhat.com/archives/libvir-list/2019-May/msg00830.html
The problem I'm trying to fix is described here:
https://www.redhat.com/archives/libvir-list/2019-May/msg00810.html
Michal Prívozník (9):
virDomainObjListAddLocked: Drop useless @cleanup label
virDomainObjListAddObjLocked: Don't expect vm->def to be set
virDomainObjListAddLocked: Set vm->def only in success path
virDomainObjIsActive: Allow vm->def to be NULL
virDomainObjListAdd: Leave def assigning as an exercise for caller
qemu: Allow vm->def == NULL in job control APIs
qemu: Grab modify job for changing domain XML
lxc: Grab modify job for changing domain XML
libxl: Grab modify job for changing domain XML
src/bhyve/bhyve_driver.c | 10 +++++---
src/conf/domain_conf.h | 2 +-
src/conf/virdomainobjlist.c | 48 ++++++++++++++----------------------
src/conf/virdomainobjlist.h | 3 +--
src/libxl/libxl_domain.c | 3 ++-
src/libxl/libxl_driver.c | 48 ++++++++++++++++++++++++------------
src/libxl/libxl_migration.c | 14 +++++------
src/lxc/lxc_domain.c | 3 ++-
src/lxc/lxc_driver.c | 23 +++++++++++------
src/openvz/openvz_conf.c | 12 ++++-----
src/openvz/openvz_driver.c | 17 +++++++------
src/qemu/qemu_domain.c | 30 ++++++++++++++---------
src/qemu/qemu_driver.c | 49 ++++++++++++++++++++++++++-----------
src/qemu/qemu_migration.c | 13 +++++++---
src/test/test_driver.c | 21 +++++++++-------
src/vmware/vmware_conf.c | 4 +--
src/vmware/vmware_driver.c | 9 +++----
src/vz/vz_sdk.c | 4 ++-
18 files changed, 183 insertions(+), 130 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/4] qemu: Fix qemuProcessInitCpuAffinity()
by Andrea Bolognani
See detailed explanation in the commit message for patch 1/4
and the corresponding bug report.
Andrea Bolognani (4):
util: Introduce virBitmapUnion()
fixup? util: Optimize virBitmapUnion()
util: Introduce virNumaNodesetToCPUset()
qemu: Fix qemuProcessInitCpuAffinity()
src/libvirt_private.syms | 2 ++
src/qemu/qemu_process.c | 7 ++++-
src/util/virbitmap.c | 32 +++++++++++++++++++++++
src/util/virbitmap.h | 4 +++
src/util/virnuma.c | 55 ++++++++++++++++++++++++++++++++++++++++
src/util/virnuma.h | 2 ++
tests/virbitmaptest.c | 37 +++++++++++++++++++++++++++
7 files changed, 138 insertions(+), 1 deletion(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/5] Check TSC frequency before starting QEMU
by Jiri Denemark
When migrating a domain with invtsc CPU feature enabled, the TSC
frequency of the destination host must match the frequency used when the
domain was started on the source host or the destination host has to
support TSC scaling.
If the frequencies do not match and the destination host does not
support TSC scaling, QEMU will fail to set the right TSC frequency when
starting vCPUs on the destination and thus migration will fail. However,
this is quite late since both host might have spent significant time
transferring memory and perhaps even storage data.
By adding the check to libvirt we can let migration fail before any data
starts to be sent over. If for some reason libvirt is unable to detect
the host's TSC frequency or scaling support, we'll just let QEMU try and
the migration will either succeed or fail later.
Luckily, we mandate TSC frequency to be explicitly set in the domain XML
to even allow migration of domains with invtsc. We can just check
whether the requested frequency is compatible with the current host
before starting QEMU.
And to let libvirt client decide whether it should even start the
migration to a specific host, this series adds host's TSC frequency and
scaling support to the host CPU capabilities XML.
https://bugzilla.redhat.com/show_bug.cgi?id=1641702
Jiri Denemark (5):
util: Add virHostCPUGetTscInfo
conf: Report TSC frequency in host CPU capabilities
cpu_x86: Fix placement of *CheckFeature functions
cpu_x86: Probe TSC frequency and scaling support
qemu: Check TSC frequency before starting QEMU
src/conf/cpu_conf.c | 48 ++++++++++++++++++++++++
src/conf/cpu_conf.h | 2 +
src/cpu/cpu_x86.c | 81 ++++++++++++++++++++++-------------------
src/qemu/qemu_process.c | 53 +++++++++++++++++++++++++++
src/util/virhostcpu.c | 71 ++++++++++++++++++++++++++++++++++++
src/util/virhostcpu.h | 11 ++++++
6 files changed, 229 insertions(+), 37 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] test_driver: implement virDomainGetHostname
by Ilias Stamatis
Always return "domain_name" + "host".
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2f58a1da95..aad7bb6036 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1910,6 +1910,27 @@ static int testDomainReboot(virDomainPtr domain,
return ret;
}
+static char *
+testDomainGetHostname(virDomainPtr domain,
+ unsigned int flags)
+{
+ char *ret = NULL;
+ virDomainObjPtr vm = NULL;
+
+ virCheckFlags(0, NULL);
+
+ if (!(vm = testDomObjFromDomain(domain)))
+ goto cleanup;
+
+ if (virDomainObjCheckActive(vm) < 0)
+ goto cleanup;
+
+ ignore_value(virAsprintf(&ret, "%shost", domain->name));
+
+ cleanup:
+ return ret;
+}
+
static int testDomainGetInfo(virDomainPtr domain,
virDomainInfoPtr info)
{
@@ -6950,6 +6971,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */
.domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */
.domainSetMemory = testDomainSetMemory, /* 0.1.4 */
+ .domainGetHostname = testDomainGetHostname, /* 5.5.0 */
.domainGetInfo = testDomainGetInfo, /* 0.1.1 */
.domainGetState = testDomainGetState, /* 0.9.2 */
.domainGetTime = testDomainGetTime, /* 5.4.0 */
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] qemu: fix pr-helper0 remain
by Jie Wang
if libvirt receive DISCONNECTED event and set prDaemonRunning to false,
and qemuDomainRemoveDiskDevice is performing in the meantime.
qemuDomainRemoveDiskDevice will return directly by prDaemonRunning
check, so the pr-helper0 object will remain. I think it is no need to
check prDaemonRunning in qemuHotplugRemoveManagedPR.
Signed-off-by: Jie Wang <wangjie88(a)huawei.com>
---
src/qemu/qemu_hotplug.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 34249bd030..5e4a929738 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -465,8 +465,7 @@ qemuHotplugRemoveManagedPR(virQEMUDriverPtr driver,
virErrorPtr orig_err;
int ret = -1;
- if (!priv->prDaemonRunning ||
- virDomainDefHasManagedPR(vm->def))
+ if (virDomainDefHasManagedPR(vm->def))
return 0;
virErrorPreserveLast(&orig_err);
--
2.16.2.windows.1
5 years, 5 months
[libvirt] [PATCH v2] docs: Drop the external AMD SEV links
by Erik Skultety
One of the current SEV document links went dead as AMD moved the
resource to another place (document store), so there's probably very
little point in maintaining 3rd party links if the resources are being
moved.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
docs/formatdomaincaps.html.in | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in
index 432d7aed5e..bcd2b3354b 100644
--- a/docs/formatdomaincaps.html.in
+++ b/docs/formatdomaincaps.html.in
@@ -514,19 +514,9 @@
encrypted with a key unique to that VM.</p>
<p>
- For more details on the SEV feature and how to use it with libvirt have
- a look at the following resources:
- <dl>
- <dd>
- <a href="https://support.amd.com/TechDocs/55766_SEV-KM_API_Specification.pdf">SEV API spec</a>
- </dd>
- <dd>
- <a href="http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory...">SEV White Paper</a>
- </dd>
- <dd>
- <a href="formatdomain.html#launchSecurity">SEV in domain XML</a>
- </dd>
- </dl>
+ For more details on the SEV feature, please follow resources in the
+ AMD developer's document store. In order to use SEV with libvirt have
+ a look at <a href="formatdomain.html#launchSecurity">SEV in domain XML</a>
</p>
<dl>
--
2.20.1
5 years, 5 months