Commit Graph

6041 Commits

Author SHA1 Message Date
Jim Fehlig
a93f55c53d libxl: Add support for max_event_channels
Add support for setting event_channels in libxl domain config object and
include a test to check that it is properly converted from XML to libxl
domain config.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-04-09 15:45:05 -06:00
Jiri Denemark
5d6059f8ec cpu_map: Distinguish Cascadelake-Server from Skylake-Server
The signatures of these two CPU model differ only in stepping as both
report family 6 and model 85. Skylake-Server uses stepping 4 or less and
Cascadelake-Server uses stepping 5..7.

https://bugzilla.redhat.com/show_bug.cgi?id=1761678

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-08 17:52:50 +02:00
Jiri Denemark
3714779b15 cputest: Add data for Intel(R) Xeon(R) Gold 6130 CPU
Skylake-Server with family 6, model 85, stepping 4, which is currently
mis-detected as Cascadelake-Server CPU model.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-08 17:52:50 +02:00
Jiri Denemark
8605960389 cputest: Add data for Intel(R) Xeon(R) Platinum 9242 CPU
Cascadelake-Server with family 6, model 85, stepping 7.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-08 17:52:50 +02:00
Bjoern Walk
5a2f2310a0 qemu: command: support for virtio packed option
Pass the packed option on the QEMU command line of the capability for
packed virtqueues is detected and the parameter is set explicitly.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-08 16:26:04 +02:00
Bjoern Walk
979500e1c1 qemu: capabilities: add 'packed' capability
Add the capability for QEMU's packed virtqueues for virtio that supposedly have
better cache utilization and performance compared to the default split queues.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-08 16:26:03 +02:00
Bjoern Walk
763416e192 qemu: capabilities: update qemu-4.2 capabilities for s390x
Update s390x capabilities for QEMU 4.2 with the actual GA version for
QEMU and on the latest z15 machine.

This picks up the new blockdev capability, so we need to refresh a bunch
of test cases as well.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-08 14:46:24 +02:00
Michal Privoznik
8b9488d929 conf: Move virDomainGenerateMachineName to hypervisor/
The virDomainGenerateMachineName() function doesn't belong in
src/conf/ really, because it has nothing to do with domain XML
parsing. It landed there because of lack of better place in the
past. But now that we have src/hypervisor/ the function should
live there. At the same time, the function name is changed to
match new location.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-04-07 15:26:19 +02:00
Michal Privoznik
34a59fb570 qemu: Drop two layers of nesting of memoryBackingDir
Initially introduced in v3.10.0-rc1~172.

When generating a path for memory-backend-file or -mem-path, qemu
driver will use the following pattern:

  $memoryBackingDir/libvirt/qemu/$id-$shortName

where $memoryBackingDir defaults to /var/lib/libvirt/qemu/ram but
can be overridden in qemu.conf. Anyway, the "/libvirt/qemu/" part
looks redundant, because it's already contained in the default,
or creates unnecessary nesting if overridden in qemu.conf.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-04-07 15:26:17 +02:00
Michal Privoznik
f00f4ea7b1 tests: Fix virQEMUDriverConfigNew() calling with respect to @root
The virQEMUDriverConfigNew() accepts path to root directory for
embed mode as an argument. If the argument is not NULL it uses
the passed value as prefix for some internal paths (e.g.
cfg->libDir). If it is NULL though, it looks if the other
argument, @privileged is true or false and generates internal
paths accordingly. But when calling the function from the test
suite, instead of passing NULL for @root, an empty string is
passed. Fortunately, this doesn't create a problem because in
both problematic cases the generated paths are "fixed" to point
somewhere into build dir or the code which is tested doesn't
access them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-04-07 15:26:10 +02:00
Christian Schoenebeck
89bbe9bb1e qemu: add support for 'multidevs' option
This option prevents misbehaviours on guest if a qemu 9pfs export
contains multiple devices, due to the potential file ID collisions
this otherwise may cause.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-06 13:55:27 +02:00
Christian Schoenebeck
c3a1856890 conf: add 'multidevs' option
Introduce new 'multidevs' option for filesystem.

  <filesystem type='mount' accessmode='mapped' multidevs='remap'>
    <source dir='/path'/>
    <target dir='mount_tag'>
  </filesystem>

This option prevents misbehaviours on guest if a qemu 9pfs export
contains multiple devices, due to the potential file ID collisions
this otherwise may cause.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-06 13:55:27 +02:00
Christian Schoenebeck
8fe6e82d1c qemu: capabilities: add QEMU_CAPS_FSDEV_MULTIDEVS
The QEMU 9pfs 'multidevs' option exists since QEMU 4.2. Probe QEMU's
command line set though to check whether this option is really
available, and if yes enable this new QEMU_CAPS_FSDEV_MULTIDEVS
capability on libvirt side.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-06 13:55:12 +02:00
Daniel Henrique Barboza
b8f1f037ed qemu: move qemuDomainDeviceDefValidateDisk() to qemu_validate.c
This function will remain public due to its usage in qemublocktest.c
even after moving qemuDomainDeviceDefValidate(). The position of its
header in qemu_validate.h is no accident.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Peter Krempa
a743583e4f qemu: capabilities: Update qemu-5.0.0 capabilities for x86_64 to rc1
Now that v5.0.0-rc1 was tagged, update the capabilities to make sure
that everything works as expected.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 09:53:49 +02:00
Peter Krempa
958ac278cd qemumonitorjsontest: AddNetdev: Use real variant
QEMU now formalized the arguments of netdev-add in the schema, so we
must use a real type to pass the schema validation once the schema is
updated.

The 'user' variant doesn't have any other mandatory fields.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 09:36:20 +02:00
Peter Krempa
5a13eb1655 qemuMonitorTestProcessCommandDefaultValidate: Output validator output to stderr
Trying to squeeze the validator output into the monitor reply message
doesn't make sense and doesn't work well as it's not well formed JSON:

54) qemuMonitorJSONAddNetdev                                          ... libvirt:  error : internal error: cannot parse json { "error":  { "desc": "failed to validate arguments of 'netdev_add' against QAPI schema: {
   ERROR: variant 'test' for discriminator 'type' not found
",    "class": "UnexpectedCommand" } }: lexical error: invalid character inside string.
          ev_add' against QAPI schema: {    ERROR: variant 'test' for
                     (right here) ------^
FAILED

Output it to stderr if requested and just note that schema validation
failed in the error message:

54) qemuMonitorJSONAddNetdev                                          ...
failed to validate arguments of 'netdev_add' against QAPI schema
args:
{
  "id": "net0",
  "type": "test"
}

validator output:
 {
   ERROR: variant 'test' for discriminator 'type' not found

libvirt: QEMU Driver error : internal error: unable to execute QEMU command 'netdev_add': failed to validate arguments of 'netdev_add' against QAPI schema (to see debug output use VIR_TEST_DEBUG=2)
FAILED

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 09:36:20 +02:00
Peter Krempa
203e802d88 qemumonitorjsontest: Space out test name concatenation
The test name is concatenated from a prefix with the test name, but no
space was added so the output looked wrong.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 09:36:20 +02:00
Ján Tomko
29fc9e96a9 qemu: use QEMU_CAPS_STORAGE_WERROR for disk-error attributes
When moving the formatting of this attributes from -drive
to -device, the QEMU_CAPS_USB_STORAGE_WERROR capability
was used, because usb-storage was the last device to gain
this capability.

However this lead to the assumption that QEMU binaries
without the usb-storage device do not support this,
leading to breakage on s390x with blockdev.

Fixes: bb4f3543bb
https://bugzilla.redhat.com/show_bug.cgi?id=1819250

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-04-01 15:45:48 +02:00
Ján Tomko
47e84b06ec qemu: add QEMU_CAPS_STORAGE_WERROR
Detect the werror property on SCSI and virtio disks.
But clear it if the QEMU supports usb-storage device without it
also supporting this option for usb-storage.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-04-01 15:45:48 +02:00
Ján Tomko
248d205171 tests: qemu: add disk-error-policy tests for s390x
To demonstrate the move of these attributes from -drive to -device.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-04-01 15:45:47 +02:00
Peter Krempa
544ef82d05 virStorageSourceParseBackingURI: Preserve query string of URI for http(s)
For http/https URIs we need to preserve the query part as it may be
important to refer to the image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-30 16:30:34 +02:00
Peter Krempa
216860dd8b qemuBlockStorageSourceGetURI: Pass through query component
If the storage source has the query part set, format it in the output.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-30 16:30:34 +02:00
Peter Krempa
5636812472 conf: Add support for http(s) query strings
Add a new attribute for holding the query part for http(s) disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-30 16:30:34 +02:00
Peter Krempa
b9166baebe virStorageSourceNetCookieValidate: Accept quoted cookie value
The quotes are forbidden only inside the value, but the value itself may
be enclosed in quotes. Fix the RNG schema and validator and add a test
case.

https://bugzilla.redhat.com/show_bug.cgi?id=1804750

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-27 15:46:52 +01:00
Peter Krempa
c34ec56aba qemuxml2xmltest: Wire up 'disk-network-http' case
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-27 15:46:52 +01:00
Jiri Denemark
17cdefe5f1 cpu_map: Don't use new noTSX models for host-model CPUs
Host-model CPU definitions (and domain capabilities) will use the
original CPU models (without noTSX in their name) and explicitly disable
hle and rtm features. This way domains with host-model CPUs will be
migratable even to older versions of libvirt which do not support the
noTSX model variants.

The new models will be advertised in host capabilities and they may
be used explicitly with custom CPUs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2020-03-25 22:27:39 +01:00
Christian Ehrhardt
dd17a4eba8 cpu_map: Add more -noTSX x86 CPU models
One of the mitigation methods for TAA[1] is to disable TSX
support on the host system.  Linux added a mechanism to disable
TSX globally through the kernel command line, and many Linux
distributions now default to tsx=off.  This makes existing CPU
models that have HLE and RTM enabled not usable anymore.

Add new versions of all CPU models that have the HLE and RTM
features enabled, that can be used when TSX is disabled in the
host system.

On systems disabling the features without those types defined
in cpu-maps users end up without modern CPU types in the list
of usable CPUs to use in the likes of virsh domcapabilities
or tools higher in the stack like virt-manager.

This adds:
-Cascadelake-Server-noTSX
-Icelake-Client-noTSX
-Icelake-Server-noTSX
-Skylake-Server-noTSX-IBRS
-Skylake-Client-noTSX-IBRS

Introduced in QEMU by commit v4.2.0-rc2-3-g9ab2237f19 (function)
                  and commit v4.2.0-rc2-4-g02fa60d101 (names)

References:

    [1] TAA, TSX asynchronous Abort:
        https://software.intel.com/security-software-guidance/insights/deep-dive-intel-transactional-synchronization-extensions-intel-tsx-asynchronous-abort
        https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/tsx_async_abort.html

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1853200

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Message-Id: <20200310104806.2723-2-christian.ehrhardt@canonical.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-03-25 22:27:39 +01:00
Peter Krempa
c3a7f46fe3 qemuAgentGetFSInfo: expose 'report_unsupported' argument
Use qemuAgentCommandFull so that callers of qemuAgentGetFSInfo can
suppress error reports if the function is not supported by the guest
agent.

Since this patch removes the last use of
qemuAgentErrorCommandUnsupported the whole function is deleted as well.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-25 13:13:18 +01:00
Peter Krempa
b126477685 qemuAgentGetTimezone: expose 'report_unsupported' argument
Use qemuAgentCommandFull so that callers of qemuAgentGetTimezone can
suppress error reports if the function is not supported by the guest
agent.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-25 13:13:18 +01:00
Peter Krempa
d8ac171718 qemuAgentGetOSInfo: expose 'report_unsupported' argument
Use qemuAgentCommandFull so that callers of qemuAgentGetOSInfo can
suppress error reports if the function is not supported by the guest
agent.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-25 13:13:18 +01:00
Peter Krempa
de1d822691 qemuAgentGetUsers: expose 'report_unsupported' argument
Use qemuAgentCommandFull so that callers of qemuAgentGetUsers can
suppress error reports if the function is not supported by the guest
agent.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-03-25 13:13:18 +01:00
Marc-André Lureau
be00118d5d util: keep the pidfile locked
Unfortunately, advisory record locking lose the lock if any fd refering
to the file is closed. There doesn't seem to be a way to preserve the
lock atomically. We could eventually retake the lock if low pidfilefd
is required.

This fixes processes being leaked, as they are not killed in
virPidFileForceCleanupPath() if the lock can be taken. Here also, we may
consider this is not good enough, as a process may leak by simply
closing the pidfilefd.

Fixes commit d146105f1e ("virCommand:
Actually acquire pidfile instead of just writing it")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-25 09:04:49 +01:00
Michal Privoznik
d146105f1e virCommand: Actually acquire pidfile instead of just writing it
Our virCommand module allows us to set a pidfile for commands we
want to spawn. The caller constructs the string of pidfile path
and then uses virCommandSetPidFile() to tell the module to write
the pidfile once the command is ran. This usually works, but has
two flaws:

1) the child process does not hold the pidfile open & locked.
Therefore, the caller (or anybody else) can't use our fancy
virPidFileForceCleanupPath() function to kill the command
afterwards. Also, for everybody else on the system it's
needlessly harder to check if the pid from the pidfile is still
alive or not.

2) if the caller ever makes a mistake and passes the same pidfile
path for two different commands, the start of the second command
will overwrite the pidfile even though the first command might
still be running.

NOTE that this temporarily renders some command spawning
unusable, specifically those code patterns where both
virCommandSetPidFile() is used together with instructing spawned
command to acquire pidfile itself. Fortunately, there is only one
occurrence of such pattern and it is in
qemuProcessStartManagedPRDaemon(). This is fixed in next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-03-24 15:44:23 +01:00
Michal Privoznik
1ac79d29eb commandtest: Fix test28 error detection
As a part of c799d150d5 I've introduced a test case that
tests whether passing error object between processes works. The
test spawns a child which reports a system error, parent process
then reads the error and compares with expected output. Problem
with this approach is that error message contains stringified
errno which is not portable. FreeBSD has generally different
messages than Linux. Therefore, use g_strerror() to do the errno
to string translation for us.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-03-24 14:33:29 +01:00
Peter Krempa
1b84dd190c storage: Parse 'nvme' disk source properties from json:{} pseudo-uri
Our code allows snapshots of NVMe based disks which means we create
overlay file with a 'json:{}' pseudo-uri refering to the NVME device.
Our parser code doesn't handle them though. Add the parser and test it
via the XML->json->XML round-trip and reference data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:48 +01:00
Peter Krempa
3b06103e69 qemuBlockGetBackingStoreString: Properly handle 'http/s' with cookies and others
Format cookies into the backing store string without encryption as they
will not be visible on the command line when formatting a 'target' only
string. In cases when cookies or other options are used we must use the
JSON format rather than pure URI.

Add tests to validate the scenario.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:48 +01:00
Peter Krempa
7ba2208add qemuBlockGetBackingStoreString: Add extra wrapping object to JSON strings
QEMU requires an extra wrapper object where only the "file" member is
populated. This is basically a placeholder for establishing the format
layer. We did the same in qemuDiskSourceGetProps for the old-school
JSON usage with -drive but forgot to adopt this for -blockdev.

https://bugzilla.redhat.com/show_bug.cgi?id=1804617

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:47 +01:00
Peter Krempa
5a70f1048f storage: Implement backing store support for "fat:" prefix
qemublocktest showed that we don't add the "fat:" prefix for directory
storage when formatting the backing store string. While it's unlikely to
be used it's simple enough to actually implement the support rather than
trying to forbid it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:47 +01:00
Peter Krempa
5f3b4a3727 qemublocktest: Test backing store strings
With -blockdev libvirt provides the string which is recorded  as
'backing store' property of an image to qemu. Add testing for
qemuBlockGetBackingStoreString which generates these strings as there's
logic which determines which format to use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:47 +01:00
Peter Krempa
93171b63c3 testQemuDiskXMLToProps: Store all per-image data in one structure
We had two non-syncrhonized arrays holding the individual data. This was
a lazy way to do it when I was adding new tests recently. Since it's
hard to extend with new data to test refactor the storage of test data
to use a new struct where all per-image data are kept and can be
extended easily.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:47 +01:00
Peter Krempa
fed97cb435 testQemuDiskXMLToPropsValidateFileSrcOnly: Move together with rest of xml->json code
The function was misplaced. Group it together with other helper
functions for testing disk XML to qemu JSON props conversion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:47 +01:00
Peter Krempa
4a9f355535 qemublocktest: xml->json: Refactor cleanup in test case functions
Use automatic variable clearing and remove the cleanup sections of
testQemuDiskXMLToProps, testQemuDiskXMLToPropsValidateSchema and
testQemuDiskXMLToPropsValidateFile.

testQemuDiskXMLToPropsValidateFileSrcOnly already uses new helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:47 +01:00
Peter Krempa
2337dbfdd1 qemublocktest: xml->json: Add test for NVMe
Based on the configuration from the only qemuxml2argv test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 14:17:47 +01:00
Mauro S. M. Rodrigues
75a4ec42f7 util: virhostcpu: Fail when fetching CPU Stats for invalid cpu
virHostCPUGetStatsLinux walks through every cpu in /proc/stat until it
finds cpu%cpuNum that matches with the requested cpu.
If none is found it logs the error but it should return -1, instead of 0.
Otherwise virsh nodecpustats --cpu <invalid cpu number> and API bindings
don't fail properly, printing a blank line instead of an error message.

This patch also includes an additional test for virhostcputest to avoid
this regression to happen again in the future.

Fixes: 93af79fba3
Reported-by: Satheesh Rajendran <satheera@in.ibm.com>
Signed-off-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2020-03-24 11:31:07 +01:00
Daniel Henrique Barboza
5540acb9a2 conf, qemu: enable NVDIMM support for ppc64
Using the 'uuid' element for ppc64 NVDIMM memory added in the
previous patch, use it in qemuBuildMemoryDeviceStr() to pass
it over to QEMU.

Another ppc64 restriction is the necessity of a mem->labelsize,
given than ppc64 only support label-area backed NVDIMMs.

Finally, we don't want ppc64 NVDIMMs to align up due to the
high risk of going beyond the end of file with a 256MiB
increment that the user didn't predict. Align it down
instead. If target size is less than the minimum of
256MiB + labelsize, error out since QEMU will error out
if we attempt to round it up to the minimum.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 10:02:48 +01:00
Daniel Henrique Barboza
08ed673901 conf: Introduce optional 'uuid' element for NVDIMM memory
ppc64 NVDIMM support was implemented in QEMU by commit [1].
The support is similar to what x86 already does, aside from
an extra 'uuid' element.

This patch introduces a new optional 'uuid' element for the
NVDIMM memory model. This element behaves like the 'uuid'
element of the domain definition - if absent, we'll create
a new one, otherwise use the one provided by the XML.
The 'uuid' element is exclusive to pseries guests and are
unavailable for other architectures.

Next patch will use this new element to add NVDIMM support
for ppc64.

[1] ee3a71e366

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 10:02:38 +01:00
Daniel Henrique Barboza
1d5f16ba81 qemu: capabilities: update qemu-5.0.0 capabilities for ppc64
Update ppc64 capabilities to pick up the new NVDIMM capability
support for ppc64.

Since the ppc64 capabilities weren't updated for some time, the
bulk of the changes here are related to the blockdev support
(see commit c6a9e54ce3 for info) that we are picking up just
now.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-24 10:02:34 +01:00
Rafael Fonseca
8ffc7e9190 util: remove virKeyFile
The functionality is now provided by glib's GKeyFile.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-03-23 15:36:02 +01:00
Michal Privoznik
c799d150d5 virprocess: Passthru error from virProcessRunInForkHelper
When running a function in a forked child, so far the only thing
we could report is exit status of the child and the error
message. However, it may be beneficial to the caller to know the
actual error that happened in the child.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
2020-03-20 16:42:45 +01:00