[libvirt PATCH] qemu_firmware: select correct firmware for AMD SEV-ES
by Pavel Hrdina
When using firmware auto-selection and user enables AMD SEV-ES we need
to pick correct firmware that actually supports it. This can be detected
by having `amd-sev-es` in the firmware JSON description.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_firmware.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 2aeac635da..8d10497717 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -129,6 +129,7 @@ typedef enum {
QEMU_FIRMWARE_FEATURE_ACPI_S3,
QEMU_FIRMWARE_FEATURE_ACPI_S4,
QEMU_FIRMWARE_FEATURE_AMD_SEV,
+ QEMU_FIRMWARE_FEATURE_AMD_SEV_ES,
QEMU_FIRMWARE_FEATURE_ENROLLED_KEYS,
QEMU_FIRMWARE_FEATURE_REQUIRES_SMM,
QEMU_FIRMWARE_FEATURE_SECURE_BOOT,
@@ -145,6 +146,7 @@ VIR_ENUM_IMPL(qemuFirmwareFeature,
"acpi-s3",
"acpi-s4",
"amd-sev",
+ "amd-sev-es",
"enrolled-keys",
"requires-smm",
"secure-boot",
@@ -913,6 +915,9 @@ qemuFirmwareOSInterfaceTypeFromOsDefFirmware(int fw)
}
+#define VIR_QEMU_FIRMWARE_AMD_SEV_ES_POLICY (1 << 2)
+
+
static bool
qemuFirmwareMatchDomain(const virDomainDef *def,
const qemuFirmware *fw,
@@ -924,6 +929,7 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
bool supportsS4 = false;
bool requiresSMM = false;
bool supportsSEV = false;
+ bool supportsSEVES = false;
bool supportsSecureBoot = false;
bool hasEnrolledKeys = false;
int reqSecureBoot;
@@ -972,6 +978,11 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
case QEMU_FIRMWARE_FEATURE_AMD_SEV:
supportsSEV = true;
break;
+
+ case QEMU_FIRMWARE_FEATURE_AMD_SEV_ES:
+ supportsSEVES = true;
+ break;
+
case QEMU_FIRMWARE_FEATURE_REQUIRES_SMM:
requiresSMM = true;
break;
@@ -1043,10 +1054,16 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
}
if (def->sev &&
- def->sev->sectype == VIR_DOMAIN_LAUNCH_SECURITY_SEV &&
- !supportsSEV) {
- VIR_DEBUG("Domain requires SEV, firmware '%s' doesn't support it", path);
- return false;
+ def->sev->sectype == VIR_DOMAIN_LAUNCH_SECURITY_SEV) {
+ if (!supportsSEV) {
+ VIR_DEBUG("Domain requires SEV, firmware '%s' doesn't support it", path);
+ return false;
+ }
+
+ if (def->sev->policy & VIR_QEMU_FIRMWARE_AMD_SEV_ES_POLICY && !supportsSEVES) {
+ VIR_DEBUG("Domain requires SEV-ES, firmware '%s' doesn't support it", path);
+ return false;
+ }
}
VIR_DEBUG("Firmware '%s' matches domain requirements", path);
@@ -1148,6 +1165,7 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver,
case QEMU_FIRMWARE_FEATURE_ACPI_S3:
case QEMU_FIRMWARE_FEATURE_ACPI_S4:
case QEMU_FIRMWARE_FEATURE_AMD_SEV:
+ case QEMU_FIRMWARE_FEATURE_AMD_SEV_ES:
case QEMU_FIRMWARE_FEATURE_ENROLLED_KEYS:
case QEMU_FIRMWARE_FEATURE_SECURE_BOOT:
case QEMU_FIRMWARE_FEATURE_VERBOSE_DYNAMIC:
@@ -1181,6 +1199,7 @@ qemuFirmwareSanityCheck(const qemuFirmware *fw,
case QEMU_FIRMWARE_FEATURE_ACPI_S3:
case QEMU_FIRMWARE_FEATURE_ACPI_S4:
case QEMU_FIRMWARE_FEATURE_AMD_SEV:
+ case QEMU_FIRMWARE_FEATURE_AMD_SEV_ES:
case QEMU_FIRMWARE_FEATURE_ENROLLED_KEYS:
case QEMU_FIRMWARE_FEATURE_VERBOSE_DYNAMIC:
case QEMU_FIRMWARE_FEATURE_VERBOSE_STATIC:
@@ -1412,6 +1431,7 @@ qemuFirmwareGetSupported(const char *machine,
case QEMU_FIRMWARE_FEATURE_ACPI_S3:
case QEMU_FIRMWARE_FEATURE_ACPI_S4:
case QEMU_FIRMWARE_FEATURE_AMD_SEV:
+ case QEMU_FIRMWARE_FEATURE_AMD_SEV_ES:
case QEMU_FIRMWARE_FEATURE_ENROLLED_KEYS:
case QEMU_FIRMWARE_FEATURE_SECURE_BOOT:
case QEMU_FIRMWARE_FEATURE_VERBOSE_DYNAMIC:
--
2.31.1
3 years, 5 months
[libvirt PATCH v2 0/7] Enable sanitizers
by Tim Wiederhake
This series enables and adds AddressSanitizer and UndefinedBehaviorSanitizer
builds to the CI.
See:
https://clang.llvm.org/docs/AddressSanitizer.html and
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
These sanitizers already found some issues in libvirt, e.g.
4eb7c621985dad4de911ec394ac628bd1a5b29ab,
1294de209cee6643511265c7e2d4283c047cf652,
8b8c91f487592c6c067847ca59dde405ca17573f, or
1c34211c22de28127a509edbf2cf2f44cb0d891e.
There exist two more relevant sanitizers, ThreadSanitizer and MemorySanitizer.
Unfortunately, those two require an instrumented build of all dependencies,
including libc, to work correctly.
Note that clang and gcc have different implementations of these sanitizers,
hence the introduction of two new jobs to the CI. The latter one issues a
warning about the use of LD_PRELOAD in `virTestMain`, which in this
particular case can be safely ignored by setting `ASAN_OPTIONS` to
verify_asan_link_order=0` for the gcc build.
Changes since V1:
Incorporated changes suggested by Pavel, except for #6 (now #7): The statement
in https://listman.redhat.com/archives/libvir-list/2021-May/msg00070.html on
the sanitizers working with Fedora 33 is wrong, I was fooled by caching. The
bug described there is present in Fedora 33, 34, and Rawhide.
Cheers,
Tim
Tim Wiederhake (7):
meson: Allow larger stack frames when instrumenting
meson: Allow undefined symbols when sanitizers are enabled
tests: virfilemock: realpath: Allow non-null second parameter
openvz: Add missing symbols to libvirt_openvz.syms
tests: openvzutilstest: Remove duplicate linking with libvirt_openvz.a
virt-aa-helper: Remove duplicate linking with src/datatypes.o
ci: Enable address and undefined behavior sanitizers
.gitlab-ci.yml | 35 +++++++++++++++++++++++++++++++++++
build-aux/syntax-check.mk | 2 +-
meson.build | 14 ++++++++++----
src/libvirt_openvz.syms | 2 ++
src/security/meson.build | 1 -
tests/meson.build | 2 +-
tests/virfilemock.c | 20 ++++++++++++--------
7 files changed, 61 insertions(+), 15 deletions(-)
--
2.26.3
3 years, 5 months
[PATCH 0/7] qemu: Rework qemuBuildDeviceVideoStr() slightly
by Michal Privoznik
The most important patch is 7/7, IMO. The rest is just prep work.
Michal Prívozník (7):
qemuDomainSupportsVideoVga: Fix const correctness
qemuBuildDeviceVideoStr: Separate out video module selection
qemuDeviceVideoGetModel: Deduplicate a check
qemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideo) to explicit
switch()
qemu_command: Switch from VIR_ENUM_IMPL(qemuDeviceVideoSecondary) to
explicit switch()
qemuBuildDeviceVideoStr: Move logic wrapping qemuBuildVirtioDevStr()
into qemuDeviceVideoGetModel()
qemuBuildDeviceVideoStr: Don't overwrite @model
src/qemu/qemu_command.c | 159 +++++++++++++++++++++++++---------------
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_domain.h | 2 +-
3 files changed, 102 insertions(+), 61 deletions(-)
--
2.31.1
3 years, 5 months
[PATCH v2 0/6] qemu: Adapt to virtio*gl* devices
by Han Han
Diff from v1:
- Leave qemuBuildVirtioDevStr() unmodified
- New patch: qemu_validate: Validate virtio*gl* devices for 3d
accerlation
- Use DO_TEST_CAPS_LATEST instead of DO_TEST
- Save video-virtio-vga-gpu-gl.x86_64-latest.xml as the sym link of tests/qemuxml2argvdata/video-virtio-vga-gpu-gl.xml
v1: https://listman.redhat.com/archives/libvir-list/2021-June/msg00181.html
Han Han (6):
qemu_capabilities: Add QEMU_CAPS_VIRTIO_GPU_GL_PCI
qemu_capabilities: Add QEMU_CAPS_VIRTIO_VGA_GL
qemu_validate: Validate virtio*gl* devices for 3d accerlation
qemu: Adapt to virtio-gpu-gl-pci device
qemu: Adapt to virtio-vga-gl device
tests: Tests for virtio-vga-gl and virtio-gpu-gl-pci device
src/qemu/qemu_capabilities.c | 4 ++
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_command.c | 8 ++++
src/qemu/qemu_validate.c | 4 +-
.../caps_6.1.0.x86_64.xml | 2 +
...video-virtio-vga-gpu-gl.x86_64-latest.args | 35 ++++++++++++++
.../video-virtio-vga-gpu-gl.xml | 46 +++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
.../video-virtio-vga-gpu-gl.x86_64-latest.xml | 1 +
tests/qemuxml2xmltest.c | 1 +
10 files changed, 103 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/video-virtio-vga-gpu-gl.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/video-virtio-vga-gpu-gl.xml
create mode 120000 tests/qemuxml2xmloutdata/video-virtio-vga-gpu-gl.x86_64-latest.xml
--
2.31.1
3 years, 5 months
[libvirt PATCH] cpu_map: Add cpu feature avx-vnni
by Tim Wiederhake
"avx-vvni" was introduced to qemu in commit
c1826ea6a052084f2e6a0bae9dd5932a727df039, adding it Cooperlake.
This feature is currently not used by any libvirt CPU models, but its
addition silences a warning from sync_qemu_i386.py:
```
warning: Unknown feature 'CPUID_7_1_EAX_AVX_VNNI'
warning: Feature unknown to libvirt: CPUID_7_1_EAX_AVX_VNNI
```
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/cpu_map/sync_qemu_i386.py | 1 +
src/cpu_map/x86_features.xml | 3 +++
2 files changed, 4 insertions(+)
diff --git a/src/cpu_map/sync_qemu_i386.py b/src/cpu_map/sync_qemu_i386.py
index 92bb58f75b..4dd9f3b84d 100755
--- a/src/cpu_map/sync_qemu_i386.py
+++ b/src/cpu_map/sync_qemu_i386.py
@@ -73,6 +73,7 @@ def translate_feature(name):
"CPUID_7_0_EDX_SPEC_CTRL_SSBD": "ssbd",
"CPUID_7_0_EDX_STIBP": "stibp",
"CPUID_7_1_EAX_AVX512_BF16": "avx512-bf16",
+ "CPUID_7_1_EAX_AVX_VNNI": "avx-vnni",
"CPUID_8000_0008_EBX_AMD_SSBD": "amd-ssbd",
"CPUID_8000_0008_EBX_CLZERO": "clzero",
"CPUID_8000_0008_EBX_IBPB": "ibpb",
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index e98b84f3ef..4cf3ff0804 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -363,6 +363,9 @@
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x80000000'/>
</feature>
+ <feature name='avx-vnni'>
+ <cpuid eax_in='0x07' ecx_in='0x01' eax='0x00000010'/>
+ </feature>
<feature name='avx512-bf16'>
<cpuid eax_in='0x07' ecx_in='0x01' eax='0x00000020'/>
</feature>
--
2.31.1
3 years, 5 months
[libvirt PATCH v2 0/7] Enable autostarting mediated devices
by Jonathon Jongsma
This series replaces the initial patch that was recently reverted. It
implements the autostart feature using a new virNodeDeviceGet/SetAutostart()
API that is consistent with how other libvirt objects handle autostart. It also
adds a counterpart virsh command nodedev-autostart.
In order to easily check the 'autostart' status of the device (since it is no
longer part of the device xml), a new virsh command is introduced:
nodedev-info. This also presents a few more basic bits of information about the
device, including 'active' and 'persistent' status, which requires exposing new
APIs on the node device: IsActive() and IsPersistent(). These APIs are
consistent with existing libvirt objects.
Changes in version 2:
- Parse the autostart property from mdevctl output.
- only re-sending patch 2/7, all others were already ACKED
Jonathon Jongsma (7):
api: add virNodeDevice(Get|Set)Autostart()
nodedev: implement virNodeDevice(Get|Set)Autostart()
nodedev: Add tests for mdevctl autostart command
virsh: add nodedev-autostart
api: add virNodeDeviceIsPersistent()/IsActive()
nodedev: Implement virNodeDeviceIsPersistent()/IsActive()
virsh: add nodedev-info
docs/manpages/virsh.rst | 27 +++
include/libvirt/libvirt-nodedev.h | 10 +
src/conf/node_device_conf.h | 1 +
src/conf/virnodedeviceobj.c | 16 ++
src/conf/virnodedeviceobj.h | 6 +
src/driver-nodedev.h | 18 ++
src/libvirt-nodedev.c | 141 ++++++++++++++
src/libvirt_private.syms | 2 +
src/libvirt_public.syms | 6 +
src/node_device/node_device_driver.c | 183 +++++++++++++++++-
src/node_device/node_device_driver.h | 19 ++
src/node_device/node_device_udev.c | 30 ++-
src/remote/remote_driver.c | 6 +-
src/remote/remote_protocol.x | 59 +++++-
src/remote_protocol-structs | 26 +++
.../nodedevmdevctldata/mdevctl-autostart.argv | 8 +
tests/nodedevmdevctltest.c | 54 ++++++
tools/virsh-nodedev.c | 139 +++++++++++++
18 files changed, 744 insertions(+), 7 deletions(-)
create mode 100644 tests/nodedevmdevctldata/mdevctl-autostart.argv
--
2.31.1
3 years, 5 months
[RFC QEMU PATCH] ui: Make the DisplayType enum entries conditional
by Thomas Huth
Libvirt's "domcapabilities" command has a way to state whether
certain graphic frontends are available in QEMU or not. Originally,
libvirt looked at the "--help" output of the QEMU binary to determine
whether SDL was available or not (by looking for the "-sdl" parameter
in the help text), but since libvirt stopped doing this analysis of
the help text, the detection of SDL is currently broken, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1790902
QEMU should provide a way via the QMP interface instead. The simplest
way, without introducing additional commands, is to make the DisplayType
enum entries conditional, so that the enum only contains the entries if
the corresponding CONFIG_xxx switches have been set. Unfortunately, this
only works for sdl, cocoa and spice, since gtk, egl-headless and curses
are hard-wired in the "data" section of the DisplayOptions, and thus
unfortunately always have to be defined.
Signed-off-by: Thomas Huth <thuth(a)redhat.com>
---
qapi/ui.json | 12 +++++++++---
ui/console.c | 4 ++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/qapi/ui.json b/qapi/ui.json
index 1052ca9c38..c4f44cfe50 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1126,9 +1126,15 @@
#
##
{ 'enum' : 'DisplayType',
- 'data' : [ 'default', 'none', 'gtk', 'sdl',
- 'egl-headless', 'curses', 'cocoa',
- 'spice-app'] }
+ 'data' : [
+ { 'name': 'default' },
+ { 'name': 'none' },
+ { 'name': 'gtk' },
+ { 'name': 'sdl', 'if': 'defined(CONFIG_SDL)' },
+ { 'name': 'egl-headless' },
+ { 'name': 'curses' },
+ { 'name': 'cocoa', 'if': 'defined(CONFIG_COCOA)' },
+ { 'name': 'spice-app', 'if': 'defined(CONFIG_SPICE)'} ] }
##
# @DisplayOptions:
diff --git a/ui/console.c b/ui/console.c
index 2de5f4105b..954f7162c3 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2371,8 +2371,12 @@ bool qemu_display_find_default(DisplayOptions *opts)
{
static DisplayType prio[] = {
DISPLAY_TYPE_GTK,
+#if defined(CONFIG_SDL)
DISPLAY_TYPE_SDL,
+#endif
+#if defined(CONFIG_COCOA)
DISPLAY_TYPE_COCOA
+#endif
};
int i;
--
2.27.0
3 years, 5 months
[PATCH] domain_conf: Use virXMLFormatElement() more
by Michal Privoznik
I've identified some places (mostly by looking for
virBufferUse()) that can use virXMLFormatElement() instead of
open coded version of it. I'm sure there are many more places
that could use the same treatment. Let's cure them some other
time.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Based on Dan's series he posted earlier today:
https://listman.redhat.com/archives/libvir-list/2021-June/msg00060.html
src/conf/domain_conf.c | 74 +++++++++++++++---------------------------
1 file changed, 27 insertions(+), 47 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7b9de2e92d..139cdfc0a7 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -25177,6 +25177,7 @@ virDomainSmartcardDefFormat(virBuffer *buf,
{
const char *mode = virDomainSmartcardTypeToString(def->type);
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
size_t i;
if (!mode) {
@@ -25209,19 +25210,13 @@ virDomainSmartcardDefFormat(virBuffer *buf,
}
virDomainDeviceInfoFormat(&childBuf, &def->info, flags);
- virBufferAsprintf(buf, "<smartcard mode='%s'", mode);
+ virBufferAsprintf(&attrBuf, " mode='%s'", mode);
if (def->type == VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH &&
- virDomainChrAttrsDefFormat(buf, def->data.passthru, false) < 0) {
+ virDomainChrAttrsDefFormat(&attrBuf, def->data.passthru, false) < 0) {
return -1;
}
- if (virBufferUse(&childBuf)) {
- virBufferAddLit(buf, ">\n");
- virBufferAddBuffer(buf, &childBuf);
- virBufferAddLit(buf, "</smartcard>\n");
- } else {
- virBufferAddLit(buf, "/>\n");
- }
+ virXMLFormatElement(buf, "smartcard", &attrBuf, &childBuf);
return 0;
}
@@ -25300,6 +25295,7 @@ virDomainSoundDefFormat(virBuffer *buf,
{
const char *model = virDomainSoundModelTypeToString(def->model);
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
size_t i;
if (!model) {
@@ -25316,14 +25312,9 @@ virDomainSoundDefFormat(virBuffer *buf,
virDomainDeviceInfoFormat(&childBuf, &def->info, flags);
- virBufferAsprintf(buf, "<sound model='%s'", model);
- if (virBufferUse(&childBuf)) {
- virBufferAddLit(buf, ">\n");
- virBufferAddBuffer(buf, &childBuf);
- virBufferAddLit(buf, "</sound>\n");
- } else {
- virBufferAddLit(buf, "/>\n");
- }
+ virBufferAsprintf(&attrBuf, " model='%s'", model);
+
+ virXMLFormatElement(buf, "sound", &attrBuf, &childBuf);
return 0;
}
@@ -25453,6 +25444,7 @@ virDomainAudioDefFormat(virBuffer *buf,
virDomainAudioDef *def)
{
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) inputBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) outputBuf = VIR_BUFFER_INITIALIZER;
const char *type = virDomainAudioTypeTypeToString(def->type);
@@ -25463,10 +25455,10 @@ virDomainAudioDefFormat(virBuffer *buf,
return -1;
}
- virBufferAsprintf(buf, "<audio id='%d' type='%s'", def->id, type);
+ virBufferAsprintf(&attrBuf, " id='%d' type='%s'", def->id, type);
if (def->timerPeriod)
- virBufferAsprintf(buf, " timerPeriod='%u'", def->timerPeriod);
+ virBufferAsprintf(&attrBuf, " timerPeriod='%u'", def->timerPeriod);
switch (def->type) {
case VIR_DOMAIN_AUDIO_TYPE_NONE:
@@ -25489,20 +25481,20 @@ virDomainAudioDefFormat(virBuffer *buf,
case VIR_DOMAIN_AUDIO_TYPE_OSS:
if (def->backend.oss.tryMMap)
- virBufferAsprintf(buf, " tryMMap='%s'",
+ virBufferAsprintf(&attrBuf, " tryMMap='%s'",
virTristateBoolTypeToString(def->backend.oss.tryMMap));
if (def->backend.oss.exclusive)
- virBufferAsprintf(buf, " exclusive='%s'",
+ virBufferAsprintf(&attrBuf, " exclusive='%s'",
virTristateBoolTypeToString(def->backend.oss.exclusive));
if (def->backend.oss.dspPolicySet)
- virBufferAsprintf(buf, " dspPolicy='%d'", def->backend.oss.dspPolicy);
+ virBufferAsprintf(&attrBuf, " dspPolicy='%d'", def->backend.oss.dspPolicy);
virDomainAudioOSSFormat(&def->backend.oss.input, &inputBuf);
virDomainAudioOSSFormat(&def->backend.oss.output, &outputBuf);
break;
case VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO:
- virBufferEscapeString(buf, " serverName='%s'",
+ virBufferEscapeString(&attrBuf, " serverName='%s'",
def->backend.pulseaudio.serverName);
virDomainAudioPulseAudioFormat(&def->backend.pulseaudio.input, &inputBuf);
@@ -25511,7 +25503,7 @@ virDomainAudioDefFormat(virBuffer *buf,
case VIR_DOMAIN_AUDIO_TYPE_SDL:
if (def->backend.sdl.driver)
- virBufferAsprintf(buf, " driver='%s'",
+ virBufferAsprintf(&attrBuf, " driver='%s'",
virDomainAudioSDLDriverTypeToString(
def->backend.sdl.driver));
@@ -25523,7 +25515,7 @@ virDomainAudioDefFormat(virBuffer *buf,
break;
case VIR_DOMAIN_AUDIO_TYPE_FILE:
- virBufferEscapeString(buf, " path='%s'", def->backend.file.path);
+ virBufferEscapeString(&attrBuf, " path='%s'", def->backend.file.path);
break;
case VIR_DOMAIN_AUDIO_TYPE_LAST:
@@ -25535,13 +25527,7 @@ virDomainAudioDefFormat(virBuffer *buf,
virDomainAudioCommonFormat(&def->input, &childBuf, &inputBuf, "input");
virDomainAudioCommonFormat(&def->output, &childBuf, &outputBuf, "output");
- if (virBufferUse(&childBuf)) {
- virBufferAddLit(buf, ">\n");
- virBufferAddBuffer(buf, &childBuf);
- virBufferAddLit(buf, "</audio>\n");
- } else {
- virBufferAddLit(buf, "/>\n");
- }
+ virXMLFormatElement(buf, "audio", &attrBuf, &childBuf);
return 0;
}
@@ -27002,6 +26988,7 @@ virDomainCachetuneDefFormat(virBuffer *buf,
unsigned int flags)
{
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
size_t i = 0;
g_autofree char *vcpus = NULL;
@@ -27024,19 +27011,17 @@ virDomainCachetuneDefFormat(virBuffer *buf,
if (!vcpus)
return -1;
- virBufferAsprintf(buf, "<cachetune vcpus='%s'", vcpus);
+ virBufferAsprintf(&attrBuf, " vcpus='%s'", vcpus);
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
const char *alloc_id = virResctrlAllocGetID(resctrl->alloc);
if (!alloc_id)
return -1;
- virBufferAsprintf(buf, " id='%s'", alloc_id);
+ virBufferAsprintf(&attrBuf, " id='%s'", alloc_id);
}
- virBufferAddLit(buf, ">\n");
- virBufferAddBuffer(buf, &childrenBuf);
- virBufferAddLit(buf, "</cachetune>\n");
+ virXMLFormatElement(buf, "cachetune", &attrBuf, &childrenBuf);
return 0;
}
@@ -27062,6 +27047,7 @@ virDomainMemorytuneDefFormat(virBuffer *buf,
unsigned int flags)
{
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
g_autofree char *vcpus = NULL;
size_t i = 0;
@@ -27084,19 +27070,17 @@ virDomainMemorytuneDefFormat(virBuffer *buf,
if (!vcpus)
return -1;
- virBufferAsprintf(buf, "<memorytune vcpus='%s'", vcpus);
+ virBufferAsprintf(&attrBuf, " vcpus='%s'", vcpus);
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
const char *alloc_id = virResctrlAllocGetID(resctrl->alloc);
if (!alloc_id)
return -1;
- virBufferAsprintf(buf, " id='%s'", alloc_id);
+ virBufferAsprintf(&attrBuf, " id='%s'", alloc_id);
}
- virBufferAddLit(buf, ">\n");
- virBufferAddBuffer(buf, &childrenBuf);
- virBufferAddLit(buf, "</memorytune>\n");
+ virXMLFormatElement(buf, "memorytune", &attrBuf, &childrenBuf);
return 0;
}
@@ -27213,11 +27197,7 @@ virDomainCputuneDefFormat(virBuffer *buf,
for (i = 0; i < def->nresctrls; i++)
virDomainMemorytuneDefFormat(&childrenBuf, def->resctrls[i], flags);
- if (virBufferUse(&childrenBuf)) {
- virBufferAddLit(buf, "<cputune>\n");
- virBufferAddBuffer(buf, &childrenBuf);
- virBufferAddLit(buf, "</cputune>\n");
- }
+ virXMLFormatElement(buf, "cputune", NULL, &childrenBuf);
return 0;
}
--
2.31.1
3 years, 5 months
[libvirt PATCH] cpu_map: sync_qemu_i386.py: Remove superfluous semicolon
by Tim Wiederhake
The semicolon in question makes the pipeline fail over a style checker
complaint.
Introduced-in: 360b8eb2d2cb1b6a8c9a78fa2c5be31dd7c74487
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/cpu_map/sync_qemu_i386.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cpu_map/sync_qemu_i386.py b/src/cpu_map/sync_qemu_i386.py
index fbf1edf5d0..92bb58f75b 100755
--- a/src/cpu_map/sync_qemu_i386.py
+++ b/src/cpu_map/sync_qemu_i386.py
@@ -209,7 +209,7 @@ def read_builtin_x86_defs(filename):
raise RuntimeError("begin mark not found")
match = begin_mark.match(line)
if match:
- break;
+ break
match = shorthand.match(line)
if match:
# TCG definitions are irrelevant for cpu models
--
2.31.1
3 years, 5 months