[libvirt] [perl][PATCH] Add virConnectGetStoragePoolCapabilities binding
by Michal Privoznik
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Changes | 1 +
examples/node-info.pl | 13 +++++++++++++
lib/Sys/Virt.pm | 6 ++++++
lib/Sys/Virt.xs | 16 ++++++++++++++++
4 files changed, 36 insertions(+)
diff --git a/Changes b/Changes
index 6bff52d..39a1bd5 100644
--- a/Changes
+++ b/Changes
@@ -7,6 +7,7 @@ Revision history for perl module Sys::Virt
- Add VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY constant
- Add VIR_DOMAIN_SAVE_IMAGE_XML_SECURE and
VIR_DOMAIN_SNAPSHOT_XML_SECURE constants
+ - Add virConnectGetStoragePoolCapabilities binding
5.0.0 2019-01-21
diff --git a/examples/node-info.pl b/examples/node-info.pl
index 9655ab4..b31e90f 100644
--- a/examples/node-info.pl
+++ b/examples/node-info.pl
@@ -4,6 +4,8 @@ use strict;
use warnings;
use Sys::Virt;
+use XML::XPath;
+use XML::XPath::XMLParser;
my $addr = @ARGV ? shift @ARGV : "";
@@ -33,5 +35,16 @@ foreach my $info (@info) {
print "\n";
}
+my $poolCaps = $hv->get_storage_pool_capabilities();
+my @poolTypes = ();
+
+my $xp = XML::XPath->new(xml => $poolCaps);
+my $nodeset = $xp->find('/storagepoolCapabilities/pool[@supported="yes"]/@type');
+foreach my $node ($nodeset->get_nodelist) {
+ push (@poolTypes, $node->getNodeValue());
+}
+
+print "Supported pool types: @poolTypes\n";
+
my $xml = $hv->get_domain_capabilities(undef, "x86_64", undef, "kvm");
print $xml;
diff --git a/lib/Sys/Virt.pm b/lib/Sys/Virt.pm
index 8fd3e23..549dc54 100644
--- a/lib/Sys/Virt.pm
+++ b/lib/Sys/Virt.pm
@@ -1869,6 +1869,12 @@ an optional name of a guest machine, and C<$virttype> is an
optional name of the virtualization type. C<$flags> is unused
and defaults to zero.
+=item my $xml = $con->get_storage_pool_capabilities($flags=0);
+
+Returns an XML document describing the storage pool driver
+capabilities (e.g. which storage pool types are supported and so
+on). C<$flags> is currently unused and defaults to zero.
+
=item my $result = $con->compare_cpu($xml, $flags=0);
Checks whether the CPU definition in C<$xml> is compatible with the
diff --git a/lib/Sys/Virt.xs b/lib/Sys/Virt.xs
index bc9320d..056d767 100644
--- a/lib/Sys/Virt.xs
+++ b/lib/Sys/Virt.xs
@@ -2774,6 +2774,22 @@ PREINIT:
RETVAL
+SV *
+get_storage_pool_capabilities(con, flags=0)
+ virConnectPtr con;
+ unsigned int flags;
+PREINIT:
+ char *xml;
+ CODE:
+ if (!(xml = virConnectGetStoragePoolCapabilities(con, flags)))
+ _croak_error();
+
+ RETVAL = newSVpv(xml, 0);
+ free(xml);
+ OUTPUT:
+ RETVAL
+
+
SV *
compare_cpu(con, xml, flags=0)
virConnectPtr con;
--
2.19.2
5 years, 8 months
[libvirt] [PATCH] virfilewrapper: Fix indentation
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Pushed as trivial.
tests/virfilewrapper.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/virfilewrapper.h b/tests/virfilewrapper.h
index 9e3816b64493..044c53223251 100644
--- a/tests/virfilewrapper.h
+++ b/tests/virfilewrapper.h
@@ -21,7 +21,7 @@
int
virFileWrapperAddPrefix(const char *prefix,
- const char *override);
+ const char *override);
void
virFileWrapperRemovePrefix(const char *prefix);
--
2.21.0
5 years, 8 months
[libvirt] [PATCH 0/2] qemu: Fixes for (non-)transitional virtio devices
by Andrea Bolognani
Andrea Bolognani (2):
qemu: Improve validation for virtio input devices
docs: Document configuration quirks for virtio devices
docs/formatdomain.html.in | 18 +++++++++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_domain.c | 32 +++++++++++++++++++
.../virtio-transitional-not-supported.xml | 11 +++++++
tests/qemuxml2argvtest.c | 4 +++
5 files changed, 66 insertions(+)
create mode 100644 tests/qemuxml2argvdata/virtio-transitional-not-supported.xml
--
2.20.1
5 years, 8 months
[libvirt] [PATCH v6 03/14] audio: -audiodev command line option: documentation
by Kővágó, Zoltán
This patch adds documentation of an -audiodev command line option, that
deprecates the old QEMU_* environment variables for audio backend
configuration. It's syntax is similar to existing options (-netdev,
-device, etc):
-audiodev driver_name,property=value,...
Although now it's possible to specify multiple -audiodev options on
command line, multiple audio backends are not supported yet.
Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu(a)gmail.com>
---
Notes:
Changes from v4:
* deprecated QEMU_AUDIO_ env vars
* updated to reflect qapi changes
* added info to qemu-deprecated.texi
qemu-deprecated.texi | 7 ++
qemu-options.hx | 236 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 240 insertions(+), 3 deletions(-)
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 45c57952da..5c07ad4acb 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -60,6 +60,13 @@ Support for invalid topologies will be removed, the user must ensure
topologies described with -smp include all possible cpus, i.e.
@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}.
+@subsection QEMU_AUDIO_ environment variables and -audio-help (since 4.0)
+
+The ``-audiodev'' argument is now the preferred way to specify audio
+backend settings instead of environment variables. To ease migration to
+the new format, the ``-audiodev-help'' option can be used to convert
+the current values of the environment variables to ``-audiodev'' options.
+
@section QEMU Machine Protocol (QMP) commands
@subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)
diff --git a/qemu-options.hx b/qemu-options.hx
index 1cf9aac1fe..52ea13e6a2 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -416,14 +416,244 @@ The default is @code{en-us}.
ETEXI
+HXCOMM Deprecated by -audiodev
DEF("audio-help", 0, QEMU_OPTION_audio_help,
- "-audio-help print list of audio drivers and their options\n",
+ "-audio-help show -audiodev equivalent of the currently specified audio settings\n",
QEMU_ARCH_ALL)
STEXI
@item -audio-help
@findex -audio-help
-Will show the audio subsystem help: list of drivers, tunable
-parameters.
+Will show the -audiodev equivalent of the currently specified
+(deprecated) environment variables.
+ETEXI
+
+DEF("audiodev", HAS_ARG, QEMU_OPTION_audiodev,
+ "-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n"
+ " specifies the audio backend to use\n"
+ " id= identifier of the backend\n"
+ " timer-period= timer period in microseconds\n"
+ " in|out.fixed-settings= use fixed settings for host audio\n"
+ " in|out.frequency= frequency to use with fixed settings\n"
+ " in|out.channels= number of channels to use with fixed settings\n"
+ " in|out.format= sample format to use with fixed settings\n"
+ " valid values: s8, s16, s32, u8, u16, u32\n"
+ " in|out.voices= number of voices to use\n"
+ " in|out.buffer-len= length of buffer in microseconds\n"
+ "-audiodev none,id=id,[,prop[=value][,...]]\n"
+ " dummy driver that discards all output\n"
+#ifdef CONFIG_AUDIO_ALSA
+ "-audiodev alsa,id=id[,prop[=value][,...]]\n"
+ " in|out.dev= name of the audio device to use\n"
+ " in|out.period-len= length of period in microseconds\n"
+ " in|out.try-poll= attempt to use poll mode\n"
+ " threshold= threshold (in microseconds) when playback starts\n"
+#endif
+#ifdef CONFIG_AUDIO_COREAUDIO
+ "-audiodev coreaudio,id=id[,prop[=value][,...]]\n"
+ " in|out.buffer-count= number of buffers\n"
+#endif
+#ifdef CONFIG_AUDIO_DSOUND
+ "-audiodev dsound,id=id[,prop[=value][,...]]\n"
+ " latency= add extra latency to playback in microseconds\n"
+#endif
+#ifdef CONFIG_AUDIO_OSS
+ "-audiodev oss,id=id[,prop[=value][,...]]\n"
+ " in|out.dev= path of the audio device to use\n"
+ " in|out.buffer-count= number of buffers\n"
+ " in|out.try-poll= attempt to use poll mode\n"
+ " try-mmap= try using memory mapped access\n"
+ " exclusive= open device in exclusive mode\n"
+ " dsp-policy= set timing policy (0..10), -1 to use fragment mode\n"
+#endif
+#ifdef CONFIG_AUDIO_PA
+ "-audiodev pa,id=id[,prop[=value][,...]]\n"
+ " server= PulseAudio server address\n"
+ " in|out.name= source/sink device name\n"
+#endif
+#ifdef CONFIG_AUDIO_SDL
+ "-audiodev sdl,id=id[,prop[=value][,...]]\n"
+#endif
+#ifdef CONFIG_SPICE
+ "-audiodev spice,id=id[,prop[=value][,...]]\n"
+#endif
+ "-audiodev wav,id=id[,prop[=value][,...]]\n"
+ " path= path of wav file to record\n",
+ QEMU_ARCH_ALL)
+STEXI
+@item -audiodev [driver=]@var{driver},id=@var{id}[,@var{prop}[=@var{value}][,...]]
+@findex -audiodev
+Adds a new audio backend @var{driver} identified by @var{id}. There are
+global and driver specific properties. Some values can be set
+differently for input and output, they're marked with @code{in|out.}.
+You can set the input's property with @code{in.@var{prop}} and the
+output's property with @code{out.@var{prop}}. For example:
+@example
+-audiodev alsa,id=example,in.frequency=44110,out.frequency=8000
+-audiodev alsa,id=example,out.channels=1 # leaves in.channels unspecified
+@end example
+
+Valid global options are:
+
+@table @option
+@item id=@var{identifier}
+Identifies the audio backend.
+
+@item timer-period=@var{period}
+Sets the timer @var{period} used by the audio subsystem in microseconds.
+Default is 10000 (10 ms).
+
+@item in|out.fixed-settings=on|off
+Use fixed settings for host audio. When off, it will change based on
+how the guest opens the sound card. In this case you must not specify
+@var{frequency}, @var{channels} or @var{format}. Default is on.
+
+@item in|out.frequency=@var{frequency}
+Specify the @var{frequency} to use when using @var{fixed-settings}.
+Default is 44100Hz.
+
+@item in|out.channels=@var{channels}
+Specify the number of @var{channels} to use when using
+@var{fixed-settings}. Default is 2 (stereo).
+
+@item in|out.format=@var{format}
+Specify the sample @var{format} to use when using @var{fixed-settings}.
+Valid values are: @code{s8}, @code{s16}, @code{s32}, @code{u8},
+@code{u16}, @code{u32}. Default is @code{s16}.
+
+@item in|out.voices=@var{voices}
+Specify the number of @var{voices} to use. Default is 1.
+
+@item in|out.buffer=@var{usecs}
+Sets the size of the buffer in microseconds.
+
+@end table
+
+@item -audiodev none,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates a dummy backend that discards all outputs. This backend has no
+backend specific properties.
+
+@item -audiodev alsa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates backend using the ALSA. This backend is only available on
+Linux.
+
+ALSA specific options are:
+
+@table @option
+
+@item in|out.dev=@var{device}
+Specify the ALSA @var{device} to use for input and/or output. Default
+is @code{default}.
+
+@item in|out.period-len=@var{usecs}
+Sets the period length in microseconds.
+
+@item in|out.try-poll=on|off
+Attempt to use poll mode with the device. Default is on.
+
+@item threshold=@var{threshold}
+Threshold (in microseconds) when playback starts. Default is 0.
+
+@end table
+
+@item -audiodev coreaudio,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates a backend using Apple's Core Audio. This backend is only
+available on Mac OS and only supports playback.
+
+Core Audio specific options are:
+
+@table @option
+
+@item in|out.buffer-count=@var{count}
+Sets the @var{count} of the buffers.
+
+@end table
+
+@item -audiodev dsound,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates a backend using Microsoft's DirectSound. This backend is only
+available on Windows and only supports playback.
+
+DirectSound specific options are:
+
+@table @option
+
+@item latency=@var{usecs}
+Add extra @var{usecs} microseconds latency to playback. Default is
+10000 (10 ms).
+
+@end table
+
+@item -audiodev oss,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates a backend using OSS. This backend is available on most
+Unix-like systems.
+
+OSS specific options are:
+
+@table @option
+
+@item in|out.dev=@var{device}
+Specify the file name of the OSS @var{device} to use. Default is
+@code{/dev/dsp}.
+
+@item in|out.buffer-count=@var{count}
+Sets the @var{count} of the buffers.
+
+@item in|out.try-poll=on|of
+Attempt to use poll mode with the device. Default is on.
+
+@item try-mmap=on|off
+Try using memory mapped device access. Default is off.
+
+@item exclusive=on|off
+Open the device in exclusive mode (vmix won't work in this case).
+Default is off.
+
+@item dsp-policy=@var{policy}
+Sets the timing policy (between 0 and 10, where smaller number means
+smaller latency but higher CPU usage). Use -1 to use buffer sizes
+specified by @code{buffer} and @code{buffer-count}. This option is
+ignored if you do not have OSS 4. Default is 5.
+
+@end table
+
+@item -audiodev pa,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates a backend using PulseAudio. This backend is available on most
+systems.
+
+PulseAudio specific options are:
+
+@table @option
+
+@item server=@var{server}
+Sets the PulseAudio @var{server} to connect to.
+
+@item in|out.name=@var{sink}
+Use the specified source/sink for recording/playback.
+
+@end table
+
+@item -audiodev sdl,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates a backend using SDL. This backend is available on most systems,
+but you should use your platform's native backend if possible. This
+backend has no backend specific properties.
+
+@item -audiodev spice,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates a backend that sends audio through SPICE. This backend requires
+@code{-spice} and automatically selected in that case, so usually you
+can ignore this option. This backend has no backend specific
+properties.
+
+@item -audiodev wav,id=@var{id}[,@var{prop}[=@var{value}][,...]]
+Creates a backend that writes audio to a WAV file.
+
+Backend specific options are:
+
+@table @option
+
+@item path=@var{path}
+Write recorded audio into the specified file. Default is
+(a)code{qemu.wav}.
+
+@end table
ETEXI
DEF("soundhw", HAS_ARG, QEMU_OPTION_soundhw,
--
2.20.1
5 years, 8 months
[libvirt] [PATCH 0/2] qemu: Allow creating ppc64 guests with graphics and no USB mouse
by Andrea Bolognani
See patch 2/2.
Andrea Bolognani (2):
tests: Add simple guests with graphics to qemuxml2argv
qemu: Allow creating ppc64 guests with graphics and no USB mouse
src/qemu/qemu_domain.c | 20 +++++++
.../aarch64-virt-graphics.aarch64-latest.args | 59 +++++++++++++++++++
.../aarch64-virt-graphics.xml | 50 ++++++++++++++++
.../ppc64-pseries-graphics.ppc64-latest.args | 47 +++++++++++++++
.../ppc64-pseries-graphics.xml | 44 ++++++++++++++
.../x86_64-pc-graphics.x86_64-latest.args | 51 ++++++++++++++++
tests/qemuxml2argvdata/x86_64-pc-graphics.xml | 55 +++++++++++++++++
.../x86_64-q35-graphics.x86_64-latest.args | 59 +++++++++++++++++++
.../qemuxml2argvdata/x86_64-q35-graphics.xml | 55 +++++++++++++++++
tests/qemuxml2argvtest.c | 6 ++
10 files changed, 446 insertions(+)
create mode 100644 tests/qemuxml2argvdata/aarch64-virt-graphics.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/aarch64-virt-graphics.xml
create mode 100644 tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/ppc64-pseries-graphics.xml
create mode 100644 tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/x86_64-pc-graphics.xml
create mode 100644 tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/x86_64-q35-graphics.xml
--
2.20.1
5 years, 8 months
[libvirt] [PATCH] test: storage: Fill in default vol types for every pool
by Cole Robinson
Fill in a default volume type for every pool type, as reported
by the VolGetInfo API.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
A more complete fix would take into account VolDef->type, so test
driver users could set this value via volume XML. That would require
adding a PostParse callback to the storage driver infrastructure.
This is still an improvement in the interim and would be part of
a complete fix anyways
src/test/test_driver.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ce0df1f8e3..3f37b2ede7 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5164,13 +5164,26 @@ testStorageVolDelete(virStorageVolPtr vol,
static int
testStorageVolumeTypeForPool(int pooltype)
{
- switch (pooltype) {
- case VIR_STORAGE_POOL_DIR:
- case VIR_STORAGE_POOL_FS:
- case VIR_STORAGE_POOL_NETFS:
- return VIR_STORAGE_VOL_FILE;
- default:
- return VIR_STORAGE_VOL_BLOCK;
+ switch ((virStoragePoolType) pooltype) {
+ case VIR_STORAGE_POOL_DIR:
+ case VIR_STORAGE_POOL_FS:
+ case VIR_STORAGE_POOL_NETFS:
+ case VIR_STORAGE_POOL_VSTORAGE:
+ return VIR_STORAGE_VOL_FILE;
+ case VIR_STORAGE_POOL_SHEEPDOG:
+ case VIR_STORAGE_POOL_ISCSI_DIRECT:
+ case VIR_STORAGE_POOL_GLUSTER:
+ case VIR_STORAGE_POOL_RBD:
+ return VIR_STORAGE_VOL_NETWORK;
+ case VIR_STORAGE_POOL_LOGICAL:
+ case VIR_STORAGE_POOL_DISK:
+ case VIR_STORAGE_POOL_MPATH:
+ case VIR_STORAGE_POOL_ISCSI:
+ case VIR_STORAGE_POOL_SCSI:
+ case VIR_STORAGE_POOL_ZFS:
+ case VIR_STORAGE_POOL_LAST:
+ default:
+ return VIR_STORAGE_VOL_BLOCK;
}
}
--
2.20.1
5 years, 8 months
[libvirt] [PATCH] util: skip RDMA detection for non-PCI network devices
by Pavel Hrdina
Only PCI devices have '/sys/class/net/<ifname>/device/resource' so we
need to skip this check for all other network devices.
Without this patch and RDMA enabled libvirt will not detect any network
device that doesn't have the path above which includes 'lo', 'virbr',
'tun', etc.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1639258
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/util/virnetdev.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index aeb9caab2a..699f2a0acb 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2914,8 +2914,14 @@ virNetDevRDMAFeature(const char *ifname,
if (virAsprintf(ð_devpath, SYSFS_NET_DIR "%s/device/resource", ifname) < 0)
goto cleanup;
- if (!virFileExists(eth_devpath))
+
+ /* If /sys/class/net/<ifname>/device/resource doesn't exist it is not a PCI
+ * device and therefore it will not have RDMA. */
+ if (!virFileExists(eth_devpath)) {
+ ret = 0;
goto cleanup;
+ }
+
if (virFileReadAll(eth_devpath, RESOURCE_FILE_LEN, ð_res_buf) < 0)
goto cleanup;
--
2.20.1
5 years, 8 months
[libvirt] [PATCH] conf: fix title and description for virDomainSetMetadata API
by Pavel Hrdina
If we pass XML to virDomainDefineXML API with these two elements:
...
<title></title>
<description></description>
...
libvirt correctly ignores these two elements and they will not appear
in the parsed XML.
However, if we use virDomainSetMetadata API and with "" as value for
title or description we will end up with the parsed XML that contains
these empty elements.
Let's fix the behavior of this API to behave the same as
virDomainDefineXML.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1518042
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/domain_conf.c | 6 +++---
tests/metadatatest.c | 23 ++++++++++++++++-------
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 477deb777e..2fba58e5c4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30363,7 +30363,7 @@ virDomainDefSetMetadata(virDomainDefPtr def,
xmlDocPtr doc = NULL;
xmlNodePtr old;
xmlNodePtr new = NULL;
- char *tmp;
+ char *tmp = NULL;
int ret = -1;
if (type >= VIR_DOMAIN_METADATA_LAST) {
@@ -30374,7 +30374,7 @@ virDomainDefSetMetadata(virDomainDefPtr def,
switch ((virDomainMetadataType) type) {
case VIR_DOMAIN_METADATA_DESCRIPTION:
- if (VIR_STRDUP(tmp, metadata) < 0)
+ if (STRNEQ_NULLABLE(metadata, "") && VIR_STRDUP(tmp, metadata) < 0)
goto cleanup;
VIR_FREE(def->description);
@@ -30382,7 +30382,7 @@ virDomainDefSetMetadata(virDomainDefPtr def,
break;
case VIR_DOMAIN_METADATA_TITLE:
- if (VIR_STRDUP(tmp, metadata) < 0)
+ if (STRNEQ_NULLABLE(metadata, "") && VIR_STRDUP(tmp, metadata) < 0)
goto cleanup;
VIR_FREE(def->title);
diff --git a/tests/metadatatest.c b/tests/metadatatest.c
index 786c62e623..a9080b32d7 100644
--- a/tests/metadatatest.c
+++ b/tests/metadatatest.c
@@ -167,6 +167,7 @@ struct metadataTest {
virDomainPtr dom;
const char *data;
+ const char *expect;
int type;
bool fail;
};
@@ -232,7 +233,7 @@ testTextMetadata(const void *data)
actual = virDomainGetMetadata(test->dom, test->type, NULL, 0);
- if (STRNEQ_NULLABLE(test->data, actual)) {
+ if (STRNEQ_NULLABLE(test->expect, actual)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"expected metadata doesn't match actual: "
"expected:'%s'\ngot: '%s'",
@@ -248,10 +249,11 @@ testTextMetadata(const void *data)
return ret;
}
-#define TEST_TEXT_METADATA(INDEX, TYPE, DATA, FAIL) \
+#define TEST_TEXT_METADATA(INDEX, TYPE, DATA, EXPECT, FAIL) \
do { \
test.type = VIR_DOMAIN_METADATA_ ## TYPE; \
test.data = DATA; \
+ test.expect = EXPECT; \
test.fail = FAIL; \
\
if (virTestRun("text metadata: " #TYPE " " INDEX " ", \
@@ -259,9 +261,16 @@ testTextMetadata(const void *data)
ret = EXIT_FAILURE; \
} while (0)
-#define TEST_TITLE(INDEX, DATA) TEST_TEXT_METADATA(INDEX, TITLE, DATA, false)
-#define TEST_TITLE_FAIL(INDEX, DATA) TEST_TEXT_METADATA(INDEX, TITLE, DATA, true)
-#define TEST_DESCR(INDEX, DATA) TEST_TEXT_METADATA(INDEX, DESCRIPTION, DATA, false)
+#define TEST_TITLE(INDEX, DATA) \
+ TEST_TEXT_METADATA(INDEX, TITLE, DATA, DATA, false)
+#define TEST_TITLE_EXPECT(INDEX, DATA, EXPECT) \
+ TEST_TEXT_METADATA(INDEX, TITLE, DATA, EXPECT, false)
+#define TEST_TITLE_FAIL(INDEX, DATA) \
+ TEST_TEXT_METADATA(INDEX, TITLE, DATA, DATA, true)
+#define TEST_DESCR(INDEX, DATA) \
+ TEST_TEXT_METADATA(INDEX, DESCRIPTION, DATA, DATA, false)
+#define TEST_DESCR_EXPECT(INDEX, DATA, EXPECT) \
+ TEST_TEXT_METADATA(INDEX, DESCRIPTION, DATA, EXPECT, false)
static int
mymain(void)
@@ -290,7 +299,7 @@ mymain(void)
TEST_TITLE("2", NULL);
TEST_TITLE("3", "blah");
TEST_TITLE_FAIL("4", "qwe\nrt");
- TEST_TITLE("5", "");
+ TEST_TITLE_EXPECT("5", "", NULL);
TEST_TITLE_FAIL("6", "qwert\n");
TEST_TITLE_FAIL("7", "\n");
@@ -298,7 +307,7 @@ mymain(void)
TEST_DESCR("2", NULL);
TEST_DESCR("3", "qwert");
TEST_DESCR("4", "\n");
- TEST_DESCR("5", "");
+ TEST_DESCR_EXPECT("5", "", NULL);
virDomainFree(test.dom);
virConnectClose(test.conn);
--
2.20.1
5 years, 8 months
[libvirt] [PATCH] qemu: Fix query-cpus-fast target architecture detection
by Boris Fiuczynski
From: Viktor Mihajlovski <mihajlov(a)linux.ibm.com>
Since qemu 2.13 reports the target architecture in a property called
'target' additionally to the property 'arch', that has been used in
qemu 2.12 in the response data of 'query-cpus-fast'.
Libvirts monitor code prefers the 'target' property over 'arch'.
At least for s390(x), target is reported as 's390x' while arch is 's390'.
In a later step a comparison is performed against 's390' which fails for
qemu 2.13 and later.
In consequence the architecture specific data for s390 won't be extracted
from the returned data, leading to incorrect values being reported by
virsh domstats --vcpu.
Changing to check explicitly for 's390' and 's390x'.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk(a)linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
src/qemu/qemu_monitor_json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index cf474eb6c8..0236323a51 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1772,7 +1772,7 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data,
goto cleanup;
/* process optional architecture-specific data */
- if (STREQ_NULLABLE(arch, "s390"))
+ if (STREQ_NULLABLE(arch, "s390") || STREQ_NULLABLE(arch, "s390x"))
qemuMonitorJSONExtractCPUS390Info(entry, cpus + i);
}
--
2.17.0
5 years, 8 months
[libvirt] [PATCH] news: document virtio-{non-}transitional feature
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
docs/news.xml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index f58c30ee22..81466c3d55 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -47,6 +47,25 @@
virConnectGetStoragePoolCapabilites API.
</description>
</change>
+ <change>
+ <summary>
+ qemu: Support virtio-{non-}transitional device models
+ </summary>
+ <description>
+ <code>virtio-transitional</code> and
+ <code>virtio-non-transitional</code> <code>model</code> values
+ were added to the QEMU driver for the following devices:
+ <code>disk</code>, <code>interface</code>, <code>filesystem</code>,
+ <code>rng</code>, <code>vsock</code>, <code>memballoon</code>,
+ <code>controller</code> type <code>scsi</code>,
+ <code>controller</code> type <code>virtio-serial</code>,
+ <code>input</code> bus <code>virtio</code>
+ type <code>passthrough</code>,
+ <code>hostdev</code> type <code>scsi_host</code>. These new
+ models can be used to give fine grained control over what
+ virtio device version is presented to the guest.
+ </description>
+ </change>
</section>
<section title="Improvements">
</section>
--
2.20.1
5 years, 8 months