Commit Graph

68 Commits

Author SHA1 Message Date
Menno Lageman
0254558e6e cli: add --features kvm.hint-dedicated.state=
QEMU version 2.12.1 introduced a performance feature under commit
be7773268d98 ("target-i386: add KVM_HINTS_DEDICATED performance hint").
Support for this performance hint was added in libvirt 5.7.0 by commit
cb12c59dac04 ("qemu: support for kvm-hint-dedicated performance hint").

This patch extends virt-install's existing --features option to insert the
appropriate XML into the guest definition if this feature is specified
on the command line.

    E.g. --features='kvm.hint-dedicated.state=on' would result
    in the following XML:

      <features>
        ...
        <kvm>
          <hint-dedicated state='on'/>
        </kvm>
        ...
      </features>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
2019-09-03 14:04:18 -04:00
Athina Plaskasoviti
2e49041d85 cli: Add --clock timer[0-9]*.catchup options
Added:
-timer[0-9]*.catchup.threshold
-timer[0-9]*.catchup.slew
-timer[0-9]*.catchup.limit

Catchup attributes need timer with assigned tickpolicy=catchup.

XML Mapping:

<clock>
  ...
  <catchup threshold="X" slew="X" limit="X"/>
  ...
</clock>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Athina Plaskasoviti
cc60d558c0 cli: Add --cputune memorytune options
--memorytune[0-9]*.vcpus
--memorytune[0-9]*.node[0-9]*.id
--memorytune[0-9]*.node[0-9]*.bandwidth

XML Mapping:

<cputune>
  ...
  <memorytune vcpus="X">
    <node id="X" bandwidth="X"/>
  </memorytune>
  ...
</cputune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Athina Plaskasoviti
9cea262b85 cli: Add --cputune cachetune options
- cachetune[0-9]*.vcpus
- cachetune[0-9]*.cache[0-9]*.level
- cachetune[0-9]*.cache[0-9]*.id
- cachetune[0-9]*.cache[0-9]*.type
- cachetune[0-9]*.cache[0-9]*.size
- cachetune[0-9]*.cache[0-9]*.unit

XML Mapping:

<domain>
...
  <cputune>
  ...
    <cachetune vcpus="X">
      <cache level="X" id="X" type="X" size="X" unit="X"/>
    </cachetune>
  ...
  </cputune>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Athina Plaskasoviti
7f8648c53d cli: Add --boot initdir, inituser, initgroup options
XML Mapping:

<os>
...
<initdir>X</initdir>
<inituser>X</inituser>
<initgroup>X</initgroup>
...
</os>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-03 19:34:18 -04:00
Athina Plaskasoviti
e70ead5098 cli: Add --blkiotune device[0-9]*.read_bytes_sec/write_bytes_sec/read_iops_sec/write_iops_sec options
XML Mapping:

<blkiotune>
  <device>
    ...
    <read_bytes_sec>X</read_bytes_sec>
    <write_bytes_sec>X</write_bytes_sec>
    <read_iops_sec>X</read_iops_sec>
    <write_iops_sec>X</write_iops_sec>
    ...
  </device>
</blkiotune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-25 19:13:13 -04:00
Athina Plaskasoviti
9afe51a0f8 cli: Add --keywrap cipher[0-9]*.name=aes|des, cipher[0-9]*.state=on|off
XML Mapping:

<domain>
...
  <keywrap>
    <cipher name="X" state="X"/>
  </keywrap>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-23 16:59:32 -04:00
Athina Plaskasoviti
2b24a85884 cli: Add --clock timer[0-9]*.track, timer[0-9]*.mode, timer[0-9]*.frequency options
XML Mapping:

<clock>
...
  <timer track="X" mode="X" frequency="X"/>
...
</clock>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-15 16:11:51 -04:00
Athina Plaskasoviti
b6563b90e5 cli: Add --numatune options memnode[0-9]*.cellid, memnode[0-9]*.mode, memnode[0-9]*.nodeset
XML Mapping:

<numatune>
...
  <memnode cellid="X" mode="X" nodeset="X"/>
...
</numatune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-06-17 17:41:25 -04:00
Cole Robinson
f107e39989 Switch to more traditional logging structure
Init a shared log instance in virtinst/logger.py, and use that
throughout the code base, so we aren't calling directly into
'logging'. This helps protect our logging output from being
cluttered with other library output, as happens with some
'requests' usage
2019-06-17 00:12:31 -04:00
Cole Robinson
9c8e879ff0 virt-install: Add --boot firmware= 2019-06-16 17:15:08 -04:00
Cole Robinson
db4d348950 domain: cpu: Rework vcpus setting slightly
Move it to Guest, where we have a more hollistic view of the issues.
This will be needed in later patches
2019-06-11 17:51:25 -04:00
Erik Skultety
8ab9dcd33f virtinst: guest: Provide further SEV support checks
These include platform checks - libvirt & QEMU - as well as
configuration - SEV is only supported with UEFI.
Another configuration requirement made in this patch is Q35 machine,
since ADM recommends Q35 in their setups even though SEV can work with
the legacy PC machine type, but we'd have to turn on
virtio-non-transitional for all virtio devices with some other potential
pitfalls along the way.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Erik Skultety
1a8728fc2d virtinst: guest: Fill in SEV platform specific data automatically
The data in question are 'cbitpos' denoting which addressing bit is the
encryption bit and 'reduced_phys_bits' denoting how many physical
address space we lose by turning on the encryption. Both of these are
hypervisor dependent and thus will be the same for all the guest
residing on the same host, but need to be specified for future migration
purposes.
But given we can probe them from domain capabilities, we don't need the
user to provide them and thus enhancing cli user experience. This
requires a new _SEV domaincapabilities XML class to be created so that
we can query the specific properties.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Erik Skultety
480a6834c2 virtinst: cli: Provide a default value for the 'policy' argument
Policy is a 4-byte bitfield used to turn on/off certain behaviour within
the SEV firmware. For a detailed table of supported flags, see
https://libvirt.org/formatdomain.html#launchSecurity.
Most of the flags are related to advanced features (some of them don't
even exist at the moment), except for the first 2 bits which determine
whether debug mode should be turned on and whether the same key should
be used to encrypt memory of multiple guests respectively.

>From security POV, most users will probably want separate keys for
individual guests, thus the value 0x03 was selected as the policy
default.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Erik Skultety
45f3a47c84 virtinst: cli: Introduce parser support for SEV launch security
Introduce both the launchSecurity XML and parser classes. While at it,
add launchSecurity as a property instance to the Guest class too.

The parser requires the 'type' argument to be mandatory since in the
future it will determine different code paths, therefore
'--launchSecurity foo=bar' is incorrect.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Athina Plaskasoviti
7a52e4c80d cli: Add --numatune memory.placement
XML Mapping:

<numatune>
  ...
  <memory placement=X/>
  ...
</numatune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-06-10 09:53:36 -04:00
Cole Robinson
361657ad15 virtinst: Add a lot of test code coverage
* Delete dead code
* Add tests for various device default code paths
* Rework certain conditions a bit so code coverage always hits them
2019-06-09 18:59:50 -04:00
Cole Robinson
261a0a0482 domain: seclabel: Drop some unneeded logic
* imagelabel is a runtime only XML attribute which we don't use at
  all, so drop parsing
* drop validation checks that libvirt will do for us
2019-06-09 18:34:48 -04:00
Cole Robinson
f85e6def55 support: Convert callers to the new format 2019-06-07 16:26:03 -04:00
Cole Robinson
d167021b0f osdict: Drop the solaris10 x2apic hack
The upstream kvm bug has never been resolved. I think this is
obscure enough nowadays that we don't need to track and test it
2019-06-05 16:35:34 -04:00
Cole Robinson
7c835321be cli: --blkiotune: Convert device.* to device[0-9]*.
Libvirt can represent multiple <device> blocks here, so mirror that
on the command line
2019-05-15 09:59:25 -04:00
Cole Robinson
af2182d890 cli: --memorybacking: Add discard= and allocation.mode= 2019-05-14 15:58:36 -04:00
Cole Robinson
90f5b29789 cli: --memorybacking: Convert hugepages.page to a list
There can be more than 1 <memoryBacking><hugepages><page> element.
Adjust the cli options to match:

- hugepages.page[0-9]*.size
- hugepages.page[0-9]*.unit
- hugepages.page[0-9]*.nodeset
2019-05-14 15:58:36 -04:00
Cole Robinson
334d18ab93 cli: --vcpus: add vcpus.vcpu[0-9]* config
This adds the following suboptions to configure the <domain><vcpus>
list:

- vcpus.vcpu[0-9]*.id
- vcpus.vcpu[0-9]*.enabled
- vcpus.vcpu[0-9]*.hotpluggable
- vcpus.vcpu[0-9]*.order
2019-05-14 15:58:36 -04:00
Cole Robinson
7083294e2c cli: --sysinfo: Add oemStrings.entry[0-9]* 2019-05-14 14:36:40 -04:00
Cole Robinson
d16425aa8f cli: --sysinfo: Add chasis suboptions
Add the following --sysinfo suboptions:

- chassis.manufacturer
- chassis.version
- chassis.serial
- chassis.asset
- chassis.sku
2019-05-14 14:36:40 -04:00
Cole Robinson
e5480829b6 cli: --boot: Add explicit boot[0-9].dev config
We keep the old bootorder support as well, but also advertise the
explict XML list support
2019-05-14 14:36:40 -04:00
Cole Robinson
a1165b2981 cli: --clock: Explicitly register options
Rather than do so based off the TIMER_NAMES list. Makes it less
easy to accidentally break cli API
2019-05-12 19:14:05 -04:00
Cole Robinson
cbb7d369ef cpu: Convert 'cache' to a singleton
Libvirt doesn't represent it at as a list, and tracking it as a list
complicates the cli machinery
2019-05-12 17:25:47 -04:00
Cole Robinson
ad36657b72 guest: Set vcpus from cpu.topology, if it's specified
We already did this in cli.py, but that's the wrong place to do it
2019-05-12 17:25:47 -04:00
Cole Robinson
913c9de29b domain: features: treat <vmcoreinfo/> as a tristate
When it was initially introduced, vmcoreinfo was a boolean option,
but that was changed a release latest to be a tristate.
2019-05-12 17:25:47 -04:00
Pavel Hrdina
c1ebd6730c DomainCpu: check CPU model name only if model exists
For CPU modes other then "custom" there is no model so we should not
check the suffix of model name.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-11 09:38:14 +02:00
Pavel Hrdina
291f2ef214 DomainCpu: fix detection of CPU security features
VM configured with mode="host-model" will have the CPU definition
expanded once the VM is started.  Libvirt will try to use the closest
CPU model with some features enabled/disabled.

The issue is that there are some models that include spec-ctrl or ibpb
features and they will not appear in the explicit list of features and
virt-manager will not correctly detect if all security features are
enabled or not.  As a workaround we can check the suffix of CPU model to
figure out which security features are enabled by the model itself.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-09 13:30:25 +02:00
Andrea Bolognani
955a3ee62e os: Add RISC-V support
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Pavel Hrdina
8720637cff virt-manager: add new checkbox to control CPU security features
By default we copy CPU security features to the guest if specific CPU
model is selected.  However, this may break migration and will affect
performance of the guest.  This adds an option to disable this default
behavior.

The checkbox is clickable only on x86 and only on host where we can
detect any CPU security features, otherwise a tooltip is set to notify
users that there is nothing to copy.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-04 15:32:42 +02:00
Pavel Hrdina
22342ef7ee cli: introduce CPU secure parameter
This will allow users to override the default behavior of virt-install
which copies CPU security features available on the host to the guest
XML if specific CPU model is configured.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-04 13:40:20 +02:00
Pavel Hrdina
fb5136a6a9 domain: cpu: automatically add CPU security features for "custom" mode
If user selects specific CPU model to be configured for guest we will
automatically add CPU security features to make sure that the guest is
not vulnerable to these CPU HW bugs.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-03-19 13:45:49 +01:00
Pavel Hrdina
6423f653fd domain: cpu: introduce set_model function
We will need to pass another variable into the setter so we cannot use
the property setter.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-03-19 13:45:49 +01:00
Pavel Hrdina
8183ba279c domcapabilities: fix CPUModel usable attribute
It is not True/False attribute, it can contain 'unknown' value as well
which means libvirt cannot figure out whether the CPU model is usable
with that specific QEMU binary.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-03-19 13:41:51 +01:00
Cole Robinson
2f89ecf4a9 Remove Author lines from file headers
Similar to what was done in libvirt. See these commits:

600462834f
c99e954973
2019-01-08 11:45:35 -05:00
Cole Robinson
b051b6c95d cpu: Have host-copy use domcaps if qemu is new enough (bz 1637767)
capabilities is known problematic. Use domcaps if libvirt+qemu
reports working host-model

https://bugzilla.redhat.com/show_bug.cgi?id=1637767
2018-10-13 17:48:25 -04:00
Yossi Ovadia
215d296b61 cli: add --boot rebootTimout
virt-install -n blah -r 1024 --vcpu=1 --disk=/root/vm/blah.qcow2,size=10\
 --network=bridge:br-public --pxe --boot=network,rebootTimeout=3

By default, in case of (first) pxe boot failure the VM will simply
stop trying.
By adding the above, VM will re-try pxe boot. ( useful when DHCP not
replys on first attempt.

Libvirt support it and VM XML will look as follow : ( 'bios rebootTimeout'
will be created under OS section. )

  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.5.0'>hvm</type>
    <boot dev='network'/>
    <bios rebootTimeout='3'/>
  </os>

(crobinso: fix it, add test case)
2018-10-11 11:24:07 -04:00
Cole Robinson
019a33e975 clock: Drop RHEL hyperv clock distinction
I think enough time has passed that we can just check the
support based on the older RHEL version.
2018-10-06 19:45:51 -04:00
Cole Robinson
9edca3486a virt-manager: Wire up support for default mode=host-model
Simplify things a long the way
2018-10-04 14:43:44 -04:00
Cole Robinson
469fed08a0 guest: Default to cpu mode=host-model if libvirt is new enough
We check whether host-model is exposed in domcapabilities, which
indicates host-model is using the smarter new safer method in
cooperation with qemu
2018-10-04 14:43:41 -04:00
Cole Robinson
76334bfabd guest: Add DomainCapabilities caching 2018-10-04 12:30:14 -04:00
Marc-André Lureau
4ad74278ca cli: add memory backing access_mode & source_type
Allow to set some memory backing options, ex:
--memorybacking access_mode=shared,source_type=anonymous

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-10-02 11:12:13 -04:00
Cole Robinson
bad5eabd93 domain: Add metadata.libosinfo
From the libosinfo discussion here:
https://www.redhat.com/archives/libosinfo/2018-September/msg00003.html

This is a cross-app schema for tracking libosinfo OS ID in the
domain <metadata> XML. Example:

   <metadata>
     <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
       <libosinfo:os id="http://fedoraproject.org/fedora/17"/>
     </libosinfo:libosinfo>
   </metadata>
2018-09-13 12:39:56 -04:00
Cole Robinson
841d5126d2 xmlapi: Move namespace mappings to the relevant classes
So we don't need to update xmlapi.py to account for additions
2018-09-13 09:34:04 -04:00