]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoTranslated using Weblate (Russian)
Sergey A [Mon, 20 Jun 2022 09:42:19 +0000 (11:42 +0200)]
Translated using Weblate (Russian)

Currently translated at 91.8% (9582 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ru/

Co-authored-by: Sergey A <sw@atrus.ru>
Signed-off-by: Sergey A. <sw@atrus.ru>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 20 Jun 2022 09:42:19 +0000 (11:42 +0200)]
Translated using Weblate (Swedish)

Currently translated at 36.0% (3761 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 35.6% (3721 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2 years agonwfilter: spawn thread for reloading on firewalld trigger
Daniel P. Berrangé [Fri, 1 Apr 2022 09:24:37 +0000 (10:24 +0100)]
nwfilter: spawn thread for reloading on firewalld trigger

When firewalld is restarted or has its rules reloaded, we trigger a
reload of the nwfilter driver. This is done directly in the main
event loop thread which is a bad idea.

In a previous commit we fixed a actual deadlock problem with the
virStateReload API, when triggered from SIGHUP:

commit 33c6eb9689eb51dfe31dd05b24b3b6b1c948c267
Author: Jim Fehlig <jfehlig@suse.com>
Date:   Thu Mar 8 15:04:48 2018 -0700

    libvirtd: fix potential deadlock when reloading

The same deadlock problem previously existed with the firewalld reload
trigger, however, today it is not quite so series. The QEMU driver uses
a private event thread for each VM, so the particular deadlock would
not occur. None the less during the time the filters are reloading all
use of the event loop is blocked, which prevents APIs being serviced.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotools: add '--xpath EXPRESSION --wrap' args to all dumpxml commands
Daniel P. Berrangé [Thu, 16 Jun 2022 15:29:54 +0000 (16:29 +0100)]
tools: add '--xpath EXPRESSION --wrap' args to all dumpxml commands

While you can chain the virsh output up to a later 'xmllint' or 'xpath'
command, integrating it into virsh avoids needs for installing extra
binaries which we've often found to be missing on production installs
of libvirt. It also gives better response if the initial virsh command
hits an error, as you don't get an aborted pipeline.

    $ virsh pool-dumpxml --xpath //permissions default
    <permissions>
      <mode>0711</mode>
      <owner>1000</owner>
      <group>1000</group>
      <label>unconfined_u:object_r:svirt_home_t:s0</label>
    </permissions>

If multiple nodes match, they are emitted individually:

    $ virsh dumpxml --xpath '//devices/*/address[@type="pci"]' --wrap demo
    <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
    <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    ...snip...
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
    <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>

but if intending to post-process the output further, the results
can be wrapped in a parent node

    $ virsh dumpxml --xpath '//devices/*/address[@type="pci"]' --wrap demo
    <nodes>
      <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
      <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
      ...snip...
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
      <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
    </nodes>

Fixes https://gitlab.com/libvirt/libvirt/-/issues/244
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotools: add helper method for printing an XML document
Daniel P. Berrangé [Thu, 16 Jun 2022 14:59:03 +0000 (15:59 +0100)]
tools: add helper method for printing an XML document

The trivial case of fully printing an XML document is boring, but
this helper does more by allowing an XPath expression to be given.
It will then print just the subset of nodes which match the
expression. It either print each match as a standalone XML doc
or can put them into one new XML doc wrapped woith <nodes>...</nodes>

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoconf: cpu: Add <signature family=X model=X stepping=X/>
Cole Robinson [Sat, 11 Jun 2022 16:24:37 +0000 (12:24 -0400)]
conf: cpu: Add <signature family=X model=X stepping=X/>

Internally we already collect x86 host family + model + stepping
numeric values. This exposed them in capabilities CPU output.
Example:

$ sudo virsh capabilities | grep -A1 -B1 signature
      <microcode version='240'/>
      <signature family='6' model='94' stepping='3'/>
      <counter name='tsc' frequency='3408010000' scaling='no'/>

Users need to know these values to calculate an expected.
SEV-ES/SEV-SNP launch measurement.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2 years agoqemu: Fix alignment in qemuFirmwareMappingFlashFormat()
Andrea Bolognani [Mon, 13 Jun 2022 09:53:09 +0000 (11:53 +0200)]
qemu: Fix alignment in qemuFirmwareMappingFlashFormat()

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: Simplify handling of virTristateBool values
Andrea Bolognani [Thu, 9 Jun 2022 17:09:31 +0000 (19:09 +0200)]
qemu: Simplify handling of virTristateBool values

We explicitly check whether the value is YES or NO, which makes
it unnecessary to make sure it's not ABSENT beforehand.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Fix virDomainDefOSValidate()
Andrea Bolognani [Thu, 9 Jun 2022 17:26:16 +0000 (19:26 +0200)]
conf: Fix virDomainDefOSValidate()

Even when the os.loader element is absent, we still have to
validate that the user is not attempting to use firmware
autoselection with a driver that doesn't implement the feature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovmx: Declare support for firmware autoselection
Andrea Bolognani [Fri, 10 Jun 2022 08:05:01 +0000 (10:05 +0200)]
vmx: Declare support for firmware autoselection

The feature was implemented in commits b4e34d1083bc and
9bb6e4e739fa but the corresponding feature flag was not set in
the driver, so other parts of of libvirt wouldn't be able to
know about it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: virtiofs: format --thread-pool-size
Ján Tomko [Fri, 10 Jun 2022 13:25:00 +0000 (15:25 +0200)]
qemu: virtiofs: format --thread-pool-size

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: virtiofs: add thread_pool element
Ján Tomko [Fri, 10 Jun 2022 13:10:29 +0000 (15:10 +0200)]
conf: virtiofs: add thread_pool element

Add an element to configure the thread pool size:

...
<binary>
  <thread_pool size='16'/>
</binary>
...

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: formatdomain: update hostdev interface section a bit
Yalan Zhang [Thu, 16 Jun 2022 05:11:42 +0000 (13:11 +0800)]
docs: formatdomain: update hostdev interface section a bit

Update the default "driver" value for hostdev interface since
the default is not "KVM" anymore (refer to "Host device
asssignment" part and by test results). And update the mac
address in one xml example.

Signed-off-by: Yalan Zhang <yalzhang@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agolxc: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:14 +0000 (20:13 +0800)]
lxc: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:13 +0000 (20:13 +0800)]
tests: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotools: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:12 +0000 (20:13 +0800)]
tools: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotest_driver: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:11 +0000 (20:13 +0800)]
test_driver: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovmx: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:10 +0000 (20:13 +0800)]
vmx: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovmware: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:09 +0000 (20:13 +0800)]
vmware: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovbox: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:08 +0000 (20:13 +0800)]
vbox: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:07 +0000 (20:13 +0800)]
util: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agostorage: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:06 +0000 (20:13 +0800)]
storage: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agorpc: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:05 +0000 (20:13 +0800)]
rpc: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoremote: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:04 +0000 (20:13 +0800)]
remote: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:03 +0000 (20:13 +0800)]
qemu: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoopenvz: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:02 +0000 (20:13 +0800)]
openvz: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agonode_device: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:01 +0000 (20:13 +0800)]
node_device: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agonetwork: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:13:00 +0000 (20:13 +0800)]
network: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agologging: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:59 +0000 (20:12 +0800)]
logging: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agolocking: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:58 +0000 (20:12 +0800)]
locking: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agolibxl: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:57 +0000 (20:12 +0800)]
libxl: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agohypvervisor: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:56 +0000 (20:12 +0800)]
hypvervisor: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agohyperv: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:55 +0000 (20:12 +0800)]
hyperv: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoesx: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:54 +0000 (20:12 +0800)]
esx: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agocpu: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:53 +0000 (20:12 +0800)]
cpu: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:52 +0000 (20:12 +0800)]
conf: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoch: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:51 +0000 (20:12 +0800)]
ch: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoadmin: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:50 +0000 (20:12 +0800)]
admin: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoaccess: Remove unused includes
Peng Liang [Wed, 8 Jun 2022 12:12:49 +0000 (20:12 +0800)]
access: Remove unused includes

Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 15 Jun 2022 15:18:53 +0000 (17:18 +0200)]
Translated using Weblate (Swedish)

Currently translated at 35.2% (3681 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2 years agoTranslated using Weblate (Russian)
Sergey A [Wed, 15 Jun 2022 15:18:52 +0000 (17:18 +0200)]
Translated using Weblate (Russian)

Currently translated at 91.8% (9582 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ru/

Co-authored-by: Sergey A <sw@atrus.ru>
Signed-off-by: Sergey A. <sw@atrus.ru>
2 years agovirDomainDiskTranslateSourcePool: Fix check of 'startupPolicy' definition
Peter Krempa [Tue, 14 Jun 2022 12:21:33 +0000 (14:21 +0200)]
virDomainDiskTranslateSourcePool: Fix check of 'startupPolicy' definition

The check was historically done only for _TYPE_VOLUME disks, but
refactors to allow _TYPE_VOLUME disks in the backing chain caused a
regression where we'd reject startupPolicy also for _TYPE_BLOCK disks
which historically worked well.

Fix it by using the 'virDomainDiskDefValidateStartupPolicy' helper and
use it only when the top level image is a _TYPE_VOLUME as in other cases
it was already validated. This also allows _TYPE_BLOCK volumes to use
startup policy.

Fixes: 37f01262eed9f37dd5eb7de8b83edd2fea741054
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2095758
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirDomainDiskDefValidateStartupPolicy: Validate disk type better
Peter Krempa [Tue, 14 Jun 2022 12:07:47 +0000 (14:07 +0200)]
virDomainDiskDefValidateStartupPolicy: Validate disk type better

Our startup policy checkers work only for local paths, so disk sources
such as NVMe, or vhost-user can't be used with startup policy.

Unfortunately the validation did not catch these cases. Fix it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomain_validate: Split out validation of disk startup policy
Peter Krempa [Tue, 14 Jun 2022 11:23:29 +0000 (13:23 +0200)]
domain_validate: Split out validation of disk startup policy

Move the code into 'virDomainDiskDefValidateStartupPolicy' which will be
later reused in the qemu driver.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirDomainDiskDefValidate: Improve error messages for 'startupPolicy' checks
Peter Krempa [Tue, 14 Jun 2022 11:13:48 +0000 (13:13 +0200)]
virDomainDiskDefValidate: Improve error messages for 'startupPolicy' checks

Remove linebreak and mention the attribute name. Also prepare the error
messages for future by substituting the type of offending access.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirDomainHugepagesFormat: Use virXMLFormatElementEmpty
Peter Krempa [Fri, 3 Jun 2022 11:37:00 +0000 (13:37 +0200)]
virDomainHugepagesFormat: Use virXMLFormatElementEmpty

Refactor the function to use modern XML formatting machinery.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoAdd unit tests for new specification of nvram.
Rohit Kumar [Wed, 4 May 2022 16:51:14 +0000 (09:51 -0700)]
Add unit tests for new specification of nvram.

This patch adds unit tests for remote NVRAM.

Examples:

<nvram type='network'>
  <source protocol='iscsi' name='iqn.2013-07.com.example:iscsi-nopool/0'>
    <host name='example.com' port='6000'/>
    <auth username='myname'>
      <secret type='iscsi' usage='mycluster_myname'/>
    </auth>
  </source>
</nvram>

and

<nvram type='network'>
  <source protocol='nbd' name='bar'>
    <host name='example.org' port='6000'/>
  </source>
</nvram>

and

<nvram type='file'>
  <source file='/var/lib/libvirt/nvram/guest_VARS.fd'/>
</nvram>

Signed-off-by: Prerna Saxena <prerna.saxena@nutanix.com>
Signed-off-by: Florian Schmidt <flosch@nutanix.com>
Signed-off-by: Rohit Kumar <rohit.kumar3@nutanix.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoconf: Add support to parse/format <source> for NVRAM
Rohit Kumar [Wed, 4 May 2022 16:51:12 +0000 (09:51 -0700)]
conf: Add support to parse/format <source> for NVRAM

This patch introduces the logic to format and parse remote NVRAM.

Update NVRAM element schema, and docs for supporting network backed
NVRAM. NVRAM backed over network would give the flexibility to start
the VM on any host without having to worry about where to get the latest
nvram image.

<nvram type='network'>
  <source protocol='iscsi' name='iqn.2013-07.com.example:iscsi-nopool/0'>
    <host name='example.com' port='6000'/>
  </source>
</nvram>

or

<nvram type='file'>
  <source file='/var/lib/libvirt/nvram/guest_VARS.fd'/>
</nvram>

In the qemu driver we will support the new definition only with qemu's
supporting -blockdev.

Signed-off-by: Prerna Saxena <prerna.saxena@nutanix.com>
Signed-off-by: Florian Schmidt <flosch@nutanix.com>
Signed-off-by: Rohit Kumar <rohit.kumar3@nutanix.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoconf: Extract formatting of NVRAM out of virDomainLoaderDefFormat
Peter Krempa [Fri, 3 Jun 2022 10:39:38 +0000 (12:39 +0200)]
conf: Extract formatting of NVRAM out of virDomainLoaderDefFormat

Introduce virDomainLoaderDefFormatNvram and extract the code to it so
that it's self-contained in upcoming patches adding more complex logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoqemuFirmwareFillDomain: Don't fill in firmware for network backed nvram
Peter Krempa [Fri, 3 Jun 2022 11:22:42 +0000 (13:22 +0200)]
qemuFirmwareFillDomain: Don't fill in firmware for network backed nvram

Prepare for network backed nvram by refusing the reset of nvram on boot
and don't check whether it exists. We will not support filling it from a
template.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoqemu: validate: Reject virStorageSource features we don't want to support with nvram
Rohit Kumar [Wed, 4 May 2022 16:51:12 +0000 (09:51 -0700)]
qemu: validate: Reject virStorageSource features we don't want to support with nvram

Signed-off-by: Prerna Saxena <prerna.saxena@nutanix.com>
Signed-off-by: Florian Schmidt <flosch@nutanix.com>
Signed-off-by: Rohit Kumar <rohit.kumar3@nutanix.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoqemuDomainInitializePflashStorageSource: Properly and fully initialize nvram source
Peter Krempa [Wed, 1 Jun 2022 12:50:29 +0000 (14:50 +0200)]
qemuDomainInitializePflashStorageSource: Properly and fully initialize nvram source

Setup all fields for use with -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoqemuProcessReconnect: Don't re-instantiate pflash storage source
Peter Krempa [Wed, 1 Jun 2022 12:40:19 +0000 (14:40 +0200)]
qemuProcessReconnect: Don't re-instantiate pflash storage source

We don't really use it besides when starting up the VM so when
reconnecting this step is totally pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoqemu: Properly setup the NVRAM virStorageSource
Peter Krempa [Fri, 3 Jun 2022 11:11:08 +0000 (13:11 +0200)]
qemu: Properly setup the NVRAM virStorageSource

Use the designated helpers for virStorageSource instead using the
file-based ones with a check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoqemu: Use 'def->os.loader->nvram' directly instead of 'priv->pflash1'
Peter Krempa [Wed, 18 May 2022 13:08:36 +0000 (15:08 +0200)]
qemu: Use 'def->os.loader->nvram' directly instead of 'priv->pflash1'

Since we now have a full virStorageSource for storing the nvram path we
don't need the extra dance of transferring the data into the 'pflash1'
variable which was an intermediary solution to use -blockdev.

For now we keep it functionally identical to the previous impl.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoconf: Convert def->os.loader->nvram a virStorageSource
Rohit Kumar [Wed, 4 May 2022 16:51:11 +0000 (09:51 -0700)]
conf: Convert def->os.loader->nvram a virStorageSource

Currently, libvirt allows only local filepaths to specify the location
of the 'nvram' image. Changing it to virStorageSource type will allow
supporting remote storage for nvram.

Signed-off-by: Prerna Saxena <prerna.saxena@nutanix.com>
Signed-off-by: Florian Schmidt <flosch@nutanix.com>
Signed-off-by: Rohit Kumar <rohit.kumar3@nutanix.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoqemuBuildPflashBlockdevCommandLine: Take virDomainObj instead of private data
Peter Krempa [Wed, 18 May 2022 12:31:17 +0000 (14:31 +0200)]
qemuBuildPflashBlockdevCommandLine: Take virDomainObj instead of private data

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agoqemuDomainPrepareStorageSourceBlockdev: Add a variant for custom nodename
Peter Krempa [Wed, 1 Jun 2022 12:10:38 +0000 (14:10 +0200)]
qemuDomainPrepareStorageSourceBlockdev: Add a variant for custom nodename

Extract the internals of qemuDomainPrepareStorageSourceBlockdev into
qemuDomainPrepareStorageSourceBlockdevNodename so that we can reuse it
when instantiating the virStorageSource for pflash backing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2 years agopo/LINGUAS: Fix sorting
Peter Krempa [Tue, 14 Jun 2022 12:36:13 +0000 (14:36 +0200)]
po/LINGUAS: Fix sorting

Fixes breakage of 'sc_linguas_sorting'.

Fixes: c886a40cfcbceb2efa57930b64f758d3e263d759
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2 years agoTranslated using Weblate (Korean)
김인수 [Mon, 13 Jun 2022 12:12:02 +0000 (14:12 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10431 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2 years agoAdded translation using Weblate (Georgian)
Temuri Doghonadze [Mon, 13 Jun 2022 12:12:01 +0000 (14:12 +0200)]
Added translation using Weblate (Georgian)

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 13 Jun 2022 12:12:01 +0000 (14:12 +0200)]
Translated using Weblate (Swedish)

Currently translated at 35.0% (3661 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 34.9% (3641 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 34.7% (3621 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2 years agoFix incorrect uses of g_clear_pointer() introduced in 8.1.0
Mark Mielke [Sun, 12 Jun 2022 19:16:50 +0000 (15:16 -0400)]
Fix incorrect uses of g_clear_pointer() introduced in 8.1.0

This is a partial revert of 87a43a907f0ad4897a28ad7c216bc70f37270b93

The change to use g_clear_pointer() in more places was accidentally
applied to cases involving vir_g_source_unref().

In some cases, the ordering of g_source_destroy() and
vir_g_source_unref() was reversed, which resulted in the source being
marked as destroyed, after it is already unreferenced. This
use-after-free case might work in many cases, but with versions of
glib older than 2.64.0 it may defer unref to run within the main
thread to avoid a race condition, which creates a large distance
between the g_source_unref() and g_source_destroy().

In some cases, the call to vir_g_source_unref() was replaced with a
second call to g_source_destroy(), leading to a memory leak or worse.

In our experience, the symptoms were that use of libvirt-python became
slower over time, with OpenStack nova-compute initially taking around
one second to periodically query the host PCI devices, and within an
hour it was taking over a minute to complete the same operation, until
it is was eventually running this query back-to-back, resulting in the
nova-compute process consuming 100% of one CPU thread, losing its
RabbitMQ connection frequently, and showing up as down to the control
plane.

Signed-off-by: Mark Mielke <mark.mielke@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agokbase: launch_security_sev: Break up overly long line
Peter Krempa [Mon, 13 Jun 2022 14:08:09 +0000 (16:08 +0200)]
kbase: launch_security_sev: Break up overly long line

Standard text is aligned to 80 colums in all .rst files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemuBuildInterfaceConnect: Initialize @tapfd array
Michal Privoznik [Mon, 13 Jun 2022 12:33:36 +0000 (14:33 +0200)]
qemuBuildInterfaceConnect: Initialize @tapfd array

When creating a TAP interface we can end up with multiple FDs,
each representing one queue. However, these FDs must be
relabelled as they are then passed to QEMU. In case of
qemuBuildInterfaceConnect() we allocate the array for the FDs and
then let function corresponding to the <interface/> type to fill
the array with FDs. When any of the functions meets an error,
it's also responsible for closing previously opened FDs. However,
the functions take a shortcut: iterate through each member of the
array and close it (if it's non-negative). This assumes that the
array is initialized to negative values, which use to be the case
before rewrite in v8.4.0-rc1~170 but after it it's no longer the
case. Subsequently, "random" FDs are closed (okay, not that
random since the array is allocated via g_new0(), but hey - FD 0
is still valid FD and might be valuable, actually).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075383#c18
Fixes: 7a38d3946bc1a7ef0206f36dfe3dbf422fb8d578
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirNetDevSaveNetConfig: Pass mode to virFileWriteStr()
Michal Privoznik [Mon, 13 Jun 2022 12:20:06 +0000 (14:20 +0200)]
virNetDevSaveNetConfig: Pass mode to virFileWriteStr()

For some types of SRIOV interfaces we create a temporary file
where the state of the interface is saved before we start
modifying it. The file is used then to restore the original
configuration when the interface is no longer associated with any
guest. For writing the file virFileWriteStr() is used. However,
it's given wrong argument: the last argument is supposed to be
mode to create the file with but virNetDevSaveNetConfig() passes
open(2) flags (O_CREAT|O_TRUNC|O_WRONLY). We need the file to be
writable and readable by root only (0600). Therefore, pass that
mode instead of gibberish.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodocs: kbase/launch_security_sev: QEMU 6.0+ sets iommu=on for us
Cole Robinson [Sat, 11 Jun 2022 16:42:34 +0000 (12:42 -0400)]
docs: kbase/launch_security_sev: QEMU 6.0+ sets iommu=on for us

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2 years agospec: Fix indentation
Cole Robinson [Mon, 13 Jun 2022 13:09:35 +0000 (09:09 -0400)]
spec: Fix indentation

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2 years agospec: Xen arches have changed on Fedora 36+
Cole Robinson [Sat, 11 Jun 2022 20:17:27 +0000 (16:17 -0400)]
spec: Xen arches have changed on Fedora 36+

Latest fedora 36+ xen builds have dropped i686 and armv7hl builds.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2 years agoutil: Fix error reporting in virProcessSetMaxMemLock
Jiri Denemark [Fri, 10 Jun 2022 16:05:16 +0000 (18:05 +0200)]
util: Fix error reporting in virProcessSetMaxMemLock

Commit v7.1.0-136-g6a6d6bb520 refactored virProcessSetMaxMemLock by
moving its part into a new virProcessSetLimit, but lost "return -1" on
error.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu: Generate command line for <defaultiothread/> pool size
Michal Privoznik [Mon, 16 May 2022 12:16:06 +0000 (14:16 +0200)]
qemu: Generate command line for <defaultiothread/> pool size

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_validate: Check if QEMU's capable of setting <defaultiothread/> pool size
Michal Privoznik [Mon, 16 May 2022 11:57:18 +0000 (13:57 +0200)]
qemu_validate: Check if QEMU's capable of setting <defaultiothread/> pool size

Since the main-loop and iothread classes are derived from the
same class (EventLoopBaseClass) we don't need new capability and
can use QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX directly to check
whether QEMU's capable of setting defaultiothread pool size.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoconf: Introduce <defaultiothread/>
Michal Privoznik [Mon, 16 May 2022 11:23:32 +0000 (13:23 +0200)]
conf: Introduce <defaultiothread/>

As of v7.0.0-877-g70ac26b9e5 QEMU exposes its default event loop
for devices with no IOThread assigned as an QMP object. In the
very next commit (v7.0.0-878-g71ad4713cc) it was extended for
thread-pool-min and thread-pool-max attributes. Expose them under
new <defaultiothread/> element.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirsh: Wire up new virDomainSetIOThreadParams parameters
Michal Privoznik [Wed, 11 May 2022 11:32:36 +0000 (13:32 +0200)]
virsh: Wire up new virDomainSetIOThreadParams parameters

Since virsh implements a wrapper over virDomainSetIOThreadParams()
(command iothreadset) let's wire up new typed parameters there too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Wire up new virDomainSetIOThreadParams parameters
Michal Privoznik [Wed, 11 May 2022 11:32:26 +0000 (13:32 +0200)]
qemu: Wire up new virDomainSetIOThreadParams parameters

Introduced in previous commit, QEMU driver needs to be taught how
to set VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN and
VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX parameters on given IOThread.
Fortunately, this is fairly trivial to do and since these two
parameters are exposed in domain XML too the update of inactive
XML can be wired up too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoinclude: Introduce typed params for virDomainSetIOThreadParams wrt pool size
Michal Privoznik [Wed, 11 May 2022 11:31:47 +0000 (13:31 +0200)]
include: Introduce typed params for virDomainSetIOThreadParams wrt pool size

Our public API offers virDomainSetIOThreadParams() function which
allows users to set various aspects of IOThreads. Introduce two
new typed parameters: VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN and
VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX which will allow users to
modify the thread-pool-min and thread-pool-max attributes of an
iothread.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Generate command line for IOThread pool size
Michal Privoznik [Wed, 9 Mar 2022 10:46:15 +0000 (11:46 +0100)]
qemu: Generate command line for IOThread pool size

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_validate: Check if QEMU's capable of setting iothread pool size
Michal Privoznik [Tue, 10 May 2022 10:26:29 +0000 (12:26 +0200)]
qemu_validate: Check if QEMU's capable of setting iothread pool size

Now that we have a capability that reflects whether QEMU is
capable of setting iothread pool size, let's introduce a
validator check to make sure users are not trying to use this
feature with QEMU that doesn't support it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Introduce QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX
Michal Privoznik [Tue, 10 May 2022 10:05:44 +0000 (12:05 +0200)]
qemu: Introduce QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX

This capability reflects whether QEMU allows setting
thread-pool-min and thread-pool-max attributes on iothread
object. Since both attributes were introduced in the same commit
(v7.0.0-878-g71ad4713cc) and can't exist independently of each
other we can stick with one capability covering both of them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoconf: Introduce thread_pool_min and thread_pool_max attributes to IOThread
Michal Privoznik [Mon, 7 Mar 2022 14:13:39 +0000 (15:13 +0100)]
conf: Introduce thread_pool_min and thread_pool_max attributes to IOThread

At least in case of QEMU an IOThread is actually a pool of
threads (see iothread_set_aio_context_params() in QEMU's code
base). As such, it can have minimal and maximal number of worker
threads. Allow setting them in domain XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoconf: Introduce allocator for virDomainIOThreadIDDef
Michal Privoznik [Mon, 7 Mar 2022 14:07:40 +0000 (15:07 +0100)]
conf: Introduce allocator for virDomainIOThreadIDDef

So far, iothread configuration structure (virDomainIOThreadIDDef)
is allocated by plain g_new0(). This is perfectly okay because
all members of the struct default to value 0 anyway. But soon
this is going to change. Therefore, replace those g_new0() with a
function so that the default value can be set consistently in one
place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoconf: Move iothread formatter into a separate function
Michal Privoznik [Mon, 16 May 2022 09:59:48 +0000 (11:59 +0200)]
conf: Move iothread formatter into a separate function

Formatting iothreads is currently open coded inside of
virDomainDefFormatInternalSetRootName(). While this works, it
makes the function needlessly long, especially if the formatting
code will expand in near future. Therefore, move it into a
separate function. At the same time, make
virDomainDefIothreadShouldFormat() accept const domain definition
so that the new function can also accept const domain definition.
Formatters shouldn't need to change definition.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirDomainIOThreadIDDefArrayInit: Decrease scope of @iothrid
Michal Privoznik [Tue, 8 Mar 2022 11:22:08 +0000 (12:22 +0100)]
virDomainIOThreadIDDefArrayInit: Decrease scope of @iothrid

In virDomainIOThreadIDDefArrayInit() the variable @iothrid is
used only inside a loop but is declared for whole function. Bring
the variable into the loop so that it's obvious that the variable
is not used elsewhere.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirDomainDefParseIOThreads: Use g_autoptr() for @iothrid
Michal Privoznik [Mon, 16 May 2022 09:48:15 +0000 (11:48 +0200)]
virDomainDefParseIOThreads: Use g_autoptr() for @iothrid

Using g_autoptr() for @iothrid variable inside
virDomainDefParseIOThreads() allows us to drop explicit call to
virDomainIOThreadIDDefFree() in one case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirml: Introduce VIR_XML_PROP_NONNEGATIVE flag
Michal Privoznik [Mon, 7 Mar 2022 15:44:46 +0000 (16:44 +0100)]
virml: Introduce VIR_XML_PROP_NONNEGATIVE flag

For easier attribute parsing we have virXMLProp*() family of
functions. These accept flags through which a caller can pose
some conditions onto the attribute value, for instance:
VIR_XML_PROP_NONZERO when the attribute may not be zero, etc.

What we are missing is VIR_XML_PROP_NONNEGATIVE when the
attribute value may be non-negative. Obviously, this flag makes
sense only for some members of the virXMLProp*() family.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoci: Move upstream QEMU integration test to Fedora 36
Andrea Bolognani [Thu, 26 May 2022 13:44:09 +0000 (15:44 +0200)]
ci: Move upstream QEMU integration test to Fedora 36

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoci: Add Fedora 36 to integration tests
Andrea Bolognani [Thu, 26 May 2022 13:43:36 +0000 (15:43 +0200)]
ci: Add Fedora 36 to integration tests

This requires publishing the RPMs as artifacts from the regular
build job.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoci: integration: Set 'safe.directory' when installing QEMU from git
Erik Skultety [Tue, 7 Jun 2022 12:51:14 +0000 (14:51 +0200)]
ci: integration: Set 'safe.directory' when installing QEMU from git

Since a fix for CVE-2022-24765 was released every git command is now
checked against the context repo in which it's supposed to run
resulting in a fatal error if the repo is owned by other user than the
one running the git command.
This means that in order to be able to do 'sudo make install', we have
to set the 'safe.directory' for the root user. This is because QEMU
runs 'git submodule update' automatically on 'make install'.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoci: integration: SELinux relabel the QEMU we installed from git
Erik Skultety [Tue, 7 Jun 2022 14:43:41 +0000 (16:43 +0200)]
ci: integration: SELinux relabel the QEMU we installed from git

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agovirsh: Check whether enough arguments was passed to iothreadset
Michal Privoznik [Wed, 8 Jun 2022 13:01:00 +0000 (15:01 +0200)]
virsh: Check whether enough arguments was passed to iothreadset

Virsh has iothreadset command which allows setting various
attributes of IOThreads. However, when the command is called
without any arguments (besides domain and IOThread IDs), then
@params stays NULL and is passed to virDomainSetIOThreadParams()
which produces rather user unfriendly error message:

  error: params in virDomainSetIOThreadParams must not be NULL

Introduce a check and produce better error message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
2 years agoqemu: Improve error messages using qemuMigrationJobName
Jiri Denemark [Wed, 8 Jun 2022 08:05:38 +0000 (10:05 +0200)]
qemu: Improve error messages using qemuMigrationJobName

They were constructed from two separate strings using "%s: %s", which
is ugly and does not work well with translations.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Fix VSERPORT_CHANGE event in post-copy migration
Jiri Denemark [Tue, 24 May 2022 15:18:56 +0000 (17:18 +0200)]
qemu: Fix VSERPORT_CHANGE event in post-copy migration

When a domain has a guest agent channel enabled and the agent is running
in the guest, we will get VSERPORT_CHANGE event on a destination host as
soon as we start vCPUs there. This is not an issue for normal migration,
but post-copy migration will remain running after we started vCPUs on
the destination. If it runs for more than 30s, the VSERPORT_CHANGE event
handler will fail to get a job and log the following error message:

    Timed out during operation: cannot acquire state change lock (held
    by monitor=remoteDispatchDomainMigrateFinish3Params)

and of course we will think the guest agent is not connected and thus
all APIs talking to it will fail. Until the agent or libvirt daemon is
restarted.

Luckily we only need to update the channel state (to mark it as
connected) and connect to the agent neither of which conflicts with
migration. Thus we can safely enable processing this event during
migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoIntroduce VIR_JOB_MIGRATION_SAFE job type
Jiri Denemark [Tue, 24 May 2022 14:17:23 +0000 (16:17 +0200)]
Introduce VIR_JOB_MIGRATION_SAFE job type

This is a special job for operations that need to modify domain state
during an active migration. The modification must not affect any state
that could conflict with the migration code. This is useful mainly for
event handlers that need to be processed during migration and which
could otherwise time out on acquiring a normal MODIFY job.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoNEWS: Add support for post-copy recovery
Jiri Denemark [Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)]
NEWS: Add support for post-copy recovery

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agovirsh: Add --postcopy option for domjobabort command
Jiri Denemark [Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)]
virsh: Add --postcopy option for domjobabort command

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemu: Implement VIR_DOMAIN_ABORT_JOB_POSTCOPY flag
Jiri Denemark [Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)]
qemu: Implement VIR_DOMAIN_ABORT_JOB_POSTCOPY flag

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoAdd VIR_DOMAIN_ABORT_JOB_POSTCOPY flag for virDomainAbortJobFlags
Jiri Denemark [Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)]
Add VIR_DOMAIN_ABORT_JOB_POSTCOPY flag for virDomainAbortJobFlags

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemu: Implement virDomainAbortJobFlags
Jiri Denemark [Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)]
qemu: Implement virDomainAbortJobFlags

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoAdd virDomainAbortJobFlags public API
Jiri Denemark [Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)]
Add virDomainAbortJobFlags public API

The original virDomainAbortJob did not support flags.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemu: Enable support for VIR_MIGRATE_POSTCOPY_RESUME
Jiri Denemark [Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)]
qemu: Enable support for VIR_MIGRATE_POSTCOPY_RESUME

Since all parts of post-copy recovery have been implemented now, it's
time to enable the corresponding flag.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>