Commit Graph

23 Commits

Author SHA1 Message Date
Michal Privoznik
d20ebdda28 qemu: Switch to -accel
We currently use -machine accel=XXX which is just a syntax sugar
for -accel XXX. The former doesn't allow specifying arguments for
accelerator, because all arguments passed to -machine are
treated as arguments of machine itself.

The -accel argument was introduced in QEMU commit
v2.9.0-rc0~70^2~19 and since our minimum required version is
newer (2.11.0) we can safely assume its existence and use it
without any capability.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/233
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-11-22 13:06:54 +01:00
Daniel P. Berrangé
ff3e93a26b qemu: remove use of (+|-)name syntax for -cpu featres
The -cpu arg gained support for feature=on|off syntax for the x86
emulator in 2.4.0

  commit 38e5c119c2925812bd441450ab9e5e00fc79e662
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Mon Mar 23 17:29:32 2015 -0300

    target-i386: Register QOM properties for feature flags

Most other targets gained this syntax even earlier in 1.4.1

  commit 1590bbcb02921dfe8e3cf66e3a3aafd31193babf
  Author: Andreas Färber <afaerber@suse.de>
  Date:   Mon Mar 3 23:33:51 2014 +0100

    cpu: Implement CPUClass::parse_features() for the rest of CPUs

    CPUs who do not provide their own implementation of feature parsing
    will treat each option as a QOM property and set it to the supplied
    value.

There appears no reason to keep supporting "+|-feature" syntax,
given the current minimum QEMU version.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-10-20 13:01:41 +01:00
Daniel P. Berrangé
7bf6292fb3 qemu: always translate underscores to hyphens in CPU features
QEMU switched from using underscores in x86 CPU features to hyphens
in the 2.8.0 series with two commits

  commit fc7dfd205f3287893c436d932a167bffa30579c8 (HEAD, refs/bisect/bad)
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:40 2016 -0300

    target-i386: Remove underscores from feat_names arrays

  commit 54b8dc7c19cd781e96f1e9b001ca6001d804eb19
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:38 2016 -0300

    target-i386: Register aliases for feature names with underscores

Libvirt names use underscores so we conditionally tranlate the
names when talking to new QEMU. Since the min QEMU was raised to
version 2.11.0, all QEMU versions we talk to expect hypens, so
the translation can be done unconditionally.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-10-20 13:01:22 +01:00
Peter Krempa
0ae3e1313f qemu: Always assume presence of QEMU_CAPS_OBJECT_SECRET
The secret object is supported since qemu-2.6 and can't be compiled out.
Assume the presence to simplify the code.

This enables the use of the secret key for most tests not using real
caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-22 14:53:55 +02:00
Peter Krempa
e2aa0c3b5a qemu: command: Always assume 'QEMU_CAPS_BOOT_STRICT'
Added by c8a6ae8bb9 in qemu-v1.5.0 and can't be compiled out. Assume
that it's present and fix all fake-caps tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-09-21 12:26:06 +02:00
Peter Krempa
c7a85b5b77 qemu: command: Always assume support for '-msg timestamp=on'
All supported QEMU versions have this option so there's no need for us
to base it on the capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 10:00:22 +02:00
Peter Krempa
d5a6145900 qemu: command: Always assume support for '-name guest=' and '-name debug-threads=on'
All QEMU versions we support have these and it's very unlikely that they
will be removed. Remove the capability checks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-08-18 09:59:31 +02:00
Peter Krempa
1924ef661b qemu: capabilities: Move setting QEMU_CAPS_DEVICE_VIDEO_PRIMARY to virQEMUCapsInitQMPBasicArch
Until we clean up and remove all capabilities which no longer make sense
to have separately, we should use virQEMUCapsInitQMPBasicArch to set the
defaults as it's used by qemuxml2argvtest when testing with fake
capabilities.

This allows us to prevent testing dead code paths with the fake
capability tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-05-03 12:14:44 +02:00
Peter Krempa
0046e0b1c2 qemuxml2argvtest: Use internal wrapping of command line arguments
virCommandToString has the possibility to return an already wrapped
string with better format than what we get from the test wrapper script.

The main advantage is that arguments for an option are always on the
same line which makes it more easy to see what changed in a diff and
prevents re-wrapping of the line if a wrapping point moves over the
threshold.

Additionally the used output is the same we have in the VM log file when
a VM is starting.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-04-12 15:55:10 +02:00
Daniel P. Berrangé
43c9c0859f qemu: use long on|off syntax for -chardev boolean option values
The preferred syntax for boolean options is to set the value "on" or
"off". QEMU 7.1.0 will deprecate the short format we currently use.

The long format has been supported with -chardev since at least 1.5.3,
so we don't need to check for it.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-02-16 12:38:20 +00:00
Michal Privoznik
a08c4b3741 qemu: Always assume QEMU_CAPS_REALTIME_MLOCK
The '-realtime mlock' cmd line argument was introduced in QEMU
commit v1.5.0-rc0~190 which matches minimal QEMU version we
require. Therefore, the capability will always be present.

Apparently, nearly none of our xml2argv test cases had the
capability hence slightly bigger change under qemuxml2argvdata/.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-04-12 13:39:42 +02:00
Erik Skultety
75a9169881 qemu: command: Override HOME variable for system QEMU
By default, qemu user's home dir points to '/' which shouldn't be used
at all. We therefore pass the HOME variable from the current variable
iff not running as SUID, which means that for systemd we never set it.
This patch makes sure, that for system QEMU this is always set to
libDir/<driver>, session mode is left untouched.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-15 16:41:26 +01:00
Erik Skultety
7e73137495 qemu: command: Enforce setting XDG variables for system QEMU
For session mode, only XDG_CACHE_HOME is set, because we want to remain
integrating with services in user session, but for system mode, this
would have become reading/writing to '/' which carries the obvious issue
with permissions (also, '/' is the wrong location in 99.9% cases anyway).

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-15 16:41:26 +01:00
Peter Krempa
caccbba64a qemu: capabilities: Always assume QEMU_CAPS_BOOTINDEX
The field was added in qemu v0.13.0-rc0-731-g1ca4d09ae0 so all supported
qemu versions now use it.

There's a LOT of test fallout as we did not use capabilities close
enough to upstream for many of our tests.

Several tests had a 'bootindex' variant. Since they'd become redundant
they are also removed here.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-08-09 17:00:54 +02:00
Ján Tomko
53fa2edb62 qemu: deprecate QEMU_CAPS_MACHINE_USB_OPT
Implied by QEMU >= 1.3.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-17 14:50:25 +02:00
Ján Tomko
5a41bd6df2 qemu: deprecate QEMU_CAPS_DISPLAY
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-17 14:49:21 +02:00
Ján Tomko
84b40886f2 qemu: deprecate QEMU_CAPS_DUMP_GUEST_CORE
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-17 14:35:09 +02:00
Ján Tomko
69420756b2 qemu: deprecate QEMU_CAPS_MACHINE_OPT
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-17 14:24:09 +02:00
Ján Tomko
fe35b1ad64 qemu: deprecate QEMU_CAPS_NO_SHUTDOWN
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 20:31:42 +02:00
Ján Tomko
470c3827cf qemu: deprecate QEMU_CAPS_RTC
Implied by QEMU >= 1.2.0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-16 14:55:55 +02:00
Ján Tomko
cc32731a3c qemu: deprecate QEMU_CAPS_NO_USER_CONFIG
Implied by QEMU >= 1.2.0.

Delete this one first, because QEMU_CAPS_NODEFCONFIG is only used
when QEMU_CAPS_NO_USER_CONFIG is unsupported.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-12 17:17:17 +02:00
Ján Tomko
a32539dea1 qemu: deprecate QEMU_CAPS_MONITOR_JSON
We require QEMU >= 1.5.0, assume every QEMU supports it.
Sadly that does not let us trivially drop qemuMonitor's
priv->monJSON bool, because of qemuDomainQemuAttach.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-04-12 17:17:17 +02:00
Michal Privoznik
ad24406440 tests: Drop qemuxml2argv- prefix for qemuxml2argv test cases
Similarly to the previous commit, rename .args files.

The files were renamed using the following commands. From
qemuxml2argvdata:

  for i in qemuxml2argv-*.args; do mv $i ${i#qemuxml2argv-}; done

and then (to fix broken symlinks) from qemuxml2argvdata and
qemuxml2xmloutdata:

  for i in $(find . -xtype l); do \
      ln -sf $(readlink $i | sed 's/qemuxml2argv-//') $i;
  done

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-12-05 07:32:08 +01:00