1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-09-10 21:45:18 +03:00

Compare commits

...

733 Commits

Author SHA1 Message Date
Jiri Denemark
d8a915bcec Release of libvirt-8.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-04-01 12:23:38 +02:00
Michal Privoznik
bea451be12 NEWS: Document some contributions
Document either my contributions or commits I helped review for
the upcoming release.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-04-01 11:45:31 +02:00
Peter Krempa
3c22f80dc6 NEWS: Mention 'manual' snapshots and FD passing for 'virsh qemu-monitor-command'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-04-01 11:43:59 +02:00
Han Han
75134a3a7d checkpoint: Fix a typo of comments
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 07:14:19 +02:00
Michal Privoznik
d5f81479a6 virsh: Fix integer overflow in allocpages
I've came across an aarch64 system which supports hugepages up to
16GiB of size. However, I was unable to allocate them using
virsh allocpages. This is because cmdAllocpages() uses
vshCommandOptScaledInt(), which scales passed value into bytes,
but since the virNodeAllocPages() expects size in KiB the
variable holding bytes is then divided by 1024. However, the
limit for the biggest value passed to vshCommandOptScaledInt() is
UINT_MAX which is now obviously wrong, as it needs to be UINT_MAX
* 1024.

The same bug is in completer. But here, let's use ULLONG_MAX so
that we don't have to care about it anymore.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-31 14:33:40 +02:00
Tim Wiederhake
49156f8070 Fix spelling
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-03-31 11:31:08 +02:00
Jonathon Jongsma
3832db2108 qemu: fix hotplug for multiqueue vdpa net device
While commit a5e659f0 removed the restriction against multiple queues
for the vdpa net device, there were some missing pieces. Configuring a
device statically and then starting the domain worked as expected, but
hotplugging a device didn't have the expected multiqueue support
enabled. Add the missing bits.

Consider the following device xml:
    <interface type="vdpa">
      <mac address="00:11:22:33:44:03" />
      <source dev="/dev/vhost-vdpa-0" />
      <model type="virtio" />
      <driver queues='2' />
    </interface>

Without this patch, hotplugging the above XML description resulted in
the following:
    {"execute":"netdev_add","arguments":{"type":"vhost-vdpa","vhostdev":"/dev/fdset/0","id":"hostnet1"},"id":"libvirt-392"}
    {"execute":"device_add","arguments":{"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:03","bus":"pci.5","addr":"0x0"},"id":"libvirt-393"}

With the patch, hotplugging results in the following:
    {"execute":"netdev_add","arguments":{"type":"vhost-vdpa","vhostdev":"/dev/fdset/0","queues":2,"id":"hostnet1"},"id":"libvirt-392"}
    {"execute":"device_add","arguments":{"driver":"virtio-net-pci","mq":true,"vectors":6,"netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:03","bus":"pci.5","addr":"0x0"},"id":"libvirt-393"}

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-30 10:14:28 -05:00
John Levon
7767454267 fix documentation for sockets topology
In 0895a0e, it was noted that the "sockets" value in the topology
section of capabilities reflects not the number of sockets per NUMA
node, not the total number.

Unfortunately, the fix was applied to the wrong place: the domain XML
format documentation, not that for the capabilities output. And, in
fact, the domain XML interprets "sockets" as the total number, not a
per-node value.

Back out this change in favour of a note in the capabilities
documentation instead.

Fixes: 0895a0e75d
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: John Levon <john.levon@nutanix.com>
2022-03-30 15:51:57 +01:00
김인수
aed587b2a3 Translated using Weblate (Korean)
Currently translated at 100.0% (10411 of 10411 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>
2022-03-30 10:23:44 +02:00
Yuri Chornoivan
2cd66920ae Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10411 of 10411 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2022-03-30 10:23:44 +02:00
Weblate
b908d4bbb2 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2022-03-30 10:23:42 +02:00
John Levon
c1ae54ad2e virConnectDomainEventRegisterAny: correct docs
The callback ID can be zero, not necessarily positive; correct the
comment to reflect this.

Signed-off-by: John Levon <levon@movementarian.org>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 15:58:41 +02:00
Michal Privoznik
cd7acb3323 virfile: Report error when changing pipe size fails
When changing the size of pipe that virFileWrapperFdNew() creates
we start at 1MiB and if that fails because it's above the system
wide limit we get EPERM and continue with half of the size.

However, we might get another error in which case we should
report proper system error and return failure from
virFileWrapperFdNew().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-28 15:04:18 +02:00
Jiri Denemark
2ddf220718 po: Refresh potfile for v8.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-03-28 13:53:45 +02:00
Peter Krempa
28e45ffccc NEWS: Mention the qemu device property override feature
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 13:15:25 +02:00
Peter Krempa
38ab5c9ead qemu: command: Override device definition according to the namespace config
Apply the user-requested changes to the device definition as requested
by the <qemu:deviceOverride> element from the custom qemu XML namespace.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/287
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 13:15:25 +02:00
Peter Krempa
e273dfc066 qemuBuildDeviceCommandlineFromJSON: Pass 'virDomainDef' into the function
The definition object will be later used to access the qemu namespace
definition used to override device properties.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 13:15:25 +02:00
Peter Krempa
8109f80720 conf: Introduce VIR_DOMAIN_TAINT_CUSTOM_DEVICE and use it in qemu
Taint the domain object when the user requests custom device properties.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 13:15:25 +02:00
Peter Krempa
b2d4ae0ec3 qemu: domain: Add XML namespace code for overriding device config
Implement the XML parser and formatter for overriding of device
properties such as:

  <qemu:override>
    <qemu:device alias='ua-disk'>
      <qemu:frontend>
        <qemu:property name='prop1' type='string' value='propval1'/>
        <qemu:property name='prop2' type='signed' value='-321'/>
        <qemu:property name='prop3' type='unsigned' value='123'/>
        <qemu:property name='prop4' type='bool' value='true'/>
        <qemu:property name='prop5' type='bool' value='false'/>
        <qemu:property name='prop6' type='bool' value='false'/>
        <qemu:property name='prop6' type='remove'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 13:15:25 +02:00
Peter Krempa
5747dff5f7 docs: drvqemu: Document overriding of device properties
Upcoming patches will add possibility to override configuration of a
device with custom properties as a more versatile replacement to using
QEMU's '-set' parameter, which doesn't work when we use JSON to
instantiate devices.

Describe the XML used for the override as well as expectations of
upstream support in case something breaks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 13:15:25 +02:00
Peter Krempa
47d6d1855c util: virfile: Fix indentation of preprocessor directives
stderr:
cppi: /home/pipo/libvirt/src/util/virfile.c: line 205: not properly indented
cppi: /home/pipo/libvirt/src/util/virfile.c: line 243: not properly indented
cppi: /home/pipo/libvirt/src/util/virfile.c: line 249: not properly indented
build-aux/syntax-check.mk: incorrect preprocessor indentation
make: *** [/home/pipo/libvirt/build-aux/syntax-check.mk:565: sc_preprocessor_indentation] Error 1

Fixes: c61d1e9ba0
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-03-28 13:13:20 +02:00
Claudio Fontana
c61d1e9ba0 virfile: set pipe size in virFileWrapperFdNew to improve throughput
currently the only user of virFileWrapperFdNew is the qemu driver;
virsh save is very slow with a default pipe size.
This change improves throughput by ~400% on fast nvme or ramdisk.

Best value currently measured is 1MB, which happens to be also
the kernel default for the pipe-max-size.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 12:56:33 +02:00
Michal Privoznik
4d7bb0177a qemu_tpm: Do async IO when starting swtpm emulator
When vTPM is secured via virSecret libvirt passes the secret
value via an FD when swtpm is started (arguments --key and
--migration-key). The writing of the secret into the FDs is
handled via virCommand, specifically qemu_tpm calls
virCommandSetSendBuffer()) and then virCommandRunAsync() spawns a
thread to handle writing into the FD via
virCommandDoAsyncIOHelper. But the thread is not created unless
VIR_EXEC_ASYNC_IO flag is set, which it isn't. In order to fix
it, virCommandDoAsyncIO() must be called.

The credit goes to Marc-André Lureau
<marcandre.lureau@redhat.com> who has done all the debugging and
proposed fix in the bugzilla.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2064115
Fixes: a9c500d2b5
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-03-28 10:00:18 +02:00
Michal Privoznik
087473a3ef Revert "qemu: add support for tsc.on_reboot element"
This reverts commit 06c960e477.

Turns out, this feature is not needed and QEMU will fix TSC
without any intervention from outside.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>P
2022-03-28 10:00:18 +02:00
Michal Privoznik
bcb3bf2f7c Revert "domain: add tsc.on_reboot element"
This reverts commit 150540394d.

Turns out, this feature is not needed and QEMU will fix TSC
without any intervention from outside.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>P
2022-03-28 10:00:18 +02:00
Paolo Bonzini
06c960e477 qemu: add support for tsc.on_reboot element
QEMU 7.0.0 adds a new property tsc-clear-on-reset to x86 CPU, corresponding
to Libvirt's <tsc on_reboot="clear"/> element.  Plumb it in the validation,
command line handling and tests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 16:31:02 +01:00
Paolo Bonzini
150540394d domain: add tsc.on_reboot element
Some versions of Windows hang on reboot if their TSC value is greater
than 2^54.  The workaround is to reset the TSC to a small value.  Add
to the domain configuration an attribute for this.  It can be used
by QEMU and in principle also by ESXi, which has a property called
monitor_control.enable_softResetClearTSC as well.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 16:30:48 +01:00
Paolo Bonzini
5cef757875 tests: add dependencies to meson declaration
Make sure that all tests are run after the helpers and mocks are
(re)built.  This enables for example using "meson test" as the
command line passed to "git bisect run".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 15:36:25 +01:00
Paolo Bonzini
5df14f8180 meson: do not look for libparted if not requested
libparted_dep is not used if -Dstorage_disk=disabled. Do not
bother looking for this library if the disk storage backend was
not requested.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 15:31:56 +01:00
Paolo Bonzini
3124cd618d meson: do not look for librbd/librados if not requested
rbd_dep is not used if -Dstorage_rbd=disabled.  Do not bother looking for
the libraries that compose it if the rbd storage backend was not requested.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 15:24:58 +01:00
Kristina Hanicova
48dc020a55 ch: use virDomainJob enum instead of virCHDomainJob
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 13:41:08 +01:00
Kristina Hanicova
44f0b63dbc libxl: use virDomainJob enum instead of libxlDomainJob
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 13:41:06 +01:00
Kristina Hanicova
096138851c lxc: use virDomainJob enum instead of virLXCDomainJob
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 13:41:04 +01:00
Kristina Hanicova
93d653a9f6 qemu: move macros QEMU_X into hypervisor as VIR_X
It makes sense to have these in the same file as the definitions
of enums.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 13:41:01 +01:00
Kristina Hanicova
a193f4bef6 move jobs enums QEMU_X into hypervisor as VIR_X
These enums are essentially the same and always sorted in the
same order in every hypervisor with jobs. They can be generalized
by using the qemu enums as the main ones as they are the most
extensive.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 13:40:56 +01:00
Tom Wieczorek
111272a9fd Translated using Weblate (German)
Currently translated at 48.4% (5045 of 10404 strings)

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

Co-authored-by: Tom Wieczorek <tom@bibbu.net>
Signed-off-by: Tom Wieczorek <tom@bibbu.net>
2022-03-25 10:03:51 +01:00
Kristina Hanicova
7287b4916c qemu: remove else branches after return in qemuMigrationSrcPerform()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-25 10:03:11 +01:00
Kristina Hanicova
d3dcc9ce2b qemu: remove unnecessary else branches after return / goto
I think the code looks cleaner without else branches.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-25 10:03:11 +01:00
Han Han
fd57b7bfe1 kbase: Fix the syntax of the snapshot link in index.rst
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-03-25 09:00:45 +01:00
Michal Privoznik
b8d6ecc70c qemu_command: Generate prealloc-threads property
Let's generate prealloc-threads property onto the cmd line if
domain configuration requests so.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-24 15:46:00 +01:00
Michal Privoznik
75a4e0165e qemu_validate: Validate prealloc threads against qemuCpas
Only fairly new QEMUs are capable of user provided number of
preallocation threads. Validate this assumption.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-24 15:46:00 +01:00
Michal Privoznik
a30dac15dc qemu_capabilities: Detect memory-backend-*.prealloc-threads property
The prealloc-threads is property of memory-backend class which is
parent to the other three classes memory-backend-{ram,file,memfd}.
Therefore the property is present for all, or none if QEMU is
older than v5.0.0-rc0~75^2~1^2~3 which introduced the property.

Anyway, the .reserve property is the same story, and we chose
memory-backend-file to detect it, so stick with our earlier
decision and use the same backend to detect this new property.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-24 15:46:00 +01:00
Michal Privoznik
ba7f98126f conf: Introduce memory allocation threads
Since its v5.0.0 release QEMU is capable of specifying number of
threads used to allocate memory. It defaults to 1, which may be
too low for humongous guests with gigantic pages.

In general, on QEMU cmd line level it is possible to use
different number of threads per each memory-backend-* object, in
practical terms it's not useful. Therefore, use <memoryBacking/>
to set guest wide value and let all memory devices 'inherit' it,
silently. IOW, don't introduce per device knob because that would
only complicate things for a little or no benefit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-24 15:45:41 +01:00
Andrea Bolognani
42d7c3c4da keycodemapdb: Update git submodule
This brings in all the fixes made since April 2020.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-22 18:00:40 +01:00
Erik Skultety
69bcfa5e3b ci: integration: Rename all Avocado standard stream log files to *.log
By default, stdout/stderr Avocado test log files do not have any file
extension which confuses GitLab's web UI to mangle the MIME type for
these and so the browser will never offer the option to open such file
from in a text editor rather than dowloading it.
Since GitLab sets a proper MIME for .txt and .log file extensions,
rename all Avocado log files without an extension to *.log . This pairs
nicely with the coredumpctl info file which we already name as
'coredumpctl.txt' because of this.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-22 17:11:51 +01:00
Erik Skultety
908cb26b5d ci: integration: Collect stack traces with coredumpctl
Some Red Hat-like distros have cores limited with a soft limit of 0
which means that neither a stack trace nor a core file will be
available. Since we want the stack trace we need to set the core limit
with systemd globally to unlimited/infinity.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-22 12:07:37 +01:00
Erik Skultety
e23353756e ci: Define the integration job tag dynamically via a variable
Custom runners are private to a project, so naturally forks cannot run
any workloads on these. The integration test suite which requires
access to our custom runner is naturally disabled on forks and can be
enabled by setting LIBVIRT_CI_INTEGRATION=1.
The problem is that the current integration jobs definitions have tags
statically defined as 'redhat-vm-host'. If users are going to supply
their own private runners for their forks, they can define whatever
tags they want with it and so unless they add 'redhat-vm-host' to their
own runner's tags, the pipeline won't run.
To solve this, define the integration job tag using a variable. The
repo config will use the value defined in the job for the variable
while users can override the value easily on a project/pipeline level
thanks to GitLab's CI variable precedence [1].

[1] https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-22 12:07:37 +01:00
Daniel P. Berrangé
731456ca13 nwfilter: merge updateMutex and updateLock
The updateLock is a R/W lock held by anything which needs to read or
modify the rules associated with an NWFilter.

APIs for defining/undefining NW filters rules hold a write lock on
updateLock.

APIs for creating/deleting NW filter bindings hold a read lock on
updateLock, which prevents define/undefine taking place concurrently.

The problems arise when we attempt to creating two NW filter bindings in
parallel.

Thread 1 can acquire the mutex for filter A

Thread 2 can acquire the mutex for filter B

Consider if filters A and B both reference filters C and D, but in
different orders:

  Filter A
     -> filter C
     -> filter D

  Filter B
     -> filter D
     -> filter C

Thread 1 will try to acquire locks in order A, C, D while thread 1 will
try to acquire in order A, D, C. Deadlock can still occur.

Think we can sort the list of filters before acquiring locks on all of
them ? Nope, we allow arbitrary recursion:

  Filter A
     -> filter C
          -> filter E
             -> filter F
                -> filter H
                -> filter K
     -> filter D
         -> filter G
         -> filter I

So we can't tell from looking at 'A' which filters we're going to
need to lock. We can only see the first level of filters references
and we need to lock those before we can see the second level of
filters, etc.

We could probably come up with some cleverness to address this but
it isn't worth the time investment. It is simpler to just keep the
process of creating NW filter bindings totally serialized.

Using two separate locks for this serialization though is pointless.

Every code path which gets a read(updateLock) will go on to hold
updateMutex. It is simpler to just hold write(updateLock) and
get rid of updateMutex. At that point we don't need updateLock
to be a R/W lock, it can be a plain mutex.

Thus this patch gets rid of the current updateLock and updateMutex
and introduces a new top level updateMutex.

This has a secondary benefit of introducing fairness into the
locking.  With a POSIX R/W lock, you get writer starvation if
you have lots of readers. IOW, if we call virNWFilterBIndingCreate
and virNWFilterBindingDelete in a tight loop from a couple of
threads, we can prevent virNWFilterDefine from ever acquiring
a write lock.

Getting rid of the R/W lock gives us FIFO lock acquisition
preventing starvation of any API call servicing.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-22 10:19:31 +00:00
Andrea Bolognani
6932eb8506 docs: Update obsolete reference to formatdomain.html.in
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-03-22 11:05:09 +01:00
Claudio Fontana
76ddf2d2e3 schemas: move out of docs, fix no-docs build
schemas are used for more than just documentation,
virsh edit fails if schemas are not available.

Therefore, fix the no-docs build by moving schemas/
to the parsing code inside src/conf/.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-03-22 11:05:09 +01:00
Peter Krempa
ccffb60a9d kbase: Introduce 'snapshots' page and describe the new 'manual' snapshot
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-22 10:32:43 +01:00
Peter Krempa
75aaf806c9 qemuSnapshotCreateActiveExternal: Implement manual snapshot mode
In case we are snapshotting at least one 'manual' disk we will pause the
VM and keep it paused.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1866400
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-22 10:32:43 +01:00
Peter Krempa
a1465e661e conf: snapshot: Introduce 'manual' mode for snapshot of a disk
The idea of the manual mode is to allow a synchronized snapshot in cases
when the storage is outsourced to an unmanaged storage provider which
requires cooperation with snapshotting.

The mode will instruct the hypervisor to pause along when the other
components are snapshotted and the 'manual' disk can be snapshotted
along. This increases latency of the snapshot but allows them in
otherwise impossible situations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-22 10:32:43 +01:00
Peter Krempa
95e439b6f0 qemuDomainDefNamespaceFormatXML*: Convert to virXMLFormatElement
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-22 10:31:06 +01:00
Daniel P. Berrangé
d31c39a83c qemu: fix recording of CPU deprecations
The code parsing thue query-cpu-definitions response will short-circuit
the for loop in the case where usable=yes, resulting in us failing to
parse the CPU deprecation flag.

IOW, we only reported deprecations in domain capabilities for CPU models
which were not runnable on the host.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-21 09:18:02 +00:00
Michal Privoznik
af6f6091e0 virNWFilterLockIface: Preserve correct lock ordering
In the not so distant past, the lock ordering in
virNWFilterLockIface() was as follows: global mutex ifaceMapLock
was acquired, then internal representation of given interface was
looked up in a hash table (or created brand new if none was
found), the global lock was released and the lock of the
interface was acquired.

But this was mistakenly changed as the function was rewritten to
use automatic mutexes, because now the global lock is held
throughout the whole run of the function and thus the interface
specific lock is acquired with the global lock held. This results
in a deadlock.

Fixes: dd8150c48d
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-03-18 17:45:17 +01:00
Michal Privoznik
db7b0b12b7 qemu_process: Be nicer to killing QEMU when probing caps
The qemuProcessQMPStop() function is intended to kill this dummy
QEMU process we started only for querying capabilities.
Nevertheless, it may be not plain QEMU binary we executed, but
in fact it may be a memcheck tool (e.g. valgrind) that executes
QEMU later. By switching to virProcessKillPainfully() we allow
this wrapper tool to exit gracefully.

Another up side is that virProcessKillPainfully() reports an
error so no need for us to VIR_ERROR() ourselves.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-18 17:00:06 +01:00
Daniel P. Berrangé
e4327557a4 ci: only run integration tests if $LIBVIRT_CI_INTEGRATION=1 is set
Right now the jobs have no rules so they will always be created in
a pipeline. If the user's fork has no runner configured, then the
jobs will never be able to execute and the pipeline will not finish.

Even on upstream, there might be times the runner has to be taken
offline for maint work, or unexpectedly fail. We need a quick way
to disable the integration tests if we decide we don't want to
have pipelines queued until the runner comes back online.

Both these problems can be addressed by requiring a environment
variable to be set

   LIBVIRT_CI_INTEGRATION=1

This can be done in the GitLab repo CI settings for permanent
enablement. Alternatively it can be set for individual
scheduled jobs, or using a push option

  git push -o ci.variable=LIBVIRT_CI_INTEGRATION=1

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-03-18 16:45:57 +01:00
Daniel P. Berrangé
b1c7cca6c9 ci: rename integration test template
Although we split out jobs across many files, the template / job
namespace is global, so we should use something more specific
than '.tests' as the template name.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-03-18 16:45:35 +01:00
Michal Privoznik
17fe6a090b virnwfilterobj: Don't use virObjectLockGuard() with virNWFilterObj
While its name would suggest that virNWFilterObj is an actual
virObject it is not. It's a plain structure (with virMutex as its
first member). Therefore, when locking the struct
virObjectLockGuard() can' be used and virLockGuardLock() must be
used instead.

Spotted-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-03-18 15:05:28 +01:00
Kristina Hanicova
45dcb1a881 qemu: use qemuDomainSaveStatus() and remove qemuDomainObjSaveStatus()
It does not make sense to have both of these, since one of them
is only a wrapper for the other one. I decided to preserve the
more general one, which requires only virDomainObj and rewrote it
a bit, so that it pulls the qemu driver from privateData.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-03-18 13:15:02 +01:00
Tim Wiederhake
4a46539d0a qemu_conf: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 17:16:23 +01:00
Tim Wiederhake
d115fe8d11 nwfilter_driver: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 17:16:10 +01:00
Tim Wiederhake
183804c043 remote_daemon_stream: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
20d2cf47bc virnetlink: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
22e67e4e67 virNetlinkEventAddClient: Remove goto
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
3e00a35311 nwfilter_ipaddrmap: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
dd8150c48d nwfilter_learnipaddr: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
2d7682dd3b nwfilter_dhcpsnoop: Replace virNWFilterSnoopReqLock functions
Use automatic mutex management instead.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
5e6442b903 nwfilter_dhcpsnoop: Replace virNWFilterSnoopLock macros
Use automatic mutex management instead.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
f61baec724 nwfilter_dhcpsnoop: Replace virNWFilterSnoopActiveLock macros
Use automatic mutex management instead.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
398745c3b3 nwfilter_gentech: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
68523b2605 nwfilter_driver: Split up nwfilterStateCleanup
This allows nwfilterStateCleanupLocked to be used in
nwfilterStateInitialize in a later patch.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Tim Wiederhake
8c86168868 nwfilter_driver: Statically initialize mutex
This enables a later patch to simplify locking during initialization
and cleanup of virNWFilterDriverState.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:44:46 +01:00
Daniel P. Berrangé
991639da96 conf: fix inverted parameters in hash iterator callbacks
virHashTableForEach unhelpfully has payload/key args in
its callback reversed compared to g_hash_table_foreach.
When converting from one to the other the semantics
change but you don't get a compile error

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-17 15:29:56 +00:00
Tim Wiederhake
5e1da78967 esx_stream: Fix NULL dereferences
A wrong reordering caused "priv" to be derefenced before the NULL-check
in esxStreamSend and esxStreamRecvFlags.

Fixes: 12e19f172d
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:20:46 +01:00
Erik Skultety
1dfd308843 gitlab-ci: Introduce new 'integration_tests' pipeline stage
This stage will download build artifacts from both the libvirt and
libvirt-perl (multi-project CI) builds, install all them on the custom
runners and configures libvirt debug logging on the runners prior to
executing the actual test suite. In case of a failure, libvirt and
Avocado logs will be saved and published as pipeline artifacts.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:09:53 +01:00
Erik Skultety
4ee1c4cc6d ci: manifest: Publish RPMs as artifacts on CentOS Stream and Fedoras
We're already building libvirt in the containers already, if we publish
the build in form of, say, RPMs, later stages of the pipeline can
consume the RPMs instead of re-building libvirt from scratch.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:09:53 +01:00
Erik Skultety
68141bd148 ci: gitlab: Refresh gitlab.yml
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 16:09:53 +01:00
Andrea Bolognani
d36ba5fa71 meson: Check for os-release's ID_LIKE in addition to ID
This makes it possible to reduce the number of cases we have to
consider, because 'sles' declares itself to be like 'suse' and
both 'rhel' and 'centos' declare themselves to be like 'fedora'.

We have to move the check for Ubuntu before the one for Debian,
however, because 'ubuntu' declares itself to be like 'debian'
and it would end up with the wrong defaults otherwise.

Suggested-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 14:46:14 +01:00
Andrea Bolognani
ab10207c3b spec: Move virkey* manual pages from -daemon to -client
The documentation included in these manual pages is mostly useful
to users of the 'send-key' virsh command, and the virsh manual
page refers to them, so it makes more sense to install them along
with virsh instead of libvirtd.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-17 14:45:51 +01:00
Andrea Bolognani
f167c083d7 Drop YouCompleteMe and color_coded integration
I introduced support for these vim plugins several years ago
but have since moved away from them. These days developers
are likely better served by lsp-based tooling, which doesn't
require additional per-project configuration.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-17 14:35:05 +01:00
Andrea Bolognani
59a7bed091 Add .gitattributes file
The files marked as export-ignore here are not going to be
included in the tarball produced by 'meson dist' when using
meson >= 0.60.

Older versions of meson excluded a small subset of these files
automatically, but since we have more control now we can be
more aggressive and leave out anything that doesn't make sense
in a release tarball.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-17 14:33:12 +01:00
Daniel P. Berrangé
c4fb52dc72 conf: use a hash table for storing nwfilter object list
The current use of an array for nwfilter objects requires
the caller to iterate over all elements to find a filter,
and also requires locking each filter.

Switching to a pair of hash tables enables O(1) lookups
both by name and uuid, with no locking required.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-17 11:39:53 +00:00
Daniel P. Berrangé
a19f1e7fc8 nwfilter: update comment about locking filter updates
The comment against the 'updateMutex' refers to a problem with
lock ordering when looking up filters in the virNWFilterObjList
which uses an array. That problem does indeed exist.

Unfortunately it claims that switching to a hash table would
solve the lock ordering problems during instantiation. That
is not correct because there is a second lock ordering
problem related to how we traverse related filters when
instantiating filters. Consider a set of filters:

  Filter A:
     Reference Filter C
     Reference Filter D

  Filter B:
     Reference Filter D
     Reference Filter C

In one example, we lock A, C, D, in the other example
we lock A, D, C.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-17 11:39:41 +00:00
Daniel P. Berrangé
a4947e8f63 nwfilter: fix crash when counting number of network filters
The virNWFilterObjListNumOfNWFilters method iterates over the
driver->nwfilters, accessing virNWFilterObj instances. As such
it needs to be protected against concurrent modification of
the driver->nwfilters object.

This API allows unprivileged users to connect, so users with
read-only access to libvirt can cause a denial of service
crash if they are able to race with a call of virNWFilterUndefine.
Since network filters are usually statically defined, this is
considered a low severity problem.

This is assigned CVE-2022-0897.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-17 11:32:07 +00:00
Martin Kletzander
92e00c7afc Add Alpine builds to CI
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-03-17 11:28:40 +01:00
Boris Fiuczynski
8efdf5b083 nodedev: trigger mdev device definition update on udev add and remove
When nodedev objects are added and removed if possible check if mdev-types is
supported by the object and trigger a mdev device definition update to correct
the associated parent nodedevs.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-03-17 11:07:33 +01:00
Boris Fiuczynski
06aebe8f9a nodedev: update mdevs on parent change
The parent of the mdev definition can change due to the existance of the
parent device. The parents existance can e.g. depend on the device
driver load state.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-03-17 11:07:30 +01:00
Boris Fiuczynski
ccb3dc72b8 virnodedeviceobj: export virNodeDeviceObjHasCap
The function will be reused in the nodedev drivers udev handling.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-03-17 10:57:17 +01:00
Boris Fiuczynski
d8b9610bb0 nodedev: fix typo in mdevctl update warning
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-17 10:57:06 +01:00
Michal Privoznik
fcbb8e916b virnetdev: Use VIR_WITH_MUTEX_LOCK_GUARD in virNetDevGenerateName()
The virNetDevGenerateName() function uses a global array of
virNetDevGenName structs to find next unused name for network
device. This obviously needs some locking and in fact each member
of the array has its own lock. However, these members are not
virObjects, they are just plain structs, therefore
VIR_WITH_MUTEX_LOCK_GUARD() must be used instead of
VIR_WITH_OBJECT_LOCK_GUARD() to lock individual mutexes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-17 09:45:38 +01:00
Kristina Hanicova
e5c10018c5 qemu: domainjob: Allow InitJob if cb is not set in qemuDomainObjInitJob()
This allows init job even if cb structure is not set. This patch
also includes slight rewriting of the function to make it look
cleaner when freeing resources, by allocating privateData at the
end.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 16:27:19 +01:00
Kristina Hanicova
965f872f92 qemu: domainjob: Allow operations if cb is not set in job structure
We should allow resetting / freeing / restoring / parsing /
formatting qemuDomainJobObj even if 'cb' attribute is not set.
This is theoretical for now, but the attribute must not be always
set in the future. It is sufficient to check if 'cb' exists
before dereferencing it.

This commit partially reverts af16e754cd.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 16:27:16 +01:00
Michal Privoznik
86dc94fbb6 qemu_cgroup: Don't deny devices from cgroupDeviceACL
On domain startup a couple of devices are allowed in the devices
controller no matter the domain configuration. The aim is to
allow devices crucial for QEMU or one of its libraries, or user
is passing through a device (e.g. through additional cmd line
arguments) and wants QEMU to access it.

However, during unplug it may happen that a device is configured
to use one of such devices and since we deny /dev nodes on
hotplug we would deny such device too. For example,
/dev/urandom belongs onto the list of implicit devices and users
can hotplug and hotunplug an RNG device with /dev/urandom as
backend.

The fix is fortunately simple - just consult the list of implicit
devices before removing the device from the namespace.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-16 13:22:17 +01:00
Michal Privoznik
a388b32ffd qemu_cgroup: Introduce and use qemuCgroupDenyDevicePath()
In all cases virCgroupDenyDevicePath() is followed by
virDomainAuditCgroupPath(). Might as well pack that into one
function and call it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-16 13:22:17 +01:00
Michal Privoznik
f0b3ae98c2 qemu_cgroup: Introduce and use qemuCgroupAllowDevicePath()
In all cases virCgroupAllowDevicePath() is followed by
virDomainAuditCgroupPath(). Might as well pack that into one
function and call it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-16 13:22:17 +01:00
Michal Privoznik
bc51dac713 qemu_cgroup: Drop ENOENT special case for RNG devices
When allowing or denying RNG device in CGroups there's a special
check if the backend device exists (errno == ENOENT) in which
case success is returned to caller. This is in contrast with the
rest of the functions and in fact wrong too - if the backend
device doesn't exist then QEMU will fail opening it. Might as
well signal error here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-16 13:22:17 +01:00
Tim Wiederhake
a29db4fbed storage: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:42 +01:00
Tim Wiederhake
69d793a0bc storage: Removing mutex locking in initialization and cleanup
These functions are only ever called in a single threaded
environment and the mutex would not have prevented concurrent
access anyway.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:39 +01:00
Tim Wiederhake
3d836f828a esx_vi: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:36 +01:00
Tim Wiederhake
12e19f172d esx_stream: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:33 +01:00
Tim Wiederhake
440a8d271d admin: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:30 +01:00
Tim Wiederhake
df8992c277 nodesuspend: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:28 +01:00
Tim Wiederhake
79e6bf3c45 netdev: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:25 +01:00
Tim Wiederhake
72adccb10e remote_daemon_dispatch: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:23 +01:00
Tim Wiederhake
2bfd03cc5d openvz: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:20 +01:00
Tim Wiederhake
3b5b1f9209 test: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-16 10:54:05 +01:00
Michal Privoznik
22188790ca qemu_namespace: Be less aggressive in removing /dev nodes from namespace
When creating /dev nodes in a QEMU domain's namespace the first
thing we simply do is unlink() the path and create it again. This
aims to solve the case when a file changed type/major/minor in
the host and thus we need to reflect this in the guest's
namespace. Fair enough, except we can be a bit more clever about
it: firstly check whether the path doesn't already exist or isn't
already of the correct type/major/minor and do the
unlink+creation only if needed.

Currently, this is implemented only for symlinks and
block/character devices. For regular files/directories (which are
less common) this might be implemented one day, but not today.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-15 17:03:07 +01:00
Michal Privoznik
9d749998b3 qemu_namespace: Don't unlink paths from cgroupDeviceACL
When building namespace for a domain there are couple of devices
that are created independent of domain config (see
qemuDomainPopulateDevices()). The idea behind is that these
devices are crucial for QEMU or one of its libraries, or user is
passing through a device and wants us to create it in the
namespace too.  That's the reason that these devices are allowed
in the devices CGroup controller as well.

However, during unplug it may happen that a device is configured
to use one of such devices and since we remove /dev nodes on
hotplug we would remove such device too. For example,
/dev/urandom belongs onto the list of implicit devices and users
can hotplug and hotunplug an RNG device with /dev/urandom as
backend.

The fix is fortunately simple - just consult the list of implicit
devices before removing the device from the namespace.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-15 17:03:03 +01:00
Michal Privoznik
4aafdf1e1f virsh: Don't open code virshEnumComplete()
Now that we have a function that generates string list for given
enum, let's use that instead of open coding it.

Note, after this there are still some 'candidates' left (e.g,
virshNetworkEventNameCompleter(), or
virshNetworkUpdateCommandCompleter()). These are not converted
because either they don't have a convenient int2str function or
they don't start from the very beginning of the enum.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-15 13:36:58 +01:00
Michal Privoznik
d2e8718f3a virsh: Introduce virshEnumComplete()
We have plenty of completers which iterate over all values of
given enum and do nothing more than translate every member into
string (using corresponding virXXXTypeToString()).

Introduce a convenience function so that callers can pass just
VIR_XXX_LAST and virXXXTypeToString and the rest is taken care
of.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-15 13:36:56 +01:00
Michal Privoznik
c21e271d36 virsh: Properly terminate string list in virshDomainInterfaceSourceModeCompleter()
A completer must return a NULL terminated list of strings, which
means that when dealing with enums, it has to allocate one
pointer more than the value of VIR_XXX_LAST. But this is not
honoured in virshDomainInterfaceSourceModeCompleter() leading to
out of bounds read.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-03-15 13:36:43 +01:00
Peter Krempa
2804fa912f qemuBlockJobDiskNew: Remove misleading return value description
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
da48fff4b9 qemuMigrationSrcNBDStorageCopyOne: Refactor cleanup
Autofree the temporary string and shuffle around the success path to
avoid the 'cleanup' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
c1e2a134c8 NEWS: Mention that VIR_MIGRATE_PARAM_TLS_DESTINATION works now for non-shared storage migration
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
e8fa09d66b qemu: migration: Use 'VIR_MIGRATE_PARAM_TLS_DESTINATION' for the NBD connection
The NBD connection for non-shared storage migration can have the same
issue regarding TLS certificate name match as the migration connection
itself.

Propagate the configured name also for the NBD connections.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1901394
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
e6d1ed4a76 conf: Add support for setting expected TLS hostname for NBD disks
In cases when the hostname of the NBD server doesn't match the hostname
in the TLS certificate the new attribute 'tlsHostname' can be used to
override it.

Add the XML infrastructure and tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
e11f2eb7a8 qemu: Add support for 'tlsHostname' setting of virStorageSource
Add validation and formatting of the blockdev props.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
47abbe0fd7 storage_source: Add 'tlsHostname' field to virStorageSource
The value will be used to override the hostname used for validation of
TLS certificates.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
19faa6f01a qemuMigrationSrcRun: Fix misleading comment about NBD with TLS support
We do support non-shared storage migration with TLS now. Fix the comment
claiming otherwise.

Fixes: a8dc146a4d
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
fd6f49034d qemu: capabilities: Introduce QEMU_CAPS_BLOCKDEV_NBD_TLS_HOSTNAME
Detect that qemu can override TLS hostname setting for NBD clients.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
2c47088e76 tests: qemucapabilities: Update caps_7.0.0.x86_64
Update to commit v6.2.0-2296-g9f0369efb0

Notable changes:
  - 'tls-hostname' field for NBD client to override local hostname
  - machine types 'pc-i440fx-1.7' and older are now deprecated
  - 'snapshot-access' block driver added
  - The 'protocol' field of 'set_password' and 'expire_password'
    parameter is now an enum instead of a pure string allowing 'vnc' and
    'spice' as value and the arguments are also covered by the schema.
  - 'copy-before-write' block driver now has a 'bitmap' property
  - 'query-migrate' now reports 'precopy-bytes', 'downtime-bytes',
    'postcopy-bytes' for 'ram' and 'disk' statistics
  - RTC_CHANGE event now has a 'qom-path' property to identify the RTC
  - 'umip' cpu feature is now migratable
  - SGX property 'section-size' reinstated after regression

Changes in build setting:
  - fuse block export support now enabled

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Ján Tomko
5e055f8bcd docs: downloads: fix link to libvirt GitLab group
s/libvirt.org/libvirt/

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 14:29:31 +01:00
Peter Krempa
825476beda qemuSnapshotCreateActiveExternal: Remove duplicit assignment
The block of code pausing the VM assigns 'resume' to true but it's
already true because of the previous condition.

The code is deliberately kept in two blocks as upcoming changes will
modify both conditions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:50 +01:00
Peter Krempa
238fef920f conf: snapshot: Use proper types for snapshot location
Refactor the code to use proper types for the memory and disk snapshot
location and fix the parsing code to be compatible with an unsigned
type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:50 +01:00
Peter Krempa
5984e5e6fd virDomainSnapshotDefParse: Decouple parsing of memory snapshot config
Separate the steps of parsing the memory snapshot config from the
post-processing and validation code. The upcoming patch refactoring the
parsing will be simpler.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:50 +01:00
Peter Krempa
8a5a096d72 virDomainSnapshotDefParse: Avoid 'memoryfile' temporary variable
Assign directly into the definition. The cleanup code can deal with
that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:50 +01:00
Peter Krempa
12b85a3611 virDomainSnapshotDefParse: Refactor cleanup
Use automatic memory cleanup, decrease scope of variables and remove the
'cleanup' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:50 +01:00
Peter Krempa
c250ab90ac conf: snapshot: Remove VIR_DOMAIN_SNAPSHOT_PARSE_DISKS flag
All callers except the one in the 'esx' driver pass the flag. The 'esx'
driver has a check that 'def->ndisks' is zero after parsing the
definition. This means that we can simply always parse the disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:50 +01:00
Peter Krempa
fc81be4bfa qemuDomainSnapshotForEachQcow2Raw: Act only on internal snapshots
Similarly to the external snapshot code the internal inactive snapshot
creation helper should act only when an internal snapshot of the disk is
required. For now the callers ensure that it's either _INTERNAL or _NO
when control reaches this function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:50 +01:00
Peter Krempa
fe6e11e856 Rename VIR_DOMAIN_SNAPSHOT_LOCATION_NONE to VIR_DOMAIN_SNAPSHOT_LOCATION_NO
The string value associated to the enum is "no". Rename the enum
accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:49 +01:00
Peter Krempa
f17da1c24b conf: Move definition of 'virDomainSnapshotLocation'
The snapshot location enum is also needed for the disk definition so if
we house it inside domain_conf we can use the proper type for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:49 +01:00
Peter Krempa
0146d70887 virStorageSource: Convert 'type' to proper enum
Use 'virStorageType' as type for the 'type' member and convert the code
to work properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:49 +01:00
Peter Krempa
b150c6cf31 virDomainSnapshotDiskDefParseXML: Automatically free temporary variables and remove cleanup
Refactor the function to avoid the cleanup section used to just free
memory associated with the parsed object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:49 +01:00
Peter Krempa
8a0e9e106b qemuSnapshotCreateAlignDisks: Rewrite logic for selecting default memory snapshot mode
Use an if/else branch rather than a expression with a ternary operator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:49 +01:00
Peter Krempa
a4752ce6ef qemuSnapshotDiskPrepareActiveExternal: Handle only external snapshots
Preparation steps ensure that the 'snapshot' field can only be
'VIR_DOMAIN_SNAPSHOT_LOCATION_NONE' or
VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL' at this point, but upcoming
patches will change that. Handle only external snapshots.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:49 +01:00
Peter Krempa
afd67eb793 virDomainDiskDefFormat: Refactor to virXMLFormatElement
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:49 +01:00
Ján Tomko
3ae5264365 docs: downloads: mark GitLab as the primary source
Document our usage of GitLab and the read-only mirrors.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-11 12:40:10 +01:00
Ján Tomko
bf34dee966 docs: downloads: remove reference to git://
With the introduction of smart HTTP protocol in git 1.6.6,
the only advantage of plain git:// over https:// is not
having the encryption overhead.

Remove the reference to git://, assuming the overhead
is neligible compared to the value of screen space
on the downloads page.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-11 12:40:09 +01:00
Ján Tomko
ed7affb2bf docs: downloads: remove links to libvirt.org mirrors
While the mirrors themselves are still available, the gitweb
interface on libvirt.org has been disabled.

The mirrors can still be accessible via, e.g.:

  git clone https://libvirt.org/git/libvirt-python.git

But such link gives a 404 error. Remove the links from the website
to avoid confusion.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-11 12:40:09 +01:00
Haonan Wang
35ba60be36 virsh: Provide completer for vol-wipe algorithms
Related issue: https://gitlab.com/libvirt/libvirt/-/issues/9

Signed-off-by: Haonan Wang <hnwanga1@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-11 09:10:24 +01:00
Peter Krempa
688a2c0897 docs: Convert 'testsuites' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 17:52:07 +01:00
Peter Krempa
0b2dec6af9 docs: Convert 'testtck' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 17:52:07 +01:00
Peter Krempa
1824ed94f7 docs: Convert 'pci-hotplug' page to rST
One internal reference was modified to work properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 17:52:07 +01:00
Peter Krempa
b4ae5dbe4a docs: Convert 'nss' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 17:52:07 +01:00
Peter Krempa
98ae4c3102 syntax-check: Don't check for non-reentrant functions in '.rst' files
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 17:52:07 +01:00
Peter Krempa
6c0f4c02b9 docs: Convert 'testapi' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 17:52:07 +01:00
Peter Krempa
5042a5def6 docs: Convert 'contact' page to rST
Preserve the 'irc' and 'email' anchors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 17:52:07 +01:00
Peter Krempa
11850158bd docs: Convert 'downloads' page to rST
The table was manually converted to a set of 'list-table'-s for better
experience of viewing the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 17:52:07 +01:00
Peter Krempa
49749fa832 docs: formatsnapshot: Remove empty 'seclabel' definition
The security label setting for the external images is part of the
'source' element and documented there. Remove the empty definition added
accidentally in commit ac88a8cfad

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 13:16:23 +01:00
Peter Krempa
7d78deca81 docs: formatsnapshot: Remove explicit listing of supported snapshot formats
In blockdev mode we support creating snapshots on all kinds of storage
that qemu allows us to format the image. Drop the part of the sentence
enumerating explicitly supported protocols.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 13:16:23 +01:00
Peter Krempa
025555236c docs: formatsnapshot: Move paragraphs describing 'disk' element together
There was another paragraph describing the attribute 'type' of the
'disk' element under the description of the subelements. Move it to the
top to get all relevant information in one place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 13:16:23 +01:00
Peter Krempa
88525500ed docs: securityprocess: Don't claim that we have maint branches
The 'Branch fixing policy' paragraph claims that we have at least one
actively maintained stable branch which isn't currently the case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 13:16:23 +01:00
Daniel P. Berrangé
a870801ae1 run: gracefully handle SIGHUP, SIGQUIT, SIGTERM
When using thue 'run' script to launch a daemon, it is intended to
temporarily stop the systemd units and re-start them again after.

When using this script over an SSH connection, it will get SIGHUP
if the connection goes away, and in this case it fails to re-start
the systemd units. We need to catch SIGHUP and turn it into a
normal python exception. For good measure we do the same for
SIGQUIT and SIGTERM too.  SIGINT already gets turned into an
exception by default which we handle.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-10 08:06:12 +00:00
Daniel P. Berrangé
a3a40903d9 run: include 'src' in $PATH for the daemons
Currently the 'run' script modifies $PATH to add the 'tools'
directly to pick up client programs. It fails to add the 'src'
directory to pick up the daemons.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-10 08:06:08 +00:00
Daniel P. Berrangé
ec8e185cd0 conf: remove misleading comments about access being 'lockless'
For the various structs storing lists of objects, the access
to the hash tables is not lockless. The mutex on the object
owning the hash table must be held.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-10 08:05:29 +00:00
Michal Privoznik
79c613ec8a virsh: fflush(stdout) after fputs()
We are not guaranteed that the string we are printing onto stdout
contains '\n' and thus that the stdout is flushed. In fact, I've
met this problem when virsh asked me whether I want to edit the
domain XML again (vshAskReedit()) but the prompt wasn't displayed
(as it does not contain a newline character) and virsh just sat
there waiting for my input, I sat there waiting for virsh's
output. Flush stdout after all fputs()-s  which do not flush
stdout.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-10 08:57:31 +01:00
Jonathon Jongsma
a5e659f071 qemu: support multiqueue for vdpa net device
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024406

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-09 16:23:02 -06:00
Martin Kletzander
3c052399ea news: Document that we build with musl
A bit of effort by me and Michal helped make this the case, and it helped us
uncover some potential issues.  I am not documenting it as supported or adding
an Alpine container into the CI, but since there were some distribution bugs
mentioning libvirt issues I thing it would be nice of us to notify those
distribution maintainers that read our release news.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-09 12:54:21 +01:00
Daniel P. Berrangé
2a95dbd03c nwfilter: drop support for legacy iptables conntrack direction
Long ago we adapted to Linux kernel changes which inverted the
behaviour of the conntrack --ctdir setting:

  commit a6a04ea47a
  Author: Stefan Berger <stefanb@us.ibm.com>
  Date:   Wed May 15 21:02:11 2013 -0400

    nwfilter: check for inverted ctdir

    Linux netfilter at some point (Linux 2.6.39) inverted the meaning of the
    '--ctdir reply' and newer netfilter implementations now expect
    '--ctdir original' instead and vice-versa.
    We check for the kernel version and assume that all Linux kernels with version
    2.6.39 have the newer inverted logic.

    Any distro backporting the Linux kernel patch that inverts the --ctdir logic
    (Linux commit 96120d86f) must also backport this patch for Linux and
    adapt the kernel version being tested for.

    Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

Given our supported platform targets, we no longer need to
consider a version of Linux before 2.6.39, so can drop
support for the old direction behaviour.

The test suite updates are triggered because that never
probed for the ctdir direction, and so the iptables syntax
generator unconditionally dropped the ctdir args.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-09 11:37:32 +00:00
Daniel P. Berrangé
02b8045517 nwfilter: drop support for legacy iptables match syntax
Long ago we adapted to iptables changes by introducing support
for '-m conntrack':

  commit 06844ccbaa
  Author: Stefan Berger <stefanb@us.ibm.com>
  Date:   Tue Aug 6 20:30:46 2013 -0400

    nwfilter: Use -m conntrack rather than -m state

    Since iptables version 1.4.16 '-m state --state NEW' is converted to
    '-m conntrack --ctstate NEW'. Therefore, when encountering this or later
    versions of iptables use '-m conntrack --ctstate'.

Given our supported platform targets, we no longer need to
consider a version of iptables before 1.4.16, so can drop
support for the old syntax.

The test suite updates are triggered because that never
probed for the new syntax, and so unconditionally
generated the old syntax.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-09 11:37:12 +00:00
Martin Pitt
7aec69b7fb apparmor: Fix QEMU access for UEFI variable files
QEMU needs to read, write, and lock the NVRAM *.fd files with UEFI
firmware.

Fixes: https://bugs.debian.org/1006324
Fixes: https://launchpad.net/bugs/1962035

Signed-off-by: Martin Pitt <mpitt@debian.org>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2022-03-09 10:50:23 +01:00
Peter Krempa
23ee41152e docs: meson: Restore alphabetical order
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
106b62ebe3 docs: formatsecret: Drop few unneeded empty lines
The examples contain some whitespace and command prompts which just
waste space.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
dc96712099 docs: Convert 'formatsecret' page to rST
Also update the link from 'formatstorageencryption' to the
'usage-type-volume' anchor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
c6d15e04ae docs: Convert 'drivers' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
523f2de82e docs: page.xsl: Update anchor to the 'Code of conduct' paragraph
Use the anchor name as generated by rst2html.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
9f12d96029 docs: Convert 'governance' page to rST
Extra care is taken to preserve the 'codeofconduct' anchor which is used
in our page template. Upcoming patch will change that but we'll retain
the anchor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
0d379be41b docs: Convert 'securityprocess' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
7f3d5914a1 docs: Convert 'support' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
3c489dbbe3 docs: Convert 'errors' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
ac5c17a2fb docs: Convert 'bugs' page to rST
Special care is given to preserve the 'quality' anchor in the 'bugs'
page as we link to it directly from the gitlab issue template.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
87b2ede00b docs: Convert 'contribute' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
127b6d1267 docs: Convert 'strategy' to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
67e0468b94 docs: Convert 'goals' to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
33a751fdc4 docs: formatsnapshot: Convert to 'rst'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
c30df02ca3 docs: Drop 'devguide' page
The page is not referenced from anywhere and contains dead links for the
output and links to old repos.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Peter Krempa
92ac0f856f docs: Remove 'virshcmdref' page
The page isn't linked from anywhere and the project was archived.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 17:40:47 +01:00
Michal Privoznik
b3ee86d901 libvirt-qemu: Fix capitalization of QEMU
In plenty of places we mention qemu, Qemu but the correct form is
all capitals.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 16:04:24 +01:00
Michal Privoznik
9583b0b7e3 libvirt-qemu: Don't allow NULL cmd in virDomainQemuMonitorCommandWithFiles()
Nothing in daemon code is prepared for the command in
virDomainQemuMonitorCommandWithFiles() to be NULL. In fact, the
client side doesn't expect this either as our RPC describes the
argument as:

    remote_nonnull_string cmd;

Validate the argument in the public API implementation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-08 16:04:24 +01:00
Daniel P. Berrangé
fd08bf2095 nwfilter: make some gentech driver methods static
The virNWFilterTechDriverForName & virNWFilterUpdateInstantiateFilter
methods are only used within the same source file, so don't need to
be exported.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-08 12:19:56 +00:00
Daniel P. Berrangé
d053b8e6cf nwfilter: remove decl of virNWFilterCreateVarHashmap
This method doesn't exist since

  commit d1a7c08eb1
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Thu Apr 26 12:26:51 2018 +0100

    nwfilter: convert the gentech driver code to use virNWFilterBindingDefPtr

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-08 12:19:53 +00:00
Daniel P. Berrangé
5f8b090f42 qemu,lxc: remove use to nwfilter update lock
Now that the virNWFilterBinding APIs are using the nwfilter
update lock directly, there is no need for the virt drivers
to do it themselves.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-08 12:19:50 +00:00
Daniel P. Berrangé
65dc79f50b nwfilter: hold filter update lock when creating/deleting bindings
The nwfilter update lock is historically acquired by the virt
drivers in order to achieve serialization between nwfilter
define/undefine, and instantiation/teardown of filters.

When running in the modular daemons, however, the mutex that
the virt drivers are locking is in a completely different
process from the mutex that the nwfilter driver is locking.

Serialization is lost and thus call from the virt driver to
virNWFilterBindingCreateXML can deadlock with a concurrent
call to the virNWFilterDefineXML method.

The solution is surprisingly easy, the update lock simply
needs acquiring in the virNWFilterBindingCreateXML method
and virNWFilterBindingUndefine method instead of in the
virt drivers.

The only semantic difference here is that when a virtual
machine has multiple NICs, the instantiation and teardown
of filters is no longer serialized for the whole VM, but
rather for each NIC. This should not be a problem since
the virt drivers already need to cope with tearing down
a partially created VM where only some of the NICs are
setup.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-08 12:19:39 +00:00
Jan Kuparinen
34238d7408 Translated using Weblate (Finnish)
Currently translated at 22.9% (2389 of 10404 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
2022-03-07 14:28:06 +01:00
Michal Privoznik
09bb46991d meson: Detect newer fuse
Now that we have support for fuse-3 we can detect it during the
configure phase. Even better, we can detect fuse-3 first and
fallback to old fuse only if the newer version doesn't exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
d881cefe60 lxc_fuse: Implement support for FUSE3
Plenty of projects switch from FUSE to FUSE3. This commit enables
libvirt to compile with newer fuse-3.1 which allows users to have
just one fuse package on their systems, allows us to set
O_CLOEXEC on the fuse session FD. In general, FUSE3 offers more
features, but apparently we don't need them right now. There is a
rewrite guide at [1] but I've took most inspiration from sshfs
[2].

1: https://github.com/libfuse/libfuse/releases/tag/fuse-3.0.0
2: https://github.com/libfuse/sshfs

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
7664955086 lxc_fuse: Tell FUSE that /proc/meminfo is nonseekable
If an app within a container wishes to read from /proc/meminfo
from a different position than the beginning of the file, we can
have FUSE keep track of all the lseek()-s and reflect them in
@offset argument of read callback (lxcProcRead()). This is done
by setting fuse_file_info::nonseekable. If we don't do this, then
FUSE reports errors back the app that does lseek().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
3f2454ca0c lxc_fuse: Prefer fuse_file_info::direct_io over mount option
When mounting a FUSE it is possible to bypass kernel cache by
specifying -odirect_io mount option. This is what we currently
do. However, FUSEv3 has a different approach - the open callback
(lxcProcOpen() in our case) can set direct_io member of
fuse_file_info struct. This results in the same behaviour, but
also works with both FUSEv1 and FUSEv3. The latter does not have
the mount option and uses per file approach.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
030faee28d lxcProcReadMeminfo: Fix case when @offset != 0
The idea behind lxcProcReadMeminfo() is that we read the host's
/proc/meminfo and copy it line by line producing the content for
container, changing only those lines we need. Thus, when a
process inside container opens the file and lseek()-s to a
different position (or reads the content in small chunks), we
mirror the seek in host's /proc/meminfo. But this doesn't work
really. We are not guaranteed to end up aligned on the beginning
of new line. It's better if we construct the new content and then
mimic seeking in it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
2de984a26e lxcProcReadMeminfo: Drop @new_meminfo variable
In the lxcProcReadMeminfo() function we have @buffer variable
which is statically allocated and then @new_meminfo which is just
a pointer to the @buffer. This is needless, the @buffer can be
accessed directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
477ae0b868 lxcProcReadMeminfo: Drop needless label
After previous cleanups, the cleanup label is no longer needed
and can be removed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
8b36a2574f lxc_fuse: Use automatic file closing
There are two functions (lxcProcHostRead() and
lxcProcReadMeminfo()) that could benefit from automatic file
closing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
d68a8b2109 lxcProcReadMeminfo: Rename @fd to @fp
In lxcProcReadMeminfo() there's a variable named @fd which would
suggest it's type of int, but in fact it's type of FILE *. Rename
it to @fp to avoid confusion.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
c7171f937e lxcSetupFuse: Cleanup error paths
In the lxcSetupFuse() function there are multiple cleanup labels,
but with a bit of rewrite they can be joined into one 'error'
label. And while at it, set the @f argument only in the
successful path (currently is set in error case too).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
320efa9572 lxc_fuse: Prefer O_ACCMODE instead of & 3
In lxcProcOpen() we want to check whether the /proc/memfile is
being opened only for read. For that we check the fi->flags which
correspond to flags open() call. Instead of explicitly masking
the last two bits use O_ACCMODE constant, which is deemed to be
more portable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
82e0f18b85 lxc_fuse.c: Modernize function declarations
Our style of writing function declarations has changed since the
time the file was introduced. Fix the whole file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
fd8c3ad50a lxc_fuse: Drop some G_GNUC_UNUSED attributes
There are few arguments that are marked as G_GNUC_UNUSED even
though they are clearly used within their respective functions.
Drop the annotation in such cases.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
2543cdf982 lxc_fuse: Move #include <fuse.h>
There is no need to include the fuse.h from the header file.
Move the include into the lxc_fuse.c then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
cc0c775b62 lxc_fuse.h: Don't include lxc_conf.h
Nothing in the lxc_fuse.h header file warrants inclusion of
lxc_conf.h. If anything, virconftypes.h must be included because
of virDomainDef required by lxcSetupFuse().

It's actually lxc_fuse.c that requires some macros from
lxc_fuse.h (e.g. LXC_STATE_DIR).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
2cbe2f0960 lxc_fuse: Move virLXCMeminfo struct into lxc_cgroup.h
The function that fills virLXCMeminfo struct
(virLXCCgroupGetMeminfo()) lives in lxc_cgroup.h. Move the struct
there too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Michal Privoznik
2cf223b261 lxc_fuse: Hide struct virLXCFuse
This structure is not used outside of lxc_fuse.c. There is no need
to define it in the header file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 14:01:48 +01:00
Martin Kletzander
89cc0ffdeb wireshark: Fix dissector for quad types
This uses the right type that is expected to make it work even on platforms
where gint64 != quad_t.

Due to indentation changes it is best to view this patch with -w.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 12:37:54 +01:00
Ján Tomko
ca6122d237 docs: remove extra closing tag
Reported-by: Юлій В. Чирков <juliyvchirkov@gmail.com>
Closes: https://gitlab.com/libvirt/libvirt/-/merge_requests/143
Fixes: d3ac12e3a1
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 10:38:59 +01:00
Martin Kletzander
3c61c9bea6 tests: Allow expansion of mocked stat symbols
When libc uses a define to rewrite stat64 to stat our mocks do not work if they
are chained because the symbol that we are looking up is being stringified and
therefore preventing the stat64->stat expansion per C-preprocessor rules.  One
stringification macro is just enough to make it work.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 10:31:24 +01:00
Martin Kletzander
822be8d652 nwfilter: Avoid memory alignment issues
The returned packet can have less strict alignment (u_char) than the struct
(ether_header) we are casting it to, so to avoid alignment issues just copy the
header into the struct on the stack.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 10:31:23 +01:00
Martin Kletzander
fad2bff51e Include sys/wait.h instead of wait.h
That is the proper POSIX way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 10:31:22 +01:00
Martin Kletzander
afecf0ee0b Include poll.h instead of sys/poll.h
That is the proper POSIX way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 10:31:22 +01:00
Martin Kletzander
00babda45e syntax-check: Rework mock-noinline to get all files at once
The script can break if the number of files does not fit one invocation and
xargs has to split it.  Instead pipe the list of files directly into the script
and in the script read them from stdin instead of the arguments.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 10:31:21 +01:00
Michal Privoznik
86c691e6de tests: Update IPv4-in-IPv6 addresses
We have couple of tests where the obsolete IPv4-in-IPv6 notation
is used (::10.1.2.3). Change them to the correct format
(::ffff:10.1.2.3).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-04 15:08:59 +01:00
Michal Privoznik
c7a0b89065 sockettest: Check for IPv4-in-IPv6 parsing and formatting
There are two standards how IPv4 address in IPv6 can be
expressed:

  ::10.1.2.3
  ::ffff:10.1.2.3

The former is obsolete and the latter should be used instead [1].
Add test cases to our sockettest to exercise parsing/formatting
of the valid address format.

1: https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.1

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-04 15:08:59 +01:00
Michal Privoznik
c3c1293984 vircgroupmock: Make global variables static
Apparently clang was fixed as it no longer considers having
global variables static a problem. Make the variables static to
be sure they aren't used outside of the source file.

This effectively reverts v1.0.6-rc1~198 which started the trend.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-04 15:08:59 +01:00
Michal Privoznik
61a12ffe08 vircgroupmock: Be wiser about detecting fakerootdir change
The way that vircgroupmock works is that the vircgrouptest
creates a temporary directory and sets LIBVIRT_FAKE_ROOT_DIR env
variable which is then checked by the mock at the beginning of
basically every function it overrides (access(), stat in all its
flavours, mkdir(), etc.). The mock then creates a CGroup dir
structure. But the test is allowed to change the directory, to
accommodate environment for the particular test case. This is
done by changing the environment variable which is then detected
by the mock and the whole process repeats.

However, the way the mock detect changes is buggy. After it got
the environment variable it compares it to the last known value
(global variable @fakerootdir) and if they don't match the last
known value is set to point to the new value. Problem is that the
result of getenv() is assigned to the @fakerootdir directly.
Therefore, @fakerootdir points somewhere into the buffer of
environment variables. In turn, when the test sets new value (via
g_setenv()) it may be placed at the very same position in the env
var buffer and thus the mock fails to detect the change.

The solution is to keep our private copy of the value (by
g_strdup()) which makes the variable not rely on
getenv()/setenv() placing values at random positions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-04 15:08:59 +01:00
Ján Tomko
20f1db2467 remote: dispatch: free and close infiles too
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-03-04 14:14:42 +01:00
Ján Tomko
2f282f300a remote: close outfiles faster
Switch the operands in the loop condition to make it converge.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-03-04 14:14:39 +01:00
Peng Liang
8a1915c4d6 rpc: Fix memory leak of fds
In virSystemdActivationClaimFDs, the memory of ent->fds has been stolen
and stored in fds, but fds is never freed, which causes a memory leak.
Fix it by declaring fds as g_autofree.

Reported-by: Jie Tang <tangjie18@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-04 10:53:03 +01:00
Michal Privoznik
cac9608c17 libxl: Turn on user aliases
When I implemented user aliases I've invented this
virDomainDefFeatures flag so that individual drivers can signal
support for user provided aliases. The reasoning was that a
device alias might be part of guest ABI, or used in a different
way then in QEMU. Well, neither applies to the libxl driver, so
it's safe to allow user aliases there.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/231
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2022-03-03 11:53:30 +01:00
Peter Krempa
c7dca225e5 virsh: cmdDesc: Fix logic when '-edit' is used along with 'desc' argument
Historically the use of the '-desc' multiple argument parameter was not
forbidden toghether with '-edit', but use of both together has some
unexpected behaviour. Specifically the editor is filled with the
contents passed via '-desc' but if the user doesn't change the text in
any way virsh will claim that the description was not chaged even if it
differs from the currently set description. Similarly, when the user
would edit the description provided via 'desc' so that it's identical
with the one configured for the domain, virsh would claim that it was
updated:

  # virsh desc cd
  No description for domain: cd
  # EDITOR=true virsh desc cd --edit "test desc"
  Domain description not changed

After the fix:

  # virsh desc cd
  No description for domain: cd
  # EDITOR=true virsh desc cd --edit "test desc"
  Domain description updated successfully
  # EDITOR=true virsh desc cd --edit "test desc"
  Domain description not changed

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:57 +01:00
Peter Krempa
420488790e virsh: domain: Don't use ternaries inside vshPrint/vshError functions
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:57 +01:00
Peter Krempa
b72849ce9d virsh: cmdDesc: Remove unneeded 'cleanup'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:57 +01:00
Peter Krempa
5b811a199d virsh: cmdDesc: Automatically free memory
Decrease scope of variables and use automatic freeing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:57 +01:00
Peter Krempa
c344784b88 virsh: cmdDesc: Use 'vshTempFile' type to simplify cleanup
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:57 +01:00
Peter Krempa
8c35dcf9fc vsh: Add helper for auto-removing temporary file
The vsh helpers for user-editing of contents use temporary files.
Introduce 'vshTempFile' type which automatically removes the file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
a3ef5414ed virsh: cmdDesc: Use separate flags variable for getters
The getters have a different set of flags. Add a variable for the getter
to avoid having to construct flags when calling the getter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
2337098b63 virsh: cmdSchedinfo: Add separate variable for holding flags used for query
Instead of having two ad-hoc places which decide whether the original
flags can be used add another variable specifically for flags used for
query.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
82217a2c7b virshGetOneDisplay: Refactor formatting of URI params
Unconditionally format the start of the query ('?') and make delimiters
('&') part of the arguments. At the end we can trim off 1 char from the
end of the buffer unconditionally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
3c73ed7300 virshGetOneDisplay: Don't reuse 'xpath' variable
Add autofreed per-xpath variables to simplify the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
d6574a0d2b virshGetOneDisplay: Automaticaly free extracted data
Use automatic memory freeing for the temporary variables holding the
data extracted from the XML.

The code in this function was originally extracted from a loop so we can
also drop pre-clearing of the pointers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
bdc9269b99 virsh: cmdDomDisplay: Remove unneeded 'cleanup' label
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
364b4f0a0d virsh: cmdDomDisplay: Extract loop body fetching display URIs into 'virshGetOneDisplay'
Separate the code so that the function is not as massive. Note that this
is a minimal extraction which does not clean up the code meant for
looping.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
c6bb274693 virsh: cmdEvent: Rewrite questionable event registration
The code registering the event handlers in 'cmdEvent' had too many
blocks of code conditional on whether just one event is being listened
to or all events.

The code can be greatly simplified by uniting the code paths and having
only one branch when filling the list of events we want to listen for.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
ea3e64fefd virsh: Move 'cmdEvent' and all of its machinery to virsh-domain-event.c
'cmdEvent' along with all the helper functions it needs is ~950 LOC.
Move it out from virsh-domain.c to virsh-domain-event.c along with the
completer function so that the new module doesn't have to expose any new
types.

Semantically this creates a new category in 'virsh help' but all other
behaviour stays the same.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
c704d27d4a virsh: Move 'virshDomainBlockJobToString' to virsh-util
The helper function is used in virshBlockJobInfo and also in the
callbacks of cmdEvent. Upcoming patch is going to move out the event
code into a helper so this needs to be in a shared place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
bf9de8cb51 virshEventPrint: Use automatic memory clearing
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
8500571466 virsh: Use NULLSTR_EMPTY instead of ternary operator
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
34244cc20d virsh: virshVcpuinfoPrintAffinity: Use if-else instead of ternary operator
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
3a00632667 virsh: cmdRestore: Use if-else instead of ternary operator
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
8c383ea960 virsh: doSave: Use if-else instead of ternary operator
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
38b600166f virsh: cmdStart: Rewrite ternary operator use to standard if conditions
Rewrite the invocation of the virDomainCreate(WithFiles/Flags) APIs
based on the arguments into if-else instead of (nested) ternary
operators.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Peter Krempa
1cd95f858a virsh: cmdBlockcopy: Use virXMLFormatElement
Rewrite the formatting of the block copy target xml using
virXMLFormatElement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-03 11:06:56 +01:00
Boris Fiuczynski
823a62ec8a qemu: segmentation fault in virtqemud executing qemuDomainUndefineFlags
Commit 5adfb34723 causes a segmentation fault.

Stack trace of thread 664419:
 #0  0x000003ff62ec553c in qemuDomainUndefineFlags (dom=0x3ff6c002810, flags=<optimized out>) at ../src/qemu/qemu_driver.c:6618
 #1  0x000003ff876a7e5c in virDomainUndefineFlags (domain=domain@entry=0x3ff6c002810, flags=<optimized out>) at ../src/libvirt-domain.c:6519
 #2  0x000002aa2b64a808 in remoteDispatchDomainUndefineFlags (server=0x2aa2c3d7880, msg=0x2aa2c3d2770, args=<optimized out>, rerr=0x3ff8287b950, client=<optimized out>)
        at src/remote/remote_daemon_dispatch_stubs.h:13080
 #3  remoteDispatchDomainUndefineFlagsHelper (server=0x2aa2c3d7880, client=<optimized out>, msg=0x2aa2c3d2770, rerr=0x3ff8287b950, args=<optimized out>, ret=0x0)
        at src/remote/remote_daemon_dispatch_stubs.h:13059
 #4  0x000003ff8758bbf4 in virNetServerProgramDispatchCall (msg=0x2aa2c3d2770, client=0x2aa2c3e3050, server=0x2aa2c3d7880, prog=0x2aa2c3d8010)
        at ../src/rpc/virnetserverprogram.c:428
 #5  virNetServerProgramDispatch (prog=0x2aa2c3d8010, server=server@entry=0x2aa2c3d7880, client=0x2aa2c3e3050, msg=0x2aa2c3d2770) at ../src/rpc/virnetserverprogram.c:302
 #6  0x000003ff8758c260 in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>, srv=0x2aa2c3d7880) at ../src/rpc/virnetserver.c:140
 #7  virNetServerHandleJob (jobOpaque=0x2aa2c3e2d30, opaque=0x2aa2c3d7880) at ../src/rpc/virnetserver.c:160
 #8  0x000003ff874c49aa in virThreadPoolWorker (opaque=<optimized out>) at ../src/util/virthreadpool.c:164
 #9  0x000003ff874c3f62 in virThreadHelper (data=<optimized out>) at ../src/util/virthread.c:256
 #10 0x000003ff86c1cf8c in start_thread () from /lib64/libc.so.6
 #11 0x000003ff86c9650e in thread_start () from /lib64/libc.so.6

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-02 09:32:02 +01:00
Tim Wiederhake
e1754a1a5b Fix typo in NEWS
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2022-03-02 09:17:30 +01:00
Peter Krempa
44ea7749f8 virsh: Require option name for '--pass-fd' argument of 'qemu-monitor-command'
Require the option name for this argument as otherwise a part of the
'cmd' argument will be claimed.

Fixes: 43edde82af
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-03-01 14:29:39 +01:00
Peter Krempa
da3acb8d55 qemu: Implement qemuDomainQemuMonitorCommandWithFiles
Add support for sending one FD from the client along with a monitor
command so that it's possible to use 'getfd' and 'add-fd' to use FDs
passed from the client with other QMP commands.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-01 13:29:49 +01:00
Peter Krempa
43edde82af virsh: Implement support for virDomainQemuMonitorCommandWithFiles
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-01 13:29:49 +01:00
Peter Krempa
f87fa77ca9 lib: Introduce 'virDomainQemuMonitorCommandWithFiles'
This API has the same semantics as 'virDomainQemuMonitorCommand' but
accepts file descriptors which are then forwarded to qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-01 13:29:49 +01:00
Peter Krempa
7cfbfe66fc virnetmessage: Introduce virNetMessageClearFDs
The helper splits out the clearing of the FDs transacted inside a
virNetMessage.

APIs transacting FDs both from and to the client at the same time will
need to clear the FDs stored in virNetMessage as the structure is
re-used for the reply and without clearing the list of FDs we'd return
the FDs sent by the client in addition to the new FDs sent by the API.t

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-01 13:29:49 +01:00
Peter Krempa
3c4b49e871 qemu: block copy: Propagate 'detect_zeroes' properly into mirror definition
'qemuDomainPrepareDiskSourceData' propagates 'detect_zeroes' only for
the disk source image, but the mirror destination has the ambition to
replace the disk source when the job is finished, so we need to
propagate the 'detect_zeroes' setting also in that case.

Unfortunately it would become very hairy to either set 'disk->mirror'
sooner or propagate that we want this done into
'qemuDomainPrepareDiskSourceData', so the most straightforward solution
is to do the propagation inside 'qemuDomainBlockCopyCommon'.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/277
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-01 13:07:23 +01:00
Kristina Hanicova
8ce46ec2c3 libxl: remove redundant variable from libxlDomainJobObj
It makes no sense to have 'started' variable in the
libxlDomainJobObj as the same one is already in virDomainJobData,
but never used.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-01 11:03:57 +01:00
Jiri Denemark
c7b9591ef3 Post-release version bump to 8.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-03-01 10:15:17 +01:00
Jiri Denemark
5dd76de225 Release of libvirt-8.1.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-03-01 10:08:21 +01:00
Kim InSoo
580643e37a Translated using Weblate (Korean)
Currently translated at 100.0% (10404 of 10404 strings)

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

Co-authored-by: Kim InSoo <simmon@nplob.com>
Signed-off-by: Kim InSoo <simmon@nplob.com>
2022-02-27 03:16:57 +01:00
Kim InSoo
854ea58e4e Translated using Weblate (Korean)
Currently translated at 99.5% (10362 of 10404 strings)

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

Co-authored-by: Kim InSoo <simmon@nplob.com>
Signed-off-by: Kim InSoo <simmon@nplob.com>
2022-02-25 04:17:03 +01:00
Yuri Chornoivan
2572dfbf19 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10404 of 10404 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2022-02-25 04:17:02 +01:00
Weblate
ce70fd388b Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2022-02-25 04:17:00 +01:00
Daniel P. Berrangé
32b9d8b0ae qemu: support firmware descriptor flash 'mode' for optional NVRAM
Currently the 'nvram_template' entry is mandatory when parsing the
firmware descriptor based on flash. QEMU is extending the firmware
descriptor spec to make the 'nvram_template' optional, depending
on the value of a new 'mode' field:

  - "split"
      * "executable" contains read-only CODE
      * "nvram_template" contains read-write VARS

  - "combined"
      * "executable" contains read-write CODE and VARs
      * "nvram_template" not present

  - "stateless"
      * "executable" contains read-only CODE and VARs
      * "nvram_template" not present

In the latter case, the guest OS can write vars but the
firmware will make no attempt to persist them, so any changes
will be lost at poweroff.

For now we parse this new 'mode' but discard any firmware
which is not 'mode=split' when matching for a domain.

In the tests we have a mixture of files with and without the
mode attribute.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-23 18:11:08 +00:00
Daniel P. Berrangé
5adfb34723 qemu: honour user's nvram path when undefining VM
When undefining a VM, we must optionally delete any NVRAM that might
exist. When using firmware auto-select we always check the generated
path, ignoring any user specified path.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-23 18:09:04 +00:00
Daniel P. Berrangé
392292cd99 tests: don't use auto-generated NVRAM path in tests
By using the auto-generated NVRAM path in test data files, we won't see
bugs where a user specified path gets accidentally overwritten by a
post-parse callback, or VM startup. For example, this caused us to miss
the bug fixed by:

  commit 24adb6c7a6
  Author: Michal Prívozník <mprivozn@redhat.com>
  Date:   Wed Feb 23 08:50:44 2022 +0100

    qemu: Don't regenerate NVRAM path if parsed from domain XML

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-23 18:08:49 +00:00
Jiri Denemark
e5804d4cbf po: Refresh potfile for v8.1.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-02-23 16:10:36 +01:00
Martin Kletzander
a64e666a11 util: Fix machined servicename
Commit 4e42686ade wrongly assumed how g_variant_new_parsed() works and broke
starting of domains on systems with systemd (machined).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-02-23 13:40:24 +01:00
Michal Privoznik
24adb6c7a6 qemu: Don't regenerate NVRAM path if parsed from domain XML
After v8.0.0-466-g08101bde5d we unconditionally regenerate per
domain NVRAM path even though it might have been parsed earlier
from domain XML. The way we do that leads to a memleak:

  43 bytes in 1 blocks are definitely lost in loss record 330 of 682
  at 0x483F7E5: malloc (vg_replace_malloc.c:381)
  by 0x50D5B18: g_malloc (in /usr/lib64/libglib-2.0.so.0.7000.2)
  by 0x50EFA4F: g_strdup (in /usr/lib64/libglib-2.0.so.0.7000.2)
  by 0x49E774E: virXPathString (virxml.c:88)
  by 0x4A3F0E4: virDomainDefParseBootLoaderOptions (domain_conf.c:18226)
  by 0x4A3F49C: virDomainDefParseBootOptions (domain_conf.c:18298)
  by 0x4A448C3: virDomainDefParseXML (domain_conf.c:19598)
  by 0x4A487A1: virDomainDefParseNode (domain_conf.c:20404)
  by 0x117FCF: testCompareXMLToArgv (qemuxml2argvtest.c:726)
  by 0x142124: virTestRun (testutils.c:142)
  by 0x1423D4: virTestRunLog (testutils.c:197)
  by 0x140A76: mymain (qemuxml2argvtest.c:3406)

If we parsed NVRAM path from domain XML we must refrain from
generating new path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-02-23 10:25:19 +01:00
Jan Kuparinen
12bd3d0f57 Translated using Weblate (Finnish)
Currently translated at 22.9% (2396 of 10455 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
2022-02-23 09:42:54 +01:00
Peter Krempa
98f0f05bb6 NEWS: Mention chardev hot(un)plug fixes, '-sock' removal and RPM storage driver fix
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-23 09:39:18 +01:00
Peter Krempa
14851cff11 qemu: blockjob: Avoid spurious log errors when cancelling a shallow copy with reused images
In case when a user starts a block copy operation with
VIR_DOMAIN_BLOCK_COPY_SHALLOW and VIR_DOMAIN_BLOCK_COPY_REUSE_EXT and
both the reused image and the original disk have a backing image libvirt
specifically does not insert the backing image until after the job is
asked to be completed via virBlockJobAbort with
VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT.

This is so that management applications can copy the backing image on
the background.

Now when a user aborts the block job instead of cancelling it we'd
ignore the fact that we didn't insert the backing image yet and the
cancellation would result into a 'blockdev-del' of a invalid node name
and thus an 'error' severity entry in the log.

To solve this issue we use the same conditions when the backing image
addition is avoided to remove the internal state for them prior to the
call to unplug the mirror destination.

Reported-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-23 09:39:18 +01:00
Michal Privoznik
a6929d62cf qemu: Don't ignore failure when building default memory backend
When building the default memory backend (which has id='pc.ram')
and no guest NUMA is configured then
qemuBuildMemCommandLineMemoryDefaultBackend() is called. However,
its return value is ignored which means that on invalid
configuration (e.g. when non-existent hugepage size was
requested) an error is reported into the logs but QEMU is started
anyway. And while QEMU does error out its error message doesn't
give much clue what's going on:

  qemu-system-x86_64: Memory backend 'pc.ram' not found

While at it, introduce a test case. While I could chose a nice
looking value (e.g. 4MiB) that's exactly what I wanted to avoid,
because while such value might not be possible on x84_64 it may
be possible on other arches (e.g. ppc is notoriously known for
supporting wide range of HP sizes). Let's stick with obviously
wrong value of 5MiB.

Reported-by: Charles Polisher <chas@chasmo.org>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-22 17:26:19 +01:00
Daniel P. Berrangé
4e76dfd2e6 conf: rename struct field for NVRAM template
This is to make it explicit that the template only applies to the NVRAM
store, not the main loader binary, even if the loader is writable.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-22 14:56:26 +00:00
Daniel P. Berrangé
08101bde5d qemu: inline code for filling in per-VM NVRAM path
Before creating a NVRAM path, the qemuDomainNVRAMPathGenerate
method checks whether the config is using the old style
firmware approach. This check is redundant in one of the two
callers. By inlining the check into the other caller, it makes
it clearer to understand that the NVRAM path filling is done
conditionally.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-22 14:55:58 +00:00
Daniel P. Berrangé
dd163b6c98 tests: add test case for NVRAM with template
This demonstrates that

  <os>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
    <nvram template="/usr/share/OVMF/OVMF_VARS.fd"/>
  </os>

gets expanded to give a per-VM NVRAM path.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-22 14:54:41 +00:00
Daniel P. Berrangé
4aad5e1c18 tests: add explicit test case for pflash loader lacking path
The following is expected to raise an error:

  <os>
    <loader readonly='yes' type='pflash'/>
  </os>

because no path to the pflash loader is given and there is
no default built-in.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-22 14:54:31 +00:00
Daniel P. Berrangé
7dd53b125a qemu: fix bad indentation for qemuDomainNVRAMPathFormat
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-22 14:54:19 +00:00
Tim Wiederhake
43c8434eab Fix typo in NEWS
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-22 15:15:31 +01:00
Martin Kletzander
4e42686ade Make systemd unit ordering more robust
Since libvirt-guests script/service can operate on various URIs and we do
support both socket activation and traditional services, the ordering should be
specified for all the possible sockets and services.

Also remove the Wants= dependency since do not want to start any service.  We
cannot know which one libvirt-guests is configured, so we'd have to start all
the daemons which would break if unused colliding services are not
masked (libvirtd.service in the modular case and all the modular daemon service
units in the monolithic scenario).  Fortunately we can assume that the system is
configured properly to start services/sockets that are of interest to the user.
That also works with the setup described in https://libvirt.org/daemons.html .

To make it even more robust we add the daemon service into the machine units
created for individual domains as it was missing there.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-22 13:35:47 +01:00
Michal Privoznik
ee5c273ec5 qemu: Move some enums impl to qemu_monitor.c
There are some enums that are declared in qemu_monitor.h but
implemented in qemu_monitor_json.c. While from compiler and
linker POV it doesn't matter, the code is cleaner if an enum is
implemented in .c file that corresponds to .h file which declared
the enum.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-22 11:49:18 +01:00
Martin Kletzander
54814c87f3 docs: Fix template matching in page.xsl
Our last default template had a match of "node()" which incidentally matched
everything, including text nodes.  Since this has the same priority according to
the XSLT spec, section 5.5:

  https://www.w3.org/TR/1999/REC-xslt-19991116#conflict

this is an error.  Also according to the same spec section, the XSLT processor
may signal the error or pick the last rule.

This was uncovered with libxslt 1.1.35 which contains the following commit:

  b0074eeca3

which makes the build fail with:

  runtime error: file ../docs/page.xsl line 223 element element
  xsl:element: The effective name '' is not a valid QName.

because our last rule also matches text nodes and we are trying to extract the
node name out of them.

To fix this we change the match to "*" which only matches elements and not all
the nodes, and to avoid any possible errors with different XSLT processors we
also bump the priority of the match="text()" rule a little higher, just in case
someone needs to use an XSLT processor that chooses signalling the error instead
of the optional recovery.

https://bugs.gentoo.org/833586

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2022-02-21 16:11:19 +01:00
Hyman Huang(黄勇)
d85a5d09ba NEWS: Document domain dirty page rate calculation APIs
The Libvirt API virDomainStartDirtyRateCalc was extended.
Document this change.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 15:35:09 +01:00
Michal Privoznik
89e3386670 qemu: Use virDomainObjCheckActive() more
Using the following spatch, I've identified two places which
could be switched from explicit virDomainObjIsActive() +
virReportError() to virDomainObjCheckActive():

  @@
  expression dom;
  @@
      if (
  -        !virDomainObjIsActive(dom)
  +        virDomainObjCheckActive(dom) < 0
      ) {
  -        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running"));
          ...
      }

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-21 15:25:32 +01:00
Hyman Huang(黄勇)
42d36b65a3 qemu_driver: Add calc_mode for dirtyrate statistics
Add calc_mode for dirtyrate statistics retured by
virsh domstats --dirtyrate api, also add vcpu dirtyrate
if dirty-ring mode was used in last measurement.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:16 +01:00
Hyman Huang(黄勇)
72e60ddf1b virsh: Add mode option to domdirtyrate-calc virsh api
Extend domdirtyrate-calc virsh api with mode option, either
of these three options "page-sampling,dirty-bitmap,dirty-ring"
can be specified when calculating dirty page rate.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:16 +01:00
Hyman Huang(黄勇)
b4b1ec6f73 qemu_driver: Extend flags parameter of virDomainStartDirtyRateCalc
Extend flags parameter of virDomainStartDirtyRateCalc as a
superset of virDomainDirtyRateCalcFlags, parse the flags and
handle it correspondingly in qemuDomainStartDirtyRateCalc.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:16 +01:00
Hyman Huang(黄勇)
de4a066bfd qemu_driver: Add mode parameter to qemuDomainStartDirtyRateCalc
Add mode parameter to qemuDomainStartDirtyRateCalc API, 'mode'
option of 'calc-dirty-rate' command was introduced since
qemu >= 6.2.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:16 +01:00
Hyman Huang(黄勇)
e7a8bd2173 include: Introduce virDomainDirtyRateCalcFlags
Introduce virDomainDirtyRateCalcFlags to get ready for
adding mode parameter to qemuDomainStartDirtyRateCalc.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:16 +01:00
Hyman Huang(黄勇)
f8dc72f0ca qemu_capabilities: Introduce QEMU_CAPS_DIRTYRATE_MODE capability
mode option of calc-dirty-rate command since qemu >=6.2.0.
Introduce QEMU_CAPS_DIRTYRATE_MODE capability definition.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:16 +01:00
Hyman Huang(黄勇)
f78b804b46 qemu_driver: Probe capability before calculating dirty page rate
Probing QEMU_CAPS_CALC_DIRTY_RATE capability in advance
in case of failure when calculating dirty page rate.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:04 +01:00
Hyman Huang(黄勇)
b207f84901 qemu_capabilities: Introduce QEMU_CAPS_CALC_DIRTY_RATE capability
calc-dirty-rate command was introduced since qemu >=5.2.0.
Introduce QEMU_CAPS_CALC_DIRTY_RATE capability definition.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:24:50 +01:00
Jim Fehlig
454b927d1e libxl: Fix libvirtd crash on domain restore
Commit cc2a3c2a94 missed one case in the libxl driver where virDomainDef
is returned from libxlDomainSaveImageOpen and a g_steal_pointer is needed.
Without it, the virDomainDef object is freed and the driver crashes later
in the restore process when accessing the object.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-18 11:20:21 -07:00
Peter Krempa
d2bc5a04c0 virsh-domain: Move and rename cmdStartGetFDs to virshFetchPassFdsList
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-17 15:53:58 +01:00
Peter Krempa
b0015df263 cmdStartGetFDs: Modernize
Calculate the length of the FD list beforehand to avoid multiple
expansions and mainly simplify the code and use automatic freeing to
remove the error code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-17 15:53:58 +01:00
Peter Krempa
c98432784a virsystemdtest: remove unused 'demo_socket_path'
Commit b56a833243 removed bunch of old code after which
'demo_socket_path' in 'testActivationFDNames' is no longer used

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-02-17 14:17:04 +01:00
Daniel P. Berrangé
b56a833243 util: drop support for obsolete systemd in RHEL-7
The systemd version in RHEL-7 lacked support for the LISTEN_FDNAMES env
variable with socket activation. Since we stopped targetting RHEL-7 we
can drop some considerable amount of compatibility code.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-17 12:35:42 +00:00
Peter Krempa
1c71e06619 virDomainCreate(XML)WithFiles: Add check for VIR_DRV_FEATURE_FD_PASSING
All APIs using FD passing have this check to prevent sending a
'VIR_NET_CALL_WITH_FDS' to an older daemon but
virDomainCreateXMLWithFiles was missing it.

Now the LXC driver was historically not exposing
VIR_DRV_FEATURE_FD_PASSING, but that is not a problem as LXC always goes
through the remote driver which intercepts it and injects
VIR_DRV_FEATURE_FD_PASSING when it was implemented.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-17 13:15:46 +01:00
Peter Krempa
ef476708f3 virDriverFeatureIsGlobal: Handle VIR_DRV_FEATURE_FD_PASSING
The feature implies that fd passing works with RPC. Non-remote impls
thus should always report support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-17 13:15:46 +01:00
Peter Krempa
5c95340100 virDriverFeatureIsGlobal: Handle VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER
The fix was on RPC level so everything should advertise it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-17 13:15:46 +01:00
Peter Krempa
963ac787c4 virDriverFeatureIsGlobal: Handle VIR_DRV_FEATURE_TYPED_PARAM_STRING
This was a lockout to make strings in typed parameters compatible with
versions which didn't have them. Now all drivers need to expose this
capability.

This namely enables it for 'esx' and 'vz' drivers, while they don't seem
to be implementing any parameters for now, they might later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-17 13:15:46 +01:00
Peter Krempa
0a6335cd22 virDriverFeatureIsGlobal: Handle VIR_DRV_FEATURE_REMOTE_(CLOSE|EVENT)_CALLBACK
They are features of the RPC; drivers must say that it's not supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-17 13:15:46 +01:00
Peter Krempa
d56f6360b6 virDriverFeatureIsGlobal: Handle VIR_DRV_FEATURE_PROGRAM_KEEPALIVE
keepalive is a RPC feature, drivers must say that it's not supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-17 13:15:46 +01:00
Peter Krempa
c7f2d0e7b1 virDriverFeatureIsGlobal: Handle VIR_DRV_FEATURE_REMOTE
VIR_DRV_FEATURE_REMOTE is a special flag which is asserted only when the
connection is remote. All drivers implementing it must return 0 for it
to work. Handle it in the global handler and add a comment why.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-17 13:15:46 +01:00
Peter Krempa
f24a22315b driver: Introduce global driver feature flag handling function
The 'virDrvFeature' has a combination of features which are asserted by
the specific driver and features which are actually global.

In many cases the implementation was cargo-culted into newer drivers
without re-assesing whether it makes sense.

This patch introduces a global function which will specifically handle
these global flags and defer the rest to the driver.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-17 13:15:46 +01:00
Jiri Denemark
f3c2b321e0 qemu: Fix crash at the end of migration
The destination daemon would crash in Finish phase due to NULL
dereference which I missed in my review of commit
v8.0.0-428-g0301db44e2

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-17 10:17:19 +01:00
Nikolay Shirokovskiy
096e3c72ec qemu: fix excluding disk from internal inactive snapshot
'qemuDomainSnapshotForEachQcow2Raw' doesn't properly handle the
'VIR_DOMAIN_SNAPSHOT_LOCATION_NONE' setting and thus doesn't skip disks
which were excluded from the snapshot due to being read-only.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-02-16 16:28:20 +03:00
Göran Uddeborg
540df80d99 Translated using Weblate (Swedish)
Currently translated at 32.8% (3434 of 10455 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>
2022-02-16 10:10:19 +01:00
Piotr Drąg
34c43dedac Translated using Weblate (Polish)
Currently translated at 22.4% (2345 of 10455 strings)

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

Co-authored-by: Piotr Drąg <piotrdrag@gmail.com>
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
2022-02-16 10:10:19 +01:00
Michal Privoznik
4b6240adc2 openrc: Make init scripts executable on install
When installing openrc init scripts, we take whatever mode the
generated files are in an copy them under /etc/init.d/. This is
not ideal, because those files are not executable and they should
be.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/250
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-16 10:09:39 +01:00
Michal Privoznik
5cba53db57 tests: Drop domcaps test data for qemu < 2.11
The minimal supported version of QEMU is 2.11. And after capabilities
for older QEMUs were dropped in v7.3.0-17-g184de10c1d we have some
domaincapsdata/ files that are never read. This is because
domaincapstest uses testQemuCapsIterate() which iterates over
qemucapabilitiesdata/caps_*.xml files.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-02-15 16:33:45 +01:00
Kristina Hanicova
65312001bd libxl: use virDomainJobData instead of virDomainJobInfo
This transition will make it easier for me to generalize jobs in
the future as they will always use virDomainJobData and
virDomainJobInfo will be only used in the public api..

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-02-15 12:20:45 +01:00
Kristina Hanicova
0301db44e2 qemu: make separate function for setting statsType of privateData
We only need to set statsType in almost every case of setting
something from private data, so it seems unnecessary to pull
privateData out of current / completed job for just this one
thing every time. I think this patch keeps the code cleaner
without variables used just once.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-02-15 12:20:45 +01:00
Kristina Hanicova
f304de0df6 qemu: use generalized virDomainJobData instead of qemuDomainJobInfo
This patch includes:
* introducing new files: src/hypervisor/domain_job.c and src/hypervisor/domain_job.h
* new struct virDomainJobData, which is almost the same as
  qemuDomainJobInfo - the only differences are moving qemu specific
  job stats into the qemuDomainJobDataPrivate and adding jobType
  (possibly more attributes in the future if needed).
* moving qemuDomainJobStatus to the domain_job.h and renaming it
  as virDomainJobStatus
* moving and renaming qemuDomainJobStatusToType
* adding callback struct virDomainJobDataPrivateDataCallbacks
  taking care of allocation, copying and freeing of private data
  of virDomainJobData
* adding functions for virDomainJobDataPrivateDataCallbacks for
  qemu hypervisor
* adding 'public' (public between the different hypervisors) functions
  taking care of init, copy, free of virDomainJobData
* renaming every occurrence of qemuDomainJobInfo *info to
  virDomainJobData *data

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-02-15 12:20:45 +01:00
Peter Krempa
79c4e4e5c4 ci: Regenerate with new lcitool
Regenerate with lcitool as of:

  commit f83b916d5efa4bd33fbf4b7ea41bf6d535cc63fb
  Author: Alex Bennée <alex.bennee@linaro.org>
  Date:   Fri Feb 11 09:39:30 2022 +0000

      mappings: skip multipath-tools for cross Debian

      This package is both a mix of library files, headers and native
      binaries so cannot be installed in a cross environment. For now skip
      it for cross targets.

      See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1005323

      Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-15 09:33:03 +01:00
Peter Krempa
9a21d6848c ci: Move from 'centos-8' to 'almalinux-8'
Upstream lcitool suggests that as a solution to 'centos-8' being
removed.

Move also the website and other jobs to depend on
'x86_64-almalinux-8-container'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-15 09:33:03 +01:00
Peter Krempa
eca3daaf5b ci: Regenerate with new lcitool
Re-generate our CI infra with 'lcitool' as of:

  commit b346752e98bd12395233ebba8c9312e08212b639 (HEAD)
  Author: Erik Skultety <eskultet@redhat.com>
  Date:   Tue Feb 1 10:48:53 2022 +0100

      tests: Replace CentOS 8 with AlmaLinux 8 in test scenarios

      Switch the test target before actually dropping CentOS 8.

      Signed-off-by: Erik Skultety <eskultet@redhat.com>

This is prior to upstream lcitool dropping 'centos-8' support to
minimize the differences.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-15 09:33:03 +01:00
Peter Krempa
874b00f750 qemuhotplugtest: Assume QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
All modern QEMU versions use FD passing for listening unix sockets so
the test should reflect this. This will later help when removing the
legacy code paths when we drop support for old QEMUs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:32:23 +01:00
Peter Krempa
5b5162072c qemuhotplugmock: Mock fd passing to qemu via 'SCM_RIGHTS'
We don't want to be dealing with real FDs thus we mock
'qemuMonitorIOWriteWithFD' to do the same thing as when no FD is being
passed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:32:23 +01:00
Peter Krempa
654486bd57 syntax-check: sc_avoid_write: Don't use blanket file exceptions
Adding an exception for the whole file usually defeats the purpose of a
syntax check and is also likely to get forgotten once the file is
removed.

In case of the suggestion of using 'safewrite' instead of write even the
comment for safewrite states that the function needs to be used only in
certain cases.

Remove the blanket exceptions for files and use an exclude string
instead. The only instance where we keep the full file exception is for
src/libvirt-stream.c as there are multiple uses in example code in
comments where I couldn't find a nicer targetted wapproach.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:32:23 +01:00
Peter Krempa
7c35c483ea qemu: monitor: Move declaration of struct _qemuMonitor to qemu_monitor_priv.h
In order to mock the SCM_RIGHTS sendmsg to simulate sending
filedescriptors to fake qemu in tests we need access to some fields of
'struct _qemuMonitor'. Move its declaration to the private header file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:32:23 +01:00
Peter Krempa
f9ae469a6e qemu: Make 'struct _qemuMonitorMessage' private
Move the declaration of the struct into 'qemu_monitor_priv.h' as other
code has no business in peeking into the monitor messages.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:32:23 +01:00
Peter Krempa
c5eb99a9d9 qemu: monitor: Drop old monitor fields from 'struct _qemuMonitorMessage'
The fields are no longer used since we've deleted support for HMP-only
qemus. The HMP command pass-through works via a QMP command.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:32:23 +01:00
Peter Krempa
c82887a323 qemuxml2argvtest: Add newer variant of 'launch-security-sev-missing-platform-info'
Upcoming patches will remove support for qemu-2.12. Since tests of
'sev' use hacked data we need to use our capability dump of qemu-6.0 as
it has the required fields.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:30:40 +01:00
Peter Krempa
4392617724 qemuxml2argvtest: Bump versioned test variants for pre-blockdev disk tests to 4.1.0
Originally when I started working on '-blockdev' support I added version
locked variants of all the relevant disk tests locked to qemu-2.12, but
blockdev was finally enabled with qemu-4.2.

This patch bumps the rest of the test cases with no functional changes
related to disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:29:39 +01:00
Peter Krempa
94f8c8873f qemuxml2argvtest: Update disk test cases having 'device_id' argument of SCSI disk
The 'device_id' property was added in qemu-4.0. Since upcoming patch
will be modernizing all disk test cases we specifically want to preserve
the instance of 'device_id' not being used with qemu-3.1 and earlier.

Change the 'disk-cache' and 'disk-shared' cases to have a qemu-3.1 and a
qemu-4.1 version for testing pre-'device_id' and pre-blockdev scenarios.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:29:17 +01:00
Peter Krempa
2fd1262bf1 qemuxml2argvtest: Add pre-blockdev post-werror-move version of 'disk-error-policy'
Starting with qemu-3.0 release we use the 'werror' and 'rerror'
properties with the frontend (device) rather than the storage backend
(with a minor caveat of s390, where we use it earlier as it doesn't
 support USB disks, and other disk types supported it earlier).

Add specific test cases after the change, but before '-blockdev' was
enabled.

This is done separately from the changes in the next commit which simply
moves all other disk tests to the last pre-blockdev qemu as we have a
semantic change happening after 2.12.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:28:57 +01:00
Peter Krempa
a572a285ab qemu: command: Inline qemuBuildDiskFrontendAttributeErrorPolicy
Commit dc481f11a6 which converted the function generating properties
for disk '-device' argument to JSON removed the only other use of
qemuBuildDiskFrontendAttributeErrorPolicy, so we can now inline it into
qemuBuildDriveStr.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-15 09:28:57 +01:00
Peter Krempa
f923620031 qemuBuildTPMCommandLine: Use 'qemuPassFD' infrastructure
Remove the last code path using hardcoded fdsets.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
4225de7c73 qemuBuildTPMOpenBackendFDs: Construct 'cancel_path' internally
Since 'cancel_path' is constructed from the 'tpmdev' argument, we can
push it down into the function opening the FDs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
d42be77208 virTPMCreateCancelPath: Refactor value returning
Automatically free 'path' inside the loop which fills it and return the
values directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
ad81aa8ad0 qemu: Honour 'virtlogd' use when hotplugging chardevs
Setup the chardev similarly to how we do it on startup so that virtlogd
is properly used with chardevs which are hotplugged to a VM.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
d86bfa631e qemu: process: Add a hotplug version of qemuProcessPrepareHostBackendChardev
When hotplugging a chardev we need the same form of setup for the
character device. Export a version which takes a 'virDomainDeviceDef'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
f22e372de2 qemuMonitorJSONTestAttachChardev: Add tests for FD passing of file backend
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
39bf220221 tests: Move testPrepareHostBackendChardevOne into test utils
Move the function doing the fake setup of chardev backend for FD passing
into the collection of qemu test helpers so that it can be used in
qemumonitorjsontest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
9eed144c50 qemuMonitorJSONAttachCharDevGetProps: Properly handle private data
FD passing and TLS is normally setup via private data for the chardev
source. The monitor implementation didn't support it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
52d38e3274 qemuMonitorJSONTestAttachChardev: Add logfile to some tests
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
84dfd6e4cd qemuMonitorJSONTestAttachChardev: Add test for TLS-secured TCP chardev
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
128f5c3383 qemumonitorjsontest: Refactor chardev hotplug testing
The main objective of this patch is to use a proper instance of
virDomainChrSourceDef allocated with the private data.

To achieve this the test cases are grouped into blocks by how much they
fill in the chardev definition. Some test cases are moved around so
that the resulting sequence doesn't need extra clearing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
e6f837f611 qemumonitorjsontest: chardev: Remove need to allow unused commands
Don't add the command to the test monitor when we don't expect to invoke
it rather than bypassing the test monitor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
22d5ce0252 qemuDomainRemoveChrDevice: Detach fdset after chardev hot-unplug
Our code uses fdsets for the pipe passed from virtlogd to qemu, but the
chardev hot-unplug code neglected to detach the fdset after the chardev
was removed. This kept the FDs open by qemu even after they were not
used any more.

After the refactor to use qemuFDPass for chardevs we now configure the
'opaque' field for fdsets used for chardevs so we can use
qemuHotplugRemoveFDSet to remove the unused fdset.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
6d161bcc60 qemu: Rewrite chardev startup code to use qemuFDPass
Rewrite the parts which already pass FDs via fdset or directly to use
the new infrastructure.

Apart from simpler code this also adds the appropriate names to the fds
in the fdsets which will allow us to properly remove the fdsets won
hot-unplug of chardevs, which we didn't do for now and resulted in
leaking the FDs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
38edcca114 qemuBuildInterfaceCommandLine: Use new pattern for naming the VDPA fdset
Prefix the file descriptor name with the alias of the network device so
that it's similar to other upcoming use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
64a69ee242 QEMUHotplugRemoveFDSet: Prepare for proper FD unplug handling
For now we have only one code path ('vdpa' interface) which actually
cleans up the fdset after it's done, but there are more device types
using fdsets.

In order to unify the handling of fdsets the removal code will now be
able to remove fdsets based on a prefix of the 'opaque' field, which
we'll always prefix with a device alias or e.g. node name once fdsets
are also used for disk backing.

To keep compatibility with old QEMUs, retain the possibility for the
VDPA interface to use the path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:14:00 +01:00
Peter Krempa
a4449fb158 qemu: hotplug: Extract code for unplugging fdsets
The code unplugging the fdset for a 'vdpa' network device can be later
reused. Extract it into 'qemuHotplugRemoveFDSet'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
bfb79de3d3 qemuBuildInterfaceCommandLine: Use qemuFDPass for the vdpa fd
Use the new helpers for passing of the file descriptor needed for 'vdpa'
interfaces.

Apart from the simplification in this case it will allow further changes
to unify all fdset handling.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
aac5899db9 qemu: Introduce helper functions for passing FDs to qemu
The existing helpers we have are very clumsy and there's no integration
with the monitor.

This patch introduces new helpers to bridge the gap and simplify handing
of fdsets and classic FD passing when generating commandline/hotplug
arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
56d16e6145 qemu: domain: Add helper for generating 'fdset' ids for VM startup
When starting a VM we must assign unique IDs for fdsets we add via
'-add-fd'. For now it was done by using the index of the filedescriptor
passed to the virCommand. That approach is not very flexible, because
you need to have already passed the 'fd' to virCommand before generating
the fdset path, and also won't nicely work with fdsets containing two or
more fds.

This patch introduces a counter into the private data of a qemu domain
so that we can allocate unique ids without relying on virCommand.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
9b07991c19 qemu: monitor: Make 'id' in 'struct _qemuMonitorFdsetInfo' unsigned
Similarly to the 'qemuMonitorRemoveFdset', it doesn't make sense
to store it as signed when only unsigned values are expected.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
b25f2a2192 qemuMonitorRemoveFdset: Convert @fdset to unsigned int to avoid error
'qemuMonitorRemoveFdset' validates that the 'fdset' argument isn't less
than 0. We can turn it to unsigned and thus avoid the error message
completely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
6e433cc8df qemuMonitorJSONQueryFdsetsParse: Don't check value passed to g_strdup
'g_strdup()' is NULL-tolerant.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
2a80ae1b30 qemuProcessPrepareHostBackendChardev: Drop unneeded arguments
Caller passes 'driver->securityManager', and 'priv->qemuCaps' as
arguments along with 'vm', but both aforementioned objects are
accessible directly from 'vm'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
9aab7acfe0 qemuProcessPrepareHostBackendChardevFileHelper: Always use FD passing
Code paths which don't wish to use FD passing are supposed to not call
the function which sets up the chardev for FD passing.

This is ensured by calling it only in the host prepare step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
0f0d6af1b2 scripts/mock-noinline: Use full name of the required annotation in error message
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
4d8cb61e4d qemu: domain: Change 'Id' to 'ID' in qemuDomainStorageIdNew/Reset
In a patch adding similarly named APIs I was asked to use 'ID' instead
of 'Id'. Since the code is being put together fix
qemuDomainStorageIdNew/Reset first.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Peter Krempa
9693b06630 qemu: domain: Move and unexport 'qemuDomainStorageIdNew/Reset'
They're used only inside qemu_domain.c. Move it before their usage,
and unexport them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 13:13:59 +01:00
Andrea Bolognani
6901d92ec4 virnetsockettest: Increase coverage
Add test cases for quotes appearing in the netcat parameter,
for the default behavior of proxy=auto where virt-ssh-helper
is used if available, and for proxy=native.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:32:24 +01:00
Andrea Bolognani
5068a76493 virnetsockettest: Allow changing the proxy parameter
Currently the test cases all follow the proxy=auto behavior, but
we want to add coverage for other proxy modes as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:32:15 +01:00
Andrea Bolognani
02c9948e36 virnetsockettest: Tweak input for test 7
The important part of the value we assign to "netcat" is that it
contains whitespace, so drop everything else to highlight this
fact.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:32:09 +01:00
Andrea Bolognani
709d190a82 virnetsockettest: Improve indentation
Having the actual script indented and the closing quote on a
separate line, like

  sh -c '
    if foo; then
      bar;
    fi
  '

makes things more readable and easier to scan visually.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:32:06 +01:00
Andrea Bolognani
a280b9282f virnetsockettest: Move opening quote
Make this test case consistent with all the other ones.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:32:05 +01:00
Andrea Bolognani
5bf9902012 virnetsockettest: Drop unnecessary backslash
No need to escape a single quote.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:32:03 +01:00
Andrea Bolognani
622e6293d9 virbuffer: Simplify virBufferEscapeShell()
We can exit early when the input is an empty string, and we can
avoid storing the string length in a variable since we only use
that information once.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:31:58 +01:00
Andrea Bolognani
f375533e07 virbuftest: Increase coverage
Test the behavior of virBufferEscapeShell for different types of
quotes as well as the empty string.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:31:56 +01:00
Andrea Bolognani
85064aae64 util: Fix getting CPU frequency on Apple Silicon
The hw.cpufrequency sysctl, which we use to obtain the CPU
frequency on macOS, is not available when running on Apple
Silicon, and as a consequence we currently report an error
whenever such information is requested.

The virNodeInfo.mhz field, where the CPU frequency gets stored,
is documented as being zero when the information could not be
obtained, and we already do that for Linux on aarch64. Extend
this behavior to macOS on Apple Silicon.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-14 11:31:53 +01:00
Peter Krempa
2a273072b6 qemucapabilitiestest: Hack/fix version in qemu-3.1 tests
The test dumps for x86_64 and ppc64 were generated from pre-release
qemu-3.0-rc1/rc2 and thus wouldn't pass our minimum version check.

As these are very old, fix the version info we use for our check to 3.1
without re-generating them and keep the version tag intact.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 09:45:29 +01:00
Peter Krempa
e51c0ac891 qemuxml2xmltest: Remove unnecessary versioned invocation of 'disk-cache'
The 'disk-cache' output file is identical in the interesting parts
(everything besides CPU config) to the '-latest' version, so the
versioned invocation can be dropped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-14 09:45:28 +01:00
Tim Wiederhake
6ccafcb53e qemumonitortestutils: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:35 +01:00
Tim Wiederhake
8e5b04e332 qemusecuritymock: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:32 +01:00
Tim Wiederhake
883cd98498 tools: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:29 +01:00
Tim Wiederhake
f9c863237f vbox: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:26 +01:00
Tim Wiederhake
ae24a63ef8 virtpm: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:24 +01:00
Tim Wiederhake
db7eede6b4 virlockspace: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:21 +01:00
Tim Wiederhake
bc27d34e3b secret: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:18 +01:00
Tim Wiederhake
53850638d8 secret: Factor out mutex
If the mutex is part of the `driver` object, it cannot guard that
object's creation and destruction perfectly.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:15 +01:00
Tim Wiederhake
ee0bc89470 vmware: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:12 +01:00
Tim Wiederhake
5305908789 vz: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 16:03:02 +01:00
Jiri Denemark
a7d77e2587 conf: Avoid NULL-dereference in virDomainObjGetMessages
All callers currently guarantee flags passed to virDomainObjGetMessages
are either zero or contain at least one of the supported flags. But it
doesn't mean we should not check for the possibility an unknown flag was
the only one passed to virDomainObjGetMessages.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 15:06:49 +01:00
Jiri Denemark
3a311593e5 qemu_migration_cookie: Properly fetch cert DN
If 1024 was not enough to fit the DN, gnutls_x509_crt_get_dn would store
the required size in subjectlen. And since we're not checking the return
value of this function, we would happily overwrite some random memory.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 15:06:19 +01:00
Jiri Denemark
d116f187c6 qemu_migration_cookie: Rename ret in qemuDomainExtractTLSSubject
We use 'ret' for storing values to be returned from a function. Return
values from called functions that are not supposed to be returned
further are usually called 'rv' (or 'rc').

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-11 15:06:19 +01:00
Jiri Denemark
6752bfdbc4 tests: Fix fd leaks in virpcivpdtest
Tests testVirPCIVPDReadVPDBytes and testVirPCIVPDParseFullVPDInvalid
failed to properly close open fildescriptors in some cases. Let's fix it
by switching to VIR_AUTOCLOSE in the whole file.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 15:06:19 +01:00
Michal Privoznik
1c7c759f5b src: Initialize stack allocated virPCIDeviceAddress variables
There are few places where a virPCIDeviceAddress typed variable
is allocated on the stack but it's not initialized. This can lead
to random values of its members which in turn can lead to a
random behaviour.

Generated with help of the following spatch:

  @@
  identifier I;
  @@
  - virPCIDeviceAddress I;
  + virPCIDeviceAddress I = { 0 };

And then fixing bhyveAssignDevicePCISlots() which does declare
the variable and then explicitly zero it by calling memset() only
to set a specific member afterwards.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-02-11 15:01:19 +01:00
Michal Privoznik
9a98ad6ddb qemuPrepareNVRAM: Drop cleanup label
After previous commits, the cleanup label shrank to plain
'return' statement. There's no point in having such label, so
drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-11 14:00:07 +01:00
Michal Privoznik
2ddb3bf0e1 qemuPrepareNVRAM: Switch to VIR_AUTOCLOSE
Nothing inside the qemuPrepareNVRAM function relies on @srcFD
being closed early and nothing closes it early. It's okay then to
close it automatically when leaving the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-11 13:59:45 +01:00
Michal Privoznik
18b9a7ac98 qemuPrepareNVRAM: Us virFileRewrite() to write NVRAM
After previous commits there is no need for qemuPrepareNVRAM() to
open code virFileRewrite(). Deduplicate the code by calling the
function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-11 13:59:21 +01:00
Michal Privoznik
d295c14258 virFileRewrite: Move error reporting into callback
When rewriting a file using virFileRewrite() and error occurs
while writing into a temporary file it's actually the callback
that can report the most accurate error. Move error reporting
into very few callback we have currently. Those callbacks are
trivial so the benefit of this change is not obvious, but this
will change shortly when slightly more complicated callback is
introduced.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-11 13:57:44 +01:00
Michal Privoznik
04ed251850 virFileRewrite: Allow setting owner
Currently, due to the way virFileRewrite() works, the rewritten
file is owned by user and group that the daemon runs under. So
far, this is not a problem, because the function is used to write
XML files or secrets for persistent objects (domains, networks,
etc.) and we don't need other users to read/write those files.

But shortly, this function is going to be used for creating files
for QEMU domains. There we want the QEMU process (i.e. different
user) to read the file.

Therefore, introduce two new arguments: @uid and @gid that allow
setting desired owner of the file. Pass -1 to preserve current
behaviour (i.e. create the file owned by the user running the
daemon).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-11 13:16:40 +01:00
Michal Privoznik
70f8299285 ch: Report VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER as supported
Even though the CH driver doesn't implement virNetworkUpdate()
API, when it does it will see the arguments in correct order.
This is similar to other drivers that don't implement the API,
like ESX, libxl, LXC, etc. Enabling this driver feature stops
clients from swapping the arguments (see comment in the API for
more info).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-11 13:14:02 +01:00
Tim Wiederhake
a99d876a0f node_device: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:04:10 +01:00
Tim Wiederhake
fb48d87765 bhyve_driver: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:04:07 +01:00
Tim Wiederhake
a71341fad7 network: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:04:04 +01:00
Tim Wiederhake
6f3c0480b1 ch: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:04:01 +01:00
Tim Wiederhake
0a6ff46c9e ch: Prepare virCHDriverGetCapabilities for automatic mutex management
No functional change intended. This change makes the refactoring to
automatic mutex management easier to follow.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:03:58 +01:00
Tim Wiederhake
241c13a7e5 lxc: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:03:54 +01:00
Tim Wiederhake
370fc9f47c lxc: Prepare virLXCDriverGetCapabilities for automatic mutex management
No functional change intended. This change makes the recfatoring to
automatic mutex management easier to follow.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:03:50 +01:00
Tim Wiederhake
621fa350ab libxl: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:03:47 +01:00
Tim Wiederhake
8278ca919e virthreadpool: Cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:03:44 +01:00
Tim Wiederhake
b05cca197f virthreadpool: Use automatic memory management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-11 11:03:31 +01:00
Michal Privoznik
83cf648ced ch_process: Check whether domain is already running before starting it
There are two places where a domain can be started in CH driver:
chDomainCreateXML() and chDomainCreateWithFlags(). Both acquire a
job (good), but neither of them checks whether the domain isn't
already running. This is wrong. Fortunately, both function call
the very same virCHProcessStart() rendering it the best place for
such check.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-11 10:48:39 +01:00
Michal Privoznik
22a96eac7c ch_driver: Introduce and use virCHDomainRemoveInactive()
There are few places where a call to virDomainObjListRemove() is
guarded with !vm->persistent check. And there are some places
which are missing this check completely (leading us to losing a
domain). To prevent such mistakes introduce
virCHDomainRemoveInactive() which does the check for us. Also
replace all occurrences of virDomainObjListRemove() with the call
to the new function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-11 10:48:35 +01:00
Michal Privoznik
3d13f6abcd ch_driver: End job properly on failed chDomainCreateXML()
When creating a domain failed, then the virCHDomainObjEndJob()
would be jumped over. Fix this by creating enjob label and fixing
one goto.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-11 10:48:32 +01:00
Michal Privoznik
b928e0d80c chDomainCreateXML: Drop spurious driver unlock
Inside chDomainCreateXML(), towards the end, the driver is
unlocked even though there is no corresponding driver lock call
before that. Drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-11 10:48:02 +01:00
Michal Privoznik
b1e7807711 ch_driver: Don't lock driver when looking up domains
There is no need to lock whole driver when accessing
virDomainObjList. Those APIs were specifically tailored to be
thread safe (when we were dropping QEMU driver lock). Don't
resurrect old history.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-11 10:47:48 +01:00
Michal Privoznik
31ef66f12e ch_driver: Don't lock driver when getting version
In chConnectGetVersion() the CH driver is locked in order to read
driver->version. This is needless, because not only is the
version set with driver unlocked (chStateInitialize() calls
chExtractVersion() which sets the version), but the version is
practically immutable. Once driver initialized itself it's never
changed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-11 10:46:49 +01:00
Michal Privoznik
d192e522ef qemuFirmwareFillDomain: Use FW descriptors to lookup template when resetting NVRAM
If VIR_QEMU_PROCESS_START_RESET_NVRAM flag is passed when
starting a domain, then user requested to overwrite the domain
specific NVRAM with the one from template. But it is very likely
that the path to the template is not stored in the domain
definition, which in turn makes the copy function
(qemuPrepareNVRAM()) fail.

The solution is simple - when preparing domain, specifically when
deciding whether the path to the template should be autofilled,
ignore any existing NVRAM file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-11 09:03:20 +01:00
Michal Privoznik
f21166c814 qemu_process: Accept VIR_QEMU_PROCESS_START_RESET_NVRAM flag when starting a domain
In one of my previous commits I've fixed the value of
VIR_QEMU_PROCESS_START_RESET_NVRAM flag (which was masking
another value). But what I forgot to do is update virCheckFlags()
calls in two places where the flag is passed: qemuProcessLaunch()
and qemuProcessStart().

Fixes: 1b636593c7
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-11 09:03:16 +01:00
Andrea Bolognani
2ac78307af docs: Clarify our stance on backported packages
The repositories containing them are usually offered with lower
guarantees, so we don't consider them when it comes to figuring
out the minimum targeted version of our dependencies.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-10 22:39:58 +01:00
Peter Krempa
775cd951e2 qemuMonitorOpen: Refactor cleanup
Use VIR_AUTOCLOSE to avoid a 'cleanup' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-10 13:13:28 +01:00
Peter Krempa
0e01846dbf qemuMonitorOpenUnix: Refactor cleanup
Use VIR_AUTOFREE for the temp socket so that the 'error:' label can be
removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-02-10 13:13:28 +01:00
Peter Krempa
ee51ab86c2 virNetDevOpenvswitchUpdateVlan: Use space for indentation
Breaks syntax-check:

TAB_in_indentation
/home/pipo/libvirt/src/util/virnetdevopenvswitch.c:610:	if (virtVlan && virtVlan->nTags > 0)
/home/pipo/libvirt/src/util/virnetdevopenvswitch.c:611:		virCommandAddArgList(cmd, "--", "--if-exists", "set", "Port", ifname, NULL);
make: Leaving directory '/home/pipo/build/libvirt/gcc/build-aux'

Fixes: 21c55a45ef
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-02-10 13:10:35 +01:00
tuqiang
21c55a45ef virNetDevOpenvswitchUpdateVlan: fix vlan tag update error
We try to update vlan tag by running virsh update-device command,
libvirtd will report ovs-vsctl arguments error. Vlan tag update
funtion does't consider the xml with no vlan configured circumstances.

The steps to reproduce the problem:
1 define and start domain with its vlan configured as:
    <interface type='bridge'>
      <mac address='52:54:00:9e:bb:ac'/>
      <source bridge='ovs-br0'/>
      <vlan>
        <tag id='10'/>
      </vlan>
      <virtualport type='openvswitch'>
      </virtualport>
      <target dev='vnet4.0'/>
      <model type='virtio'/>
      <driver name='vhost'/>
    </interface>
2 define and run virsh update-device command with no vlan configured as:
    <interface type='bridge'>
      <mac address='52:54:00:9e:bb:ac'/>
      <source bridge='ovs-br0'/>
      <virtualport type='openvswitch'>
      </virtualport>
      <target dev='vnet4.0'/>
      <model type='virtio'/>
      <driver name='vhost'/>
    </interface>
   #virsh update-device dom-id novlan.xml
3 virsh command returned error, and we got an error in libvirtd.log:
  error : virCommandWait:2584 : internal error: exit status 1: ovs-vsctl: 'set' command requires at least 3 arguments
  . Child process (ovs-vsctl --timeout=5 -- --if-exists clear Port vnet4.0 tag -- --if-exists clear Port vnet4.0 trunk
  -- --if-exists clear Port vnet4.0 vlan_mode -- --if-exists set Port vnet4.0) unexpected
  error : virNetDevOpenvswitchUpdateVlan:540 : internal error: Unable to set vlan configuration on port vnet4.0

Signed-off-by: Tu Qiang <tu.qiang35@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-10 13:02:10 +01:00
Jing Qi
89b8b3662e docs: Fix HMAT example
There are dupliacated and non-continuous CPU IDs used in HMAT
example. Fix that.

Signed-off-by: Jing Qi <jinqi@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-10 12:43:36 +01:00
Jiri Denemark
558f00397a qemu: Ignore missing vm.unprivileged_userfaultfd sysctl
Older kernels did not support this sysctl, but they did not restrict
userfaultfd in any way so everything worked as if
vm.unprivileged_userfaultfd was set to 1. Thus we can safely ignore
errors when setting the value.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-09 13:03:33 +01:00
Michal Privoznik
da393034c9 qemu_process: Fix theoretical overflow in uint to bool typecast
The qemuPrepareNVRAM() function accepts three arguments and the
last one being a boolean type. However, when the function is
called from qemuProcessPrepareHost() the argument passed is a
result of logical and of @flags (unsigned int) and
VIR_QEMU_PROCESS_START_RESET_NVRAM value. In theory this is
unsafe to do because if the value of the flag is ever changed
then this expression might overflow. Do what we do elsewhere:
double negation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-09 09:31:54 +01:00
Michal Privoznik
1b636593c7 qemu_process.c: Fix VIR_QEMU_PROCESS_START_RESET_NVRAM value
In one of recent commits qemuProcessStartFlags enum gained new
value: VIR_QEMU_PROCESS_START_RESET_NVRAM but due to a typo it
has the same value as another member of the enum. Fix that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-09 09:30:15 +01:00
Jim Fehlig
18ec405a36 libxl: Release auto-allocated spice ports
While VNC ports auto-allocated by the libxl driver are released in
libxlDomainCleanup, spice ports are overlooked. Rework the existing
logic to release any auto-allocated graphics ports, not just the VNC
port of the first graphics device.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-08 10:40:40 -07:00
Daniel P. Berrangé
3ef9b51b10 qemu: fix formatting of pflash readonly attribute
When the <loader> had an explicit readonly='no' attribute we
accidentally still marked the plfash as readonly due to the
bad conversion from virTristateBool to bool. This was missed
because the test cases run with no capabilities set and thus
are validated the -drive approach for pflash configuration,
not the -blockdev approach.

This affected the following config:

  <os>
    <loader readonly='no' type='pflash'>/var/lib/libvirt/qemu/nvram/test-bios.fd</loader>
  </os>

for the sake of completeness, we also add a test XML config
with no readonly attribute at all, to demonstrate that the
default for pflash is intended to be r/w.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-08 13:04:20 +00:00
Daniel P. Berrangé
7904e521b2 tools: add --reset-nvram arg to several virsh commands
This wires up support for resetting NVRAM for all APIs that allow
this feature.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-08 13:04:20 +00:00
Daniel P. Berrangé
5413608dc2 qemu: wire up support for resetting NVRAM
We can now replace the existing NVRAM file on startup when
the API requests this.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-08 13:04:20 +00:00
Daniel P. Berrangé
12a658ecf7 include: define constants for resetting NVRAM state
When starting a guest with pflash based firmware, we will initialize
NVRAM from a template if it does not already exist. In theory if the
firmware code file is updated, the existing NVRAM variables should
continue to work correctly. It is inevitable that this could break
accidentally one day. Or a bug in the firmware might corrupt the
NVRAM storage. Or user might make bad changes to the settings that
prevent booting. Or the user might have re-configured the XML to
point to a different firmware file incompatible with the current
variables.

In all these cases it would be useful to delete the existing NVRAM
and initialize it from the pristine template.

To support this introduce a VIR_DOMAIN_START_RESET_NVRAM constant
for use with virDomainCreate / virDomainCreateXML, along with
VIR_DOMAIN_SAVE_RESET_NVRAM for use with virDomainRestore and
VIR_DOMAIN_SNAPSHOT_REVERT_RESET_NVRAM for use with
virDomainSnapshotRevert.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-08 13:04:11 +00:00
Daniel P. Berrangé
5e3498744e qemu: do crash safe creation of NVRAM file
If we crash part way through writing the NVRAM file we end up with an
unusable NVRAM on file. To avoid this we need to write to a temporary
file and fsync(2) at the end, then rename to the real NVRAM file path.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-08 13:01:24 +00:00
Göran Uddeborg
2df9031a0e Translated using Weblate (Swedish)
Currently translated at 32.4% (3394 of 10455 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>
2022-02-08 12:38:48 +01:00
Michal Privoznik
a58ff73644 cpu_conf: unbreak XPath in virCPUDefParseXML()
In one of my previous commits, I've changed an XPath in
virCPUDefParseXML() from "boolean(./counter...)" to
"./counter...)". Notice the dangling closing bracket? Well, I
didn't back then.

Fixes: 0fe2d8dd33
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-08 12:38:01 +01:00
Michal Privoznik
87a43a907f lib: Use g_clear_pointer() more
This change was generated using the following spatch:

  @ rule1 @
  expression a;
  identifier f;
  @@
    <...
  - f(*a);
    ... when != a;
  - *a = NULL;
  + g_clear_pointer(a, f);
    ...>

  @ rule2 @
  expression a;
  identifier f;
  @@
    <...
  - f(a);
    ... when != a;
  - a = NULL;
  + g_clear_pointer(&a, f);
    ...>

Then, I left some of the changes out, like tools/nss/ (which
doesn't link with glib) and put back a comment in
qemuBlockJobProcessEventCompletedActiveCommit() which coccinelle
decided to remove (I have no idea why).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-08 08:42:07 +01:00
Michal Privoznik
1688d2527f vbox_common: Drop needless set to NULL
There are two places where a variable passed to VBOX_RELEASE()
macro is set to NULL explicitly. There is no need for that
because the macro sets the variable to NULL already.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-08 08:41:56 +01:00
Jim Fehlig
e0241f334d libxl: Set auto-allocated graphics ports to used on reconnect
The libxl driver reconnects to all running VMs when libvirtd is restarted,
but it failed to mark auto-allocated graphics ports as set in the port
allocator. If many VMs are running that use port auto-allocation and
libvirtd is restarted, the port allocator is likely to hand out a port
already in use when a new VM is created that uses auto-allocation. VM
creation will fail due to the port clash.

When reconnecting to running VMs after a libvirtd restart, let the port
allocator know about previously allocated ports.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-07 13:30:35 -07:00
Peter Krempa
a7743c6026 qemu: process: Don't use hardcoded QOM path for cpu for probing flags
Modify 'qemuProcessGetVCPUQOMPath' to take the detected QOM path of the
first vCPU which is always present as the QOM path used our code probing
CPU flags via 'qom-get'.

This is needed as upcoming qemu will change it.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/272
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2051451
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-07 18:04:52 +01:00
Peter Krempa
068aaa9795 qemu: process: Move call to qemuProcessRefreshCPU after cpu probe
Similarly to previous commit we need to probe the vcpus first.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-07 18:04:52 +01:00
Peter Krempa
2f498b5980 qemu: process: Move cpu flag querying after code probing cpus
Upcoming changes will require that we have a proper QOM path for cpus
when querying the flags as qemu is going to change it.

By moving the flag probing code later we'll already probe the QOM paths
so no re-query will be needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-07 18:04:52 +01:00
Peter Krempa
f0a4951616 qemu: domain: Store 'qomPath' in qemuDomainVcpuPrivate
The QOM path will be needed by code which is querying the cpu flags via
'qom-get' and thus needs a valid QOM path to the vCPU.

Add it into the private data and transfer from the queried data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-07 18:04:52 +01:00
Peter Krempa
715846b6ea qemu: monitor: Don't hardcode QOM path of first CPU
Convert all code using the 'QOM_CPU_PATH' macro to accept the QOM path
as an argument.

For now the new helper for fetching the path 'qemuProcessGetVCPUQOMPath'
will always return the same hard-coded value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-07 18:04:52 +01:00
Peter Krempa
476e864186 qemuProcessUpdateAndVerifyCPU: Refactor cleanup
Use automatic memory clearing and remove the 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-07 18:04:52 +01:00
Peter Krempa
3ac3b3e8fb qemuMonitorJSONGetCPUx86Data: Unexport
The function is used only as a helper in src/qemu/qemu_monitor_json.c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-07 18:04:52 +01:00
Andrea Bolognani
e7be6be775 qemu: Move high-level actions close together
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
cc132636fc qemu: Move entry points close together
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
e74d87c43b qemu: Move utility functions close together
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
8367ad8a38 qemu: Fix description of swtpmStateDir
This directory contains runtime state, not persistent state.
The latter goes into swtpmStorageDir.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
a0dedd64d4 qemu: Call virDomainDefGetShortName() less frequently
When looping over TPM devices for a domain, we can avoid calling
this function for each iteration and call it once per domain
instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
f3a40a7d20 qemu: Rename path-building functions
Using the word "create" can give users the impression that disk
operations will be performed, when in reality all these functions
do is string formatting.

Follow the naming convention established by virBuildPath(),
virFileBuildPath() and virPidFileBuildPath().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
c2c8cf3ed4 qemu: Introduce qemuTPMEmulatorCleanupHost()
This leaves qemuExtTPMCleanupHost() to only deal with looping
over TPM devices, same as other qemuExtTPMDoThing() functions.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
5d35e2f2cc qemu: Introduce qemuExtTPMEmulatorSetupCgroup()
This leaves qemuExtTPMSetupCgroup() to only deal with looping
over TPM devices, same as other qemuExtTPMDoThing() functions.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
a9763e8e38 qemu: Make qemuTPMEmulatorCreateStorage() take a virDomainTPMDef*
This matches how qemuTPMEmulatorDeleteStorage() expects to be
called.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
b12779dc80 qemu: Drop qemuTPMEmulatorInitStorage()
Absorb it into qemuTPMEmulatorCreateStorage(), its only caller.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
4d0cff4221 qemu: Document qemuTPMEmulatorDeleteStorage()
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
de69ad16ac qemu: Rename qemuTPM{Create,Delete}EmulatorStorage()
Other functions that operate on a single TPM emulator follow
the qemuTPMEmulatorDoThing() naming convention.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
806f5b5d42 qemu: Fully document qemuTPMEmulatorStart()
The @tpm argument was not mentioned.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Andrea Bolognani
5d9d9943a7 qemu: Rename qemuExtTPMStartEmulator()
Its counterpart is qemuTPMEmulatorStop().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-02-05 14:36:11 +01:00
Boris Fiuczynski
f087335034 nodedev: add parent_addr to mdev nodedev dumpxml
As the parent address is part of the mdev nodedev name lets expose the
internally available parent address in the XML.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-04 17:50:57 +01:00
Boris Fiuczynski
609836e2b2 tests: adding vfio-ccw to nodedev tests
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-04 17:50:53 +01:00
Boris Fiuczynski
37ce3da14e tests: correct formating in mdevctl test
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-04 17:50:18 +01:00
Michal Privoznik
517b8c12b9 qemu: Validate domain definition even on migration
When we are about to spawn QEMU, we validate the domain
definition against qemuCaps. Except when domain is/was already
running before (i.e. on incoming migration, snapshots, resume
from a file). However, especially on incoming migration it may
happen that the destination QEMU is different to the source
QEMU, e.g. the destination QEMU may have some devices disabled.

And we have a function that validates devices/features requested
in domain XML against the desired QEMU capabilities (aka
qemuCaps) - it's virDomainDefValidate() which calls
qemuValidateDomainDef() and qemuValidateDomainDeviceDef()
subsequently.

But the problem here is that the validation function is
explicitly skipped over in specific scenarios (like incoming
migration, restore from a snapshot or previously saved file).

This in turn means that we may spawn QEMU and request
device/features it doesn't support. When that happens QEMU fails
to load migration stream:

  qemu-kvm: ... 'virtio-mem-pci' is not a valid device model name

(NB, while the example shows one particular device, the problem
is paramount)

This problem is easier to run into since we are slowly moving
validation from qemu_command.c into said validation functions.

The solution is simple: do the validation in all cases. And while
it may happen that users would be unable to migrate/restore a
guest due to a bug in our validator, spawning QEMU without
validation is worse (especially when you consider that users can
supply their own XMLs for migrate/restore operations - these were
never validated).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2048435
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-02-04 13:49:39 +01:00
Vasiliy Ulyanov
e3dfa52d26 qemu: gpu: Get pid without binary validation
The binary validation in virPidFileReadPathIfAlive may fail with EACCES
if the calling process does not have CAP_SYS_PTRACE capability.
Therefore instead do only the check that the pidfile is locked by the
correct process.

Fixes the same issue as with swtpm.

Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-04 10:27:43 +01:00
Vasiliy Ulyanov
a9c500d2b5 qemu: tpm: Get swtpm pid without binary validation
Access to /proc/[pid]/exe may be restricted in certain environments (e.g.
in containers) and any attempt to stat(2) or readlink(2) the file will
result in 'permission denied' error if the calling process does not have
CAP_SYS_PTRACE capability. According to proc(5) manpage:

Permission to dereference or read (readlink(2)) this symbolic link is
governed by a ptrace access mode PTRACE_MODE_READ_FSCREDS check; see
ptrace(2).

The binary validation in virPidFileReadPathIfAlive may fail with EACCES.
Therefore instead do only the check that the pidfile is locked by the
correct process. To ensure this is always the case the daemonization and
pidfile handling of the swtpm command is now controlled by libvirt.

Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-04 10:27:35 +01:00
Vasiliy Ulyanov
013ab22f79 virpidfile: Add virPidFileReadPathIfLocked func
The function will attempt to read a pid from @path, and store it in
@pid. The @pid will only be set, however, if @path is locked by
virFileLock() at byte 0 and the pid in @path is running.

Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-04 10:27:30 +01:00
Andrea Bolognani
5c0125b4f8 conf: Fix documentation for virDomainDefGetShortName()
The @unique argument didn't exist even when the function was
introduced in a042275a39, and the @vm argument was not renamed
when the function was changed to take a virDomainDef* instead of
a virDomainObj* in 7ed6934f3b.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-02-04 09:30:54 +01:00
Dmitrii Shcherbakov
bf36dcb2a6 NEWS: Document recent VLAN ID improvement
After previous commits, the set of NICs that work well with
Libvirt was extended. Document this change.

Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-03 16:52:05 +01:00
Dmitrii Shcherbakov
09cdd16a9b Ignore EPERM on implicit clearing of VF VLAN ID
SmartNIC DPUs may not expose some privileged eswitch operations
to the hypervisor hosts. For example, this happens with Bluefield
devices running in the ECPF (default) mode for security reasons. While
VF MAC address programming is possible via an RTM_SETLINK operation,
trying to set a VLAN ID in the same operation will fail with EPERM.

The equivalent ip link commands below provide an illustration:

1. This works:

sudo ip link set enp130s0f0 vf 2 mac de:ad:be:ef:ca:fe

2. Setting (or clearing) a VLAN fails with EPERM:

sudo ip link set enp130s0f0 vf 2 vlan 0
RTNETLINK answers: Operation not permitted

3. This is what Libvirt attempts to do today (when trying to clear a
   VF VLAN at the same time as programming a VF MAC).

sudo ip link set enp130s0f0 vf 2 vlan 0 mac de:ad:be:ef:ca:fe
RTNETLINK answers: Operation not permitted

If setting an explicit VLAN ID results in an EPERM, clearing a VLAN
(setting a VLAN ID to 0) can be handled gracefully by ignoring the
EPERM error with the rationale being that if we cannot set this state
in the first place, we cannot clear it either.

In order to keep explicit clearing of VLAN ID working as it used to
be passing a NULL pointer for VLAN ID is used.

Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-03 16:52:05 +01:00
Dmitrii Shcherbakov
73961771a1 Allow VF vlanid to be passed as a pointer
There should be a way to show no intent in programming a VLAN at all
(including clearing it). This allows handling error conditions
differently when VLAN clearing is explicit (vlan id == 0) vs implicit
(vlanid == NULL - try to clear it if possible).

Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-03 16:52:05 +01:00
Dmitrii Shcherbakov
86fc0c2576 Set VF MAC and VLAN ID in two different operations
This has a benefit of being able to handle error codes for those
operations separately which is useful when drivers allow setting a MAC
address but do not allow setting a VLAN (which is the case with some
SmartNIC DPUs).

Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-03 16:52:05 +01:00
Göran Uddeborg
76a7ff99db Translated using Weblate (Swedish)
Currently translated at 32.2% (3374 of 10455 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>
2022-02-03 15:41:39 +01:00
Andrea Bolognani
654968381d docs: Add example for isa-debugcon
Most people will want to use isa-debugcon to obtain debug output
for SeaBIOS / EDK II, so let's include a ready-made example for
that scenario in our documentation.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-03 15:40:37 +01:00
Andrea Bolognani
d70d5eb6c5 syntax-check: Suggest correct replacement for str(n)dup()
As of 610963cd04 VIR_STRDUP() no longer exists.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-03 15:39:46 +01:00
Ján Tomko
47d194139c ch: virCHProcessSetupIOThreads: use correct type for return value
virCHMonitorGetIOThreads returns an int, not size_t.

Also return early if it's negative, because promoting it to
an unsigned type in the for loop condition could lead to
an infinte loop.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-03 14:15:04 +01:00
Ján Tomko
7b1c1642b1 ch: virCHMonitorGetIOThreads: fix g_steal_pointer usage
Fixes: 81226d8803
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-03 14:15:04 +01:00
Ján Tomko
459f8009c2 qemu: virtiofs: check whether the supplied binary exists
Report an error upfront if the binary does not exist
or is not executable.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-03 14:15:04 +01:00
Ján Tomko
baa779ea9c maint: remove unnecessary virutil.h includes
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-02-03 14:10:04 +01:00
Ján Tomko
8eb7d869ed virParseVersionString: rename to virStringParseVersion
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-02-03 14:10:03 +01:00
Ján Tomko
f40179b9fb util: virParseVersionString: move to virstring.c
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-02-03 14:10:03 +01:00
Ján Tomko
bc8a1071ee maint: add required includes
Some files do not include what they use and rely on virutil.h
to pull in the necessary header files.

Fix it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-02-03 14:10:03 +01:00
Andrea Bolognani
9f2d3cb472 meson: Don't overwrite includedir
The current implementation of the workaround for yajl's broken
pkg-config file accidentally overwrites the value of includedir
that is later used by the installation process. Rename the
local variable to avoid this issue.

Fixes: c97075e1e4
Closes: https://gitlab.com/libvirt/libvirt/-/issues/271
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-03 13:19:23 +01:00
Daniel P. Berrangé
7714034ecd qemu: add tests for the ISA debug console command line
The XML-to-XML test validates that we don't accidentally copy the
isa-debug <serial> into a <console>.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-03 10:59:03 +00:00
Daniel P. Berrangé
aab943a632 conf: support firmware ISA debug console
Introduce support for

  <serial type='pty'>
    <target type='isa-debug'>
      <model type='isa-debugcon'/>
    </target>
    <address type='isa' iobase='0x402'/>
  </console>

which is used as a way to receive debug messages from the
firmware on x86 platforms.

Note that the default port is hypervisor specific, with QEMU
currently using 0xe9 since that's the original Bochs debug port.
For use with SeaBIOS/OVMF, the iobase port needs to be explicitly
set to 0x402.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-03 10:59:03 +00:00
Daniel P. Berrangé
82be0ffe63 conf: validate serial port model in ABI checks
The serial port model cannot be allowed to change across migration
as it affects ABI.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-03 10:59:03 +00:00
Michal Privoznik
39ac285c6b virnodedeviceobj: Don't unlock virNodeDeviceObj in virNodeDeviceObjListRemove()
When virNodeDeviceObjListRemove() is called, the passed
virNodeDeviceObj is removed from internal list of node devices
and then unrefed and unlocked. While the former is warranted (the
object was refed at the beginning of the function) the unlock is
not. In fact, it's wrong from conceptual POV. We still want
threads working on the object tu mutually exclude each other.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-02-03 09:37:44 +01:00
Andrea Bolognani
41e878859a tests: Cover virtio-mem being plugged into a bridge
This is a perfectly valid configuration that we need to keep
working, so add test coverage for it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 16:32:41 +01:00
Andrea Bolognani
cb81263c22 qemu: Drop qemuAudioDriver enumeration
This mostly overlaps with virDomainAudioType, but in a couple of
cases the string representations are different.

Right now we're doing that in a somewhat sketchy way, in that we
store values of one enumeration and then convert them to strings
using TypeToString() implementation for the other enumeration;
when converting from string, we open-code the handling of the
special values mentioned above.

Drop the second enumeration and introduce two helpers to deal
with conversion. Most calling sites don't need to be changed, and
one can even be simplified significantly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 16:26:58 +01:00
Andrea Bolognani
9827614378 qemu: Correctly translate QEMU_AUDIO_DRV=wav
This, along with "pa", is the other case where the libvirt and
QEMU names do not match.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 16:26:49 +01:00
Andrea Bolognani
7627c96cdb meson: Add missing virt_install_dirs
We recently started listing these in the spec file and, since we
were not creating them during the installation phase, that broke
RPM builds.

Fixes: 4b43da0bff
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 16:26:36 +01:00
Andrea Bolognani
29b64dc610 meson: Sort virt_install_dirs
This will make subsequent patches nicer.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 16:26:35 +01:00
Andrea Bolognani
f2da2f173d rpm: List one more directory
Commit 4b43da0bff missed it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 16:26:29 +01:00
Michal Privoznik
af23241cfe qemu_command: Generate memory only after controllers
Currently, memory device (def->mems) part of cmd line is
generated before any controller. In majority of cases it doesn't
matter because neither of memory devices live on a bus that's
created by an exposed controller (e.g. there's no DIMM
controller, at least not exposed). Except for virtio-mem and
virtio-pmem, which do have a PCI address. And if it so happens
that the device goes onto non-default bus (pci.0) starting such
guest fails, because the controller that creates the desired bus
wasn't processed yet. QEMU processes arguments in order.

For instance, if virtio-mem has address with bus='0x01' QEMU
refuses to start with the following message:

  Bus 'pci.1' not found

Similarly for virtio-pmem. I've successfully tested migration and
changing the order does not affect migration stream.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2047271
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-02-02 14:22:47 +01:00
Andrea Bolognani
4b43da0bff rpm: List more directories
This has two advantages: it makes it possible for the admin to
ask rpm what package they belong to, and results in them ending
up with stricter permissions than they would have if we let
libvirt create them at runtime.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 10:59:50 +01:00
Andrea Bolognani
3a22ba2e84 rpm: Move /var/lib/libvirt from -libs to -daemon
The server, not the client, uses local storage.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 10:59:48 +01:00
Andrea Bolognani
4098c68ec8 rpm: Move /etc/libvirt from -daemon to -libs
Files like libvirt.conf influence the behavior of the library
itself. The daemon depends on the library, so the directory is
guaranteed to be present both on the client side and on the
server side.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 10:59:33 +01:00
Lubomir Rintel
8f0f38e418 qemu: add PCI root to MIPS Malta machine
MIPS Malta (and no other supported MIPS machine) has a PCI bus.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 10:07:21 +01:00
Lubomir Rintel
fc80b94a57 qemu: add qemuDomainIsMipsMalta()
This identifies various MIPS Malta machines, be it 32-bit or 64-bit,
little-endian or big-endian.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 10:07:19 +01:00
Lubomir Rintel
395bbd61ea util: add ARCH_IS_MIPS helper macro
Identifies all of various MIPS sub-architectures: 32-bit or 64-bit,
little-endian or big-endian.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-02 10:07:15 +01:00
Michal Privoznik
2c0898ff4e src: Use g_steal_pointer() more
There are few places where the g_steal_pointer() is open coded.
Switch them to calling the g_steal_pointer() function instead.
Generated by the following spatch:

  @ rule1 @
  expression a, b;
  @@
    <...
  - b = a;
    ... when != b
  - a = NULL;
  + b = g_steal_pointer(&a);
    ...>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-02-01 19:01:49 +01:00
Michal Privoznik
a7c016e4cb virpcivpdtest: Fix potential double-free()
Inside the testPCIVPDResourceCustomCompareIndex() function we
have two variables @a and @b, both marked as g_autoptr(). Then,
towards the end of the function b->value is freed and set to
a->value. This is to make sure
virPCIVPDResourceCustomCompareIndex() works correctly even if
->value member is the same for both arguments.

Nevertheless, if the function returns anything else than 0 then
the control executes subsequent return statement and since
b->value points to the very same string as a->value a double free
will occur. Avoid this by setting b->value to NULL explicitly,
just like we are already doing for the successful path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-02-01 17:37:06 +01:00
Michal Privoznik
ce880ad8ba lib: Don't set variable to NULL after VIR_FREE()
There are a few places where a variable is VIR_FREE()-d and then
explicitly set to NULL. This is not necessary since VIR_FREE()
does that for us.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-02-01 17:37:06 +01:00
Michal Privoznik
726b9616b2 test_driver: Don't leak @group_name
In testDomainSetBlockIoTune() the info.group_name is strdup()-ed
and just after the whole @info structure is passed to
virDomainDiskSetBlockIOTune() the @group_name member is set to
NULL. This creates a memleak, because
virDomainDiskSetBlockIOTune() creates its own copy of the string.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-02-01 17:37:06 +01:00
Erik Skultety
d955cbd3a1 ci: containers: Add CentOS Stream 9 target
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:33:17 +01:00
Erik Skultety
7485f47082 ci: manifest: Allow RPM builds on CentOS Stream 8
The meson version provided by the package managing system satisfies our
minimum requirement.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:33:16 +01:00
Tim Wiederhake
28e9877e86 lxcDomainDetachDeviceHostdevUSBLive: Use VIR_WITH_OBJECT_LOCK_GUARD
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:20:15 +01:00
Tim Wiederhake
03f9f50712 bhyveAutostartDomain: Use virObjectLockGuard
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:20:09 +01:00
Tim Wiederhake
7a7994abc1 virChrdevFree: Use VIR_WITH_MUTEX_LOCK
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:20:02 +01:00
Tim Wiederhake
61cb99d32c virChrdevFDStreamCloseCb: Use virLockGuardLock
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:19:50 +01:00
Tim Wiederhake
6373a87315 virobject: Introduce VIR_WITH_OBJECT_LOCK_GUARD
Modeled after "WITH_QEMU_LOCK_GUARD" (see qemu's include/qemu/lockable.h).

See comment for typical usage.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:19:44 +01:00
Tim Wiederhake
8935c8397c virobject: Introduce virObjectLockGuard
Typical usage:
    void foobar(virObjectLockable *obj)
    {
        VIR_LOCK_GUARD lock = virObjectLockGuard(obj);
        /* `obj` is locked, and released automatically on scope exit */

        ...
    }

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:19:38 +01:00
Tim Wiederhake
2075195d70 virthread: Introduce VIR_WITH_MUTEX_LOCK_GUARD
Modeled after "WITH_QEMU_LOCK_GUARD" (see qemu's include/qemu/lockable.h).

See comment for typical usage.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:19:32 +01:00
Tim Wiederhake
d00d078968 virthread: Introduce virLockGuard
Locks a virMutex on creation and unlocks it in its destructor.

The VIR_LOCK_GUARD macro is used instead of "g_auto(virLockGuard)" to
work around a clang issue (see https://bugs.llvm.org/show_bug.cgi?id=3888
and https://bugs.llvm.org/show_bug.cgi?id=43482).

Typical usage:

    void function(virMutex *m)
    {
        VIR_LOCK_GUARD lock = virLockGuardLock(m);
        /* `m` is locked, and released automatically on scope exit */

        ...
        while (expression) {
            VIR_LOCK_GUARD lock2 = virLockGuardLock(...);
            /* similar */
        }
    }

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:19:23 +01:00
Tim Wiederhake
3f19e116cd internal: Add CONCAT macro
Using the two-step idiom to force resolution of other macros, e.g.:

  #define bar BAR
  CONCAT_(foo, bar)     // foobar
  CONCAT(foo, bar)      // fooBAR

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 17:19:05 +01:00
Peter Krempa
f468f0a634 systemd: Use correct man page name in modular daemon service files
The service files were copied out of the service file for libvirtd and
the name of the corresponding manpage was not fixed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2045959
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-01 13:20:11 +01:00
Peter Krempa
463af62c2c kbase: debuglogs: Add note about sensitive information in the logs
Outline information commonly logged which users could consider
sensitive.

Add a note that VNC/SPICE passwords are logged in plaintext.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-01 13:18:35 +01:00
Michal Privoznik
a7201789ab virnwfilterbindingobj: Fix virNWFilterBindingObjNew()
The idea behind virNWFilterBindingObjNew() is to create and
return an object of virNWFilterBindingObjClass class. The class
is virObjectLockable (and the corresponding
_virNWFilterBindingObj structure has virObjectLockable parent).
But for some reason plain virObjectNew() is called. This is wrong
because the mutex in the parent is left uninitialized.

Next, the returned object is not locked. This is wrong because in
some cases the returned object is added onto a list of bindings
and then passed to virNWFilterBindingObjEndAPI() which unlocks it
right away. This is potentially dangerous because we might just
have unlocked the object for another thread.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-01 11:55:13 +01:00
Göran Uddeborg
5e0b2aeb29 Translated using Weblate (Swedish)
Currently translated at 32.0% (3354 of 10455 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>
2022-01-31 20:39:39 +01:00
Emilio Herrera
1203f39573 Translated using Weblate (Spanish)
Currently translated at 48.7% (5097 of 10455 strings)

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

Co-authored-by: Emilio Herrera <ehespinosa57@gmail.com>
Signed-off-by: Emilio Herrera <ehespinosa57@gmail.com>
2022-01-31 20:39:39 +01:00
Ján Tomko
4d5f82ee7b libxl: assume LIBXL_HAVE_PVUSB
Introduced in Xen 4.7 by commit:
  commit bf7628f087b212052a0e9f024044b2790c33f820
    libxl: add pvusb API

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-31 20:38:53 +01:00
Ján Tomko
c282edb782 libxl: assume LIBXL_HAVE_SRM_V2
Introduced in Xen 4.6.0 by:
  commit 3a9ace0147d48af49ffd34628f9510f248f2f588
    tools/libxc+libxl+xl: Restore v2 streams

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-31 20:38:53 +01:00
Ján Tomko
8ac22ba17e libxl: remove LIBXL_ATTR_UNUSED
Unused as of:
  commit 446d091498
    libxl: pass driver config to libxlMakeDomBuildInfo

All other usage of LIBXL_HAVE_DEVICE_CHANNEL was removed by:
  commit e58004d70a
    Xen: Remove unneeded LIBXL_HAVE_* ifdefs

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-31 20:38:53 +01:00
Ján Tomko
247813acd1 libxl: assume LIBXL_HAVE_DEVICE_BACKEND_DOMNAME
Introduced in 4.3.0 by xen commit:

  commit ef496b81f0336f09968a318e7f81151dd4f5a0cc
    libxl: postpone backend name resolution

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-31 20:38:53 +01:00
Ján Tomko
5c706266cb tests: refactor testSELinuxLoadDef
Since its introduction in
commit 907a39e735
    Add a test suite for validating SELinux labelling

this function did not return NULL on OOM.

Since we abort on OOM now, switch testSELinuxMungePath to void,
return NULL explicitly on XML parsing failure and remove
the (now pointless) cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-31 20:37:48 +01:00
Ján Tomko
c1f8dd2e9e syntax-check: https: list the HTTP-only sites
Instead of listing the sites that surely support HTTPS,
list the ones that don't.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-31 20:28:13 +01:00
Ján Tomko
2960531310 qemu: qemuDomainSetLaunchSecurityState: do not lookup qemuCaps in cache
Any active domain has a copy in the privateData, filled in
qemuProcessInit.

Move the qemu capability check below the activeness check and remove
the extra lookup.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-31 15:47:47 +01:00
Michal Privoznik
1861e9fda2 lib: Drop '&*' from '&*variable'
Apparently, some of '&*variable' slipped in. Drop '&*' and access
the variable directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
2022-01-31 13:47:46 +01:00
Ján Tomko
07ddb4c6b3 qemu: qemuDomainSetLaunchSecurityState: check for params presence
We require the header and the secret to be present.

Use a different approach to virParams to report an error if they
are not present, instead of trying to pass empty arguments to QEMU
via QMP.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-31 13:38:11 +01:00
Ján Tomko
d248e3dca8 virsh: domsetlaunchsecstate: report error if no options are passed
We already exit if they are not present.

Report an error, but do not mark them as required in case a future
version of this command will want to accept a different set of
parameters.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-31 13:38:11 +01:00
Ján Tomko
18813edbf2 util: refactor virNetDevBandwidthUnplug
Remove pointless 'ret', cmd variable reuse and use g_auto.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 20:38:44 +01:00
Ján Tomko
ed35076581 util: refactor virNetDevBandwidthPlug
Use g_auto, split the double use of 'cmd' variable and remove useless
ret variable.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 20:38:44 +01:00
Ján Tomko
470987a53f util: virNetDevBandwidthClear: use g_auto
Separate the two uses of 'cmd' to avoid mixing manual and automatic
cleanup.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 20:38:44 +01:00
Ján Tomko
e1470a2295 util: virNetDevBandwidthManipulateFilter: use g_auto
Reduce the scope of the variable to avoid renaming it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 20:38:44 +01:00
Ján Tomko
6f8ac7bc46 util: virNetDevBandwidthUpdateRate: refactor
Use automatic cleanup and remove the 'ret' variable in favor of
direct returns.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 20:38:44 +01:00
Ján Tomko
aa9cd08d92 util: midonet: use g_auto for virCommand
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 20:38:44 +01:00
Michal Privoznik
a269fae099 domain_cgroup: Don't put semicolon at the end of VIR_GET_LIMIT_PARAMETER macro
In domain_cgroup.c there's VIR_GET_LIMIT_PARAMETER macro which
has a semicolon at the end of its declaration. Well, remove it so
that the places where macro is used have to put the semicolon
explicitly. This helps with automatic reformatting (at least in
vim).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-01-28 17:06:21 +01:00
Praveen K Paladugu
782ef1a992 ch_driver: emulator threadinfo & pinning callbacks
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 17:04:50 +01:00
Praveen K Paladugu
81226d8803 ch_process: Setup emulator and iothread settings
using virCHProcessSetupPid

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 17:04:50 +01:00
Vineeth Pillai
588a2eb719 ch_driver: add numatune callbacks for CH driver
Signed-off-by: Vineeth Pillai <viremana@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 17:04:50 +01:00
Vineeth Pillai
06d5055136 ch_driver: enable typed param string for numatune
Enable support of VIR_DRV_FEATURE_TYPED_PARAM_STRING to enable numatune

Signed-off-by: Vineeth Pillai <viremana@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 17:04:50 +01:00
Vineeth Pillai
d8343fb0ae ch_driver, ch_domain: vcpupin callback in ch driver
Signed-off-by: Vineeth Pillai <viremana@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 17:04:50 +01:00
Vineeth Pillai
ae34b921d9 ch: Move and rename chDomObjFromDomain()
The chDomObjFromDomain() function which currently lives as a
static one in ch_driver.c is going to be needed in other parts
of the driver. Move it into ch_domain.c, rename to
virCHDomainObjFromDomain() and expose in corresponding header
file for the rest of the driver to use.

Signed-off-by: Vineeth Pillai <viremana@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 17:04:50 +01:00
Vineeth Pillai
da6d4a2afc ch: methods for cgroup mgmt in ch driver
Signed-off-by: Vineeth Pillai <viremana@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 17:04:50 +01:00
Praveen K Paladugu
788e2b58cb qemu, hypervisor: refactor some cgroup mgmt methods
Refactor some cgroup management methods from qemu into hypervisor.
These methods will be shared with ch driver for cgroup management.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 17:04:50 +01:00
Tim Wiederhake
50a40c8d52 cpu-data.py: Query hyperv enlightenments
Reporting hv-* properties properly requires hv to be enabled,
see qemu commit 071ce4b03b.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-28 10:55:03 +01:00
Andrea Bolognani
6abfe77f0b include: Fix documentation for various VIR_*_LAST values
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-27 16:20:36 +01:00
Michal Privoznik
7251307199 qemuDomainDetachDeviceLive: Handle hostevs with unassigned type of address
A <hostdev/> can have <address type='unassigned'/> which means
libvirt manages the device detach from/reattach to the host but
the device is never exposed to the guest. This means that we have
to take a shortcut during hotunplug (e.g. never ask QEMU on the
monitor to detach the device, or never wait for DEVICE_DELETED
event).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-27 14:02:26 +01:00
Michal Privoznik
f5de3af7f4 qemuDomainAttachHostPCIDevice: Handle hostevs with unassigned type of address
A <hostdev/> can have <address type='unassigned'/> which means
libvirt manages the device detach from/reattach to the host but
the device is never exposed to the guest. This means that we have
to take a shortcut during hotplug, similar to the one we are
taking when constructing the command line (see
qemuBuildHostdevCommandLine()).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2040548
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-27 13:27:54 +01:00
Michal Privoznik
89f9346791 domain_validate: Refuse VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED
We document that <address type='unassigned'/> can be used only
for <hostdev/>-s. However, corresponding validation rule is
missing. Let's put the rule into hypervisor agnostic part of
validation process so that all drivers can benefit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-27 13:27:54 +01:00
Andrea Bolognani
bdf40b73f7 meson: Optimize handling of qemu_user and qemu_group
If the user has already provided us with the configuration they
want, there's no point in trying to come up with a reasonable
OS-specific default.

Suggested-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-01-27 11:48:36 +01:00
Andrea Bolognani
00c1a47914 meson: Require that both qemu_user and qemu_group are provided
Or that neither is. The current implementation, where if only
one of the two is provided the other one will be based on
OS-specific defaults is more likely to cause confusion than it
is to be helpful.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-01-27 11:48:35 +01:00
Andrea Bolognani
46b5fbd1fe meson: Don't check whether qemu_user and qemu_group exist
QEMU might not be installed on the build system, in which case
the user and group will not be present. We should avoid falling
back to root:root in that case, and assume the user and group
are going to be present in the target system instead.

Suggested-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-01-27 11:48:33 +01:00
Andrea Bolognani
e963390342 meson: Don't require /etc/os-release to be present
It might be part of some non-mandatory package on certain
distros, and our logic deals just fine with its contents not
being available.

Fixes: 4c69d64efa
Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-01-27 11:48:27 +01:00
Michal Privoznik
f103976ff3 node_device: Treat NVMe disks as regular disks
Unfortunately, udev doesn't set ID_TYPE attribute for NVMe disks,
therefore we have to add another case into udevKludgeStorageType()
to treat /dev/nvme* devlinks as any other disk.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2045953
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-27 08:40:35 +01:00
Michal Privoznik
ec9e2adb96 node_device: Rework udevKludgeStorageType()
The udevKludgeStorageType() function looks at devlink name
(/dev/XXX) and guesses the type of the (storage) device using a
series of STRPREFIX() calls. Well those can be turn into an array
and a for() loop, especially if we are about to add a new case
(in the next commit).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-27 08:38:00 +01:00
Michal Privoznik
f9db6f3ab6 qemu: Allow prealloc for virtio-mem-pci
There are a some scenarios in which we want to prealloc guest
memory (e.g. when requested in domain XML, when using hugepages,
etc.). With 'regular' <memory/> models (like 'dimm', 'nvdimm' or
'virtio-pmem') or regular guest memory it is corresponding
memory-backend-* object that ends up with .prealloc attribute
set. And that's desired because neither of those devices can
change its size on the fly. However, with virtio-mem model things
are a bit different. While one can set .prealloc attribute on
corresponding memory-backend-* object it doesn't make much sense,
because virtio-mem can inflate/deflate on the fly, i.e. change
how big of a portion of the memory-backend-* object is exposed to
the guest. For instance, from a say 4GiB module only a half can
be exposed to the guest. Therefore, it doesn't make much sense to
preallocate whole 4GiB and keep them allocated. But we still want
the part exposed to the guest preallocated (when conditions
described at the beginning are met).

Having said that, with new enough QEMU the virtio-mem-pci device
gained new attribute ".prealloc" which instructs the device to
talk to the memory backend object and allocate only the requested
portion of memory.

Now, that our algorithm for setting .prealloc was isolated in a
single function, the function can be called when constructing cmd
line for virtio-mem-pci device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 12:41:27 +01:00
Michal Privoznik
a82d9e8996 qemu_capabilities: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC
This new capability tracks whether virtio-mem device is capable
of memory preallocation, which is detected by the device having
.prealloc attribute.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 12:41:27 +01:00
Michal Privoznik
d198351faa qemu: Move @prealloc into qemuBuildMemoryGetPagesize()
The qemuBuildMemoryGetPagesize() function has everything is needs
to decide whether preallocation is needed or not. Move the logic
from qemuBuildMemoryBackendProps() into
qemuBuildMemoryGetPagesize().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 12:41:27 +01:00
Michal Privoznik
117ede19fb qemu: Separate out hugepages handling from qemuBuildMemoryBackendProps()
The qemuBuildMemoryBackendProps() function is already long
enough. Move code that decides what hugepages to use into a
separate function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 12:41:26 +01:00
Michal Privoznik
bad883787f qemuBuildMemoryDeviceProps: Fix const correctness
The @mem agrument of qemuBuildMemoryDeviceProps() function is
only read from. Make this fact obvious from the function
declaration too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 12:41:26 +01:00
Andrea Bolognani
0f97f9860c spec: Don't clean up *.la and *.a files
autotools used to produce those, but meson doesn't.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-26 11:57:32 +01:00
Michal Privoznik
d349ebab24 conf: Separate out virDomainClockDef formatting
Currently, virDomainClockDef is formatted inside
virDomainDefFormatInternalSetRootName() which is already long
enough. Move the code into a new function
(virDomainClockDefFormat()) and make the code use
virXMLFormatElement() while at it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:30 +01:00
Michal Privoznik
b529c51933 virDomainTimerDefFormat: return void
This function never returns an error, make it void then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:28 +01:00
Michal Privoznik
a1c47cb8fc conf: Rework virDomainTimerDefFormat()
Use virXMLFormatElement() to simplify virDomainTimerDefFormat().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:26 +01:00
Michal Privoznik
82e902ddcc conf: Fix @mode member of _virDomainTimerDef struct
The @mode member of the _virDomainTimerDef struct stores
values of the virDomainTimerModeType enum, or -1 for the
default value (when user provided no value in XML).

This is needlessly complicated. Introduce new value to the enum
which reflects the default state.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:24 +01:00
Michal Privoznik
10eb597137 conf: Fix @track member of _virDomainTimerDef struct
The @track member of the _virDomainTimerDef struct stores
values of the virDomainTimerTrackType enum, or -1 for the
default value (when user provided no value in XML).

This is needlessly complicated. Introduce new value to the enum
which reflects the default state.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:22 +01:00
Michal Privoznik
96d72b461f conf: Fix @tickpolicy member of _virDomainTimerDef struct
The @tickpolicy member of the _virDomainTimerDef struct stores
values of the virDomainTimerTickpolicyType enum, or -1 for the
default value (when user provided no value in XML).

This is needlessly complicated. Introduce new value to the enum
which reflects the default state.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:20 +01:00
Michal Privoznik
754a7f6c94 conf: Fix type of @present in _virDomainTimerDef struct
In the _virDomainTimerDef structure we have @present member which
is like virTristateBool, except it's an integer and has values
shifted by one. This is harder to read. Retype the member to
virTristateBool which we are familiar with.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:18 +01:00
Michal Privoznik
9198b7090b virDomainChrSourceDefCopy: return void
This function never returns an error, make it void then. And
while at it, make the @src argument const to make it obvious it's
never changed inside the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:17 +01:00
Michal Privoznik
7e57285eec virDomainChrSourceDefCopy: Don't check arguments against NULL
The only caller of this function
(qemuProcessFindCharDevicePTYsMonitor()) doesn't pass NULL.
Remove corresponding check from virDomainChrSourceDefCopy().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:14 +01:00
Michal Privoznik
8af76c3764 virDomainChrSourceDefCopy: Copy more struct members
The aim of virDomainChrSourceDefCopy() is to make a deep copy of
given virDomainChrSourceDef. However, some types were not copied
at all (VIR_DOMAIN_CHR_TYPE_SPICEVMC and
VIR_DOMAIN_CHR_TYPE_SPICEPORT) and some members weren't copied
either (@logfile, @logappend).

After this, there are still some members that are not copied
(seclabels and private data), but the sole caller
qemuProcessFindCharDevicePTYsMonitor() doesn't seem to care.
Therefore, just document this behavior so that future user is
aware.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:11 +01:00
Michal Privoznik
3de95c3d51 virDomainInputDefParseXML: Move validation into validator
There is some code that validates whether parsed @bus <input/>
makes sense (e.g. some hypervisors have their own type of bus).
But this code should not live in the parser, but validator
rather. That way, we can also validate that the value we compute
(if user didn't provide any) is valid.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-26 10:49:03 +01:00
Peter Krempa
ddb2384f0c qemuDomainSetupDisk: Initialize 'targetPaths'
Compiler isn't able to see that 'virDevMapperGetTargets' in cases e.g.
when the devmapper isn't available may not initialize the value in the
pointer passed as the second argument.

The usage 'qemuDomainSetupDisk' lead to an accidental infinite loop as
previous calls apparently doctored the stack to a point where
'g_slist_concat' would end up in an infinite loop trying to find the end
of the list.

Fixes: 6c49c2ee9f
Closes: https://gitlab.com/libvirt/libvirt/-/issues/268
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-26 09:24:59 +01:00
Olaf Hering
7d54a29138 meson: recognize sles when guessing default_qemu_user
NAME="SLES"
VERSION="15-SP3"
VERSION_ID="15.3"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP3"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp3"
DOCUMENTATION_URL="https://documentation.suse.com/"

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-25 18:09:09 +01:00
Roman Bolshakov
5f27793b28 news: Mention hvf domain type
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Roman Bolshakov
3ff4ff4831 docs: Add support page for libvirt on macOS
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Roman Bolshakov
9a5306ba2f docs: Note hvf support for domain elements
Many domain elements have "QEMU and KVM only" or "QEMU/KVM since x.y.z"
remarks. Most of the elements work for HVF domain, so it makes sense to
add respective notices for HVF domain.

All the elements have been manually tested.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Roman Bolshakov
44863b37c1 docs: Add hvf on QEMU driver page
It's worth to make the domain type a little bit more visible than a row
in news. An example of hvf domain is available on QEMU driver page.

While at it, mention Hypervisor.framework on index page.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Andrea Bolognani
299d48d574 tests: Add HVF test cases
We need to use a hardcoded list of capabilities because we don't
yet have proper replies files obtained from QEMU running on actual
macOS machines.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Andrea Bolognani
ebb921cb37 tests: Add macOS support to qemuxml2*test
The new DO_TEST_MACOS() macro makes it possible to create test
cases that verify the behavior of libvirt on a macOS machine
with HVF support available.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Andrea Bolognani
5fd9ddfa1f tests: Add macOS support to testutilsqemu
This exposes a couple of macOS-specific variants of existing
APIs, which can be used when implementing test programs and
result in HVF support being advertised.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Andrea Bolognani
f16626ccd7 tests: Introduce testQemuHostOS
This new enumeration provides a way to specify the host OS
that a specific test case expects. The default is Linux, which
has been the implicit host OS until now; when Linux is selected
as the host OS, KVM support is advertised in capabilies data
exposed to test cases.

This commit doesn't result in any functional change, and simply
sets the stage for introducing macOS host OS support later.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Roman Bolshakov
244542f3bf qemu: Correct CPU capabilities probing for hvf
With this change virsh domcapabilites shows:

  <mode name='host-passthrough' supported='yes'/>

https://gitlab.com/libvirt/libvirt/-/issues/147

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:44 +01:00
Roman Bolshakov
6b94f4d1b1 qemu: Introduce virQEMUCapsHaveAccel
The function should be used to check if qemu capabilities include a
hardware acceleration, i.e. accel is not TCG.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:43 +01:00
Roman Bolshakov
a8643c53fb qemu: Introduce virQEMUCapsTypeIsAccelerated
It replaces hardcoded checks for KVM. It'll be cleaner to use
the function once multiple accelerators are supported in the
QEMU driver.

Explicit KVM domain checks should be done only when a feature is
available only for KVM.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:40 +01:00
Roman Bolshakov
9c56dae1cb qemu: Introduce virQEMUCapsAccelStr
This makes possible to add more accelerators by touching less code and
reduces code duplication.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:54:27 +01:00
Roman Bolshakov
c6bf66e1ee qemu: Expose hvf domain type if hvf is supported
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:53:39 +01:00
Roman Bolshakov
a339c27b15 qemu: Query hvf capability on macOS
There's no QMP command for querying if hvf is supported, therefore we
use sysctl interface that tells if Hypervisor.framework works/available
on the host.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:53:39 +01:00
Roman Bolshakov
171b5ee844 qemu: Define hvf capability
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:53:39 +01:00
Roman Bolshakov
bb9373d096 conf: Add hvf domain type
QEMU supports Hypervisor.framework since 2.12 as hvf accel.
Hypervisor.framework provides a lightweight interface to run a virtual
cpu on macOS without the need to install third-party kernel
extensions (KEXTs).

It's supported since macOS 10.10 on machines with Intel VT-x feature
set that includes Extended Page Tables (EPT) and Unrestricted Mode.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:53:39 +01:00
Roman Bolshakov
4794458c8d qemu: Add KVM CPUs into cache only if KVM is present
virQEMUCapsFormatCache/virQEMUCapsLoadCache adds/reads KVM CPUs to/from
capabilities cache regardless of QEMU_CAPS_KVM. That can cause undesired
side-effects when KVM CPUs are present in the cache on a platform that
doesn't support it, e.g. macOS or Linux without KVM support.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:53:39 +01:00
Andrea Bolognani
8885cd9a76 qemu: Only probe KVM on Linux
We already know it's not going to be available on other
platforms.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Brad Laue <brad@brad-x.com>
Tested-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-25 16:53:39 +01:00
Jim Fehlig
31e937fb3b libxl: Add lock process indicator to saved VM state
Commit fa58f571ee added a lock processes indicator to the
libxlDomainObjPrivate struct to note that a lock process was
successfully started for the VM. However, the commit neglected to
add the indicator to the VM's saved state file. As a result, the
indicator is lost on libvirtd restart, along with the knowledge of
whether a lock process was started for the VM.

This change adds support for the indicator in the domainObjPrivate
data parse and format callbacks, ensuring its value survives libvirtd
restarts.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-25 08:50:19 -07:00
Nicolas Lécureuil
673b74be5f conf: network: Allow hostnames to start with a number
RFC952 mandated that hostnames would start with an alpha character.
This requirement was later relaxed by RFC1123 which allowed hostnames to
start with a number as well.

https://datatracker.ietf.org/doc/html/rfc952
https://datatracker.ietf.org/doc/html/rfc1123#page-13

Signed-off-by: Nicolas Lécureuil <nicolas.lecureuil@siveo.net>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-25 15:47:05 +01:00
Michal Privoznik
e185f03f39 qemuDomainAttachHostPCIDevice: Fix coding style
Our coding style requires that a body of an if() longer than two
lines is wrapped in a curly braces. There's one offender in
qemuDomainAttachHostPCIDevice(). Fortunately, there was no
functional problem because one of the lines is a comment.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-25 12:38:40 +01:00
Han Han
fa6e29f978 docs: Mention the types of params in event callbacks
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-24 15:21:54 +01:00
Han Han
d29d153fd9 docs: Fix typos in the code comment
1. s/LifeCycle/Lifecycle/
2. s/virConnectDomainEventTrayChangeReason/virDomainEventTrayChangeReason/

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-24 15:21:49 +01:00
Göran Uddeborg
d1f89a9d28 Translated using Weblate (Swedish)
Currently translated at 31.9% (3336 of 10455 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>
2022-01-24 10:21:35 +01:00
shenjiatong
7bc7304ca5 qemu: Remove scsi parameter for vhost-user-blk for qemu < 4.2
When trying to attach vhost-user-blk device to virtual machine using
qemu < 4.2 libvirt would mistakenly add a scsi=off parameter, which is
not supported by qemu.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/265
Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-24 10:17:00 +01:00
Peter Krempa
5e645b80f4 qemuxml2argvtest: disk-vhostuser: Add invocation for qemu-4.2
With qemu versions prior to qemu-5.0 we'll format 'scsi=off' for
virtio-blk disks, but also for vhost-user-blk. This is a bug as it's not
supported.

Add a test case to show that wrong configuration is generated by adding
running 'disk-vhostuser' test case on capabilities from qemu-4.2.

For this to be possible it's required to enable shared memory via NUMA
configuration as old QEMU's don't allow configuration of the default
memory backend. This is achieved by adding a copy of the
'disk-vhostuser' XML with NUMA enabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-01-24 10:17:00 +01:00
Martin Kletzander
4c69d64efa meson: Explicitly specify run_command's check parameter
An update to meson 0.61.1 meant that it started showing warnings due to the fact
that the default for run_command's 'check' parameter is going to change.  It
unveiled the fact that we were even missing that parameter in some calls where
we expected different outcome.  To make sure the behaviour does not change
specify the parameter explicitly.  In places where we check for the return code
the parameter should be 'false' so that meson does not fail.  In all other cases
the parameter should be set to 'true' to make sure possible failure also stops
meson.

The warning in meson was added in https://github.com/mesonbuild/meson/pull/9304

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-01-24 09:54:35 +01:00
Martin Kletzander
2e2c9797c5 esx: Do not return root objects in a lookup
The lookups in esx_vi work a bit differently that we are used to.  The filters
(travelsalSpec and selectSet) choose how to look up the objects, but given a
root object the lookup lists all the objects of a requested type inside it as
well as the root object itself.  We then go through the results and find the one
which has the same name as was requested.  However in a case with nested folders
of a same name this could break when the first returned object in the list is
the parent folder as we'd select it only based on the name.  To avoid this also
add a check that the candidate we are trying to pick is not exactly the same
object (reference) as the root object.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2022-01-24 09:54:24 +01:00
Tim Wiederhake
088bb9cebe docs: Fix spelling
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2022-01-24 09:41:44 +01:00
Ján Tomko
eee062d7a2 bhyve: handle all enum values in switches
Recent commits switched some variables to enums but did not
fix the warnings in the bhyve driver.

Fixes: 0eb42087c7
Fixes: a1ce98061c
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 18:20:58 +01:00
Michal Privoznik
bdb95b520c conf: Convert virDomainHostdevDefParseXMLSubsys() to virXMLProp*()
After previous cleanups, the virDomainHostdevDefParseXMLSubsys()
function uses a mixture of virXMLProp*() and the old
virXMLPropString() + virXXXTypeFromString() patterns. Rework it
so that virXMLProp*() is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:14 +01:00
Michal Privoznik
af5a7dba78 conf: Convert virNetworkPortDefParseXML() to virXMLProp*()
After previous cleanups, the virNetworkPortDefParseXML() function
uses a mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:14 +01:00
Michal Privoznik
97129ed43a conf: Convert virDomainNetDefParseXML() to virXMLProp*()
After previous cleanups, the virDomainNetDefParseXML() function
uses a mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:14 +01:00
Michal Privoznik
a1ce98061c conf: Convert virDomainFSDefParseXML() to virXMLProp*()
After previous cleanups, the virDomainFSDefParseXML() function
uses a mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:14 +01:00
Michal Privoznik
0eb42087c7 conf: Convert virDomainDefParseBootXML() to virXMLProp*()
After previous cleanups, the virDomainDefParseBootXML() function
uses a mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:14 +01:00
Michal Privoznik
0aaf410262 conf: Convert virCPUDefParseXML() to virXMLProp*()
After previous cleanups, the virCPUDefParseXML() function uses a
mixture of virXMLProp*() and the old virXMLPropString() +
virXXXTypeFromString() patterns. Rework it so that virXMLProp*()
is used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:14 +01:00
Michal Privoznik
0fe2d8dd33 lib: Almost eliminate use of virTristateBoolTypeFromString()
There are couple of places where virTristateBoolTypeFromString()
is called. Well, the same result can be achieved by
virXMLPropTristateBool() and on fewer lines.

Note there are couple of places left untouched because those
don't care about error reporting and thus are shorter they way
they are now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:13 +01:00
Michal Privoznik
9086ae4fac lib: Eliminate use of virTristateSwitchTypeFromString()
There are couple of places (all of them in XML parsing) where
virTristateSwitchTypeFromString() is called. Well, the same
result can be achieved by virXMLPropTristateSwitch() and on fewer
lines.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:13 +01:00
Michal Privoznik
5a33dd25c1 qemu: Use virTristateBool instead of virTristateSwitch in a few places
Both @accel2d and @accel3d are parsed as virTristateBool, but in
a few places (qemuDeviceVideoGetModel() and
qemuValidateDomainDeviceDefVideo()) they are compared to
virTristateSwitch enum either directly or via a variable of that
type. Clear this confusion by using the correct enum.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:13 +01:00
Michal Privoznik
2ab0a346bf qemuValidateDomainDeviceDefFS: Use correct enum for fs->multidevs comparison
During validation of a virDomainFSDef QEMU capabilities are check
for multidevs support if the FS definition has it enabled.
However, the fs->multidevs is really type of virDomainFSMultidevs
but is compared against virDomainFSModel enum. Fortunately, both
values are the same so no user visible harm done here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:13 +01:00
Michal Privoznik
6690a97b06 virNetworkPortDefParseXML: Fix a typo in an error message
There's a typo in error message that's printed when parsing of
<plug type=''/> fails: "prt" is reported instead of "port".

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:13 +01:00
Michal Privoznik
7b64a83ae2 virxml: Extend virXMLPropU{Int,LongLong}() error message
In case virXMLPropUInt() or virXMLPropULongLong() meets an
attribute with a negative integer the following error message is
printed:

  Invalid value ...: Expected integer value

This message is not as good as it could be. Let users know it's a
non-negative integer we are expecting.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-21 16:42:13 +01:00
Erik Skultety
b42e088019 qemu: command: Fix the qemuBuldDomainLoaderPflashCommandLine name typo
The function should be called qemuBuildDomainLoaderPflashCommandLine.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2022-01-21 15:20:22 +01:00
Peter Krempa
61ad700129 man: virt-admin: Mention monolithic daemon URIs
Hint users that they can use 'virt-admin' also for the new monolithic
daemons.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2038045
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-21 13:40:11 +01:00
Peter Krempa
a4402c5253 kbase: debuglogs: Fix for modular daemons
Modular daemons are now the default in many new installations, thus we
need to include steps how to determine that modular daemons are used and
modular-daemon specific locations for the config files and admin URIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-21 13:40:11 +01:00
Peter Krempa
985abd5503 docs: daemons: Add section on figuring out whether modular or monolithic daemon is in use
Since we are at a transition period where some users may be running
monolithic libvirtd and others already the modular topology we need a
section that allows users to figure out which is in use.

This will be particularly important in the document about enabling
logging, as the active log file depends on which daemon is in use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-21 13:40:11 +01:00
Peter Krempa
41537dd09a man: virt-admin: Remove misleading paragraph about unix socket permissions
The socket permissions are controlled by 'unix_sock_admin_perms', but
regardless the code requires that 'geteuid() != clientuid' to allow
clients thus it doesn't make sense to make users aware of it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-21 11:11:28 +01:00
Andrea Bolognani
6cb131e5cb docs: Drop node.gif
It's the only GIF file we have in our repository.

We could convert it to PNG, but that would result in a
significantly bigger file (~5.5 KiB vs ~1.5 KiB).

Since the image doesn't really add much to the documentation,
drop it instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-21 10:17:11 +01:00
Daniel Henrique Barboza
2b7f9506b1 tests: update QEMU capabilities for qemu 6.2 release
Update existing ppc64 6.2 caps to match what was released in QEMU 6.2.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-20 19:17:21 +01:00
Michal Privoznik
105dace22c Revert "report error when virProcessGetStatInfo() is unable to parse data"
This reverts commit 938382b60a.

Turns out, the commit did more harm than good. It changed
semantics on some public APIs. For instance, while
qemuDomainGetInfo() previously did not returned an error it does
now. While the calls to virProcessGetStatInfo() is guarded with
virDomainObjIsActive() it doesn't necessarily mean that QEMU's
PID is still alive. QEMU might be gone but we just haven't
realized it (e.g. because the eof handler thread is waiting for a
job).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041610
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-20 17:51:07 +01:00
Daniel Henrique Barboza
add089d9f5 tests: update QEMU and domain ppc64 capabilities for qemu 7.0
Changes in all 'ppc64-latest.ags' files were needed due to the
JSONification of command line devices.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-20 17:29:14 +01:00
Göran Uddeborg
5f773628f4 Translated using Weblate (Swedish)
Currently translated at 31.3% (3281 of 10455 strings)

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

Translated using Weblate (Swedish)

Currently translated at 31.2% (3266 of 10455 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>
2022-01-20 15:17:22 +01:00
simmon
2916b6386c Translated using Weblate (Korean)
Currently translated at 100.0% (10455 of 10455 strings)

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

Translated using Weblate (Korean)

Currently translated at 99.7% (10434 of 10455 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
2022-01-20 15:17:22 +01:00
Jan Kuparinen
beb9869757 Translated using Weblate (Finnish)
Currently translated at 22.8% (2392 of 10455 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
2022-01-20 15:17:22 +01:00
Ján Tomko
76deb65613 qemu: fix inactive snapshot revert
The commit splitting out the qemuSnapshotRevertInactive function
dropped the 'defined = true' line by accident and instead
returned -1, leaving the user with a cryptic error:
error: An error occurred, but the cause is unknown

https://bugzilla.redhat.com/show_bug.cgi?id=2039136
https://gitlab.com/libvirt/libvirt/-/issues/266

Fixes: 85e4a13c3f
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 15:16:18 +01:00
Peter Krempa
9911a6f2ff storage: Implement 'checkPool' method for 'disk' type pools
If 'checkPool' is not implemented, the pool will be made inactive when
restarting libvirtd and subsequently re-loading the state from the pool
state XML.

Base the 'checkPool' implementation on logic similar to 'startPool'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1910856
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
23b0d6a0ff virStoragePoolObjSourceFindDuplicateCb: Fix handling of VIR_STORAGE_POOL_ISCSI_DIRECT
The direct SCSI pool doesn't expose the volumes in the host attempting
to match it using 'virStoragePoolObjSourceMatchTypeDEVICE' which in turn
uses 'virStoragePoolSourceFindDuplicateDevices' doesn't make sense.

Remove it from the source matching completely as we can open multiple
connections to the target.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
a09c5b3cc2 storageDriverAutostartCallback: Refactor control flow
Use early returns to decrease the indentation level and make it more
obvious that the 'cleanup' path is a noop in those cases.

'virStoragePoolObjSetStarting' was called only when the code wanted to
start the pool, so if that was skipped, cleanup is noop as it's
conditional on the return value of 'virStoragePoolObjIsStarting'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
8a80df95ac virStoragePoolObjLoadAllConfigs: Use automatic memory clearing
Refactor the inner loop to automatically free temporary variables and
remove unreachable error paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
7cf5b88338 storage: Add debug logs for storage pool config loading
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-20 14:23:56 +01:00
Peter Krempa
755b16d10a docs: man: virsh: Document more carefully that 'guestinfo' can return nothing
When invoking 'virsh guestinfo $VM' without explicitly specifying a
group of information to return, virsh always reports success even when
the guest agent doesn't report any information in the current state.
This is desired in situations when you are okay with stats being missing
and avoids spurious errors being reported.

Clarify that this is really desired in the man page.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041665
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-01-19 19:01:32 +01:00
Peter Krempa
8487772451 kbase: debuglogs: Emphasise 'virt-admin'
It's a tool name so use backticks to format it in monospace.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
0e65006747 kbase: debuglogs: Extract client library logging setup
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
69349e0902 kbase: debuglogs: Add a section describing log outputs and filters
Outline what the given settings influence.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
5e38c32e3d kbase: debuglogs: Section off the settings for legacy libvirt
Move out the settings required to pre libvirt-4.4.0 deployments into a
separate section so that the main point is not cluttered by now mostly
irrelevant settings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
58d0cf480d kbase: debuglogs: Un-nest section on enabling debug logs
Enabling the logs is the focus of this article. Decouple it from the
first section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:04 +01:00
Peter Krempa
83f4019f51 kbase: debuglogs: Use common heading hierarchy
Use the heading hierarchy as generated by pandoc which we use in most
of the converted XML format docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 18:52:03 +01:00
Peter Krempa
aaec8c91ae spec: Run pre/post-install stuff on 'daemon-driver-storage-core'
'daemon-driver-storage' is just a meta-package, the actual daemon is in
the 'daemon-driver-storage-core' package, so without installing the meta
package the storage daemon is not being enabled.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2025644
Fixes: 50eae3f885, b8ef625544
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 17:00:27 +01:00
Peter Krempa
9c800d62ad remote: systemd: Remove unix sockets from filesystem when disabling a '.socket' unit
The existence of the unix socket path is used by the remote driver to
determine whether modular daemons are in use, so if the socket file
stays behind and the user decided to switch from modular to monolithic
daemon which was socket activated, the remote driver will insist on
picking '/var/run/libvirt/virtqemud-sock', even when it's no longer in
use:

 # systemctl start libvirtd.service
 # virsh list
  Id   Name   State
 --------------------

 # systemctl stop libvirtd.service
 Warning: Stopping libvirtd.service, but it can still be activated by:
   libvirtd.socket
   libvirtd-ro.socket
   libvirtd-admin.socket
 # systemctl start virtqemud.socket
 # virsh list
  Id   Name   State
 --------------------

 # systemctl stop virtqemud.socket
 # systemctl start libvirtd.service
 # virsh list
 error: failed to connect to the hypervisor
 error: Failed to connect socket to '/var/run/libvirt/virtqemud-sock': Connection refused

 # virsh -c 'qemu:///system?socket=/var/run/libvirt/libvirt-sock' list
  Id   Name   State
 --------------------

Fix this by instructing systemd to delete the socket file when
deactivating the unit file for the socket.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
2022-01-19 16:54:33 +01:00
Peter Krempa
1652babf15 qemuValidateDomainDeviceDefVideo: Reject non-default video head count for devices not supporting it
Only QXL and virtio-vga actually propagate the 'heads' attribute as
'max_outputs' to the commandline of qemu. Reject the setting when
non-default value is used for any other video type.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2036300
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:33 +01:00
Peter Krempa
37c0a25ca0 qemuValidateDomainDeviceDefVideo: Refactor condition checking for qxl and virtio-vga
Subsequent patch will use the same condition so move the primary device
check into a nested condition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Peter Krempa
4c308ea42e qemuBuildDeviceVideoCmd: Simplify formatting of 'max_outputs' property
Since there's no capability to check now, we can simply move the
formatting of 'max_outputs' earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Peter Krempa
49a85978b7 qemu: capabilities: Retire QEMU_CAPS_QXL_MAX_OUTPUTS and QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS
Both are supported by qemu-2.11 and later, so we don't have to check for
them explicitly.

Note that QXL is supported only on x86_64, thus on other arches only the
capability for 'virtio-gpu' is removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Peter Krempa
d35ddc6243 qemuBuildDeviceVideoCmd: Always assume support for 'max_outputs' property
Both the QXL video device and 'virtio' video device support
'max_outputs' in all qemu versions libvirt supports. This means we no
longer have to check the QEMU_CAPS_QXL_MAX_OUTPUTS and
QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:54:32 +01:00
Peter Krempa
6622e3cc33 virDomainDeviceInfoParseXML: Reject '0' value for ACPI index
Value of '0' is treated equivalently to when it's not provided by the
user. Reject an explicit '0' provided by the user as it would get
ignored.

In this rare case we can make the XML parser more strict, as libvirt
would never format the '<acpi/>' element if the index is '0' thus there
are no libvirt-generated XMLs we'd not load back, as of such this is
identical to rejecting it in the validation phase.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037146
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-19 16:54:32 +01:00
Michal Privoznik
ec7fbdef56 virsh-network: Don't check for virshXXXTypeFromString() >= VIR_XXX_LAST
They way our VIR_ENUM_IMPL() and virXXXTypeFromString() work is
that for any string that's not recognized a negative one is
returned. And, since VIR_XXX_LAST is passed to VIR_ENUM_IMPL() we
can be sure that all enum members are covered. Therefore, there
is no way that virXXXTypeFromString() can return a value that's
bigger or equal to VIR_XXX_LAST.

I've noticed two places where such comparison was made, both in
cmdNetworkUpdate(). Drop them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 16:48:33 +01:00
Michal Privoznik
d724ca8fcd virsh: Introduce net-update --section completer
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:48:33 +01:00
Michal Privoznik
687d6f1d7b virsh: Introduce net-update --command completer
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-19 16:48:33 +01:00
Daniel P. Berrangé
ab96031943 util: set facility when opening syslog channel
We're currently passing '0' which leaves the syslog facility
unset. Since we're passing an explicit facility for syslog
when using journald, it makes sense to be explicit when
using  syslog directly too.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-19 15:32:54 +00:00
Daniel P. Berrangé
017fa1e097 util: fix syslog facility value
We set SYSLOG_PRIORITY when sending to journald to avoid our
messages getting tagged with the default facility which is
used for the kernel.

Unfortunately:

  commit fd00f0e6c7
  Author: Guido Günther <agx@sigxcpu.org>
  Date:   Mon Sep 21 20:06:55 2015 +0200

    Use daemon log facility for journald

used the LOG_nnn constants from the syslog header without realizing
that these values have a bit-shift applied. While Linux defines a
LOG_FAC() macros to undo the bit-shift this doesn't appear to be
standardized. So the safe thing is to just use the raw value since
these values are fixed by RFC 5424.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-19 15:32:45 +00:00
Tim Wiederhake
6c68f120a5 docs: coding-style: One variable declaration per line
This was not mentioned before.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-19 14:54:08 +01:00
Tim Wiederhake
95c380d410 docs: coding-style: Clarify on virXXXPtr types
This partially reverts commit 9ccbed6afb.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-19 14:54:08 +01:00
Tim Wiederhake
1787a77cf8 manpages: libvirt-guests: Fix typos
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-19 14:52:27 +01:00
Ján Tomko
6ba2643257 qemu: simplify qemuProcessSetupRawIO
Remove the now unused 'driver' parameter, as well as the pointless
if (ret == 0) comparison which is always true after removing the
cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
8120021860 util: remove {Get,Set}UnprivSGIO
These are no longer used.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
44aaa02992 util: remove virGetDeviceID
It was only used to construct the hash key for the (now removed)
shared devices in the qemu driver.

Remove it and its mocking.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
89803eb5f8 qemu: remove sharedDevices hash table
Its only use was to check conflicts of the sgio attributes between
devices shared with other domains.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
dbd2f26cf0 qemu: remove all use of SGIO
Now that the 'unfiltered' attribute is rejected by the validator,
remove all the code that deals with the feature.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
711f593566 conf: reject unfiltered sgio on validation
No kernels supported by upstream libvirt have the feature.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
f322018c23 util: remove virGetUnprivSGIOSysfsPath
unpriv_sgio was a downstream-only feature in RHEL 6-8.
The libvirt support was merged upstream by mistake.

Remove the function that constructs the sysfs path and assume it
does not exist in all the callers.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-19 13:57:59 +01:00
Ján Tomko
ae8add363a qemu: remove support for transitional virtio-input-host
virtio-input is virtio-1.0 only and these models have been only present
in one upstream QEMU release, then removed by:

      commit d923e30578a65392e50e530e3a29b2edf5c51c5b
          virtio-input-host-pci: cleanup types

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 19:13:40 +01:00
Ján Tomko
8b90d0833a qemu: remove support for transitional virtio-input-host
This device was virtio 1.0-only so adding the (non-)transitional model
did not make sense and it was only present in QEMU 4.0.

Report a validation error for both of the users that will ever hit this
code path.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 19:13:36 +01:00
Ján Tomko
a829adf24a qemu: capabilities: do not check for transitional input host
The (non-)transitional version of this device was only present in
one upstream QEMU release (4.0), then removed by:

  commit d923e30578a65392e50e530e3a29b2edf5c51c5b
      virtio-input-host-pci: cleanup types

Remove them from probing as well, since they are unlikely to be found.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 18:09:33 +01:00
Ján Tomko
a5e8eec7d5 util: openvswitch: do not reuse cmd in InterfaceClearTxQos
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
3ab7df7421 util: openvswitch: do not reuse cmd in InterfaceSetTxQos
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
5d55546e0f util: openvswitch: split out virNetDevOpenvswitchInterfaceSetRxQos
The virNetDevOpenvswitchInterfaceSetQos function is uneven
because setting the Rx Qos is open-coded, while clearing it
is sepearated in another function.

Separate the setting too.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
be82600128 util: openvswitch: split out virNetDevOpenvswitchInterfaceSetTxQos
The virNetDevOpenvswitchInterfaceSetQos function is uneven
because setting the Tx Qos is open-coded, while clearing it
is sepearated in another function.

Separate the setting too.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
186aa292a0 util: openvswitch: unexport InterfaceClear{Rx,Tx}Qos
This also removes the indentation error.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Ján Tomko
a6ffb1712b util: openvswitch: move InterfaceClear{Rx,Tx}Qos
These functions are called by virNetDevOpenvswitchInterfaceSetQos
as well as virNetDevOpenvswitchInterfaceClearQos.

Move them above both fuctions.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 17:48:32 +01:00
Andrea Bolognani
dbf9b8a6ed util: Stop storing dnsmasq version
We don't do anything with it after checking that it satisfies our
requirements and don't provide a way for users of the module to
access it, so carrying it around is pointless.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 16:50:31 +01:00
Andrea Bolognani
cef015e325 spec: Drop BuildRequires on dnsmasq
It's been an optional build time dependency for a long time, so
if Meson couldn't find it the only consequence was that libvirt
would look for it at runtime instead, which is what we are doing
for most of our non-library dependencies anyway.

Since 5c98d1cee0 we've stopped even looking for it at build
time, so there's no point in having it installed in the build
environment.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-18 16:50:15 +01:00
Michal Privoznik
11627e021d virdnsmasq: Join dnsmasqCapsNewEmpty() and dnsmasqCapsNewFromBinary()
After previous cleanups, there's just one caller of
dnsmasqCapsNewEmpty() and it is dnsmasqCapsNewFromBinary().
And the former is pretty short. Therefore, it is not necessary
for the code to live in two separate functions. Dissolve the
former in the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 16:18:57 +01:00
Michal Privoznik
d730392293 virdnsmasq: Drop dnsmasqCapsNewFromBuffer()
The function is no longer used. Remove it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 16:18:57 +01:00
Michal Privoznik
2fc6adcb30 networkxml2conftest: Check if capabilities were created successfully
Now that looking up dnsmasq is handled/mocked we can start
checking whether dnsmasq capabilities were built successfully and
error out if that wasn't the case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 16:18:54 +01:00
Michal Privoznik
ec9ee676b4 networkxml2conftest: Use dnsmasqCapsNewFromBinary() to construct caps
DISCLAIMER: dnsmasq capabilities are empty as of v8.0.0-rc1~145.

In a real environment the dnsmasq capabilities are constructed
using dnsmasqCapsNewFromBinary(). We also have
dnsmasqCapsNewFromBuffer() to bypass checks that real code is
doing and just get capabilities object. The latter is used from
test suite.

However, with a little bit of mocking we can test the real life
code. All that's needed is to simulate dnsmasq's output for
--version and --help and mock a stat() that's done in
dnsmasqCapsRefreshInternal().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 16:18:45 +01:00
Michal Privoznik
4b68c982e2 virdnsmasq: Require non NULL @caps in dnsmasqCapsGetBinaryPath()
First observation: There is no way that caps->binaryPath can be
NULL. Second observation: There is no caller that passes NULL.
Let's drop the ternary operator and access @caps directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Michal Privoznik
5c98d1cee0 virdnsmasq: Lookup DNSMASQ in PATH
While it's true that our virCommand subsystem is happy with
non-absolute paths, the dnsmasq capability code is not. It stores
the path to dnsmasq within and makes it accessible via
dnsmasqCapsGetBinaryPath(). While strictly speaking no caller
necessarily needs canonicalized path, let's find dnsmasq once and
cache the result.

Therefore, when constructing the capabilities structure look up
the binary path. If DNSMASQ already contains an absolute path
then virFindFileInPath() will simply return a copy.

With this code in place, the virFileIsExecutable() check can be
removed from dnsmasqCapsRefreshInternal() because
virFindFileInPath() already made sure the binary is executable.

But introducing virFindFileInPath() means we have to mock it in
test suite because dnsmasqCaps are created in
networkxml2conftest.

Moreover, we don't need to check for dnsmasq in configure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Michal Privoznik
96308ebae9 virdnsmasq: Don't run 'dnsmasq --help'
We don't query any capabilities of dnsmasq. We are only
interested in dnsmasq's version (obtained via 'dnsmasq
--version'). Therefore, there's no point in running 'dnsmasq
--help'. Its output is not processed even.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Michal Privoznik
ce6bb27649 virdnsmasq: Drop !caps check from dnsmasqCapsRefreshInternal()
There is no way that the dnsmasqCapsRefreshInternal() function
can be called with @caps == NULL. Therefore, drop the if() that
checks for that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Michal Privoznik
f947b2343a virdnsmasq: Drop noRefresh member from from struct _dnsmasqCaps
The noRefresh member of _dnsmasqCaps struct is set only after it
was checked for and is never checked again. This is needless and
the member can be removed. There is no way that
dnsmasqCapsRefreshInternal() can be called after
dnsmasqCapsSetFromBuffer().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Michal Privoznik
0a7224a147 virdnsmasq: Drop mtime member from struct _dnsmasqCaps
The _dnsmasqCaps struct has @mtime member which holds the mtime
of the dnsmasq binary. The idea was that capabilities don't need
to be queried if mtime hasn't changed since the last time.
However, the code that would try to query capabilities again was
removed and now we are left with code that stores mtime but has
no use for it.

Remove the member and code that uses it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Michal Privoznik
bc9fea6237 virdnsmasq: Drop @force argument of dnsmasqCapsRefreshInternal()
This argument is not used really as the only caller passes true
and dnsmasqCapsRefreshInternal() only checks for false value.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Michal Privoznik
6944c78d38 lib: Prefer g_autoptr(dnsmasqCaps) instead of explicit unref
The dnsmasqCaps type has its own cleanup function defined and
ready to use via g_autoptr(). Use automatic cleanup instead of
an explicit one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Michal Privoznik
a7ffa2a647 virdnsmasq: Drop @binaryPath argument from dnsmasqCapsNewEmpty()
Both callers of dnsmasqCapsNewEmpty() pass DNSMASQ as an argument
which is then fed to a ternary operator which looks like this
(after substitution).

  DNSMASQ ? DNSMASQ : DNSMASQ

While I like tautologies, the code can be simplified by dropping
the argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-18 15:19:47 +01:00
Peter Krempa
ce20fe5c2a qemuDomainPinIOThread: Update live definition after process pinning
Otherwise we'll keep using the new pinning value even if it can't be
applied to the thread.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2040555
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-01-18 14:16:48 +01:00
Peter Krempa
dcfa6c650d qemuDomainPinIOThread: Copy the cpu bitmap instead of re-parsing it
The bitmap recorded in the live/persistent definition was re-parsed two
more times. We can copy it which is cheaper and less verbose.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-01-18 14:16:48 +01:00
Jiri Denemark
a23ce0b956 qemu: Log which API is trying to acquire a job
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-18 13:58:38 +01:00
Olaf Hering
d2fb6b4b21 NEWS: mention removal of sysconfig
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-17 18:21:02 +01:00
Olaf Hering
8eb4461645 remove sysconfig files
sysconfig files are owned by the admin of the host. They have the
liberty to put anything they want into these files. This makes it
difficult to provide different built-in defaults.

Remove the sysconfig file and place the current desired default into
the service file.

Local customizations can now go either into /etc/sysconfig/name
or /etc/systemd/system/name.service.d/my-knobs.conf

Attempt to handle upgrades in libvirt.spec.
Dirty files which are marked as %config will be renamed to file.rpmsave.
To restore them automatically, move stale .rpmsave files away, and
catch any new rpmsave files in %posttrans.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-17 18:20:59 +01:00
Olaf Hering
31d461f575 docs: domain: document legacy audio for qemu
Adding a blurb like this was forgotten in 2009.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-17 18:20:56 +01:00
Jim Fehlig
161727417a docs: Add man page for libvirt-guests
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-17 18:20:55 +01:00
Jim Fehlig
3be5ba11a2 build: Only install libvirt-guests when building libvirtd
libvirt-guests was already moved to the libvirt daemon package in commit
d800c50349. It only needs to be installed when building libvirtd.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-17 18:20:52 +01:00
Michal Privoznik
fbe33e6587 testutils: Terminate usage string with a new line
If a test binary is executed with an argument then usage
information is printed out (that no arguments are accepted and
what environment variables affect execution). The string is
printed onto stderr but it is not terminated with a newline
character producing not so nice output.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-17 16:53:21 +01:00
Daniel P. Berrangé
4166f6bc59 examples: drop some conditionals checks from macros
We no longer need to worry about GCC version older than 7.4.0. The other
remaining conditionals checks were also overkill for the example code.
In the unlikely event that someone tries to re-use the code in a
scenario where further conditions apply they can figure out.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 10:44:33 +00:00
Daniel P. Berrangé
79f738c510 configure: bump min required CLang to 6.0 / XCode 10.0
Several distros have been dropped since the last time we bumped the
minimum required CLang version.

Per repology, currently shipping versions are:

             RHEL-8: 10.0.1
      Debian Buster: 7.0.1
 openSUSE Leap 15.2: 9.0.1
   Ubuntu LTS 18.04: 6.0.0
   Ubuntu LTS 20.04: 10.0.0
         FreeBSD 12: 8.0.1
          Fedora 33: 11.0.0
          Fedora 34: 11.1.0

With this list Ubuntu LTS 18.04 is the constraint at 6.0.0

An LLVM version of 6.0.0 corresponds to macOS XCode version of 10.0
which dates from Sept 2018.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 10:44:29 +00:00
Daniel P. Berrangé
a9377629f7 configure: bump min required GCC to 7.4.0
Several distros have been dropped since the last time we bumped the
minimum required GCC version.

Per repology, currently shipping versions are:

                 RHEL-8: 8.3.1
          Debian Buster: 8.3.0
     openSUSE Leap 15.2: 7.5.0
       Ubuntu LTS 18.04: 7.5.0
       Ubuntu LTS 20.04: 9.3.0
                FreeBSD: 10.3.0
              Fedora 33: 9.2.0
              Fedora 34: 11.0.1
                OpenBSD: 8.4.0
         macOS HomeBrew: 11.1.0

With this list Ubuntu LTS 18.04 / openSUSE Leap 15.2 are the
constraint at 7.5.0.

When QEMU bumped GCC to 7.5.0, however, it was reported that
this is a problem for NetBSD which still ships 7.4.0.

NetBSD is not an officially targetted platform for libvirt.
Given that QEMU saw complaints about this and the feature
difference between GCC 7.4.0 and 7.5.0 is minor, I'm being
friendly and sticking 7.4.0.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 10:44:08 +00:00
Tim Wiederhake
c807f65de6 docs: coding-style: Remove "no_memory" as acceptable goto target
There are no instances of that label left.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 10:59:19 +01:00
Tim Wiederhake
15ca9bf2bc docs: coding-style: Rewrite section on shortening comparisons
The code style showed `bool hasFoos; if (hasFoos == true)` as a
good example in one place, only to warn against comparisons with
`true` a couple of paragraphs further down.

Merge this advice on comparing with `true` into the "Conditional
expressions" section and split the example up for readability.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 10:58:59 +01:00
Michal Privoznik
364cf32e57 virsh: Remove needless labels
There are few places where a cleanup label contains nothing but a
return statement. Drop such labels and return directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
7b9cebac22 libxl: Remove needless labels
After previous cleanups some labels are needless: they contain
nothing but a return statement. Drop such labels and return
directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
d90cb8ff10 xen_xl.c: Use g_autoptr() for virCPUDef
In xenParseXLVnuma() the @cpu variable is freed explicitly.
However, when switched to g_autoptr(virCPUDef) the explicit call
can be removed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
ef7f01b6d0 xen_xl.c: Use g_autofree more
There are few places inside src/libxl/xen_xl.c that can benefit
from g_autofree. Let them use automatic memory freeing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
2645c66a6c libxl: Allocate @libxldisk in xenParseXLDisk() on stack
In xenParseXLDisk() the @libxldisk variable (which is type of
libxl_device_disk) is allocated on heap. But this is not
necessary as nothing in the function needs that approach.

Allocate the variable on the stack and drop corresponding
VIR_FREE() call.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
5a1bdcfbf0 libxl: Don't use a static buffer in xenParseXLVnuma()
The xenParseXLVnuma() function is responsible for parsing 'vnuma'
part of XL config and setting corresponding values in
virDomainDef. While doing so it uses a static buffer which is set
to data we are interested in and then parsing the buffer further
(e.g. string to integer conversion, bitmap parsing, and so on).
Well, the data we are interested in are already in a string
(@data) which can be used directly rendering this intermediary
buffer needless.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
17c324bd25 virconf: Make virConfSetValue() clear consumed pointer
The way that virConfSetValue() works (and the way it is even
documented) is that the @value pointer is always consumed.
However, since the first order pointer is passed it leaves
callers in a pickle situation - they always have to set pointer
to NULL after calling virConfSetValue() to avoid touching it.

Let's switch @value to a double pointer and clear it inside the
function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
94ce37c8e2 src: Declare and use g_autoptr(virConfValue)
This commit declares g_autoptr() function for virConfValue type.
At the same time, it switches variable declarations to use it.
Also, in a few places we might have freed a variable twice, for
instance in xenFormatXLDomainNamespaceData(). This is because
virConfSetValue() consumes passed pointer (@value) even in case
of failure and thus any code that uses virConfSetValue() must
refrain from touching @value and it must not call
virConfFreeValue().

This semantic is not obvious and will be addressed in one of
future commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
8b12f6af0b xen_xl: Check for virConfSetValue() retval
There's one case where the return value of virConfSetValue() is
not checked for and it's in xenFormatXLInputDevs() function.
Let's fix that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
dfda149e15 virconf: Report an error in when virConfSetValue() fails
Callers of virConfSetValue() don't report any error, they just
pass the error blindly. Therefore, report an error when
virConfSetValue() is about to fail.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:45 +01:00
Michal Privoznik
ad051d2a74 storage_file: Declare virStorageSourceParseRBDColonString only in one header
The virStorageSourceParseRBDColonString() function is declared in
src/storage_file/storage_source.h and
src/storage_file/storage_source_backingstore.h but implemented
only in the .c that corresponds to the latter header file.
Therefore, drop declaration from storage_source.h as the function
is not implemented in its corresponding .c file.

Leftover from: 2d29a3a9d8
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:53:44 +01:00
Peter Krempa
1a691fe1c8 qemu: capabilities: Re-enable JSON syntax for -device
Now that qemu fixed device unplug when JSON syntax is used with -device
we can re-enable the feature.

Since the old capability string representation is condemned by
suggesting filtering it as a workaround we must introduce a new string.
To achieve this the original capability position is renamed to
X_QEMU_CAPS_DEVICE_JSON_BROKEN_HOTPLUG and a new position with the
original name QEMU_CAPS_DEVICE_JSON is introduced to prevent us having
to change the rest of the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:26:17 +01:00
Peter Krempa
cb15bf9d4d tests: qemucapabilities: Add test data for the qemu-7.0 development cycle
Update to commit v6.2.0-874-g1cd2ad11d3

Notable changes are:
- added flag noting that use of JSON syntax for -device was fixed
- 'dbus' backend for graphics and character devices added
- virtio-mem added 'node' property
- 'clusters' added to CPU topology
- 'open-timeout' property for NBD protocol backend
- 'wheel-left' and 'wheel-right' event types for 'input-send-event'
- increased default resolution to '1280x800' on 'virtio-gpu'
- SGX property 'section-size' changed to 'sections' incompatibly
  (unused luckily)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:26:17 +01:00
Peter Krempa
8a1e6c1ab1 qemuxml2(argv|xml)data: x86-kvm-32-on-64: Add machine type
The machine type doesn't change the test result and prevents tests being
changed every time we are about to update real capabilities to a new
qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-17 09:26:17 +01:00
Michal Privoznik
4f6d5656d3 tests: Report expected monitor command for simulated commands
There are two tests currently that simulate QMP talk:
qemucapabilitiestest and qemuhotplugtest. In both cases they
check whether currently executed command is the one for which
reply was provided. If not an error message is reported. However,
the error message contains only the actual command and not the
expected one. This makes it harder to navigate through .replies
files.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-15 06:33:33 +01:00
Göran Uddeborg
6076ca7a03 Translated using Weblate (Swedish)
Currently translated at 30.5% (3191 of 10455 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>
2022-01-14 23:16:33 +01:00
Daniel P. Berrangé
c723a98618 qemu: split handling of distinct firmware enum conversions
The qemuFirmwareOSInterfaceTypeFromOsDefFirmware method
was added to convert from virDomainOsDefFirmware to the
qemuFirmwareOSInterface enum.

It was later also used to convert from virDomainLoader
to qemuFirmwareOSInterface in:

  commit 8e1804f9f6
  Author: Michal Prívozník <mprivozn@redhat.com>
  Date:   Tue Dec 17 17:45:50 2019 +0100

    qemu_firmware: Try to autofill for old style UEFI specification

This caused compile errors with clang due to passing a
mis-matched enum type. These were later silenced by
stripping the enum types:

  commit 8fcee47807
  Author: Michal Prívozník <mprivozn@redhat.com>
  Date:   Wed Jan 8 09:42:47 2020 +0100

    qemu_firmware: Accept int in qemuFirmwareOSInterfaceTypeFromOsDefFirmware()

This is still rather confusing to humans reading the
code. It is clearer to just define a separate helper
method for the virDomainLoader type conversion.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-14 18:56:39 +00:00
Daniel P. Berrangé
4bb150ed3a docs: use virYesNo definition in more schemas
A few places are still using an expend yes/no choice instead of the
common virYesNo definition.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-14 18:56:37 +00:00
Daniel P. Berrangé
08e3d9ed24 docs: split example for <os> schema
The docs illustration for the <os> schema contains a mixture of
incompatible configuration options. This is rather confusing and
misleading to users. Splitting the illustration into four separate
examples clarifies the situation.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-14 18:56:23 +00:00
Ivan Teterevkov
19407e8d7d meson: Detect rst2html5 and rst2man only when needed
Detect these commands in docs/meson.build, i.e. only when
users enable documentation.

Signed-off-by: Ivan Teterevkov <ivan.teterevkov@nutanix.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-14 18:17:56 +01:00
Peter Krempa
717f1cc4d1 virDomainSnapshotRedefinePrep: Don't do partial redefine
'virDomainSnapshotRedefinePrep' does everything needed for a redefine
when the snapshot exists but not when we are defining metadata for a new
snapshot. This gives us weird semantics.

Extract the code for replacing the definition of an existing snapshot
into a new helper 'virDomainSnapshotReplaceDef' and refactor all
callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:58 +01:00
Peter Krempa
d281c1323f virDomainSnapshotAssignDef: Clear second argument when it is consumed
Rather than callers second-guessing when the snapshot definition is
assigned turn it into a double pointer and clear it on success.

Fix callers to work with the new semantics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:58 +01:00
Peter Krempa
91df85e057 qemuDomainSnapshotLoad: Refactor handling of snapshot definition object
Move the variable holding the snapshot definition into the loop and use
automatic clearing for it. Adjust the code for parity.

Note that the clearing of 'snapdef' on success of
'virDomainSnapshotAssignDef' will be refactored in upcoming patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:58 +01:00
Peter Krempa
2d0f7d779d qemuSnapshotCreate: Standardize handling of the reference on @snapdef
As with qemuSnapshotRedefine, make an extra reference in a temporary
autocleaned variable and use that instead of refing the definition after
it's stolen.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:58 +01:00
Peter Krempa
c0fd70c1e1 qemuSnapshotCreate: Use 'snapdef' instead of 'def'
'def' is commonly used for domain definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:58 +01:00
Peter Krempa
4584a451e6 testDomainSnapshotCreateXML: Extract snapshot redefinition code
The test driver code was copied from qemu but wasn't refactored
recently. Split out the redefinition code similarly to what qemu driver
did.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:58 +01:00
Peter Krempa
bec2a922bd virDomainSnapshotRedefineValidate: Don't modify the snapshot definition
It is not expected that a function with 'Validate' in the name actually
modifies the validated object, even worse when it even modifies another
object and the ultimatively worst bit is that it doesn't undo the mess
if the validation fails midway.

Move the stealing of the domain definition from the definition of a
snapshot being redefined into the caller along with the call to
virDomainSnapshotAlignDisks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:58 +01:00
Peter Krempa
504b108cb9 virDomainSnapshotRedefinePrep: Use 'snapdef' for snapshot definition object
We use this variable name to distinguish it from the domain definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:58 +01:00
Peter Krempa
d1d4983dfc virDomainSnapshotRedefineValidate: Unexport
The function isn't used outside of src/conf/snapshot_conf.c as of
57d252c74

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:11:33 +01:00
Peter Krempa
ef3f3884a2 virDomainSnapshotAlignDisks: Allow alternate domain definition when redefining
Due to historical reasons we allow users to redefine an existing
snapshot without providing the domain definition which would correspond
to it. In such case we'd use the domain definition from the snapshot
that is being redefined.

To prevent callers from doing complex moving of the domain definition
object back and forth between the snapshot definitions we can add an
argument to virDomainSnapshotAlignDisks which will allow us to pass in
the alternate definition if the one from the snapshot is missing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:05:30 +01:00
Peter Krempa
0b97d87a6d virDomainSnapshotAlignDisks: Move 'require_match' selection logic inside
'require_match' set to true is only needed for internal snapshots taken
by hypervisors (qemu) which don't have a way to control which disks take
part in the snapshot (savevm).

To de-clutter callers we can change the argument to mean 'this code path
requires uniform snapshot for internal snapshots'.

Change the argument and fix the callers. For now all callers pass 'true'
but any new hypervisor or even usage in qemu is not going to share the
limitation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:05:30 +01:00
Peter Krempa
311b300d85 virDomainSnapshotAlignDisks: Convert @default_snapshot to virDomainSnapshotLocation
Use the appropriate type for the variable and fix all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:05:29 +01:00
Peter Krempa
94686f1919 virDomainSnapshotAlignDisks: Improve function comment
Add description of arguments, reword the description for clarity, and
fix improper argument names mentioned in the existing description.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:05:29 +01:00
Peter Krempa
82e0a1878e virDomainSnapshotRedefineValidate: Fix validation of VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY flag
External snapshot with memory is created without using the
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY flag, but rather with properly
configuring the XML. When redefining the code should be checking the
same thing as by definition an external snapshot with memory is not a
disk-only snapshot.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:05:29 +01:00
Peter Krempa
ebfe9b1a15 virDomainMomentAssignDef: Simplify error handling
Remove error handling from the call to 'virDomainMomentObjNew' as it
can't return NULL and replace 'virHashAddEntry' by 'g_hash_table_insert'
as we've already checked that snapshot with such name doesn't exist in
the hash table. This removes handling for two impossible errors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-14 18:05:29 +01:00
Divya Garg
abf9eac87c qemu: add index for isa-serial device using target.port
VM XML accepts target.port but this does not get passed while
building the QEMU command line for this VM.

Signed-off-by: Divya Garg <divya.garg@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:41:57 +01:00
Divya Garg
11ddab1daf Add the port allocation logic for isa-serial devices.
This commit takes care of following cases:
-> Check availability of requested ports.
  ->The total number of requested ports should not be more than
    VIR_MAX_ISA_SERIAL_PORTS.
  ->The ports requested should be less than VIR_MAX_ISA_SERIAL_PORTS.
  ->VIR_MAX_ISA_SERIAL_PORTS should correspond to MAX_ISA_SERIAL_PORTS
    specified in QEMU code commit def337ffda34d331404bd7f1a42726b71500df22.
-> Prevent duplicate device assignments to the same port.
-> In case no ports are provided in the XML, this patch scans the list of unused
   isa-serial indices to automatically assign available ports for this VM.

Signed-off-by: Divya Garg <divya.garg@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:41:57 +01:00
Tim Wiederhake
d8f6e198bf virInterfaceDefParse: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:50 +01:00
Tim Wiederhake
56b4186efc virInterfaceDefParseXML: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:50 +01:00
Tim Wiederhake
7443101eb0 virInterfaceDefParseIfAdressing: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:50 +01:00
Tim Wiederhake
a2d7bb4062 virInterfaceDefParseProtoIPv6: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:50 +01:00
Tim Wiederhake
f4b970dc2a virInterfaceDefParseProtoIPv4: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:49 +01:00
Tim Wiederhake
86cfd4d4e8 virInterfaceDefParseDhcp: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:49 +01:00
Tim Wiederhake
5f9c35ffd6 virInterfaceDefParseIP: Simplify and cleanup
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:49 +01:00
Tim Wiederhake
91624098e0 virInterfaceDefParseXML: Inline trivial virInterfaceDefParseName
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:49 +01:00
Tim Wiederhake
3d54880af1 conf: interface: Remove ret and goto
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:49 +01:00
Tim Wiederhake
9dde307c44 conf: interface: Use g_auto
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:49 +01:00
Tim Wiederhake
77eb77ef4a conf: interface: Preparation for g_auto
These changes make the g_auto-ification in the next commit clearer.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:49 +01:00
Tim Wiederhake
c5860d177b virInterfaceDefDevFormat: Add missing error handling
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-14 15:38:49 +01:00
Jiri Denemark
fdc5f5d7ac Post-release version bump to 8.1.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-01-14 15:17:26 +01:00
1217 changed files with 133688 additions and 60315 deletions

View File

@@ -1,38 +0,0 @@
-I@abs_top_builddir@
-I@abs_top_srcdir@
-I@abs_top_builddir@/include
-I@abs_top_srcdir@/include
-I@abs_top_builddir@/src
-I@abs_top_srcdir@/src
-I@abs_top_builddir@/src/access
-I@abs_top_srcdir@/src/access
-I@abs_top_builddir@/src/admin
-I@abs_top_srcdir@/src/admin
-I@abs_top_builddir@/src/bhyve
-I@abs_top_srcdir@/src/bhyve
-I@abs_top_builddir@/src/conf
-I@abs_top_srcdir@/src/conf
-I@abs_top_builddir@/src/libxl
-I@abs_top_srcdir@/src/libxl
-I@abs_top_builddir@/src/locking
-I@abs_top_srcdir@/src/locking
-I@abs_top_builddir@/src/logging
-I@abs_top_srcdir@/src/logging
-I@abs_top_builddir@/src/lxc
-I@abs_top_srcdir@/src/lxc
-I@abs_top_builddir@/src/qemu
-I@abs_top_srcdir@/src/qemu
-I@abs_top_builddir@/src/remote
-I@abs_top_srcdir@/src/remote
-I@abs_top_builddir@/src/rpc
-I@abs_top_srcdir@/src/rpc
-I@abs_top_builddir@/src/secret
-I@abs_top_srcdir@/src/secret
-I@abs_top_builddir@/src/security
-I@abs_top_srcdir@/src/security
-I@abs_top_builddir@/src/util
-I@abs_top_srcdir@/src/util
-I@abs_top_builddir@/src/vmx
-I@abs_top_srcdir@/src/vmx
-I@abs_top_builddir@/src/xenconfig
-I@abs_top_srcdir@/src/xenconfig

22
.gitattributes vendored Normal file
View File

@@ -0,0 +1,22 @@
# Generic git stuff
**/.gitattributes export-ignore
**/.gitignore export-ignore
/.gitmodules export-ignore
/.mailmap export-ignore
# Project-specific git stuff
/.gitpublish export-ignore
/docs/gitdm export-ignore
/docs/gitdm/** export-ignore
/gitdm.config export-ignore
# Code hosting stuff
/.github export-ignore
/.github/** export-ignore
/.gitlab export-ignore
/.gitlab/** export-ignore
# CI stuff
/.gitlab-ci.yml export-ignore
/ci export-ignore
/ci/** export-ignore

View File

@@ -4,6 +4,7 @@ variables:
stages: stages:
- containers - containers
- builds - builds
- integration_tests
- sanity_checks - sanity_checks
.script_variables: &script_variables | .script_variables: &script_variables |
@@ -14,7 +15,9 @@ stages:
export VIR_TEST_VERBOSE="1" export VIR_TEST_VERBOSE="1"
export VIR_TEST_DEBUG="1" export VIR_TEST_DEBUG="1"
include: '/ci/gitlab.yml' include:
- '/ci/gitlab.yml'
- '/ci/integration.yml'
.native_build_job: .native_build_job:
extends: .gitlab_native_build_job extends: .gitlab_native_build_job
@@ -30,7 +33,8 @@ include: '/ci/gitlab.yml'
- meson dist -C build --no-tests - meson dist -C build --no-tests
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip"; - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
then then
rpmbuild --nodeps -ta build/meson-dist/libvirt-*.tar.xz; rpmbuild --clean --nodeps --define "_topdir $PWD/rpmbuild/" -ta build/meson-dist/libvirt-*.tar.xz;
mv rpmbuild/RPMS/x86_64/ libvirt-rpms/;
else else
meson compile -C build; meson compile -C build;
meson test -C build --no-suite syntax-check --print-errorlogs; meson test -C build --no-suite syntax-check --print-errorlogs;
@@ -56,9 +60,9 @@ include: '/ci/gitlab.yml'
# https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=website # https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=website
website: website:
stage: builds stage: builds
image: $CI_REGISTRY_IMAGE/ci-centos-8:latest image: $CI_REGISTRY_IMAGE/ci-almalinux-8:latest
needs: needs:
- x86_64-centos-8-container - x86_64-almalinux-8-container
before_script: before_script:
- *script_variables - *script_variables
script: script:
@@ -92,9 +96,9 @@ codestyle:
# https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=potfile # https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=potfile
potfile: potfile:
stage: builds stage: builds
image: $CI_REGISTRY_IMAGE/ci-centos-8:latest image: $CI_REGISTRY_IMAGE/ci-almalinux-8:latest
needs: needs:
- x86_64-centos-8-container - x86_64-almalinux-8-container
rules: rules:
- if: "$CI_COMMIT_BRANCH == 'master'" - if: "$CI_COMMIT_BRANCH == 'master'"
before_script: before_script:
@@ -114,9 +118,9 @@ potfile:
# Coverity job that is run only by schedules # Coverity job that is run only by schedules
coverity: coverity:
image: $CI_REGISTRY_IMAGE/ci-centos-8:latest image: $CI_REGISTRY_IMAGE/ci-almalinux-8:latest
needs: needs:
- x86_64-centos-8-container - x86_64-almalinux-8-container
stage: builds stage: builds
script: script:
- curl https://scan.coverity.com/download/linux64 --form project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN -o /tmp/cov-analysis-linux64.tgz - curl https://scan.coverity.com/download/linux64 --form project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN -o /tmp/cov-analysis-linux64.tgz

View File

@@ -1,43 +0,0 @@
flags = [
'-I@abs_top_builddir@',
'-I@abs_top_srcdir@',
'-I@abs_top_builddir@/include',
'-I@abs_top_srcdir@/include',
'-I@abs_top_builddir@/src',
'-I@abs_top_srcdir@/src',
'-I@abs_top_builddir@/src/access',
'-I@abs_top_srcdir@/src/access',
'-I@abs_top_builddir@/src/admin',
'-I@abs_top_srcdir@/src/admin',
'-I@abs_top_builddir@/src/bhyve',
'-I@abs_top_srcdir@/src/bhyve',
'-I@abs_top_builddir@/src/conf',
'-I@abs_top_srcdir@/src/conf',
'-I@abs_top_builddir@/src/libxl',
'-I@abs_top_srcdir@/src/libxl',
'-I@abs_top_builddir@/src/locking',
'-I@abs_top_srcdir@/src/locking',
'-I@abs_top_builddir@/src/logging',
'-I@abs_top_srcdir@/src/logging',
'-I@abs_top_builddir@/src/lxc',
'-I@abs_top_srcdir@/src/lxc',
'-I@abs_top_builddir@/src/qemu',
'-I@abs_top_srcdir@/src/qemu',
'-I@abs_top_builddir@/src/remote',
'-I@abs_top_srcdir@/src/remote',
'-I@abs_top_builddir@/src/rpc',
'-I@abs_top_srcdir@/src/rpc',
'-I@abs_top_builddir@/src/secret',
'-I@abs_top_srcdir@/src/secret',
'-I@abs_top_builddir@/src/security',
'-I@abs_top_srcdir@/src/security',
'-I@abs_top_builddir@/src/util',
'-I@abs_top_srcdir@/src/util',
'-I@abs_top_builddir@/src/vmx',
'-I@abs_top_srcdir@/src/vmx',
'-I@abs_top_builddir@/src/xenconfig',
'-I@abs_top_srcdir@/src/xenconfig',
]
def FlagsForFile(filename, **kwargs):
return { 'flags': flags, 'do_cache': True }

160
NEWS.rst
View File

@@ -8,6 +8,166 @@ the changes introduced by each of them.
For a more fine-grained view, use the `git log`_. For a more fine-grained view, use the `git log`_.
v8.2.0 (2022-04-01)
===================
* **New features**
* qemu: Introduce ``manual`` disk snapshot mode
This new mode allows users to synchronize libvirt snapshots with snapshots
which need to be done outside of libvirt e.g. when 'vhost-user-blk' is used
to back the disk.
* Introduce memory allocation threads
When starting a QEMU guest, libvirt can now instruct QEMU to allocate
guest's memory in parallel. This may be handy when guest has large amounts
of memory.
* **Improvements**
* qemu: ``VIR_MIGRATE_PARAM_TLS_DESTINATION`` now works with non-shared storage migration
The setting now also applies to the NBD connections for non-shared storage
migration allowing migration to proceed even when the user expects certificate
name not to match.
* qemu: Allow overrides of device properties via the qemu namespace
Users wishing to override or modify properties of devices configured by
libvirt can use the ``<qemu:deviceOverride>`` QEMU namespace element to
specify the overrides instead of relying on the argv passthrough of the
``-set`` qemu commandline option which no longer works with new qemu.
* qemu: Allow passing file descriptors to ``virsh qemu-monitor-command``
Passing FDs allows users wanting to experiment with qemu driven by libvirt
use commands like ``add-fd`` properly.
* libxl: Turn on user aliases
Users can now use so called user aliases for XEN domains.
* Implement support for FUSE3
The LXC driver uses fuse to overwrite some lines in ``/proc/meminfo``
inside containers so that they see correct amount of memory given to them.
The code was changed so that both ``fuse`` and ``fuse3`` are supported.
* Improve domain save/restore throughput
Code that's handling save or restore of QEMU domains was changed resulting
in better performance of I/O and thus shortening time needed for the operation.
* **Bug fixes**
* Both build and tests should now pass on Alpine Linux or any other
distribution with musl libc.
* virsh: Fix integer overflow in allocpages
On hosts which support hugepages larger than 1GiB ``virsh allocpages``
failed to accept them because of an integer overflow. This is now fixed.
* qemu: Fix segmentation fault in virDomainUndefineFlags
When a domain without any ``<loader/>`` was being undefined, libvirt has
crashed. This is now fixed.
* lxc: Fix unaligned reads of /proc/meminfo within a container
When /proc/meminfo was read in chunks smaller than the entire file, libvirt
would produce mangled output. While porting the code to FUSE3 this area was
reworked and the file can now be read with any granularity.
* qemu: Be less aggressive around cgroup_device_acl
A basic set of devices common to every domain can be set in ``qemu.conf``
via cgroup_device_acl knob. Devices from this set are allowed in CGroup and
created in domain private namespace for every domain. However, upon device
hotunplug it may have had happened that libvirt mistakenly denied a device
from this set and/or removed it from the namespace. For instance,
/dev/urandom was removed and denied in CGroup on RNG hotunplug.
* nodedev: trigger mdev device definition update on udev add and remove
When nodedev objects are added and removed mdev device definitions are
updated to report correct associated parent.
v8.1.0 (2022-03-01)
===================
* **New features**
* qemu: Add hvf domain type for Hypervisor.framework
It works on Intel machines as well as recent machines powered by Apple
Silicon. QEMU 6.2.0 is needed for Apple Silicon support.
* qemu: Support mode option for dirtyrate calculation
Introduce ``virDomainDirtyRateCalcFlags`` as parameter of
``virDomainStartDirtyRateCalc``, which is used to specify the mode of
dirty page rate calculation.
Add ``--mode`` option to ``virsh domdirtyrate-calc``, which can be
either of the following 3 options:
``page-sampling, dirty-bitmap, dirty-ring``.
Add ``calc_mode`` field for dirtyrate statistics returned by
``virsh domstats --dirtyrate``, also add ``vCPU dirtyrate`` if
``dirty-ring`` mode was used in last measurement.
* **Improvements**
* packaging: sysconfig files no longer installed
libvirt used to provide defaults in various /etc/sysconfig/ files, such
as /etc/sysconfig/libvirtd. Since these files are owned by the admin, this
made it difficult to change built-in defaults in case such file was
modified by the admin. The built-in defaults are now part of the provided
systemd unit files, such as libvirtd.service. These unit files continue
to parse sysconfig files, in case they are created by the admin and filled
with the desired key=value pairs.
* virnetdev: Ignore EPERM on implicit clearing of VF VLAN ID
Libvirt will now ignore EPERM errors on attempts to implicitly clear a
VLAN ID (when a VLAN is not explicitly provided via an interface XML
using a 0 or a non-zero value) as SmartNIC DPUs do not expose VLAN
programming capabilities to the hypervisor host. This allows Libvirt
clients to avoid specifying a VLAN and expect VF configuration to work
since Libvirt tries to clear a VLAN in the same operation
as setting a MAC address for VIR_DOMAIN_NET_TYPE_HOSTDEV devices which
is now split into two distinct operations. EPERM errors received while
trying to program a non-zero VLAN ID or explicitly program a VLAN ID 0
will still cause errors as before so there is no change in behavior
in those cases.
* **Bug fixes**
* Remove unix sockets from filesystem when disabling a '.socket' systemd unit
The presence of the socket files is used by our remote driver to determine
which service to access. Since neither systemd nor the daemons clean up the
socket file clients were running into problems when a modular deployment was
switched to monolithic ``libvirtd``.
* qemu: Fixes of fd passing during hotplug and hotunplug of chardevs
FDs used as chardev backing are now properly removed when hot-unplugging
a chardev from qemu and hotplugged chardevs now properly use ``virtlogd``
to handle the input and output from qemu.
* RPM: Run pre/post-install steps on ``daemon-driver-storage-core``
Previously the pre/post-install code was part of the meta-package which
installed all storage driver sub-packages thus a minimalistic install
of the storage driver didn't behave correctly.
v8.0.0 (2022-01-14) v8.0.0 (2022-01-14)
=================== ===================

View File

@@ -20,7 +20,7 @@ endif
if host_machine.system() == 'freebsd' if host_machine.system() == 'freebsd'
grep_prog = find_program('grep') grep_prog = find_program('grep')
grep_cmd = run_command(grep_prog, '--version') grep_cmd = run_command(grep_prog, '--version', check: true)
if grep_cmd.stdout().startswith('grep (BSD grep') if grep_cmd.stdout().startswith('grep (BSD grep')
grep_prog = find_program('/usr/local/bin/grep', required: false) grep_prog = find_program('/usr/local/bin/grep', required: false)
if not grep_prog.found() if not grep_prog.found()

View File

@@ -116,6 +116,7 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX = \
# the safewrite wrapper. # the safewrite wrapper.
sc_avoid_write: sc_avoid_write:
@prohibit='\<write *\(' \ @prohibit='\<write *\(' \
exclude='sc_avoid_write' \
in_vc_files='\.c$$' \ in_vc_files='\.c$$' \
halt='consider using safewrite instead of write' \ halt='consider using safewrite instead of write' \
$(_sc_search_regexp) $(_sc_search_regexp)
@@ -244,7 +245,7 @@ sc_prohobit_vsnprintf:
sc_prohibit_strdup: sc_prohibit_strdup:
@prohibit='\<strn?dup\> *\(' \ @prohibit='\<strn?dup\> *\(' \
halt='use VIR_STRDUP, not strdup' \ halt='use g_str(n)dup, not str(n)dup' \
$(_sc_search_regexp) $(_sc_search_regexp)
# Prefer virSetUIDGID. # Prefer virSetUIDGID.
@@ -874,20 +875,61 @@ sc_prohibit_obj_free_apis_in_virsh:
halt='avoid using public virXXXFree in virsh, use virsh-prefixed wrappers instead' \ halt='avoid using public virXXXFree in virsh, use virsh-prefixed wrappers instead' \
$(_sc_search_regexp) $(_sc_search_regexp)
https_sites = www.libvirt.org # Links in various schemas
https_sites += libvirt.org http_sites = libvirt.org.*\/schemas\/
https_sites += security.libvirt.org http_sites += \.dtd
https_sites += qemu.org http_sites += libosinfo
https_sites += www.qemu.org http_sites += localhost
https_sites += wiki.qemu.org http_sites += rdf:resource
https_sites += linux-kvm.org http_sites += schemas.dmtf.org
https_sites += www.linux-kvm.org http_sites += schemas.microsoft.com
http_sites += schemas.xmlsoap.org
http_sites += www.inkscape.org
http_sites += www.innotek.de
http_sites += www.w3.org
http_sites += xmlns
https_re= ($(subst $(space),|,$(https_sites))) # Links in licenses
http_sites += scripts.sil.org
http_sites += www.gnu.org\/licenses\/
http_sites += www.sun.com
# Example links
http_sites += example.com
http_sites += example.org
http_sites += herp.derp
# HTTP-only sites
http_sites += 0pointer.de
http_sites += mah.everybody.org
http_sites += mingw.org
http_sites += munin.projects.linpro.no
http_sites += netcat.sourceforge.net
http_sites += snooze.inria.fr
http_sites += www.nimbusproject.org
http_sites += www.odin.com
http_sites += www.sflow.net
http_sites += xmlsoft.org
http_sites += etallen.com
# dead sites
http_sites += blog.lystor.org.ua
http_sites += blog.mes-stats.fr
http_sites += cc1.ifj.edu.pl
http_sites += www.javvin.com
# 404 links
http_sites += publib.boulder.ibm.com
http_sites += kerneltrap.org
http_sites += www.microsoft.com
http_sites += xenbits.xen.org
http_sites += lovezutto.googlepages.com
http_re= ($(subst $(space),|,$(http_sites)))
sc_prohibit_http_urls: sc_prohibit_http_urls:
@prohibit='http://$(https_re)' \ @prohibit='http://\w' \
exclude="/schemas/" \ exclude="$(http_re)" \
halt='Links must use https:// protocol' \ halt='Links must use https:// protocol' \
$(_sc_search_regexp) $(_sc_search_regexp)
@@ -1506,7 +1548,7 @@ sc_spacing-check:
{ echo '$(ME): incorrect formatting' 1>&2; exit 1; } { echo '$(ME): incorrect formatting' 1>&2; exit 1; }
sc_mock-noinline: sc_mock-noinline:
$(AM_V_GEN)$(VC_LIST_EXCEPT) | $(GREP) '\.[ch]$$' | $(RUNUTF8) xargs \ $(AM_V_GEN)$(VC_LIST_EXCEPT) | $(GREP) '\.[ch]$$' | $(RUNUTF8) \
$(PYTHON) $(top_srcdir)/scripts/mock-noinline.py $(PYTHON) $(top_srcdir)/scripts/mock-noinline.py
sc_header-ifdef: sc_header-ifdef:
@@ -1527,10 +1569,7 @@ sc_prohibit_enum_impl_with_vir_prefix_in_virsh:
# List all syntax-check exemptions: # List all syntax-check exemptions:
exclude_file_name_regexp--sc_avoid_strcase = ^tools/vsh\.h$$ exclude_file_name_regexp--sc_avoid_strcase = ^tools/vsh\.h$$
_src1=libvirt-stream|qemu/qemu_monitor|util/vir(command|file|fdstream)|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon|logging/log_daemon|remote/remote_ssh_helper exclude_file_name_regexp--sc_avoid_write = ^src/libvirt-stream\.c$$
_test1=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock|commandhelper
exclude_file_name_regexp--sc_avoid_write = \
^(src/($(_src1))|tools/virsh-console|tests/($(_test1)))\.c$$
exclude_file_name_regexp--sc_bindtextdomain = .* exclude_file_name_regexp--sc_bindtextdomain = .*
@@ -1580,7 +1619,7 @@ exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic = \
^src/rpc/gendispatch\.pl$$ ^src/rpc/gendispatch\.pl$$
exclude_file_name_regexp--sc_prohibit_nonreentrant = \ exclude_file_name_regexp--sc_prohibit_nonreentrant = \
^((po|tests|examples)/|docs/.*(py|js|html\.in)|run.in$$|tools/wireshark/util/genxdrstub\.pl|tools/virt-login-shell\.c$$) ^((po|tests|examples)/|docs/.*(py|js|html\.in|.rst)|run.in$$|tools/wireshark/util/genxdrstub\.pl|tools/virt-login-shell\.c$$)
exclude_file_name_regexp--sc_prohibit_select = \ exclude_file_name_regexp--sc_prohibit_select = \
^build-aux/syntax-check\.mk$$ ^build-aux/syntax-check\.mk$$

View File

@@ -4,7 +4,7 @@
# #
# https://gitlab.com/libvirt/libvirt-ci # https://gitlab.com/libvirt/libvirt-ci
FROM docker.io/library/centos:8 FROM docker.io/library/almalinux:8
RUN dnf update -y && \ RUN dnf update -y && \
dnf install 'dnf-command(config-manager)' -y && \ dnf install 'dnf-command(config-manager)' -y && \

View File

@@ -0,0 +1,82 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool manifest ci/manifest.yml
#
# https://gitlab.com/libvirt/libvirt-ci
FROM docker.io/library/alpine:3.14
RUN apk update && \
apk upgrade && \
apk add \
acl-dev \
attr-dev \
audit-dev \
augeas \
bash-completion \
ca-certificates \
ccache \
ceph-dev \
clang \
curl-dev \
cyrus-sasl-dev \
diffutils \
dnsmasq \
eudev-dev \
fuse-dev \
gcc \
gettext \
git \
glib-dev \
gnutls-dev \
grep \
iproute2 \
iptables \
kmod \
libcap-ng-dev \
libnl3-dev \
libpcap-dev \
libpciaccess-dev \
libselinux-dev \
libssh-dev \
libssh2-dev \
libtirpc-dev \
libxml2-dev \
libxml2-utils \
libxslt \
lvm2 \
lvm2-dev \
make \
meson \
musl-dev \
netcf-dev \
nfs-utils \
numactl-dev \
open-iscsi \
parted-dev \
perl \
pkgconf \
polkit \
py3-docutils \
py3-flake8 \
python3 \
qemu-img \
readline-dev \
rpcgen \
samurai \
sed \
util-linux-dev \
wireshark-dev \
xen-dev \
yajl-dev && \
apk list | sort > /packages.txt && \
mkdir -p /usr/libexec/ccache-wrappers && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"

View File

@@ -0,0 +1,81 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool manifest ci/manifest.yml
#
# https://gitlab.com/libvirt/libvirt-ci
FROM docker.io/library/alpine:edge
RUN apk update && \
apk upgrade && \
apk add \
acl-dev \
attr-dev \
audit-dev \
augeas \
bash-completion \
ca-certificates \
ccache \
ceph-dev \
clang \
curl-dev \
cyrus-sasl-dev \
diffutils \
dnsmasq \
eudev-dev \
fuse-dev \
gcc \
gettext \
git \
glib-dev \
gnutls-dev \
grep \
iproute2 \
iptables \
kmod \
libcap-ng-dev \
libnl3-dev \
libpcap-dev \
libpciaccess-dev \
libselinux-dev \
libssh-dev \
libssh2-dev \
libtirpc-dev \
libxml2-dev \
libxml2-utils \
libxslt \
lvm2 \
lvm2-dev \
make \
meson \
musl-dev \
netcf-dev \
nfs-utils \
numactl-dev \
open-iscsi \
parted-dev \
perl \
pkgconf \
polkit \
py3-docutils \
py3-flake8 \
python3 \
qemu-img \
readline-dev \
samurai \
sed \
util-linux-dev \
wireshark-dev \
xen-dev \
yajl-dev && \
apk list | sort > /packages.txt && \
mkdir -p /usr/libexec/ccache-wrappers && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"

View File

@@ -0,0 +1,90 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool manifest ci/manifest.yml
#
# https://gitlab.com/libvirt/libvirt-ci
FROM quay.io/centos/centos:stream9
RUN dnf update -y && \
dnf install 'dnf-command(config-manager)' -y && \
dnf config-manager --set-enabled -y crb && \
dnf install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm && \
dnf install -y \
audit-libs-devel \
augeas \
bash-completion \
ca-certificates \
clang \
cpp \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \
fuse-devel \
gcc \
gettext \
git \
glib2-devel \
glibc-devel \
glibc-langpack-en \
gnutls-devel \
grep \
iproute \
iproute-tc \
iptables \
iscsi-initiator-utils \
kmod \
libacl-devel \
libattr-devel \
libblkid-devel \
libcap-ng-devel \
libcurl-devel \
libnl3-devel \
libpcap-devel \
libpciaccess-devel \
librbd-devel \
libselinux-devel \
libssh-devel \
libtirpc-devel \
libwsman-devel \
libxml2 \
libxml2-devel \
libxslt \
lvm2 \
make \
meson \
nfs-utils \
ninja-build \
numactl-devel \
numad \
parted-devel \
perl-base \
pkgconfig \
polkit \
python3 \
python3-docutils \
qemu-img \
readline-devel \
rpcgen \
rpm-build \
sanlock-devel \
scrub \
sed \
systemd-devel \
systemtap-sdt-devel \
wireshark-devel \
yajl-devel && \
dnf autoremove -y && \
dnf clean all -y && \
rpm -qa | sort > /packages.txt
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales dpkg-reconfigure locales
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -97,8 +97,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -92,8 +92,7 @@ RUN zypper update -y && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -99,8 +99,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -98,8 +98,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
RUN pip3 install \ RUN pip3 install meson==0.56.0
meson==0.56.0
ENV LANG "en_US.UTF-8" ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make" ENV MAKE "/usr/bin/make"

View File

@@ -10,8 +10,7 @@
stage: containers stage: containers
needs: [] needs: []
services: services:
- name: registry.gitlab.com/libvirt/libvirt-ci/docker-dind:master - docker:dind
alias: docker
before_script: before_script:
- export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest" - export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest"
- export COMMON_TAG="$CI_REGISTRY/libvirt/libvirt/ci-$NAME:latest" - export COMMON_TAG="$CI_REGISTRY/libvirt/libvirt/ci-$NAME:latest"
@@ -80,11 +79,25 @@ check-dco:
# Native container jobs # Native container jobs
x86_64-centos-8-container: x86_64-almalinux-8-container:
extends: .container_job extends: .container_job
allow_failure: false allow_failure: false
variables: variables:
NAME: centos-8 NAME: almalinux-8
x86_64-alpine-314-container:
extends: .container_job
allow_failure: false
variables:
NAME: alpine-314
x86_64-alpine-edge-container:
extends: .container_job
allow_failure: true
variables:
NAME: alpine-edge
x86_64-centos-stream-8-container: x86_64-centos-stream-8-container:
@@ -94,6 +107,13 @@ x86_64-centos-stream-8-container:
NAME: centos-stream-8 NAME: centos-stream-8
x86_64-centos-stream-9-container:
extends: .container_job
allow_failure: false
variables:
NAME: centos-stream-9
x86_64-debian-10-container: x86_64-debian-10-container:
extends: .container_job extends: .container_job
allow_failure: false allow_failure: false
@@ -372,25 +392,43 @@ mingw64-fedora-rawhide-container:
# Native build jobs # Native build jobs
x86_64-centos-8: x86_64-almalinux-8:
extends: .native_build_job extends: .native_build_job
needs: needs:
- x86_64-centos-8-container - x86_64-almalinux-8-container
allow_failure: false allow_failure: false
variables: variables:
NAME: centos-8 NAME: almalinux-8
RPM: skip RPM: skip
x86_64-centos-8-clang: x86_64-almalinux-8-clang:
extends: .native_build_job extends: .native_build_job
needs: needs:
- x86_64-centos-8-container - x86_64-almalinux-8-container
allow_failure: false allow_failure: false
variables: variables:
NAME: centos-8
RPM: skip
CC: clang CC: clang
NAME: almalinux-8
RPM: skip
x86_64-alpine-314:
extends: .native_build_job
needs:
- x86_64-alpine-314-container
allow_failure: false
variables:
NAME: alpine-314
x86_64-alpine-edge:
extends: .native_build_job
needs:
- x86_64-alpine-edge-container
allow_failure: true
variables:
NAME: alpine-edge
x86_64-centos-stream-8: x86_64-centos-stream-8:
@@ -400,7 +438,23 @@ x86_64-centos-stream-8:
allow_failure: false allow_failure: false
variables: variables:
NAME: centos-stream-8 NAME: centos-stream-8
RPM: skip artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
x86_64-centos-stream-9:
extends: .native_build_job
needs:
- x86_64-centos-stream-9-container
allow_failure: false
variables:
NAME: centos-stream-9
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
x86_64-debian-10: x86_64-debian-10:
@@ -446,6 +500,10 @@ x86_64-fedora-34:
allow_failure: false allow_failure: false
variables: variables:
NAME: fedora-34 NAME: fedora-34
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
x86_64-fedora-35: x86_64-fedora-35:
@@ -455,6 +513,10 @@ x86_64-fedora-35:
allow_failure: false allow_failure: false
variables: variables:
NAME: fedora-35 NAME: fedora-35
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
x86_64-fedora-rawhide: x86_64-fedora-rawhide:
@@ -472,8 +534,8 @@ x86_64-fedora-rawhide-clang:
- x86_64-fedora-rawhide-container - x86_64-fedora-rawhide-container
allow_failure: true allow_failure: true
variables: variables:
NAME: fedora-rawhide
CC: clang CC: clang
NAME: fedora-rawhide
RPM: skip RPM: skip
@@ -512,9 +574,9 @@ x86_64-ubuntu-2004:
- x86_64-ubuntu-2004-container - x86_64-ubuntu-2004-container
allow_failure: false allow_failure: false
variables: variables:
NAME: ubuntu-2004
ASAN_OPTIONS: verify_asan_link_order=0 ASAN_OPTIONS: verify_asan_link_order=0
MESON_ARGS: -Db_lundef=false -Db_sanitize=address,undefined MESON_ARGS: -Db_lundef=false -Db_sanitize=address,undefined
NAME: ubuntu-2004
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
@@ -524,9 +586,9 @@ x86_64-ubuntu-2004-clang:
- x86_64-ubuntu-2004-container - x86_64-ubuntu-2004-container
allow_failure: false allow_failure: false
variables: variables:
NAME: ubuntu-2004
CC: clang CC: clang
MESON_ARGS: -Db_lundef=false -Db_sanitize=address,undefined MESON_ARGS: -Db_lundef=false -Db_sanitize=address,undefined
NAME: ubuntu-2004
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
@@ -539,8 +601,8 @@ armv6l-debian-10:
- armv6l-debian-10-container - armv6l-debian-10-container
allow_failure: false allow_failure: false
variables: variables:
NAME: debian-10
CROSS: armv6l CROSS: armv6l
NAME: debian-10
mips-debian-10: mips-debian-10:
@@ -549,8 +611,8 @@ mips-debian-10:
- mips-debian-10-container - mips-debian-10-container
allow_failure: false allow_failure: false
variables: variables:
NAME: debian-10
CROSS: mips CROSS: mips
NAME: debian-10
mipsel-debian-10: mipsel-debian-10:
@@ -559,8 +621,8 @@ mipsel-debian-10:
- mipsel-debian-10-container - mipsel-debian-10-container
allow_failure: false allow_failure: false
variables: variables:
NAME: debian-10
CROSS: mipsel CROSS: mipsel
NAME: debian-10
armv7l-debian-11: armv7l-debian-11:
@@ -569,8 +631,8 @@ armv7l-debian-11:
- armv7l-debian-11-container - armv7l-debian-11-container
allow_failure: false allow_failure: false
variables: variables:
NAME: debian-11
CROSS: armv7l CROSS: armv7l
NAME: debian-11
mips64el-debian-11: mips64el-debian-11:
@@ -579,8 +641,8 @@ mips64el-debian-11:
- mips64el-debian-11-container - mips64el-debian-11-container
allow_failure: false allow_failure: false
variables: variables:
NAME: debian-11
CROSS: mips64el CROSS: mips64el
NAME: debian-11
ppc64le-debian-11: ppc64le-debian-11:
@@ -589,8 +651,8 @@ ppc64le-debian-11:
- ppc64le-debian-11-container - ppc64le-debian-11-container
allow_failure: false allow_failure: false
variables: variables:
NAME: debian-11
CROSS: ppc64le CROSS: ppc64le
NAME: debian-11
aarch64-debian-sid: aarch64-debian-sid:
@@ -599,8 +661,8 @@ aarch64-debian-sid:
- aarch64-debian-sid-container - aarch64-debian-sid-container
allow_failure: true allow_failure: true
variables: variables:
NAME: debian-sid
CROSS: aarch64 CROSS: aarch64
NAME: debian-sid
i686-debian-sid: i686-debian-sid:
@@ -609,8 +671,8 @@ i686-debian-sid:
- i686-debian-sid-container - i686-debian-sid-container
allow_failure: true allow_failure: true
variables: variables:
NAME: debian-sid
CROSS: i686 CROSS: i686
NAME: debian-sid
s390x-debian-sid: s390x-debian-sid:
@@ -619,8 +681,8 @@ s390x-debian-sid:
- s390x-debian-sid-container - s390x-debian-sid-container
allow_failure: true allow_failure: true
variables: variables:
NAME: debian-sid
CROSS: s390x CROSS: s390x
NAME: debian-sid
mingw64-fedora-35: mingw64-fedora-35:
@@ -629,8 +691,8 @@ mingw64-fedora-35:
- mingw64-fedora-35-container - mingw64-fedora-35-container
allow_failure: false allow_failure: false
variables: variables:
NAME: fedora-35
CROSS: mingw64 CROSS: mingw64
NAME: fedora-35
mingw32-fedora-rawhide: mingw32-fedora-rawhide:
@@ -639,8 +701,8 @@ mingw32-fedora-rawhide:
- mingw32-fedora-rawhide-container - mingw32-fedora-rawhide-container
allow_failure: true allow_failure: true
variables: variables:
NAME: fedora-rawhide
CROSS: mingw32 CROSS: mingw32
NAME: fedora-rawhide
# Native cirrus build jobs # Native cirrus build jobs
@@ -650,13 +712,13 @@ x86_64-freebsd-12:
needs: [] needs: []
allow_failure: false allow_failure: false
variables: variables:
NAME: freebsd-12
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
CIRRUS_VM_IMAGE_SELECTOR: image_family
CIRRUS_VM_IMAGE_NAME: freebsd-12-2 CIRRUS_VM_IMAGE_NAME: freebsd-12-2
CIRRUS_VM_IMAGE_SELECTOR: image_family
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
INSTALL_COMMAND: pkg install -y
NAME: freebsd-12
UPDATE_COMMAND: pkg update UPDATE_COMMAND: pkg update
UPGRADE_COMMAND: pkg upgrade -y UPGRADE_COMMAND: pkg upgrade -y
INSTALL_COMMAND: pkg install -y
x86_64-freebsd-13: x86_64-freebsd-13:
@@ -664,13 +726,13 @@ x86_64-freebsd-13:
needs: [] needs: []
allow_failure: false allow_failure: false
variables: variables:
NAME: freebsd-13
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
CIRRUS_VM_IMAGE_SELECTOR: image_family
CIRRUS_VM_IMAGE_NAME: freebsd-13-0 CIRRUS_VM_IMAGE_NAME: freebsd-13-0
CIRRUS_VM_IMAGE_SELECTOR: image_family
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
INSTALL_COMMAND: pkg install -y
NAME: freebsd-13
UPDATE_COMMAND: pkg update UPDATE_COMMAND: pkg update
UPGRADE_COMMAND: pkg upgrade -y UPGRADE_COMMAND: pkg upgrade -y
INSTALL_COMMAND: pkg install -y
x86_64-macos-11: x86_64-macos-11:
@@ -678,12 +740,12 @@ x86_64-macos-11:
needs: [] needs: []
allow_failure: false allow_failure: false
variables: variables:
NAME: macos-11
CIRRUS_VM_INSTANCE_TYPE: osx_instance
CIRRUS_VM_IMAGE_SELECTOR: image
CIRRUS_VM_IMAGE_NAME: big-sur-base CIRRUS_VM_IMAGE_NAME: big-sur-base
UPDATE_COMMAND: brew update CIRRUS_VM_IMAGE_SELECTOR: image
UPGRADE_COMMAND: brew upgrade CIRRUS_VM_INSTANCE_TYPE: osx_instance
INSTALL_COMMAND: brew install INSTALL_COMMAND: brew install
NAME: macos-11
PATH_EXTRA: /usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin:/usr/local/opt/libpcap/bin:/usr/local/opt/libxslt/bin:/usr/local/opt/rpcgen/bin PATH_EXTRA: /usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin:/usr/local/opt/libpcap/bin:/usr/local/opt/libxslt/bin:/usr/local/opt/rpcgen/bin
PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/libpcap/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/libpcap/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig
UPDATE_COMMAND: brew update
UPGRADE_COMMAND: brew upgrade

116
ci/integration.yml Normal file
View File

@@ -0,0 +1,116 @@
.integration_tests:
stage: integration_tests
before_script:
- mkdir "$SCRATCH_DIR"
- sudo sh -c "echo DefaultLimitCORE=infinity >> /etc/systemd/system.conf" # Explicitly allow storing cores globally
- sudo systemctl daemon-reexec # need to reexec systemd after changing config
- sudo dnf install -y libvirt-rpms/* libvirt-perl-rpms/*
- sudo pip3 install --prefix=/usr avocado-framework
- source /etc/os-release # in order to query the vendor-provided variables
- if test "$ID" = "centos" && test "$VERSION_ID" -lt 9 ||
test "$ID" = "fedora" && test "$VERSION_ID" -lt 35;
then
DAEMONS="libvirtd virtlogd virtlockd";
else
DAEMONS="virtproxyd virtqemud virtinterfaced virtsecretd virtstoraged virtnwfilterd virtnodedevd virtlogd virtlockd";
fi
- for daemon in $DAEMONS;
do
LOG_OUTPUTS="1:file:/var/log/libvirt/${daemon}.log";
LOG_FILTERS="3:remote 4:event 3:util.json 3:util.object 3:util.dbus 3:util.netlink 3:node_device 3:rpc 3:access 1:*";
sudo augtool set /files/etc/libvirt/${daemon}.conf/log_filters "$LOG_FILTERS" &>/dev/null;
sudo augtool set /files/etc/libvirt/${daemon}.conf/log_outputs "$LOG_OUTPUTS" &>/dev/null;
sudo systemctl --quiet stop ${daemon}.service;
sudo systemctl restart ${daemon}.socket;
done
- sudo virsh net-start default &>/dev/null || true;
script:
- mkdir logs
- cd "$SCRATCH_DIR"
- git clone --depth 1 https://gitlab.com/libvirt/libvirt-tck.git
- cd libvirt-tck
- sudo avocado --config avocado.config run --job-results-dir "$SCRATCH_DIR"/avocado
after_script:
- test "$CI_JOB_STATUS" = "success" && exit 0;
- test -e "$SCRATCH_DIR"/avocado && sudo mv "$SCRATCH_DIR"/avocado/latest/test-results logs/avocado;
- sudo coredumpctl info --no-pager > logs/coredumpctl.txt
- sudo mv /var/log/libvirt logs/libvirt
- sudo chown -R $(whoami):$(whoami) logs
# rename all Avocado stderr/stdout logs to *.log so that GitLab's web UI doesn't mangle the MIME type
- find logs/avocado/ -type f ! -name "*.log" -exec
sh -c 'DIR=$(dirname {}); NAME=$(basename {}); mv $DIR/$NAME{,.log}' \;
variables:
SCRATCH_DIR: "/tmp/scratch"
artifacts:
name: logs
paths:
- logs
when: on_failure
rules:
- if: '$LIBVIRT_CI_INTEGRATION'
when: on_success
- when: never
centos-stream-8-tests:
extends: .integration_tests
needs:
- x86_64-centos-stream-8
- project: libvirt/libvirt-perl
job: x86_64-centos-stream-8
ref: master
artifacts: true
variables:
# needed by libvirt-gitlab-executor
DISTRO: centos-stream-8
# can be overridden in forks to set a different runner tag
LIBVIRT_CI_INTEGRATION_RUNNER_TAG: redhat-vm-host
tags:
- $LIBVIRT_CI_INTEGRATION_RUNNER_TAG
centos-stream-9-tests:
extends: .integration_tests
needs:
- x86_64-centos-stream-9
- project: libvirt/libvirt-perl
job: x86_64-centos-stream-9
ref: master
artifacts: true
variables:
# needed by libvirt-gitlab-executor
DISTRO: centos-stream-9
# can be overridden in forks to set a different runner tag
LIBVIRT_CI_INTEGRATION_RUNNER_TAG: redhat-vm-host
tags:
- $LIBVIRT_CI_INTEGRATION_RUNNER_TAG
fedora-34-tests:
extends: .integration_tests
needs:
- x86_64-fedora-34
- project: libvirt/libvirt-perl
job: x86_64-fedora-34
ref: master
artifacts: true
variables:
# needed by libvirt-gitlab-executor
DISTRO: fedora-34
# can be overridden in forks to set a different runner tag
LIBVIRT_CI_INTEGRATION_RUNNER_TAG: redhat-vm-host
tags:
- $LIBVIRT_CI_INTEGRATION_RUNNER_TAG
fedora-35-tests:
extends: .integration_tests
needs:
- x86_64-fedora-35
- project: libvirt/libvirt-perl
job: x86_64-fedora-35
ref: master
artifacts: true
variables:
# needed by libvirt-gitlab-executor
DISTRO: fedora-35
# can be overridden in forks to set a different runner tag
LIBVIRT_CI_INTEGRATION_RUNNER_TAG: redhat-vm-host
tags:
- $LIBVIRT_CI_INTEGRATION_RUNNER_TAG

View File

@@ -6,7 +6,7 @@ gitlab:
project: libvirt project: libvirt
targets: targets:
centos-8: almalinux-8:
jobs: jobs:
- arch: x86_64 - arch: x86_64
variables: variables:
@@ -18,11 +18,30 @@ targets:
RPM: skip RPM: skip
CC: clang CC: clang
alpine-314:
jobs:
- arch: x86_64
alpine-edge:
jobs:
- arch: x86_64
allow-failure: true
centos-stream-8: centos-stream-8:
jobs: jobs:
- arch: x86_64 - arch: x86_64
variables: artifacts:
RPM: skip expire_in: 1 day
paths:
- libvirt-rpms
centos-stream-9:
jobs:
- arch: x86_64
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
debian-10: debian-10:
jobs: jobs:
@@ -125,11 +144,21 @@ targets:
- arch: s390x - arch: s390x
allow-failure: true allow-failure: true
fedora-34: x86_64 fedora-34:
jobs:
- arch: x86_64
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
fedora-35: fedora-35:
jobs: jobs:
- arch: x86_64 - arch: x86_64
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
- arch: mingw32 - arch: mingw32
allow-failure: true allow-failure: true

View File

@@ -36,18 +36,18 @@
#if defined(__clang_major__) && defined(__clang_minor__) #if defined(__clang_major__) && defined(__clang_minor__)
# ifdef __apple_build_version__ # ifdef __apple_build_version__
# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) # if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
# error You need at least XCode Clang v5.1 to compile libvirt # error You need at least XCode Clang v10.0 to compile libvirt
# endif # endif
# else # else
# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) # if __clang_major__ < 6 || (__clang_major__ == 6 && __clang_minor__ < 4)
# error You need at least Clang v3.4 to compile libvirt # error You need at least Clang v6.0 to compile libvirt
# endif # endif
# endif # endif
#elif defined(__GNUC__) && defined(__GNUC_MINOR__) #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) # if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4)
# error You need at least GCC v4.8 to compile libvirt # error You need at least GCC v7.4.0 to compile libvirt
# endif # endif
#else #else
# error You either need at least GCC 4.8 or Clang 3.4 or XCode Clang 5.1 to compile libvirt # error You either need at least GCC 7.4.0 or Clang 6.0 or XCode Clang 10.0 to compile libvirt
#endif #endif

View File

@@ -73,7 +73,7 @@ The first task is to define the public API. If the new API involves an
XML extension, you have to enhance the RelaxNG schema and document the XML extension, you have to enhance the RelaxNG schema and document the
new elements or attributes: new elements or attributes:
``docs/schemas/domaincommon.rng docs/formatdomain.html.in`` ``src/conf/schemas/domaincommon.rng docs/formatdomain.rst``
If the API extension involves a new function, you have to add a If the API extension involves a new function, you have to add a
declaration in the public header, and arrange to export the function declaration in the public header, and arrange to export the function

View File

@@ -1,161 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Bug reporting</h1>
<ul id="toc"></ul>
<h2><a id="security">Security Issues</a></h2>
<p>
If you think that an issue with libvirt may have security
implications, <strong>please do not</strong> publicly
report it in the bug tracker, mailing lists, or irc. Libvirt
has <a href="securityprocess.html">a dedicated process for handling (potential) security issues</a>
that should be used instead. So if your issue has security
implications, ignore the rest of this page and follow the
<a href="securityprocess.html">security process</a> instead.
</p>
<h2><a id="bugtracking">Bug Tracking</a></h2>
<p>
If you are using libvirt binaries from a Linux distribution
check below for distribution specific bug reporting policies
first.
</p>
<h2><a id="general">General libvirt bug reports</a></h2>
<p>
Bugs in upstream libvirt code should be reported as issues in the
appropriate <a href="https://gitlab.com/libvirt">project on GitLab.</a>
Before submitting a ticket, check the existing tickets to see if
the bug/feature is already tracked.
</p>
<p>
It's always a good idea to file bug reports, as the process of
filing the report always makes it easier to describe the
problem, and the bug number provides a quick way of referring to
the problem. However, not everybody in the community pays frequent
attention to issues, so after you file a bug, asking questions
and submitting patches on <a href="contact.html">the libvirt
mailing lists</a> will increase your bug's visibility and
encourage people to think about your problem. Don't hesitate to
ask questions on the list, as others may know of existing
solutions or be interested in collaborating with you on finding
a solution. Patches are always appreciated, and it's likely
that someone else has the same problem you do!
</p>
<p>
If you decide to write code, though, before you begin please
read the <a href="hacking.html">contributor guidelines</a>,
especially the first point: "Discuss any large changes on the
mailing list first. Post patches early and listen to feedback."
Few development experiences are more discouraging than spending
a bunch of time writing a patch only to have someone point out a
better approach on list.
</p>
<ul>
<li><a href="https://gitlab.com/libvirt/libvirt/-/issues">View libvirt.git tickets</a></li>
<li><a href="https://gitlab.com/libvirt/libvirt/-/issues/new">New libvirt.git ticket</a></li>
</ul>
<p>
Note bugs in language bindings and other sub-projects should be
reported to their corresponding git repository rather than the
main libvirt.git linked above.
</p>
<h2><a id="distribution">Linux Distribution specific bug reports</a></h2>
<ul>
<li>
If you are using binaries from <strong>Fedora</strong>, enter
tickets against the <code>Fedora</code> product and
the <code>libvirt</code> component.
<ul>
<li><a href="https://bugzilla.redhat.com/buglist.cgi?component=libvirt&amp;product=Fedora">View Fedora libvirt tickets</a></li>
<li><a href="https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&amp;component=libvirt">New Fedora libvirt ticket</a></li>
</ul>
</li>
<li>
<p>
If you are using binaries from <strong>Red Hat Enterprise
Linux</strong>, enter tickets against the Red Hat Enterprise
Linux product that you're using (e.g., Red Hat Enterprise
Linux 6) and the <code>libvirt</code> component. Red Hat
bugzilla has <a href="https://bugzilla.redhat.com">additional guidance</a> about getting support if
you are a Red Hat customer.
</p>
</li>
<li>
<p>
If you are using binaries from another Linux distribution
first follow their own bug reporting guidelines.
</p>
</li>
<li>
<p>
Finally, if you are a contributor to another Linux
distribution and would like to have your procedure for
filing bugs mentioned here, please mail the libvirt
development list.
</p>
</li>
</ul>
<h2><a id="quality">How to file high quality bug reports</a></h2>
<p>
To increase the likelihood of your bug report being addressed it is
important to provide as much information as possible. When filing
libvirt bugs use this checklist to see if you are providing enough
information:
</p>
<ul>
<li>The version number of the libvirt build, or SHA1 of the GIT
commit</li>
<li>The hardware architecture being used</li>
<li>The name of the hypervisor (Xen, QEMU, KVM)</li>
<li>The XML config of the guest domain if relevant</li>
<li>For Xen hypervisor, the domain logfiles from /var/log/xen and
/var/log/libvirt/libxl</li>
<li>For QEMU/KVM, the domain logfile from /var/log/libvirt/qemu</li>
</ul>
<p>
If the bug leads to a tool linked to libvirt crash, then the best
is to provide a backtrace along with the scenario used to get the
crash, the simplest is to run the program under gdb, reproduce the
steps leading to the crash and then issue a gdb "bt -a" command to
get the stack trace, attach it to the bug. Note that for the
data to be really useful libvirt debug information must be present
for example by installing libvirt debuginfo package on Fedora or
Red Hat Enterprise Linux (with debuginfo-install libvirt) prior
to running gdb.</p>
<p>
It may also happen that the libvirt daemon itself crashes or gets stuck,
in the first case run it (as root) under gdb, and reproduce the sequence
leading to the crash, similarly to a normal program provide the
"bt" backtrace information to where gdb will have stopped.<br/>
But if libvirtd gets stuck, for example seems to stop processing
commands, try to attach to the faulty daemon and issue a gdb command
"thread apply all bt" to show all the threads backtraces, as in:</p>
<pre> # ps -o etime,pid `pgrep libvirt`
... note the process id from the output
# gdb /usr/sbin/libvirtd
.... some information about gdb and loading debug data
(gdb) attach $the_daemon_process_id
....
(gdb) thread apply all bt
.... information to attach to the bug
(gdb)
</pre>
</body>
</html>

125
docs/bugs.rst Normal file
View File

@@ -0,0 +1,125 @@
.. role:: anchor(raw)
:format: html
=============
Bug reporting
=============
.. contents::
Security Issues
---------------
If you think that an issue with libvirt may have security implications, **please
do not** publicly report it in the bug tracker, mailing lists, or irc. Libvirt
has `a dedicated process for handling (potential) security
issues <securityprocess.html>`__ that should be used instead. So if your issue
has security implications, ignore the rest of this page and follow the `security
process <securityprocess.html>`__ instead.
Bug Tracking
------------
If you are using libvirt binaries from a Linux distribution check below for
distribution specific bug reporting policies first.
General libvirt bug reports
---------------------------
Bugs in upstream libvirt code should be reported as issues in the appropriate
`project on GitLab. <https://gitlab.com/libvirt>`__ Before submitting a ticket,
check the existing tickets to see if the bug/feature is already tracked.
It's always a good idea to file bug reports, as the process of filing the report
always makes it easier to describe the problem, and the bug number provides a
quick way of referring to the problem. However, not everybody in the community
pays frequent attention to issues, so after you file a bug, asking questions and
submitting patches on `the libvirt mailing lists <contact.html>`__ will increase
your bug's visibility and encourage people to think about your problem. Don't
hesitate to ask questions on the list, as others may know of existing solutions
or be interested in collaborating with you on finding a solution. Patches are
always appreciated, and it's likely that someone else has the same problem you
do!
If you decide to write code, though, before you begin please read the
`contributor guidelines <hacking.html>`__, especially the first point: "Discuss
any large changes on the mailing list first. Post patches early and listen to
feedback." Few development experiences are more discouraging than spending a
bunch of time writing a patch only to have someone point out a better approach
on list.
- `View libvirt.git tickets <https://gitlab.com/libvirt/libvirt/-/issues>`__
- `New libvirt.git ticket <https://gitlab.com/libvirt/libvirt/-/issues/new>`__
Note bugs in language bindings and other sub-projects should be reported to
their corresponding git repository rather than the main libvirt.git linked
above.
Linux Distribution specific bug reports
---------------------------------------
- If you are using binaries from **Fedora**, enter tickets against the
``Fedora`` product and the ``libvirt`` component.
- `View Fedora libvirt
tickets <https://bugzilla.redhat.com/buglist.cgi?component=libvirt&product=Fedora>`__
- `New Fedora libvirt
ticket <https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&component=libvirt>`__
- If you are using binaries from **Red Hat Enterprise Linux**, enter tickets
against the Red Hat Enterprise Linux product that you're using (e.g., Red Hat
Enterprise Linux 6) and the ``libvirt`` component. Red Hat bugzilla has
`additional guidance <https://bugzilla.redhat.com>`__ about getting support
if you are a Red Hat customer.
- If you are using binaries from another Linux distribution first follow their
own bug reporting guidelines.
- Finally, if you are a contributor to another Linux distribution and would
like to have your procedure for filing bugs mentioned here, please mail the
libvirt development list.
:anchor:`<a id="quality"/>`
How to file high quality bug reports
------------------------------------
To increase the likelihood of your bug report being addressed it is important to
provide as much information as possible. When filing libvirt bugs use this
checklist to see if you are providing enough information:
- The version number of the libvirt build, or SHA1 of the GIT commit
- The hardware architecture being used
- The name of the hypervisor (Xen, QEMU, KVM)
- The XML config of the guest domain if relevant
- For Xen hypervisor, the domain logfiles from /var/log/xen and
/var/log/libvirt/libxl
- For QEMU/KVM, the domain logfile from /var/log/libvirt/qemu
If the bug leads to a tool linked to libvirt crash, then the best is to provide
a backtrace along with the scenario used to get the crash, the simplest is to
run the program under gdb, reproduce the steps leading to the crash and then
issue a gdb "bt -a" command to get the stack trace, attach it to the bug. Note
that for the data to be really useful libvirt debug information must be present
for example by installing libvirt debuginfo package on Fedora or Red Hat
Enterprise Linux (with debuginfo-install libvirt) prior to running gdb.
| It may also happen that the libvirt daemon itself crashes or gets stuck, in
the first case run it (as root) under gdb, and reproduce the sequence leading
to the crash, similarly to a normal program provide the "bt" backtrace
information to where gdb will have stopped.
| But if libvirtd gets stuck, for example seems to stop processing commands, try
to attach to the faulty daemon and issue a gdb command "thread apply all bt"
to show all the threads backtraces, as in:
::
# ps -o etime,pid `pgrep libvirt`
... note the process id from the output
# gdb /usr/sbin/libvirtd
.... some information about gdb and loading debug data
(gdb) attach $the_daemon_process_id
....
(gdb) thread apply all bt
.... information to attach to the bug
(gdb)

View File

@@ -53,11 +53,16 @@ Struct type names
All structs should have a 'vir' prefix in their typedef name, All structs should have a 'vir' prefix in their typedef name,
and each following word should have its first letter in and each following word should have its first letter in
uppercase. The struct name should be the same as the typedef uppercase. The struct name should be the same as the typedef
name with a leading underscore. name with a leading underscore. For types that are part of the
public API, a second typedef should be given for a pointer to
the struct with a 'Ptr' suffix. Do not introduce new such
typedefs for internal types.
:: ::
typedef struct _virHashTable virHashTable; typedef struct _virSomeType virSomeType;
struct _virHashTable { typedef virSomeType *virSomeTypePtr;
struct _virSomeType {
... ...
}; };
@@ -69,8 +74,8 @@ Function names
name prefix should match the object typedef name, otherwise it name prefix should match the object typedef name, otherwise it
should match the filename. Following this comes the verb / should match the filename. Following this comes the verb /
action name, and finally an optional subject name. For example, action name, and finally an optional subject name. For example,
given an object 'virHashTable', all functions should have a given an object 'virSomeType', all functions should have a
name 'virHashTable$VERB' or 'virHashTable$VERB$SUBJECT", e.g. name 'virSomeType$VERB' or 'virSomeType$VERB$SUBJECT", e.g.
'virHashTableLookup' or 'virHashTableGetValue'. 'virHashTableLookup' or 'virHashTableGetValue'.
Macro names Macro names
@@ -422,25 +427,47 @@ Conditional expressions
----------------------- -----------------------
For readability reasons new code should avoid shortening For readability reasons new code should avoid shortening
comparisons to 0 for numeric types. Boolean and pointer comparisons to 0 for numeric types:
comparisons may be shortened. All long forms are okay:
:: ::
virFoo *foos = NULL;
size nfoos = 0; size nfoos = 0;
GOOD:
if (nfoos != 0)
if (nfoos == 0)
BAD:
if (nfoos)
if (!nfoos)
Prefer the shortened version for boolean values. Boolean values
should never be compared against the literal ``true``, as a
logical non-false value need not be ``1``.
::
bool hasFoos = false; bool hasFoos = false;
GOOD: GOOD:
if (!foos) if (hasFoos)
if (!hasFoos) if (!hasFoos)
if (nfoos == 0)
if (foos == NULL)
if (hasFoos == true)
BAD: BAD:
if (!nfoos) if (hasFoos == true)
if (nfoos) if (hasFoos != false)
if (hasFoos == false)
if (hasFoos != true)
Pointer comparisons may be shortened. All long forms are okay.
::
virFoo *foo = NULL;
GOOD:
if (foo) # or: if (foo != NULL)
if (!foo) # or: if (foo == NULL)
New code should avoid the ternary operator as much as possible. New code should avoid the ternary operator as much as possible.
Specifically it must never span more than one line or nest: Specifically it must never span more than one line or nest:
@@ -502,19 +529,13 @@ Scalars
- In the unusual event that you require a specific width, use a - In the unusual event that you require a specific width, use a
standard type like ``int32_t``, ``uint32_t``, ``uint64_t``, standard type like ``int32_t``, ``uint32_t``, ``uint64_t``,
etc. etc.
- While using ``bool`` is good for readability, it comes with - While using ``bool`` is good for readability, it comes with a
minor caveats: minor caveat: Don't use ``bool`` in places where the type size
must be constant across all systems, like public interfaces and
- Don't use ``bool`` in places where the type size must be on-the-wire protocols. Note that it would be possible (albeit
constant across all systems, like public interfaces and wasteful) to use ``bool`` in libvirt's logical wire protocol,
on-the-wire protocols. Note that it would be possible since XDR maps that to its lower-level ``bool_t`` type, which
(albeit wasteful) to use ``bool`` in libvirt's logical wire **is** fixed-size.
protocol, since XDR maps that to its lower-level ``bool_t``
type, which **is** fixed-size.
- Don't compare a bool variable against the literal, ``true``,
since a value with a logical non-false value need not be
``1``. I.e., don't write ``if (seen == true) ...``. Rather,
write ``if (seen)...``.
Of course, take all of the above with a grain of salt. If you're Of course, take all of the above with a grain of salt. If you're
about to use some system interface that requires a type like about to use some system interface that requires a type like
@@ -579,6 +600,19 @@ calling another function.
... ...
} }
Prefer variable definitions on separate lines. This allows for smaller,
easier to understand diffs when changing them. Define variables in the
smallest possible scope.
::
GOOD:
int count = 0;
int nnodes;
BAD:
int count = 0, nnodes;
Attribute annotations Attribute annotations
--------------------- ---------------------
@@ -932,7 +966,6 @@ makes sense:
error: A path only taken upon return with an error code error: A path only taken upon return with an error code
cleanup: A path taken upon return with success code + optional error cleanup: A path taken upon return with success code + optional error
no_memory: A path only taken upon return with an OOM error code
retry: If needing to jump upwards (e.g., retry on EINTR) retry: If needing to jump upwards (e.g., retry on EINTR)
Top-level labels should be indented by one space (putting them on Top-level labels should be indented by one space (putting them on

View File

@@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Contacting the project contributors</h1>
<ul id="toc"></ul>
<h2><a id="security">Security Issues</a></h2>
<p>
If you think that an issue with libvirt may have security
implications, <strong>please do not</strong> publicly
report it in the bug tracker, mailing lists, or irc. Libvirt
has <a href="securityprocess.html">a dedicated process for handling (potential) security issues</a>
that should be used instead. So if your issue has security
implications, ignore the rest of this page and follow the
<a href="securityprocess.html">security process</a> instead.
</p>
<h2><a id="email">Mailing lists</a></h2>
<p>
There are three mailing-lists:
</p>
<dl class="mail">
<dt><a href="https://www.redhat.com/mailman/listinfo/libvir-list">libvir-list@redhat.com</a> (for development)</dt>
<dd>
Archives at <a href="https://www.redhat.com/archives/libvir-list">https://www.redhat.com/archives/libvir-list</a>
</dd>
<dd>
This is a high volume mailing list. It is a place for discussions
about the <strong>development</strong> of libvirt.
</dd>
<dd>
Topics for discussion include:
<ul>
<li>New features for libvirt</li>
<li>Bug fixing of libvirt</li>
<li>New hypervisor drivers</li>
<li>Development of language bindings for libvirt API</li>
<li>Testing and documentation of libvirt</li>
</ul>
</dd>
<dt><a href="https://www.redhat.com/mailman/listinfo/libvirt-users">libvirt-users@redhat.com</a> (for users)</dt>
<dd>
Archives at <a href="https://www.redhat.com/archives/libvirt-users">https://www.redhat.com/archives/libvirt-users</a>
</dd>
<dd>
This is a moderate volume mailing list. It is a place for discussions
involving libvirt <strong>users</strong>.
</dd>
<dd>
Topics for discussion include:
<ul>
<li>Usage of libvirt / virsh</li>
<li>Administration of libvirt</li>
<li>Deployment of libvirt with hypervisors</li>
<li>Development of applications on top of / using the libvirt API(s)</li>
<li>Any other topics along these lines</li>
</ul>
</dd>
<dt><a href="https://www.redhat.com/mailman/listinfo/libvirt-announce">libvirt-announce@redhat.com</a> (for release notices)</dt>
<dd>
Archives at <a href="https://www.redhat.com/archives/libvirt-announce">https://www.redhat.com/archives/libvirt-announce</a>
</dd>
<dd>
This is a low volume mailing list, with restricted posting, for
announcements of new libvirt releases.
</dd>
<dd>
Subscribe to just this if you want to be notified of new releases,
without subscribing to either of the other mailing lists.
</dd>
</dl>
<p>
It is recommended but not required that you subscribe before posting
to the user and development lists. Posts from non-subscribers will be
subject to manual moderation delays. You can subscribe at the linked
web pages above.
</p>
<p>
Patches with explanations and provided as attachments are really
appreciated, and should be directed to the development mailing list
for review and discussion.
Wherever possible, please generate the patches by using
<code>git format-patch</code> in a git repository clone. Further
useful information regarding developing libvirt and/or contributing is
available on our <a href="hacking.html">Contributor Guidelines</a>
page.
</p>
<h2><a id="irc">IRC discussion</a></h2>
<p>
Some of the libvirt developers may be found on IRC on the <a href="https://oftc.net">OFTC IRC</a>
network. Use the settings:
</p>
<ul>
<li>server: irc.oftc.net</li>
<li>port: 6667 (the usual IRC port)</li>
<li>channel: #virt</li>
</ul>
<p>
NB There is no guarantee that someone will be watching or able to reply
promptly, so use the mailing-list if you don't get an answer on the IRC
channel.
</p>
</body>
</html>

94
docs/contact.rst Normal file
View File

@@ -0,0 +1,94 @@
.. role:: anchor(raw)
:format: html
===================================
Contacting the project contributors
===================================
.. contents::
Security Issues
---------------
If you think that an issue with libvirt may have security implications, **please
do not** publicly report it in the bug tracker, mailing lists, or irc. Libvirt
has `a dedicated process for handling (potential) security
issues <securityprocess.html>`__ that should be used instead. So if your issue
has security implications, ignore the rest of this page and follow the `security
process <securityprocess.html>`__ instead.
:anchor:`<a id="email"/>`
Mailing lists
-------------
There are three mailing-lists:
**libvir-list@redhat.com** (for development)
Archives
https://www.redhat.com/archives/libvir-list
List info
https://www.redhat.com/mailman/listinfo/libvir-list
This is a high volume mailing list. It is a place for discussions about the
**development** of libvirt.
Topics for discussion include:
- New features for libvirt
- Bug fixing of libvirt
- New hypervisor drivers
- Development of language bindings for libvirt API
- Testing and documentation of libvirt
**libvirt-users@redhat.com** (for users)
Archives
https://www.redhat.com/archives/libvirt-users
List info
https://www.redhat.com/mailman/listinfo/libvirt-users
This is a moderate volume mailing list. It is a place for discussions
involving libvirt **users**.
Topics for discussion include:
- Usage of libvirt / virsh
- Administration of libvirt
- Deployment of libvirt with hypervisors
- Development of applications on top of / using the libvirt API(s)
- Any other topics along these lines
**libvirt-announce@redhat.com** (for release notices)
Archives
https://www.redhat.com/archives/libvirt-announce
List info
https://www.redhat.com/mailman/listinfo/libvirt-announce
This is a low volume mailing list, with restricted posting, for announcements
of new libvirt releases.
Subscribe to just this if you want to be notified of new releases, without
subscribing to either of the other mailing lists.
It is recommended but not required that you subscribe before posting to the user
and development lists. Posts from non-subscribers will be subject to manual
moderation delays. You can subscribe at the linked web pages above.
Patches with explanations and provided as attachments are really appreciated,
and should be directed to the development mailing list for review and
discussion. Wherever possible, please generate the patches by using
``git format-patch`` in a git repository clone. Further useful information
regarding developing libvirt and/or contributing is available on our
`Contributor Guidelines <hacking.html>`__ page.
:anchor:`<a id="irc"/>`
IRC discussion
--------------
Some of the libvirt developers may be found on IRC on the `OFTC
IRC <https://oftc.net>`__ network. Use the settings:
- server: irc.oftc.net
- port: 6667 (the usual IRC port)
- channel: #virt
NB There is no guarantee that someone will be watching or able to reply
promptly, so use the mailing-list if you don't get an answer on the IRC channel.

View File

@@ -1,143 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Contributing to libvirt</h1>
<p>
This page provides guidance on how to contribute to the
libvirt project.
</p>
<ul id="toc"></ul>
<h2><a id="skills">Contributions required</a></h2>
<p>
The libvirt project is always looking for new contributors to
participate in ongoing activities. While code development is a
major part of the project, assistance is needed in many other
areas including documentation writing, bug triage, testing,
application integration, website / wiki content management,
translation, branding, social media and more. The only
requirement is an interest in virtualization and desire to
help.
</p>
<p>
The following is a non-exhaustive list of areas in which
people can contribute to libvirt. If you have ideas for
other contributions feel free to follow them.
</p>
<ul>
<li><strong>Software development</strong>. The official upstream code are
kept in various <a href="https://gitlab.com/libvirt/">Git repositories</a>.
The core library / daemon (and thus the bulk of coding) is written in C,
but there are language bindings written in Python, Perl, Java, Ruby,
Php, OCaml and Go. There are also higher level wrappers
mapping libvirt into other object frameworks, such GLib,
CIM and SNMP. For those interested in working on the core parts of
libvirt, the <a href="hacking.html">contributor guidelines</a> are
mandatory reading</li>
<li><strong>Translation</strong>. All the libvirt modules aim to support
translations where appropriate. All translation is
handling outside of the normal libvirt review process,
using the <a href="https://translate.fedoraproject.org/projects/libvirt/libvirt">Fedora
instance</a> of the Weblate tool. Thus people wishing
to contribute to translation should join the Fedora
translation team</li>
<li><strong>Documentation</strong>. There are docbook guides on various
aspects of libvirt, particularly application development
guides for the C library and Python, and a virsh command
reference. There is thus scope for work by people who are
familiar with using or developing against libvirt, to
write further content for these guides. There is also a
need for people to review existing content for copy editing
and identifying gaps in the docs</li>
<li><strong>Website / wiki curation</strong>. The bulk of the website is
maintained in the primary GIT repository, while the wiki
site uses mediawiki. In both cases there is a need for
people to both write new content and curate existing
content to identify outdated information, improve its
organization and target gaps.</li>
<li><strong>Testing</strong>. There are a number of tests suites that can run
automated tests against libvirt. The coverage of the tests
is never complete, so there is a need for people to create
new test suites and / or provide environments to actually
run the tests in a variety of deployment scenarios.</li>
<li><strong>Code analysis</strong>. The libvirt project has access to the coverity
tool to run static analysis against the codebase, however,
there are other types of code analysis that can be useful.
In particular fuzzing of the inputs can be very effective
at identifying problematic edge cases.</li>
<li><strong>Security handling</strong>. Downstream (operating system) vendors
who distribute libvirt may wish to propose a person to
be part of the security handling team, to get early access
to information about forthcoming vulnerability fixes.</li>
<li><strong>Evangelism</strong>. Work done by the project is of no benefit
unless the (potential) user community knows that it
exists. Thus it is critically important to the health
and future growth of the project, that there are a people
who evangelize the work created by the project. This can
take many forms, writing blog posts (about usage of features,
personal user experiences, areas for future work, and more),
syndicating docs and blogs via social media, giving user
group and/or conference talks about libvirt.</li>
<li><strong>User assistance</strong>. Since documentation
is never perfect, there are inevitably cases where users
will struggle to attain a deployment goal they have, or
run into trouble with managing an existing deployment.
While some users may be able to contact a software vendor
to obtain support, it is common to rely on community help
forums such as <a href="contact.html#email">libvirt users
mailing list</a>, or sites such as
<a href="https://stackoverflow.com/questions/tagged/libvirt">stackoverflow.</a>
People who are familiar with libvirt and have ability &amp;
desire to help other users are encouraged to participate in
these help forums.</li>
</ul>
<h2><a id="comms">Communication</a></h2>
<p>
For full details on contacting other project contributors
read the <a href="contact.html">contact</a> page. There
are two main channels that libvirt uses for communication
between contributors:
</p>
<h3><a id="email">Mailing lists</a></h3>
<p>
The project has a number of
<a href="contact.html#email">mailing lists</a> for
general communication between contributors.
In general any design discussions and review
of contributions will take place on the mailing
lists, so it is important for all contributors
to follow the traffic.
</p>
<h3><a id="irc">Instant messaging / chat</a></h3>
<p>
Contributors to libvirt are encouraged to join the
<a href="contact.html#irc">IRC channel</a> used by
the project, where they can have live conversations
with others members.
</p>
<h2><a id="outreach">Student / outreach coding programs</a></h2>
<p>
Since 2016, the libvirt project directly participates as an
organization in the <a href="https://wiki.libvirt.org/page/Google_Summer_of_Code_Ideas">Google Summer of Code program</a>. Prior to
this the project had a number of students in the program
via a joint application with the QEMU project. People are
encouraged to look at both the libvirt and QEMU programs
to identify potentially interesting projects to work on.
</p>
</body>
</html>

105
docs/contribute.rst Normal file
View File

@@ -0,0 +1,105 @@
=======================
Contributing to libvirt
=======================
This page provides guidance on how to contribute to the libvirt project.
.. contents::
Contributions required
----------------------
The libvirt project is always looking for new contributors to participate in
ongoing activities. While code development is a major part of the project,
assistance is needed in many other areas including documentation writing, bug
triage, testing, application integration, website / wiki content management,
translation, branding, social media and more. The only requirement is an
interest in virtualization and desire to help.
The following is a non-exhaustive list of areas in which people can contribute
to libvirt. If you have ideas for other contributions feel free to follow them.
- **Software development**. The official upstream code are kept in various `Git
repositories <https://gitlab.com/libvirt/>`__. The core library / daemon (and
thus the bulk of coding) is written in C, but there are language bindings
written in Python, Perl, Java, Ruby, Php, OCaml and Go. There are also higher
level wrappers mapping libvirt into other object frameworks, such GLib, CIM
and SNMP. For those interested in working on the core parts of libvirt, the
`contributor guidelines <hacking.html>`__ are mandatory reading
- **Translation**. All the libvirt modules aim to support translations where
appropriate. All translation is handling outside of the normal libvirt review
process, using the `Fedora
instance <https://translate.fedoraproject.org/projects/libvirt/libvirt>`__ of
the Weblate tool. Thus people wishing to contribute to translation should
join the Fedora translation team
- **Documentation**. There are docbook guides on various aspects of libvirt,
particularly application development guides for the C library and Python, and
a virsh command reference. There is thus scope for work by people who are
familiar with using or developing against libvirt, to write further content
for these guides. There is also a need for people to review existing content
for copy editing and identifying gaps in the docs
- **Website / wiki curation**. The bulk of the website is maintained in the
primary GIT repository, while the wiki site uses mediawiki. In both cases
there is a need for people to both write new content and curate existing
content to identify outdated information, improve its organization and target
gaps.
- **Testing**. There are a number of tests suites that can run automated tests
against libvirt. The coverage of the tests is never complete, so there is a
need for people to create new test suites and / or provide environments to
actually run the tests in a variety of deployment scenarios.
- **Code analysis**. The libvirt project has access to the coverity tool to run
static analysis against the codebase, however, there are other types of code
analysis that can be useful. In particular fuzzing of the inputs can be very
effective at identifying problematic edge cases.
- **Security handling**. Downstream (operating system) vendors who distribute
libvirt may wish to propose a person to be part of the security handling
team, to get early access to information about forthcoming vulnerability
fixes.
- **Evangelism**. Work done by the project is of no benefit unless the
(potential) user community knows that it exists. Thus it is critically
important to the health and future growth of the project, that there are a
people who evangelize the work created by the project. This can take many
forms, writing blog posts (about usage of features, personal user
experiences, areas for future work, and more), syndicating docs and blogs via
social media, giving user group and/or conference talks about libvirt.
- **User assistance**. Since documentation is never perfect, there are
inevitably cases where users will struggle to attain a deployment goal they
have, or run into trouble with managing an existing deployment. While some
users may be able to contact a software vendor to obtain support, it is
common to rely on community help forums such as `libvirt users mailing
list <contact.html#email>`__, or sites such as
`stackoverflow. <https://stackoverflow.com/questions/tagged/libvirt>`__
People who are familiar with libvirt and have ability & desire to help other
users are encouraged to participate in these help forums.
Communication
-------------
For full details on contacting other project contributors read the
`contact <contact.html>`__ page. There are two main channels that libvirt uses
for communication between contributors:
Mailing lists
~~~~~~~~~~~~~
The project has a number of `mailing lists <contact.html#email>`__ for general
communication between contributors. In general any design discussions and review
of contributions will take place on the mailing lists, so it is important for
all contributors to follow the traffic.
Instant messaging / chat
~~~~~~~~~~~~~~~~~~~~~~~~
Contributors to libvirt are encouraged to join the `IRC
channel <contact.html#irc>`__ used by the project, where they can have live
conversations with others members.
Student / outreach coding programs
----------------------------------
Since 2016, the libvirt project directly participates as an organization in the
`Google Summer of Code
program <https://wiki.libvirt.org/page/Google_Summer_of_Code_Ideas>`__. Prior to
this the project had a number of students in the program via a joint application
with the QEMU project. People are encouraged to look at both the libvirt and
QEMU programs to identify potentially interesting projects to work on.

View File

@@ -209,13 +209,6 @@ controlled via the system unit files
``libvirtd.socket``, ``libvirtd-ro.socket`` and ``libvirtd-admin.socket`` unit ``libvirtd.socket``, ``libvirtd-ro.socket`` and ``libvirtd-admin.socket`` unit
files. files.
Systemd releases prior to version 227 lacked support for passing the activation
socket unit names into the service. When using these old versions, the
``tcp_port``, ``tls_port`` and ``unix_sock_dir`` settings in ``libvirtd.conf``
must be changed in lock-step with the equivalent settings in the unit files to
ensure that ``libvirtd`` can identify the sockets.
Modular driver daemons Modular driver daemons
====================== ======================
@@ -354,13 +347,6 @@ controlled via the system unit files:
``virt${DRIVER}d.socket``, ``virt${DRIVER}d-ro.socket`` and ``virt${DRIVER}d.socket``, ``virt${DRIVER}d-ro.socket`` and
``virt${DRIVER}d-admin.socket`` unit files. ``virt${DRIVER}d-admin.socket`` unit files.
Systemd releases prior to version 227 lacked support for passing the activation
socket unit names into the service. When using these old versions, the
``unix_sock_dir`` setting in ``virt${DRIVER}d.conf`` must be changed in
lock-step with the equivalent setting in the unit files to ensure that
``virt${DRIVER}d`` can identify the sockets.
Switching to modular daemons Switching to modular daemons
---------------------------- ----------------------------
@@ -435,6 +421,58 @@ host first.
$ systemctl enable virtproxyd-tls.socket $ systemctl enable virtproxyd-tls.socket
$ systemctl start virtproxyd-tls.socket $ systemctl start virtproxyd-tls.socket
Checking whether modular/monolithic mode is in use
==================================================
New distributions are likely to use the modular mode although the upgrade
process preserves whichever mode was in use before the upgrade.
To determine whether modular or monolithic mode is in use on a host running
``systemd`` as the init system you can take the following steps:
#. Check whether the modular daemon infrastructure is in use
First check whether the modular daemon you are interested (see
`Modular driver daemons`_ for a summary of which daemons are provided by
libvirt) in is running:
#. Check ``.socket`` for socket activated services
::
# systemctl is-active virtqemud.socket
active
#. Check ``.service`` for always-running daemons
::
# systemctl is-active virtqemud.service
active
If either of the above is ``active`` your system is using the modular daemons.
#. Check whether the monolithic daemon is in use
#. Check ``libvirtd.socket``
::
# systemctl is-active libvirtd.socket
active
#. Check ``libvirtd.service`` for always-running daemon
::
# systemctl is-active libvirtd.service
active
If either of the above is ``active`` your system is using the monolithic
daemon.
#. To determine which of the above will be in use on the next boot of the system,
substitute ``is-enabled`` for ``is-active`` in the above examples.
Proxy daemon Proxy daemon
============ ============
@@ -587,12 +625,6 @@ controlled via the system unit files:
independently controlled via the ``ListenStream`` parameter in any of the independently controlled via the ``ListenStream`` parameter in any of the
``virtlogd.socket`` and ``virtlogd-admin.socket`` unit files. ``virtlogd.socket`` and ``virtlogd-admin.socket`` unit files.
Systemd releases prior to version 227 lacked support for passing the activation
socket unit names into the service. When using these old versions, the
``unix_sock_dir`` setting in ``virtlogd.conf`` must be changed in
lock-step with the equivalent setting in the unit files to ensure that
``virtlogd`` can identify the sockets.
Locking daemon Locking daemon
============== ==============
@@ -681,8 +713,23 @@ controlled via the system unit files:
independently controlled via the ``ListenStream`` parameter in any of the independently controlled via the ``ListenStream`` parameter in any of the
``virtlockd.socket`` and ``virtlockd-admin.socket`` unit files. ``virtlockd.socket`` and ``virtlockd-admin.socket`` unit files.
Systemd releases prior to version 227 lacked support for passing the activation Changing command line options for daemons
socket unit names into the service. When using these old versions, the =========================================
``unix_sock_dir`` setting in ``virtlockd.conf`` must be changed in
lock-step with the equivalent setting in the unit files to ensure that Two ways exist to override the defaults in the provided service files:
``virtlockd`` can identify the sockets. either a systemd "drop-in" configuration file, or a ``/etc/sysconfig/$daemon``
file must be created. For example, to change the command line option
for a debug session of ``libvirtd``, create a file
``/etc/systemd/system/libvirtd.service.d/debug.conf`` with the following content:
::
[Unit]
Description=Virtualization daemon, with override from debug.conf
[Service]
Environment=G_DEBUG=fatal-warnings
Environment=LIBVIRTD_ARGS="--listen --verbose"
After changes to systemd "drop-in" configuration files it is required to run
``systemctl daemon-reload``.

View File

@@ -1,13 +0,0 @@
=================
Developer tooling
=================
libvirt includes support for some useful development tools right
in its source repository, meaning users will be able to take
advantage of them without little or no configuration. Examples
include:
- `color_coded <https://github.com/jeaye/color_coded>`__, a vim
plugin for libclang-powered semantic syntax highlighting;
- `YouCompleteMe <http://valloric.github.io/YouCompleteMe/>`__, a
vim plugin for libclang-powered semantic code completion.

View File

@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>libvirt Application Development Guides</h1>
<p>
The libvirt API is accessible from a number of programming languages.
At this time, there are application development guides available
which cover the C API and the Python API. Of the two, the Python guide
is currently the more comprehensive document.
</p>
<ul>
<li><a href="https://libvirt.org/docs/libvirt-appdev-guide/en-US/html/">Application Development Guide (C language) HTML</a></li>
<li><a href="https://libvirt.org/docs/libvirt-appdev-guide/en-US/pdf/">Application Development Guide (C language) PDF</a></li>
<li><a href="https://libvirt.org/docs/libvirt-appdev-guide-python/en-US/html/">Application Development Guide (Python language) HTML</a></li>
<li><a href="https://libvirt.org/docs/libvirt-appdev-guide-python/en-US/pdf/">Application Development Guide (Python language) PDF</a></li>
</ul>
<h2>Contributing content</h2>
<p>
These guides are written in DocBook and published with the
publican tool, which is also used for Fedora and Red Hat
documentation. The original content is provided in GIT and
any contributions to the guide are welcome.
</p>
<pre>
# C language
$ git clone <a href="https://libvirt.org/git/?p=libvirt-appdev-guide.git">https://libvirt.org/git/libvirt-appdev-guide.git</a>
# Python language
$ git clone <a href="https://libvirt.org/git/?p=libvirt-appdev-guide-python.git">https://libvirt.org/git/libvirt-appdev-guide-python.git</a>
# Publican Style/Theme
$ git clone <a href="https://libvirt.org/git/?p=libvirt-publican.git">https://libvirt.org/git/libvirt-publican.git</a>
</pre>
</body>
</html>

View File

@@ -16,6 +16,9 @@
<dt><a href="windows.html">Windows</a></dt> <dt><a href="windows.html">Windows</a></dt>
<dd>Downloads for Windows</dd> <dd>Downloads for Windows</dd>
<dt><a href="macos.html">macOS</a></dt>
<dd>Working with libvirt on macOS</dd>
<dt><a href="migration.html">Migration</a></dt> <dt><a href="migration.html">Migration</a></dt>
<dd>Migrating guests between machines</dd> <dd>Migrating guests between machines</dd>

View File

@@ -1,661 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Downloads</h1>
<ul id="toc"></ul>
<h2><a id="releases">Project modules</a></h2>
<p>
The libvirt project maintains a number of inter-related modules beyond
the core C library/daemon.
</p>
<table class="top_table downloads">
<thead>
<tr>
<th>Module</th>
<th>Releases</th>
<th>GIT Repo</th>
<th>Bug Tracker</th>
<th>GIT Mirrors</th>
<th>Resources</th>
</tr>
</thead>
<tbody>
<tr>
<td>libvirt</td>
<td>
<a href="https://libvirt.org/sources/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt">github</a>
</td>
<td>
<a href="html/index.html">api ref</a>
<a href="news.html">changes</a>
</td>
</tr>
<tr>
<th colspan="7">Language bindings</th>
</tr>
<tr>
<td>C#</td>
<td>
<a href="https://libvirt.org/sources/csharp/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-csharp">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-csharp/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-csharp.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-csharp">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Go</td>
<td>
<a href="https://libvirt.org/go/libvirt">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-go-module">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-go-module/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-go-module.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-go-module">github</a>
</td>
<td>
<a href="https://pkg.go.dev/libvirt.org/go/libvirt">api ref</a>
</td>
</tr>
<tr>
<td>Java</td>
<td>
<a href="https://libvirt.org/sources/java/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-java">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-java/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-java.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-java">github</a>
</td>
<td></td>
</tr>
<tr>
<td>OCaml</td>
<td>
<a href="https://libvirt.org/sources/ocaml/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-ocaml">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-ocaml/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-ocaml.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-ocaml">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Perl (Sys::Virt)</td>
<td>
<a href="https://metacpan.org/release/Sys-Virt/">cpan</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-perl">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-perl/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-perl.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-perl">github</a>
</td>
<td>
<a href="https://metacpan.org/release/Sys-Virt/">api ref</a>
<a href="https://libvirt.org/git/?p=libvirt-perl.git;a=blob;f=Changes;hb=HEAD">changes</a>
</td>
</tr>
<tr>
<td>PHP</td>
<td>
<a href="https://libvirt.org/sources/php/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-php">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-php/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-php.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-php">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Python</td>
<td>
<a href="https://libvirt.org/sources/python/">libvirt</a>
<a href="https://pypi.python.org/pypi/libvirt-python">pypi</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-python">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-python/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-python.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-python">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Ruby</td>
<td>
<a href="https://libvirt.org/sources/ruby/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-ruby">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-ruby/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-ruby.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-ruby">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Rust</td>
<td>
<a href="https://crates.io/crates/virt">crates.io</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-rust">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-rust/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-rust.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-rust">github</a>
</td>
<td>
<a href="https://docs.rs/virt">api ref</a>
</td>
</tr>
<tr>
<th colspan="7">Integration modules</th>
</tr>
<tr>
<td>GLib / GConfig / GObject</td>
<td>
<a href="https://libvirt.org/sources/glib/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-glib">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-glib/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-glib.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-glib">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Go XML</td>
<td>
<a href="https://libvirt.org/go/libvirtxml">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-go-xml-module">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-go-xml-module/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-go-xml-module.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-go-xml-module">github</a>
</td>
<td>
<a href="https://pkg.go.dev/libvirt.org/go/libvirtxml">api ref</a>
</td>
</tr>
<tr>
<td>D-Bus</td>
<td>
<a href="https://libvirt.org/sources/dbus/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-dbus">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-dbus/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-dbus.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-dbus">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Console Proxy</td>
<td>
<a href="https://libvirt.org/sources/consoleproxy/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-console-proxy">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-console-proxy/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-console-proxy.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-console-proxy">github</a>
</td>
<td></td>
</tr>
<tr>
<td>CIM provider</td>
<td>
<a href="https://libvirt.org/sources/CIM/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-cim">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-cim/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-cim.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-cim">github</a>
</td>
<td></td>
</tr>
<tr>
<td>CIM utils</td>
<td>
<a href="https://libvirt.org/sources/CIM/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libcmpiutil">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libcmpiutil/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libcmpiutil.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libcmpiutil">github</a>
</td>
<td></td>
</tr>
<tr>
<td>SNMP</td>
<td>
<a href="https://libvirt.org/sources/snmp/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-snmp">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-snmp/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-snmp.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-snmp">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Application Sandbox</td>
<td>
<a href="https://libvirt.org/sources/sandbox/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-sandbox">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-sandbox/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-sandbox.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-sandbox">github</a>
</td>
<td></td>
</tr>
<tr>
<th colspan="7">Testing</th>
</tr>
<tr>
<td>TCK</td>
<td>
<a href="https://libvirt.org/sources/tck/">libvirt</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-tck">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-tck/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-tck.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-tck">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Test API</td>
<td></td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-test-API">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-test-API/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-test-API.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-test-API">github</a>
</td>
<td></td>
</tr>
<tr>
<td>Continuous Integration Config</td>
<td></td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-ci">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-ci/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-ci.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-ci">github</a>
</td>
<td></td>
</tr>
<tr>
<td>CIM Test</td>
<td></td>
<td>
<a href="https://gitlab.com/libvirt/cimtest">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/cimtest/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=cimtest.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/cimtest">github</a>
</td>
<td></td>
</tr>
<tr>
<th colspan="7">Documentation</th>
</tr>
<tr>
<td>Publican Brand</td>
<td></td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-publican">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-publican/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-publican.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-publican">github</a>
</td>
<td></td>
</tr>
<tr>
<td>App Development Guide</td>
<td></td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-appdev-guide">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-appdev-guide/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-appdev-guide.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-appdev-guide">github</a>
</td>
<td></td>
</tr>
<tr>
<td>App Development Guide Python</td>
<td></td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-appdev-guide-python">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-appdev-guide-python/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-appdev-guide-python.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-appdev-guide-python">github</a>
</td>
<td></td>
</tr>
<tr>
<td>virsh Command Reference</td>
<td></td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-virshcmdref">gitlab</a>
</td>
<td>
<a href="https://gitlab.com/libvirt/libvirt-virshcmdref/-/issues">issues</a>
</td>
<td class="gitmirror">
<a href="https://libvirt.org/git/?p=libvirt-virshcmdref.git;a=summary">libvirt</a>
<a href="https://github.com/libvirt/libvirt-virshcmdref">github</a>
</td>
<td></td>
</tr>
</tbody>
</table>
<h2>Primary download site</h2>
<p>
Most modules have releases made available for download on the project
site via HTTPS. Some modules are instead made available at alternative
locations, for example, the Perl binding is made available only on CPAN.
</p>
<ul>
<li><a href="https://libvirt.org/sources/">libvirt.org HTTPS server</a></li>
</ul>
<h2><a id="schedule">Primary release schedule</a></h2>
<p>
The core libvirt module follows a time based plan, with releases made
once a month on the 1st of each month give or take a few days. The only
exception is at the start of the year where there are two 6 weeks gaps
(first release in the middle of Jan, then skip the Feb release), giving
a total of 11 releases a year. The Python and Perl modules will aim to
release at the same time as the core libvirt module. Other modules have
independent ad-hoc releases with no fixed time schedule.
</p>
<h2><a id="numbering">Release numbering</a></h2>
<p>
Since libvirt 2.0.0, a time based version numbering rule
is applied to the core library releases. As such, the changes
in version number have do not have any implications with respect
to the scope of features or bugfixes included, the stability of
the code, or the API / ABI compatibility (libvirt API / ABI is
guaranteed stable forever). The rules applied for changing the
libvirt version number are:
</p>
<dl>
<dt><code>major</code></dt>
<dd>incremented by 1 for the first release of the year (the
Jan 15th release)</dd>
<dt><code>minor</code></dt>
<dd>reset to 0 with every major increment, otherwise incremented by 1
for each monthly release from git master</dd>
<dt><code>micro</code></dt>
<dd>always 0 for releases from git master, incremented by 1
for each stable maintenance release</dd>
</dl>
<p>
Prior to 2.0.0, the major/minor numbers were incremented
fairly arbitrarily, and maintenance releases appended a
fourth digit. The language bindings will aim to use the
same version number as the most recent core library API
they support. The other modules have their own distinct
release numbering sequence, though they generally aim
to follow the above rules for incrementing major/minor/micro
digits.
</p>
<h2><a id="maintenance">Maintenance releases</a></h2>
<p>
In the git repository are several stable maintenance branches
for the core library, matching the
pattern <code>v<i>major</i>.<i>minor</i>-maint</code>;
these branches are forked off the corresponding
<code>v<i>major</i>.<i>minor</i>.0</code> formal
release, and may have further releases of the
form <code>v<i>major</i>.<i>minor</i>.<i>micro</i></code>.
These maintenance branches should only contain bug fixes, and no
new features, backported from the master branch, and are
supported as long as at least one downstream distribution
expresses interest in a given branch. These maintenance
branches are considered during CVE analysis. In contrast
to the primary releases which are made once a month, there
is no formal schedule for the maintenance releases, which
are made whenever there is a need to make available key
bugfixes to downstream consumers. The language bindings
and other modules generally do not provide stable branch
releases.
</p>
<p>
For more details about contents of maintenance releases, see
<a href="https://wiki.libvirt.org/page/Maintenance_Releases">the
wiki page</a>.
</p>
<h2><a id="git">GIT source repository</a></h2>
<p>
All modules maintained by the libvirt project have their primary
source available in the <a href="https://libvirt.org/git/">project GIT server</a>.
Each module can be cloned anonymously using:
</p>
<pre>
git clone https://libvirt.org/git/[module name].git</pre>
<p>
The <code>git://</code> protocol is also available if desired, but
<code>https://</code> is encouraged, since it is more reliable when
faced with strict firewalls.
</p>
<pre>
git clone git://libvirt.org/[module name].git</pre>
<p>
In addition to this primary repository, there are the following read-only git
repositories which mirror the master one. Note that we currently do not
use the full set of features on these mirrors (e.g. pull requests on
GitHub, so please don't use them). All patch review and discussion only
occurs on the <a href="contact.html">libvir-list</a> mailing list. Also
note that some repositories listed below allow HTTP checkouts too.
</p>
<pre>
<a href="https://github.com/libvirt/">https://github.com/libvirt/</a>
<a href="https://gitlab.com/libvirt/libvirt">https://gitlab.com/libvirt/</a></pre>
<h2><a id="keys">Signing keys</a></h2>
<p>
Source RPM packages and tarballs for libvirt and libvirt-python published
on this project site are signed with a GPG signature. You should always
verify the package signature before using the source to compile binary
packages. The following key is currently used to generate the GPG
signatures:
</p>
<pre>
pub 4096R/10084C9C 2020-07-20 Jiří Denemark &lt;jdenemar@redhat.com&gt;
Fingerprint=453B 6531 0595 5628 5547 1199 CA68 BE80 1008 4C9C
</pre>
<p>
It can be downloaded from
<a href="https://libvirt.org/sources/gpg_key.asc">this site</a> or from
public GPG key servers.
</p>
<p>
Releases prior to libvirt-6.6 were signed with the following GPG key:
</p>
<pre>
pub dsa1024 2000-05-31 [SC]
C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
uid [ unknown] Daniel Veillard (Red Hat work email) &lt;veillard@redhat.com&gt;
uid [ unknown] Daniel Veillard &lt;Daniel.Veillard@w3.org&gt;
</pre>
<pre>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Starting from libvirt-6.6.0 the upstream releases will be done by Jiří Denemark
signed with his PGP key:
pub 4096R/10084C9C 2020-07-20 Jiří Denemark &lt;jdenemar@redhat.com&gt;
Fingerprint=453B 6531 0595 5628 5547 1199 CA68 BE80 1008 4C9C
This message is signed by the old signing key which was used for previous
releases.
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl/8H9cACgkQFViLJllr
6l3iVwgAm9n703/QoIfPbxT5qGQzWK6LNriEcG2R9MLgFcW+UuGA9cqIBLhH1RaJ
q7Gc3gK0dgE2HAF6DxuG5+nkDY6LdmonLOVFWQkMCh41JHFrV6tw8y9hc/RNOb/m
gFAl4HpwYisjTRvsTRcpR3ElK6lI0Yu4GY4gJxj5qH4L5exR+kkylwuAxqP+wuyY
b/L/tP76F4+Q9SSPj0M01NRVC7V8m3yvnok5y374vtxvRFome0WMELn81vphxBLx
X7LQ1LyjvRs0HhN5MutJES5FYDzArTYZfZJozJgE465XrHxMMCbXbZ/AgAs/aD+5
x+m2mFplbS57tMEoMBP/ezbbL5wpvA==
=KnaO
-----END PGP SIGNATURE-----
</pre>
</body>
</html>

392
docs/downloads.rst Normal file
View File

@@ -0,0 +1,392 @@
=========
Downloads
=========
.. contents::
Project modules
---------------
The libvirt project maintains a number of inter-related modules beyond the core
C library/daemon.
Libvirt
~~~~~~~
.. list-table::
:header-rows: 1
* - Module
- Releases
- GIT Repo
- Bug Tracker
- GIT Mirrors
- Resources
* - libvirt
- `libvirt <https://libvirt.org/sources/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt>`__
- `issues <https://gitlab.com/libvirt/libvirt/-/issues>`__
- `github <https://github.com/libvirt/libvirt>`__
- `api ref <html/index.html>`__
`changes <news.html>`__
Language bindings
~~~~~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Module
- Releases
- GIT Repo
- Bug Tracker
- GIT Mirrors
- Resources
* - C#
- `libvirt <https://libvirt.org/sources/csharp/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-csharp>`__
- `issues <https://gitlab.com/libvirt/libvirt-csharp/-/issues>`__
- `github <https://github.com/libvirt/libvirt-csharp>`__
-
* - Go
- `libvirt <https://libvirt.org/go/libvirt>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-go-module>`__
- `issues <https://gitlab.com/libvirt/libvirt-go-module/-/issues>`__
- `github <https://github.com/libvirt/libvirt-go-module>`__
- `api ref <https://pkg.go.dev/libvirt.org/go/libvirt>`__
* - Java
- `libvirt <https://libvirt.org/sources/java/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-java>`__
- `issues <https://gitlab.com/libvirt/libvirt-java/-/issues>`__
- `github <https://github.com/libvirt/libvirt-java>`__
-
* - OCaml
- `libvirt <https://libvirt.org/sources/ocaml/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-ocaml>`__
- `issues <https://gitlab.com/libvirt/libvirt-ocaml/-/issues>`__
- `github <https://github.com/libvirt/libvirt-ocaml>`__
-
* - Perl (Sys::Virt)
- `cpan <https://metacpan.org/release/Sys-Virt/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-perl>`__
- `issues <https://gitlab.com/libvirt/libvirt-perl/-/issues>`__
- `github <https://github.com/libvirt/libvirt-perl>`__
- `api ref <https://metacpan.org/release/Sys-Virt/>`__
`changes <https://libvirt.org/git/?p=libvirt-perl.git;a=blob;f=Changes;hb=HEAD>`__
* - PHP
- `libvirt <https://libvirt.org/sources/php/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-php>`__
- `issues <https://gitlab.com/libvirt/libvirt-php/-/issues>`__
- `github <https://github.com/libvirt/libvirt-php>`__
-
* - Python
- `libvirt <https://libvirt.org/sources/python/>`__
`pypi <https://pypi.python.org/pypi/libvirt-python>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-python>`__
- `issues <https://gitlab.com/libvirt/libvirt-python/-/issues>`__
- `github <https://github.com/libvirt/libvirt-python>`__
-
* - Ruby
- `libvirt <https://libvirt.org/sources/ruby/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-ruby>`__
- `issues <https://gitlab.com/libvirt/libvirt-ruby/-/issues>`__
- `github <https://github.com/libvirt/libvirt-ruby>`__
-
* - Rust
- `crates.io <https://crates.io/crates/virt>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-rust>`__
- `issues <https://gitlab.com/libvirt/libvirt-rust/-/issues>`__
- `github <https://github.com/libvirt/libvirt-rust>`__
- `api ref <https://docs.rs/virt>`__
Integration modules
~~~~~~~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Module
- Releases
- GIT Repo
- Bug Tracker
- GIT Mirrors
- Resources
* - GLib / GConfig / GObject
- `libvirt <https://libvirt.org/sources/glib/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-glib>`__
- `issues <https://gitlab.com/libvirt/libvirt-glib/-/issues>`__
- `github <https://github.com/libvirt/libvirt-glib>`__
-
* - Go XML
- `libvirt <https://libvirt.org/go/libvirtxml>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-go-xml-module>`__
- `issues <https://gitlab.com/libvirt/libvirt-go-xml-module/-/issues>`__
- `github <https://github.com/libvirt/libvirt-go-xml-module>`__
- `api ref <https://pkg.go.dev/libvirt.org/go/libvirtxml>`__
* - D-Bus
- `libvirt <https://libvirt.org/sources/dbus/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-dbus>`__
- `issues <https://gitlab.com/libvirt/libvirt-dbus/-/issues>`__
- `github <https://github.com/libvirt/libvirt-dbus>`__
-
* - Console Proxy
- `libvirt <https://libvirt.org/sources/consoleproxy/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-console-proxy>`__
- `issues <https://gitlab.com/libvirt/libvirt-console-proxy/-/issues>`__
- `github <https://github.com/libvirt/libvirt-console-proxy>`__
-
* - CIM provider
- `libvirt <https://libvirt.org/sources/CIM/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-cim>`__
- `issues <https://gitlab.com/libvirt/libvirt-cim/-/issues>`__
- `github <https://github.com/libvirt/libvirt-cim>`__
-
* - CIM utils
- `libvirt <https://libvirt.org/sources/CIM/>`__
- `gitlab <https://gitlab.com/libvirt/libcmpiutil>`__
- `issues <https://gitlab.com/libvirt/libcmpiutil/-/issues>`__
- `github <https://github.com/libvirt/libcmpiutil>`__
-
* - SNMP
- `libvirt <https://libvirt.org/sources/snmp/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-snmp>`__
- `issues <https://gitlab.com/libvirt/libvirt-snmp/-/issues>`__
- `github <https://github.com/libvirt/libvirt-snmp>`__
-
* - Application Sandbox
- `libvirt <https://libvirt.org/sources/sandbox/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-sandbox>`__
- `issues <https://gitlab.com/libvirt/libvirt-sandbox/-/issues>`__
- `github <https://github.com/libvirt/libvirt-sandbox>`__
-
Testing
~~~~~~~
.. list-table::
:header-rows: 1
* - Module
- Releases
- GIT Repo
- Bug Tracker
- GIT Mirrors
* - TCK
- `libvirt <https://libvirt.org/sources/tck/>`__
- `gitlab <https://gitlab.com/libvirt/libvirt-tck>`__
- `issues <https://gitlab.com/libvirt/libvirt-tck/-/issues>`__
- `github <https://github.com/libvirt/libvirt-tck>`__
* - Test API
-
- `gitlab <https://gitlab.com/libvirt/libvirt-test-API>`__
- `issues <https://gitlab.com/libvirt/libvirt-test-API/-/issues>`__
- `github <https://github.com/libvirt/libvirt-test-API>`__
* - Continuous Integration Config
-
- `gitlab <https://gitlab.com/libvirt/libvirt-ci>`__
- `issues <https://gitlab.com/libvirt/libvirt-ci/-/issues>`__
- `github <https://github.com/libvirt/libvirt-ci>`__
* - CIM Test
-
- `gitlab <https://gitlab.com/libvirt/cimtest>`__
- `issues <https://gitlab.com/libvirt/cimtest/-/issues>`__
- `github <https://github.com/libvirt/cimtest>`__
Documentation
~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Module
- GIT Repo
- Bug Tracker
- GIT Mirrors
* - Publican Brand
- `gitlab <https://gitlab.com/libvirt/libvirt-publican>`__
- `issues <https://gitlab.com/libvirt/libvirt-publican/-/issues>`__
- `github <https://github.com/libvirt/libvirt-publican>`__
* - App Development Guide
- `gitlab <https://gitlab.com/libvirt/libvirt-appdev-guide>`__
- `issues <https://gitlab.com/libvirt/libvirt-appdev-guide/-/issues>`__
- `github <https://github.com/libvirt/libvirt-appdev-guide>`__
* - App Development Guide Python
- `gitlab <https://gitlab.com/libvirt/libvirt-appdev-guide-python>`__
- `issues <https://gitlab.com/libvirt/libvirt-appdev-guide-python/-/issues>`__
- `github <https://github.com/libvirt/libvirt-appdev-guide-python>`__
* - virsh Command Reference
- `gitlab <https://gitlab.com/libvirt/libvirt-virshcmdref>`__
- `issues <https://gitlab.com/libvirt/libvirt-virshcmdref/-/issues>`__
- `github <https://github.com/libvirt/libvirt-virshcmdref>`__
Primary download site
---------------------
Most modules have releases made available for download on the project site via
HTTPS. Some modules are instead made available at alternative locations, for
example, the Perl binding is made available only on CPAN.
- `libvirt.org HTTPS server <https://libvirt.org/sources/>`__
Primary release schedule
------------------------
The core libvirt module follows a time based plan, with releases made once a
month on the 1st of each month give or take a few days. The only exception is at
the start of the year where there are two 6 weeks gaps (first release in the
middle of Jan, then skip the Feb release), giving a total of 11 releases a year.
The Python and Perl modules will aim to release at the same time as the core
libvirt module. Other modules have independent ad-hoc releases with no fixed
time schedule.
Release numbering
-----------------
Since libvirt 2.0.0, a time based version numbering rule is applied to the core
library releases. As such, the changes in version number have do not have any
implications with respect to the scope of features or bugfixes included, the
stability of the code, or the API / ABI compatibility (libvirt API / ABI is
guaranteed stable forever). The rules applied for changing the libvirt version
number are:
``major``
incremented by 1 for the first release of the year (the Jan 15th release)
``minor``
reset to 0 with every major increment, otherwise incremented by 1 for each
monthly release from git master
``micro``
always 0 for releases from git master, incremented by 1 for each stable
maintenance release
Prior to 2.0.0, the major/minor numbers were incremented fairly arbitrarily, and
maintenance releases appended a fourth digit. The language bindings will aim to
use the same version number as the most recent core library API they support.
The other modules have their own distinct release numbering sequence, though
they generally aim to follow the above rules for incrementing major/minor/micro
digits.
Maintenance releases
--------------------
In the git repository are several stable maintenance branches for the core
library, matching the pattern ``vmajor.minor-maint``; these branches are forked
off the corresponding ``vmajor.minor.0`` formal release, and may have further
releases of the form ``vmajor.minor.micro``. These maintenance branches should
only contain bug fixes, and no new features, backported from the master branch,
and are supported as long as at least one downstream distribution expresses
interest in a given branch. These maintenance branches are considered during CVE
analysis. In contrast to the primary releases which are made once a month, there
is no formal schedule for the maintenance releases, which are made whenever
there is a need to make available key bugfixes to downstream consumers. The
language bindings and other modules generally do not provide stable branch
releases.
For more details about contents of maintenance releases, see `the wiki
page <https://wiki.libvirt.org/page/Maintenance_Releases>`__.
GIT source repository
---------------------
All modules maintained by the libvirt project have their primary source
available in the `libvirt group on GitLab <https://gitlab.com/libvirt/>`__.
Each module can be cloned anonymously using:
::
git clone https://gitlab.com/libvirt/[module name].git
In addition to this primary repository, there are mirrored read-only git
repositories on GitHub:
::
https://github.com/libvirt/
And there are also read-only mirrors on libvirt.org:
::
git clone https://libvirt.org/git/[module name].git
Note that for most repositories, development happens via merge requests
on GitLab. However, for the main `libvirt.git` repository all patch review and
discussion only occurs on the `libvir-list <contact.html>`__ mailing list.
The GitHub repository is read-only and pull requests and issues there are ignored.
Signing keys
------------
Source RPM packages and tarballs for libvirt and libvirt-python published on
this project site are signed with a GPG signature. You should always verify the
package signature before using the source to compile binary packages. The
following key is currently used to generate the GPG signatures:
::
pub 4096R/10084C9C 2020-07-20 Jiří Denemark <jdenemar@redhat.com>
Fingerprint=453B 6531 0595 5628 5547 1199 CA68 BE80 1008 4C9C
It can be downloaded from `this
site <https://libvirt.org/sources/gpg_key.asc>`__ or from public GPG key
servers.
Releases prior to libvirt-6.6 were signed with the following GPG key:
::
pub dsa1024 2000-05-31 [SC]
C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
uid [ unknown] Daniel Veillard (Red Hat work email) <veillard@redhat.com>
uid [ unknown] Daniel Veillard <Daniel.Veillard@w3.org>
::
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Starting from libvirt-6.6.0 the upstream releases will be done by Jiří Denemark
signed with his PGP key:
pub 4096R/10084C9C 2020-07-20 Jiří Denemark <jdenemar@redhat.com>
Fingerprint=453B 6531 0595 5628 5547 1199 CA68 BE80 1008 4C9C
This message is signed by the old signing key which was used for previous
releases.
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl/8H9cACgkQFViLJllr
6l3iVwgAm9n703/QoIfPbxT5qGQzWK6LNriEcG2R9MLgFcW+UuGA9cqIBLhH1RaJ
q7Gc3gK0dgE2HAF6DxuG5+nkDY6LdmonLOVFWQkMCh41JHFrV6tw8y9hc/RNOb/m
gFAl4HpwYisjTRvsTRcpR3ElK6lI0Yu4GY4gJxj5qH4L5exR+kkylwuAxqP+wuyY
b/L/tP76F4+Q9SSPj0M01NRVC7V8m3yvnok5y374vtxvRFome0WMELn81vphxBLx
X7LQ1LyjvRs0HhN5MutJES5FYDzArTYZfZJozJgE465XrHxMMCbXbZ/AgAs/aD+5
x+m2mFplbS57tMEoMBP/ezbbL5wpvA==
=KnaO
-----END PGP SIGNATURE-----

View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Internal drivers</h1>
<ul>
<li><a href="#hypervisor">Hypervisor drivers</a></li>
<li><a href="storage.html">Storage drivers</a></li>
<li><a href="drvnodedev.html">Node device driver</a></li>
<li><a href="drvsecret.html">Secret driver</a></li>
</ul>
<p>
The libvirt public API delegates its implementation to one or
more internal drivers, depending on the <a href="uri.html">connection URI</a>
passed when initializing the library. There is always a hypervisor driver
active, and if the libvirt daemon is available there will usually be a
network and storage driver active.
</p>
<h2><a id="hypervisor">Hypervisor drivers</a></h2>
<p>
The hypervisor drivers currently supported by libvirt are:
</p>
<ul>
<li><strong><a href="drvlxc.html">LXC</a></strong> - Linux Containers</li>
<li><strong><a href="drvopenvz.html">OpenVZ</a></strong></li>
<li><strong><a href="drvqemu.html">QEMU</a></strong></li>
<li><strong><a href="drvtest.html">Test</a></strong> - Used for testing</li>
<li><strong><a href="drvvbox.html">VirtualBox</a></strong></li>
<li><strong><a href="drvesx.html">VMware ESX</a></strong></li>
<li><strong><a href="drvvmware.html">VMware Workstation/Player</a></strong></li>
<li><strong><a href="drvxen.html">Xen</a></strong></li>
<li><strong><a href="drvhyperv.html">Microsoft Hyper-V</a></strong></li>
<li><strong><a href="drvvirtuozzo.html">Virtuozzo</a></strong></li>
<li><strong><a href="drvbhyve.html">Bhyve</a></strong> - The BSD Hypervisor</li>
<li><strong><a href="drvch.html">Cloud Hypervisor</a></strong></li>
</ul>
</body>
</html>

31
docs/drivers.rst Normal file
View File

@@ -0,0 +1,31 @@
================
Internal drivers
================
- `Hypervisor drivers <#hypervisor-drivers>`__
- `Storage drivers <storage.html>`__
- `Node device driver <drvnodedev.html>`__
- `Secret driver <drvsecret.html>`__
The libvirt public API delegates its implementation to one or more internal
drivers, depending on the `connection URI <uri.html>`__ passed when initializing
the library. There is always a hypervisor driver active, and if the libvirt
daemon is available there will usually be a network and storage driver active.
Hypervisor drivers
------------------
The hypervisor drivers currently supported by libvirt are:
- `LXC <drvlxc.html>`__ - Linux Containers
- `OpenVZ <drvopenvz.html>`__
- `QEMU <drvqemu.html>`__
- `Test <drvtest.html>`__ - Used for testing
- `VirtualBox <drvvbox.html>`__
- `VMware ESX <drvesx.html>`__
- `VMware Workstation/Player <drvvmware.html>`__
- `Xen <drvxen.html>`__
- `Microsoft Hyper-V <drvhyperv.html>`__
- `Virtuozzo <drvvirtuozzo.html>`__
- `Bhyve <drvbhyve.html>`__ - The BSD Hypervisor
- `Cloud Hypervisor <drvch.html>`__

View File

@@ -1,13 +1,18 @@
.. role:: since .. role:: since
.. role:: removed .. role:: removed
========================== ==============================
KVM/QEMU hypervisor driver QEMU/KVM/HVF hypervisor driver
========================== ==============================
The libvirt KVM/QEMU driver can manage any QEMU emulator from version 2.11.0 or The libvirt KVM/QEMU driver can manage any QEMU emulator from version 2.11.0 or
later. later.
It supports multiple QEMU accelerators: software
emulation also known as TCG, hardware-assisted virtualization on Linux
with KVM and hardware-assisted virtualization on macOS with
Hypervisor.framework (:since:`since 8.1.0`).
.. contents:: .. contents::
Project Links Project Links
@@ -15,6 +20,7 @@ Project Links
- The `KVM <https://www.linux-kvm.org/>`__ Linux hypervisor - The `KVM <https://www.linux-kvm.org/>`__ Linux hypervisor
- The `QEMU <https://wiki.qemu.org/Index.html>`__ emulator - The `QEMU <https://wiki.qemu.org/Index.html>`__ emulator
- `Hypervisor.framework`<https://developer.apple.com/documentation/hypervisor>__` reference
Deployment pre-requisites Deployment pre-requisites
------------------------- -------------------------
@@ -27,6 +33,9 @@ Deployment pre-requisites
- **KVM hypervisor**: The driver will probe ``/usr/bin`` for the presence of - **KVM hypervisor**: The driver will probe ``/usr/bin`` for the presence of
``qemu-kvm`` and ``/dev/kvm`` device node. If both are found, then KVM fully ``qemu-kvm`` and ``/dev/kvm`` device node. If both are found, then KVM fully
virtualized, hardware accelerated guests will be available. virtualized, hardware accelerated guests will be available.
- **Hypervisor.framework (HVF)**: The driver will probe ``sysctl`` for the
presence of ``Hypervisor.framework``. If it is found and QEMU is newer than
2.12, then it will be possible to create hardware accelerated guests.
Connections to QEMU driver Connections to QEMU driver
-------------------------- --------------------------
@@ -571,6 +580,63 @@ reconfigure libvirtd.
*DO NOT* use in production. *DO NOT* use in production.
Overriding properties of QEMU devices
-------------------------------------
For development or testing the ``<qemu:override>`` tag allows to override
specific properties of devices instantiated by libvirt.
The ``<qemu:device>`` sub-element groups overrides for a device identified via
the ``alias`` attribute. The alias corresponds to the ``<alias name=''>``
property of a device. It's strongly recommended to use user-specified aliases
for devices with overridden properties.
Sub element ``<qemu:frontend>`` encapsulates all overrides of properties for the
device frontend and overrides what libvirt formats via ``-device``.
:since:`Since 8.2.0`.
The individual properties are overridden by a ``<qemu:property>`` element. The
``name`` specifies the name of the property to override. In case when libvirt
doesn't configure the property a property with the name is added to the
commandline. The ``type`` attribute specifies a type of the argument used. The
type must correspond with the type that is expected by QEMU. Supported values
for the type attribute are: ``string``, ``number``, ``bool`` (allowed values for
``bool`` are ``true`` and ``false``) and ``remove``. The ``remove`` type is
special and instructs libvirt to remove the property without replacement.
The overrides are applied only to initial device configuration passed to QEMU
via the commandline. Later hotplug operations will not apply any modifications.
Configuring override for a device alias which is not used or attempting to
remove a device property which is not formatted by libvirt will cause failure
to startup the VM.
*Note:* The libvirt project doesn't guarantee any form of compatibility and
stability of devices with overridden properties. The domain is tainted when
such configuration is used.
Example:
::
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>testvm</name>
[...]
<qemu:override>
<qemu:device alias='ua-devalias'>
<qemu:frontend>
<qemu:property name='propname1' type='string' value='test'/>
<qemu:property name='propname2' type='unsigned' value='123'/>
<qemu:property name='propname2' type='signed' value='-123'/>
<qemu:property name='propname3' type='bool' value='false'/>
<qemu:property name='propname4' type='remove'/>
</qemu:frontend>
</qemu:device>
</qemu:override>
</domain>
Example domain XML config Example domain XML config
------------------------- -------------------------
@@ -634,3 +700,36 @@ KVM hardware accelerated guest on i686
<graphics type='vnc' port='-1' keymap='de'/> <graphics type='vnc' port='-1' keymap='de'/>
</devices> </devices>
</domain> </domain>
HVF hardware accelerated guest on x86_64
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
<domain type='hvf'>
<name>hvf-demo</name>
<uuid>4dea24b3-1d52-d8f3-2516-782e98a23fa0</uuid>
<memory>131072</memory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">hvm</type>
</os>
<features>
<acpi/>
</features>
<clock sync="localtime"/>
<devices>
<emulator>/usr/local/bin/qemu-system-x86_64</emulator>
<controller type='scsi' index='0' model='virtio-scsi'/>
<disk type='volume' device='disk'>
<driver name='qemu' type='qcow2'/>
<source pool='default' volume='myos'/>
<target bus='scsi' dev='sda'/>
</disk>
<interface type='user'>
<mac address='24:42:53:21:52:45'/>
<model type='virtio'/>
</interface>
<graphics type='vnc' port='-1'/>
</devices>
</domain>

View File

@@ -1,84 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >Handling of errors</h1>
<p>The main goals of libvirt when it comes to error handling are:</p>
<ul>
<li>provide as much detail as possible</li>
<li>provide the information as soon as possible</li>
<li>dont force the library user into one style of error handling</li>
</ul>
<p>As result the library provide both synchronous, callback based and
asynchronous error reporting. When an error happens in the library code the
error is logged, allowing to retrieve it later and if the user registered an
error callback it will be called synchronously. Once the call to libvirt ends
the error can be detected by the return value and the full information for
the last logged error can be retrieved.</p>
<p>To avoid as much as possible troubles with a global variable in a
multithreaded environment, libvirt will associate when possible the errors to
the current connection they are related to, that way the error is stored in a
dynamic structure which can be made thread specific. Error callback can be
set specifically to a connection with</p>
<p>So error handling in the code is the following:</p>
<ol>
<li>if the error can be associated to a connection for example when failing
to look up a domain
<ol><li>if there is a callback associated to the connection set with <a href="html/libvirt-virterror.html#virConnSetErrorFunc">virConnSetErrorFunc</a>,
call it with the error information</li><li>otherwise if there is a global callback set with <a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a>,
call it with the error information</li><li>otherwise call <a href="html/libvirt-virterror.html#virDefaultErrorFunc">virDefaultErrorFunc</a>
which is the default error function of the library issuing the error
on stderr</li><li>save the error in the connection for later retrieval with <a href="html/libvirt-virterror.html#virConnGetLastError">virConnGetLastError</a></li></ol></li>
<li>otherwise like when failing to create a hypervisor connection:
<ol><li>if there is a global callback set with <a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a>,
call it with the error information</li><li>otherwise call <a href="html/libvirt-virterror.html#virDefaultErrorFunc">virDefaultErrorFunc</a>
which is the default error function of the library issuing the error
on stderr</li><li>save the error in the connection for later retrieval with <a href="html/libvirt-virterror.html#virGetLastError">virGetLastError</a></li></ol></li>
</ol>
<p>In all cases the error information is provided as a <a href="html/libvirt-virterror.html#virErrorPtr">virErrorPtr</a> pointer to
read-only structure <a href="html/libvirt-virterror.html#virError">virError</a> containing the
following fields:</p>
<ul>
<li>code: an error number from the <a href="html/libvirt-virterror.html#virErrorNumber">virErrorNumber</a>
enum</li>
<li>domain: an enum indicating which part of libvirt raised the error see
<a href="html/libvirt-virterror.html#virErrorDomain">virErrorDomain</a></li>
<li>level: the error level, usually VIR_ERR_ERROR, though there is room for
warnings like VIR_ERR_WARNING</li>
<li>message: the full human-readable formatted string of the error</li>
<li>conn: if available a pointer to the <a href="html/libvirt-libvirt-host.html#virConnectPtr">virConnectPtr</a>
connection to the hypervisor where this happened</li>
<li>dom: if available a pointer to the <a href="html/libvirt-libvirt-domain.html#virDomainPtr">virDomainPtr</a> domain
targeted in the operation</li>
</ul>
<p>and then extra raw information about the error which may be initialized
to 0 or NULL if unused</p>
<ul>
<li>str1, str2, str3: string information, usually str1 is the error
message format</li>
<li>int1, int2: integer information</li>
</ul>
<p>So usually, setting up specific error handling with libvirt consist of
registering a handler with <a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a> or
with <a href="html/libvirt-virterror.html#virConnSetErrorFunc">virConnSetErrorFunc</a>,
check the value of the code value, take appropriate action, if needed let
libvirt print the error on stderr by calling <a href="html/libvirt-virterror.html#virDefaultErrorFunc">virDefaultErrorFunc</a>.
For asynchronous error handing, set such a function doing nothing to avoid
the error being reported on stderr, and call virConnGetLastError or
virGetLastError when an API call returned an error value. It can be a good
idea to use <a href="html/libvirt-virterror.html#virResetLastError">virResetError</a> or <a href="html/libvirt-virterror.html#virConnResetLastError">virConnResetLastError</a>
once an error has been processed fully.</p>
<p>At the python level, there only a global reporting callback function at
this point, see the error.py example about it:</p>
<pre>def handler(ctxt, err):
global errno
#print "handler(%s, %s)" % (ctxt, err)
errno = err
libvirt.registerErrorHandler(handler, 'context') </pre>
<p>the second argument to the registerErrorHandler function is passed as the
first argument of the callback like in the C version. The error is a tuple
containing the same field as a virError in C, but cast to Python.</p>
</body>
</html>

109
docs/errors.rst Normal file
View File

@@ -0,0 +1,109 @@
==================
Handling of errors
==================
The main goals of libvirt when it comes to error handling are:
- provide as much detail as possible
- provide the information as soon as possible
- dont force the library user into one style of error handling
As result the library provide both synchronous, callback based and asynchronous
error reporting. When an error happens in the library code the error is logged,
allowing to retrieve it later and if the user registered an error callback it
will be called synchronously. Once the call to libvirt ends the error can be
detected by the return value and the full information for the last logged error
can be retrieved.
To avoid as much as possible troubles with a global variable in a multithreaded
environment, libvirt will associate when possible the errors to the current
connection they are related to, that way the error is stored in a dynamic
structure which can be made thread specific. Error callback can be set
specifically to a connection with
So error handling in the code is the following:
#. if the error can be associated to a connection for example when failing to
look up a domain
#. if there is a callback associated to the connection set with
`virConnSetErrorFunc <html/libvirt-virterror.html#virConnSetErrorFunc>`__,
call it with the error information
#. otherwise if there is a global callback set with
`virSetErrorFunc <html/libvirt-virterror.html#virSetErrorFunc>`__, call it
with the error information
#. otherwise call
`virDefaultErrorFunc <html/libvirt-virterror.html#virDefaultErrorFunc>`__
which is the default error function of the library issuing the error on
stderr
#. save the error in the connection for later retrieval with
`virConnGetLastError <html/libvirt-virterror.html#virConnGetLastError>`__
#. otherwise like when failing to create a hypervisor connection:
#. if there is a global callback set with
`virSetErrorFunc <html/libvirt-virterror.html#virSetErrorFunc>`__, call it
with the error information
#. otherwise call
`virDefaultErrorFunc <html/libvirt-virterror.html#virDefaultErrorFunc>`__
which is the default error function of the library issuing the error on
stderr
#. save the error in the connection for later retrieval with
`virGetLastError <html/libvirt-virterror.html#virGetLastError>`__
In all cases the error information is provided as a
`virErrorPtr <html/libvirt-virterror.html#virErrorPtr>`__ pointer to read-only
structure `virError <html/libvirt-virterror.html#virError>`__ containing the
following fields:
- code: an error number from the
`virErrorNumber <html/libvirt-virterror.html#virErrorNumber>`__ enum
- domain: an enum indicating which part of libvirt raised the error see
`virErrorDomain <html/libvirt-virterror.html#virErrorDomain>`__
- level: the error level, usually VIR_ERR_ERROR, though there is room for
warnings like VIR_ERR_WARNING
- message: the full human-readable formatted string of the error
- conn: if available a pointer to the
`virConnectPtr <html/libvirt-libvirt-host.html#virConnectPtr>`__ connection
to the hypervisor where this happened
- dom: if available a pointer to the
`virDomainPtr <html/libvirt-libvirt-domain.html#virDomainPtr>`__ domain
targeted in the operation
and then extra raw information about the error which may be initialized to 0 or
NULL if unused
- str1, str2, str3: string information, usually str1 is the error message
format
- int1, int2: integer information
So usually, setting up specific error handling with libvirt consist of
registering a handler with
`virSetErrorFunc <html/libvirt-virterror.html#virSetErrorFunc>`__ or with
`virConnSetErrorFunc <html/libvirt-virterror.html#virConnSetErrorFunc>`__, check
the value of the code value, take appropriate action, if needed let libvirt
print the error on stderr by calling
`virDefaultErrorFunc <html/libvirt-virterror.html#virDefaultErrorFunc>`__. For
asynchronous error handing, set such a function doing nothing to avoid the error
being reported on stderr, and call virConnGetLastError or virGetLastError when
an API call returned an error value. It can be a good idea to use
`virResetError <html/libvirt-virterror.html#virResetLastError>`__ or
`virConnResetLastError <html/libvirt-virterror.html#virConnResetLastError>`__
once an error has been processed fully.
At the python level, there only a global reporting callback function at this
point, see the error.py example about it:
::
def handler(ctxt, err):
global errno
#print "handler(%s, %s)" % (ctxt, err)
errno = err
libvirt.registerErrorHandler(handler, 'context')
the second argument to the registerErrorHandler function is passed as the first
argument of the callback like in the C version. The error is a tuple containing
the same field as a virError in C, but cast to Python.

View File

@@ -51,7 +51,10 @@
<dt><code>topology</code></dt> <dt><code>topology</code></dt>
<dd>This element embodies the host internal topology. Management <dd>This element embodies the host internal topology. Management
applications may want to learn this information when orchestrating new applications may want to learn this information when orchestrating new
guests - e.g. due to reduce inter-NUMA node transfers.</dd> guests - e.g. due to reduce inter-NUMA node transfers. Note that the
<code>sockets</code> value reported here is per-NUMA-node; this is in
contrast to the value given in domain definitions, which is interpreted
as a total number of sockets for the domain.</dd>
<dt><code>secmodel</code></dt> <dt><code>secmodel</code></dt>
<dd>To find out default security labels for different security models you <dd>To find out default security labels for different security models you

View File

@@ -20,7 +20,8 @@ Element and attribute overview
The root element required for all virtual machines is named ``domain``. It has The root element required for all virtual machines is named ``domain``. It has
two attributes, the ``type`` specifies the hypervisor used for running the two attributes, the ``type`` specifies the hypervisor used for running the
domain. The allowed values are driver specific, but include "xen", "kvm", "qemu" domain. The allowed values are driver specific, but include "xen", "kvm",
"hvf" (:since:`since 8.1.0 and QEMU 2.12`), "qemu"
and "lxc". The second attribute is ``id`` which is a unique integer identifier and "lxc". The second attribute is ``id`` which is a unique integer identifier
for the running guest machine. Inactive machines have no id value. for the running guest machine. Inactive machines have no id value.
@@ -110,12 +111,19 @@ harddisk, cdrom, network) determining where to obtain/find the boot image.
:: ::
<!-- Xen with fullvirt loader -->
... ...
<os firmware='efi'> <os>
<type>hvm</type> <type>hvm</type>
<loader readonly='yes' secure='no' type='rom'>/usr/lib/xen/boot/hvmloader</loader> <loader>/usr/lib/xen/boot/hvmloader</loader>
<nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/nvram/guest_VARS.fd</nvram>
<boot dev='hd'/> <boot dev='hd'/>
</os>
...
<!-- QEMU with default firmware, serial console and SMBIOS -->
...
<os>
<type>hvm</type>
<boot dev='cdrom'/> <boot dev='cdrom'/>
<bootmenu enable='yes' timeout='3000'/> <bootmenu enable='yes' timeout='3000'/>
<smbios mode='sysinfo'/> <smbios mode='sysinfo'/>
@@ -123,6 +131,25 @@ harddisk, cdrom, network) determining where to obtain/find the boot image.
</os> </os>
... ...
<!-- QEMU with UEFI manual firmware and secure boot -->
...
<os>
<type>hvm</type>
<loader readonly='yes' secure='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
<nvram template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/nvram/guest_VARS.fd</nvram>
<boot dev='hd'/>
</os>
...
<!-- QEMU with automatic UEFI firmware and secure boot -->
...
<os firmware='efi'>
<type>hvm</type>
<loader secure='yes'/>
<boot dev='hd'/>
</os>
...
``firmware`` ``firmware``
The ``firmware`` attribute allows management applications to automatically The ``firmware`` attribute allows management applications to automatically
fill ``<loader/>`` and ``<nvram/>`` elements and possibly enable some fill ``<loader/>`` and ``<nvram/>`` elements and possibly enable some
@@ -977,7 +1004,7 @@ Memory Backing
<locked/> <locked/>
<source type="file|anonymous|memfd"/> <source type="file|anonymous|memfd"/>
<access mode="shared|private"/> <access mode="shared|private"/>
<allocation mode="immediate|ondemand"/> <allocation mode="immediate|ondemand" threads='8'/>
<discard/> <discard/>
</memoryBacking> </memoryBacking>
... ...
@@ -1026,8 +1053,10 @@ influence how virtual memory pages are backed by host pages.
Using the ``mode`` attribute, specify if the memory is to be "shared" or Using the ``mode`` attribute, specify if the memory is to be "shared" or
"private". This can be overridden per numa node by ``memAccess``. "private". This can be overridden per numa node by ``memAccess``.
``allocation`` ``allocation``
Using the ``mode`` attribute, specify when to allocate the memory by Using the optional ``mode`` attribute, specify when to allocate the memory by
supplying either "immediate" or "ondemand". supplying either "immediate" or "ondemand". :since:`Since 8.2.0` it is
possible to set the number of threads that hypervisor uses to allocate
memory via ``threads`` attribute.
``discard`` ``discard``
When set and supported by hypervisor the memory content is discarded just When set and supported by hypervisor the memory content is discarded just
before guest shuts down (or when DIMM module is unplugged). Please note that before guest shuts down (or when DIMM module is unplugged). Please note that
@@ -1425,7 +1454,8 @@ In case no restrictions need to be put on CPU model and its features, a simpler
:since:`Since 7.1.0` with the QEMU driver. :since:`Since 7.1.0` with the QEMU driver.
Both ``host-model`` and ``host-passthrough`` modes make sense when a domain Both ``host-model`` and ``host-passthrough`` modes make sense when a domain
can run directly on the host CPUs (for example, domains with type ``kvm``). can run directly on the host CPUs (for example, domains with type ``kvm``
or ``hvf``).
The actual host CPU is irrelevant for domains with emulated virtual CPUs The actual host CPU is irrelevant for domains with emulated virtual CPUs
(such as domains with type ``qemu``). However, for backward compatibility (such as domains with type ``qemu``). However, for backward compatibility
``host-model`` may be implemented even for domains running on emulated CPUs ``host-model`` may be implemented even for domains running on emulated CPUs
@@ -1459,12 +1489,12 @@ In case no restrictions need to be put on CPU model and its features, a simpler
The ``topology`` element specifies requested topology of virtual CPU provided The ``topology`` element specifies requested topology of virtual CPU provided
to the guest. Four attributes, ``sockets``, ``dies``, ``cores``, and to the guest. Four attributes, ``sockets``, ``dies``, ``cores``, and
``threads``, accept non-zero positive integer values. They refer to the ``threads``, accept non-zero positive integer values. They refer to the
number of CPU sockets per NUMA node, number of dies per socket, number of total number of CPU sockets, number of dies per socket, number of cores per
cores per die, and number of threads per core, respectively. The ``dies`` die, and number of threads per core, respectively. The ``dies`` attribute is
attribute is optional and will default to 1 if omitted, while the other optional and will default to 1 if omitted, while the other attributes are all
attributes are all mandatory. Hypervisors may require that the maximum number mandatory. Hypervisors may require that the maximum number of vCPUs specified
of vCPUs specified by the ``cpus`` element equals to the number of vcpus by the ``cpus`` element equals to the number of vcpus resulting from the
resulting from the topology. topology.
``feature`` ``feature``
The ``cpu`` element can contain zero or more ``feature`` elements used to The ``cpu`` element can contain zero or more ``feature`` elements used to
fine-tune features provided by the selected CPU model. The list of known fine-tune features provided by the selected CPU model. The list of known
@@ -1634,14 +1664,13 @@ ACPI Heterogeneous Memory Attribute Table
<cpu> <cpu>
... ...
<numa> <numa>
<cell id='0' cpus='0-3' memory='512000' unit='KiB' discard='yes'/> <cell id='0' cpus='0-3' memory='2097152' unit='KiB' discard='yes'>
<cell id='1' cpus='4-7' memory='512000' unit='KiB' memAccess='shared'/>
<cell id='3' cpus='0-3' memory='2097152' unit='KiB'>
<cache level='1' associativity='direct' policy='writeback'> <cache level='1' associativity='direct' policy='writeback'>
<size value='10' unit='KiB'/> <size value='10' unit='KiB'/>
<line value='8' unit='B'/> <line value='8' unit='B'/>
</cache> </cache>
</cell> </cell>
<cell id='1' cpus='4-7' memory='512000' unit='KiB' memAccess='shared'/>
<interconnects> <interconnects>
<latency initiator='0' target='0' type='access' value='5'/> <latency initiator='0' target='0' type='access' value='5'/>
<latency initiator='0' target='0' cache='1' type='access' value='10'/> <latency initiator='0' target='0' cache='1' type='access' value='10'/>
@@ -1749,7 +1778,7 @@ Each of these states allow for the same four possible actions.
The domain will be terminated and then restarted with a new name. (Only The domain will be terminated and then restarted with a new name. (Only
supported by the libxl hypervisor driver.) supported by the libxl hypervisor driver.)
QEMU/KVM supports the ``on_poweroff`` and ``on_reboot`` events handling the QEMU/KVM/HVF supports the ``on_poweroff`` and ``on_reboot`` events handling the
``destroy`` and ``restart`` actions, but the combination of ``on_poweroff`` set ``destroy`` and ``restart`` actions, but the combination of ``on_poweroff`` set
to ``restart`` and ``on_reboot`` set to ``destroy`` is forbidden. to ``restart`` and ``on_reboot`` set to ``destroy`` is forbidden.
@@ -1884,8 +1913,8 @@ are:
Physical address extension mode allows 32-bit guests to address more than 4 Physical address extension mode allows 32-bit guests to address more than 4
GB of memory. GB of memory.
``acpi`` ``acpi``
ACPI is useful for power management, for example, with KVM guests it is ACPI is useful for power management, for example, with KVM or HVF guests it
required for graceful shutdown to work. is required for graceful shutdown to work.
``apic`` ``apic``
APIC allows the use of programmable IRQ management. :since:`Since 0.10.2 APIC allows the use of programmable IRQ management. :since:`Since 0.10.2
(QEMU only)` there is an optional attribute ``eoi`` with values ``on`` and (QEMU only)` there is an optional attribute ``eoi`` with values ``on`` and
@@ -2593,13 +2622,14 @@ paravirtualized driver is specified via the ``disk`` element.
Indicates the default behavior of the disk during disk snapshots: Indicates the default behavior of the disk during disk snapshots:
"``internal``" requires a file format such as qcow2 that can store both "``internal``" requires a file format such as qcow2 that can store both
the snapshot and the data changes since the snapshot; "``external``" will the snapshot and the data changes since the snapshot; "``external``" will
separate the snapshot from the live data; and "``no``" means the disk will separate the snapshot from the live data; "``no``" means the disk will
not participate in snapshots. Read-only disks default to "``no``", while not participate in snapshots; and ``manual`` allows snapshotting done via
the default for other disks depends on the hypervisor's capabilities. Some an unmanaged storage provider. Read-only disks default to "``no``", while
hypervisors allow a per-snapshot choice as well, during `domain snapshot the default for other disks depends on the hypervisor's capabilities.
creation <formatsnapshot.html>`__. Not all snapshot modes are supported; Some hypervisors allow a per-snapshot choice as well, during `domain
for example, enabling snapshots with a transient disk generally does not snapshot creation <formatsnapshot.html>`__. Not all snapshot modes are
make sense. :since:`Since 0.9.5` supported; for example, enabling snapshots with a transient disk
generally does not make sense. :since:`Since 0.9.5`
``source`` ``source``
Representation of the disk ``source`` depends on the disk ``type`` attribute Representation of the disk ``source`` depends on the disk ``type`` attribute
@@ -2626,7 +2656,9 @@ paravirtualized driver is specified via the ``disk`` element.
be enabled by setting the ``tls`` attribute to ``yes``. For the QEMU be enabled by setting the ``tls`` attribute to ``yes``. For the QEMU
hypervisor, usage of a TLS environment can also be globally controlled on hypervisor, usage of a TLS environment can also be globally controlled on
the host by the ``nbd_tls`` and ``nbd_tls_x509_cert_dir`` in the host by the ``nbd_tls`` and ``nbd_tls_x509_cert_dir`` in
/etc/libvirt/qemu.conf. ('tls' :since:`Since 4.5.0` ) /etc/libvirt/qemu.conf. ('tls' :since:`Since 4.5.0` ) :since:`Since 8.2.0`
the optional attribute ``tlsHostname`` can be used to override the
expected host name of the NBD server used for TLS certificate verification.
For protocols ``http`` and ``https`` an optional attribute ``query`` For protocols ``http`` and ``https`` an optional attribute ``query``
specifies the query string. ( :since:`Since 6.2.0` ) specifies the query string. ( :since:`Since 6.2.0` )
@@ -6194,14 +6226,16 @@ A video device.
You can provide the amount of video memory in kibibytes (blocks of 1024 You can provide the amount of video memory in kibibytes (blocks of 1024
bytes) using ``vram``. This is supported only for guest type of "vz", "qemu", bytes) using ``vram``. This is supported only for guest type of "vz", "qemu",
"vbox", "vmx" and "xen". If no value is provided the default is used. If the "kvm", "hvf", "vbox", "vmx" and "xen".
If no value is provided the default is used. If the
size is not a power of two it will be rounded to closest one. size is not a power of two it will be rounded to closest one.
The number of screen can be set using ``heads``. This is supported only for The number of screen can be set using ``heads``. This is supported only for
guests type of "vz", "kvm", "vbox" and "vmx". guests type of "vz", "kvm", "hvf", "vbox" and "vmx".
For guest type of "kvm" or "qemu" and model type "qxl" there are optional For guest type of "kvm", "hvf" or "qemu" and model type "qxl" there are
attributes. Attribute ``ram`` ( :since:`since 1.0.2` ) specifies the size of optional attributes.
Attribute ``ram`` ( :since:`since 1.0.2` ) specifies the size of
the primary bar, while the attribute ``vram`` specifies the secondary bar the primary bar, while the attribute ``vram`` specifies the secondary bar
size. If ``ram`` or ``vram`` are not supplied a default value is used. The size. If ``ram`` or ``vram`` are not supplied a default value is used. The
``ram`` should also be rounded to power of two as ``vram``. There is also ``ram`` should also be rounded to power of two as ``vram``. There is also
@@ -6365,6 +6399,12 @@ Serial port
<source path='/dev/pts/3'/> <source path='/dev/pts/3'/>
<target port='0'/> <target port='0'/>
</serial> </serial>
<!-- Debug port for SeaBIOS / EDK II -->
<serial type='pty'>
<target type='isa-debug'/>
<address type='isa' iobase='0x402'/>
</console>
</devices> </devices>
... ...
@@ -6388,8 +6428,9 @@ values are, :since:`since 1.0.2` , ``isa-serial`` (usable with x86 guests),
``usb-serial`` (usable whenever USB support is available) and ``pci-serial`` ``usb-serial`` (usable whenever USB support is available) and ``pci-serial``
(usable whenever PCI support is available); :since:`since 3.10.0` , (usable whenever PCI support is available); :since:`since 3.10.0` ,
``spapr-vio-serial`` (usable with ppc64/pseries guests), ``system-serial`` ``spapr-vio-serial`` (usable with ppc64/pseries guests), ``system-serial``
(usable with aarch64/virt and, :since:`since 4.7.0` , riscv/virt guests) and (usable with aarch64/virt and, :since:`since 4.7.0` , riscv/virt guests),
``sclp-serial`` (usable with s390 and s390x guests) are available as well. ``sclp-serial`` (usable with s390 and s390x guests) are available as well
and :since:`since 8.1.0` ``isa-debug`` (usable with x86 guests).
:since:`Since 3.10.0` , the ``target`` element can have an optional ``model`` :since:`Since 3.10.0` , the ``target`` element can have an optional ``model``
subelement; valid values for its ``name`` attribute are: ``isa-serial`` (usable subelement; valid values for its ``name`` attribute are: ``isa-serial`` (usable
@@ -6398,9 +6439,12 @@ with the ``isa-serial`` target type); ``usb-serial`` (usable with the
target type); ``spapr-vty`` (usable with the ``spapr-vio-serial`` target type); target type); ``spapr-vty`` (usable with the ``spapr-vio-serial`` target type);
``pl011`` and, :since:`since 4.7.0` , ``16550a`` (usable with the ``pl011`` and, :since:`since 4.7.0` , ``16550a`` (usable with the
``system-serial`` target type); ``sclpconsole`` and ``sclplmconsole`` (usable ``system-serial`` target type); ``sclpconsole`` and ``sclplmconsole`` (usable
with the ``sclp-serial`` target type). Providing a target model is usually with the ``sclp-serial`` target type). ``isa-debugcon`` (usable with the
unnecessary: libvirt will automatically pick one that's suitable for the chosen ``isa-debug`` target type); provides a virtual console for receiving debug
target type, and overriding that value is generally not recommended. messages from the firmware on x86 platforms. :since:`Since: 8.1.0`.
Providing a target model is usually unnecessary: libvirt will automatically
pick one that's suitable for the chosen target type, and overriding that
value is generally not recommended.
If any of the attributes is not specified by the user, libvirt will choose a If any of the attributes is not specified by the user, libvirt will choose a
value suitable for most users. value suitable for most users.
@@ -7079,6 +7123,20 @@ is permitted with the following attributes.
The audio format, one of ``s8``, ``u8``, ``s16``, ``u16``, The audio format, one of ``s8``, ``u8``, ``s16``, ``u16``,
``s32``, ``u32``, ``f32``. The default is hypervisor specific. ``s32``, ``u32``, ``f32``. The default is hypervisor specific.
Note:
If no ``<audio/>`` element is defined, and the ``graphics`` element is set to
either 'vnc' or 'sdl', the libvirtd or virtqemud process will honor the following
environment variables:
* ``SDL_AUDIODRIVER``
Valid values are 'pulseaudio', 'esd', 'alsa' or 'arts'.
* ``QEMU_AUDIO_DRV``
Valid values are 'pa', 'none', 'alsa', 'coreaudio', 'jack', 'oss',
'sdl', 'spice' or 'wav'.
None audio backend None audio backend
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^

View File

@@ -1250,7 +1250,6 @@
&lt;/dhcp&gt; &lt;/dhcp&gt;
&lt;/ip&gt; &lt;/ip&gt;
&lt;ip family="ipv6" address="fdXX:XXXX:XXXX:NNNN:: prefix="64"/&gt; &lt;ip family="ipv6" address="fdXX:XXXX:XXXX:NNNN:: prefix="64"/&gt;
&lt;/ip&gt;
&lt;/network&gt;</pre> &lt;/network&gt;</pre>
<p>IPv6 NAT addressing has some caveats over the more straight <p>IPv6 NAT addressing has some caveats over the more straight

View File

@@ -1,414 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Secret XML format</h1>
<ul id="toc"></ul>
<h2><a id="SecretAttributes">Secret XML</a></h2>
<p>
Secrets stored by libvirt may have attributes associated with them, using
the <code>secret</code> element. The <code>secret</code> element has two
optional attributes, each with values '<code>yes</code>' and
'<code>no</code>', and defaulting to '<code>no</code>':
</p>
<dl>
<dt><code>ephemeral</code></dt>
<dd>This secret must only be kept in memory, never stored persistently.
</dd>
<dt><code>private</code></dt>
<dd>The value of the secret must not be revealed to any caller of libvirt,
nor to any other node.
</dd>
</dl>
<p>
The top-level <code>secret</code> element may contain the following
elements:
</p>
<dl>
<dt><code>uuid</code></dt>
<dd>
An unique identifier for this secret (not necessarily in the UUID
format). If omitted when defining a new secret, a random UUID is
generated.
</dd>
<dt><code>description</code></dt>
<dd>A human-readable description of the purpose of the secret.
</dd>
<dt><code>usage</code></dt>
<dd>
Specifies what this secret is used for. A mandatory
<code>type</code> attribute specifies the usage category, currently
only <code>volume</code>, <code>ceph</code>, <code>iscsi</code>,
<code>tls</code>, and <code>vtpm</code> are defined. Specific usage
categories are described below.
</dd>
</dl>
<h3><a id="VolumeUsageType">Usage type "volume"</a></h3>
<p>
This secret is associated with a volume, whether the format is either
for a "luks" encrypted volume. Each volume will have a
unique secret associated with it and it is safe to delete the
secret after the volume is deleted. The
<code>&lt;usage type='volume'&gt;</code> element must contain a
single <code>volume</code> element that specifies the path of the volume
this secret is associated with. For example, create a volume-secret.xml
file as follows:
</p>
<pre>
&lt;secret ephemeral='no' private='yes'&gt;
&lt;description&gt;Super secret name of my first puppy&lt;/description&gt;
&lt;uuid&gt;0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f&lt;/uuid&gt;
&lt;usage type='volume'&gt;
&lt;volume&gt;/var/lib/libvirt/images/puppyname.img&lt;/volume&gt;
&lt;/usage&gt;
&lt;/secret&gt;
</pre>
<p>
Define the secret and set the passphrase as follows:
</p>
<pre>
# virsh secret-define volume-secret.xml
Secret 0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f created
</pre>
<p>
See <a href="#settingSecrets">virsh secret-set-value</a> on how
to set the value of the secret.
</p>
<p>
The volume type secret can be supplied either in volume XML during
creation of a <a href="formatstorage.html#StorageVol">storage volume</a>
in order to provide the passphrase to encrypt the volume or in
domain XML <a href="formatdomain.html#elementsDisks">disk device</a>
in order to provide the passphrase to decrypt the volume,
<span class="since">since 2.1.0</span>. An example follows:
</p>
<pre>
# cat luks-secret.xml
&lt;secret ephemeral='no' private='yes'&gt;
&lt;description&gt;LUKS Sample Secret&lt;/description&gt;
&lt;uuid&gt;f52a81b2-424e-490c-823d-6bd4235bc57&lt;/uuid&gt;
&lt;usage type='volume'&gt;
&lt;volume&gt;/var/lib/libvirt/images/luks-sample.img&lt;/volume&gt;
&lt;/usage&gt;
&lt;/secret&gt;
# virsh secret-define luks-secret.xml
Secret f52a81b2-424e-490c-823d-6bd4235bc57 created
</pre>
<p>
See <a href="#settingSecrets">virsh secret-set-value</a> on how
to set the value of the secret.
</p>
<p>
The volume type secret can be supplied in domain XML for a luks storage
volume <a href="formatstorageencryption.html">encryption</a> as follows:
</p>
<pre>
&lt;encryption format='luks'&gt;
&lt;secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc57'/&gt;
&lt;/encryption&gt;
</pre>
<h3><a id="CephUsageType">Usage type "ceph"</a></h3>
<p>
This secret is associated with a Ceph RBD (rados block device).
The <code>&lt;usage type='ceph'&gt;</code> element must contain
a single <code>name</code> element that specifies a usage name
for the secret. The Ceph secret can then be used by UUID or by
this usage name via the <code>&lt;auth&gt;</code> element of
a <a href="formatdomain.html#elementsDisks">disk device</a> or
a <a href="formatstorage.html">storage pool (rbd)</a>.
<span class="since">Since 0.9.7</span>. The following is an example
of the steps to be taken. First create a ceph-secret.xml file:
</p>
<pre>
&lt;secret ephemeral='no' private='yes'&gt;
&lt;description&gt;CEPH passphrase example&lt;/description&gt;
&lt;usage type='ceph'&gt;
&lt;name&gt;ceph_example&lt;/name&gt;
&lt;/usage&gt;
&lt;/secret&gt;
</pre>
<p>
Next, use <code>virsh secret-define ceph-secret.xml</code> to define
the secret and <code>virsh secret-set-value</code> using the generated
UUID value and a base64 generated secret value in order to define the
chosen secret pass phrase.
</p>
<pre>
# virsh secret-define ceph-secret.xml
Secret 1b40a534-8301-45d5-b1aa-11894ebb1735 created
#
# virsh secret-list
UUID Usage
-----------------------------------------------------------
1b40a534-8301-45d5-b1aa-11894ebb1735 cephx ceph_example
</pre>
<p>
See <a href="#settingSecrets">virsh secret-set-value</a> on how
to set the value of the secret.
</p>
<p>
The ceph secret can then be used by UUID or by the
usage name via the <code>&lt;auth&gt;</code> element in a domain's
<a href="formatdomain.html#elementsDisks"><code>&lt;disk&gt;</code></a>
element as follows:
</p>
<pre>
&lt;auth username='myname'&gt;
&lt;secret type='ceph' usage='ceph_example'/&gt;
&lt;/auth&gt;
</pre>
<p>
As well as the <code>&lt;auth&gt;</code> element in a
<a href="formatstorage.html">storage pool (rbd)</a>
<code>&lt;source&gt;</code> element as follows:
</p>
<pre>
&lt;auth type='ceph' username='myname'&gt;
&lt;secret usage='ceph_example'/&gt;
&lt;/auth&gt;
</pre>
<h3><a id="iSCSIUsageType">Usage type "iscsi"</a></h3>
<p>
This secret is associated with an iSCSI target for CHAP authentication.
The <code>&lt;usage type='iscsi'&gt;</code> element must contain
a single <code>target</code> element that specifies a usage name
for the secret. The iSCSI secret can then be used by UUID or by
this usage name via the <code>&lt;auth&gt;</code> element of
a <a href="formatdomain.html#elementsDisks">disk device</a> or
a <a href="formatstorage.html">storage pool (iscsi)</a>.
<span class="since">Since 1.0.4</span>. The following is an example
of the XML that may be used to generate a secret for iSCSI CHAP
authentication. Assume the following sample entry in an iSCSI
authentication file:
</p>
<pre>
&lt;target iqn.2013-07.com.example:iscsi-pool&gt;
backing-store /home/tgtd/iscsi-pool/disk1
backing-store /home/tgtd/iscsi-pool/disk2
incominguser myname mysecret
&lt;/target&gt;
</pre>
<p>
Define an iscsi-secret.xml file to describe the secret. Use the
<code>incominguser</code> username used in your iSCSI authentication
configuration file as the value for the <code>username</code> attribute.
The <code>description</code> attribute should contain configuration
specific data. The <code>target</code> name may be any name of your
choosing to be used as the <code>usage</code> when used in the pool
or disk XML description.
</p>
<pre>
&lt;secret ephemeral='no' private='yes'&gt;
&lt;description&gt;Passphrase for the iSCSI example.com server&lt;/description&gt;
&lt;usage type='iscsi'&gt;
&lt;target&gt;libvirtiscsi&lt;/target&gt;
&lt;/usage&gt;
&lt;/secret&gt;
</pre>
<p>
Next, use <code>virsh secret-define iscsi-secret.xml</code> to define
the secret and
<code><a href="#settingSecrets">virsh secret-set-value</a></code>
using the generated
UUID value and a base64 generated secret value in order to define the
chosen secret pass phrase. The pass phrase must match the password
used in the iSCSI authentication configuration file.
</p>
<pre>
# virsh secret-define secret.xml
Secret c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 created
# virsh secret-list
UUID Usage
-----------------------------------------------------------
c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 iscsi libvirtiscsi
</pre>
<p>
See <a href="#settingSecrets">virsh secret-set-value</a> on how
to set the value of the secret.
</p>
<p>
The iSCSI secret can then be used by UUID or by the
usage name via the <code>&lt;auth&gt;</code> element in a domain's
<a href="formatdomain.html#elementsDisks"><code>&lt;disk&gt;</code></a>
element as follows:
</p>
<pre>
&lt;auth username='myname'&gt;
&lt;secret type='iscsi' usage='libvirtiscsi'/&gt;
&lt;/auth&gt;
</pre>
<p>
As well as the <code>&lt;auth&gt;</code> element in a
<a href="formatstorage.html">storage pool (iscsi)</a>
<code>&lt;source&gt;</code> element as follows:
</p>
<pre>
&lt;auth type='chap' username='myname'&gt;
&lt;secret usage='libvirtiscsi'/&gt;
&lt;/auth&gt;
</pre>
<h3><a id="tlsUsageType">Usage type "tls"</a></h3>
<p>
This secret may be used in order to provide the passphrase for the
private key used to provide TLS credentials.
The <code>&lt;usage type='tls'&gt;</code> element must contain a
single <code>name</code> element that specifies a usage name
for the secret.
<span class="since">Since 2.3.0</span>.
The following is an example of the expected XML and processing to
define the secret:
</p>
<pre>
# cat tls-secret.xml
&lt;secret ephemeral='no' private='yes'&gt;
&lt;description&gt;sample tls secret&lt;/description&gt;
&lt;usage type='tls'&gt;
&lt;name&gt;TLS_example&lt;/name&gt;
&lt;/usage&gt;
&lt;/secret&gt;
# virsh secret-define tls-secret.xml
Secret 718c71bd-67b5-4a2b-87ec-a24e8ca200dc created
# virsh secret-list
UUID Usage
-----------------------------------------------------------
718c71bd-67b5-4a2b-87ec-a24e8ca200dc tls TLS_example
#
</pre>
<p>
A secret may also be defined via the
<a href="html/libvirt-libvirt-secret.html#virSecretDefineXML">
<code>virSecretDefineXML</code></a> API.
Once the secret is defined, a secret value will need to be set. The
secret would be the passphrase used to access the TLS credentials.
The following is a simple example of using
<code><a href="#settingSecrets">virsh secret-set-value</a></code> to set
the secret value. The
<a href="html/libvirt-libvirt-secret.html#virSecretSetValue">
<code>virSecretSetValue</code></a> API may also be used to set
a more secure secret without using printable/readable characters.
</p>
<h3><a id="vTPMUsageType">Usage type "vtpm"</a></h3>
<p>
This secret is associated with a virtualized TPM (vTPM) and serves
as a passphrase for deriving a key from for encrypting the state
of the vTPM.
The <code>&lt;usage type='vtpm'&gt;</code> element must contain
a single <code>name</code> element that specifies a usage name
for the secret. The vTPM secret can then be used by UUID
via the <code>&lt;encryption&gt;</code> element of
a <a href="formatdomain.html#elementsTpm">tpm</a> when using an
emulator.
<span class="since">Since 5.6.0</span>. The following is an example
of the steps to be taken. First create a vtpm-secret.xml file: </p>
<pre>
# cat vtpm-secret.xml
&lt;secret ephemeral='no' private='yes'&gt;
&lt;description&gt;sample vTPM secret&lt;/description&gt;
&lt;usage type='vtpm'&gt;
&lt;name&gt;VTPM_example&lt;/name&gt;
&lt;/usage&gt;
&lt;/secret&gt;
# virsh secret-define vtpm-secret.xml
Secret 6dd3e4a5-1d76-44ce-961f-f119f5aad935 created
# virsh secret-list
UUID Usage
----------------------------------------------------------------------------------------
6dd3e4a5-1d76-44ce-961f-f119f5aad935 vtpm VTPM_example
#
</pre>
<p>
A secret may also be defined via the
<a href="html/libvirt-libvirt-secret.html#virSecretDefineXML">
<code>virSecretDefineXML</code></a> API.
Once the secret is defined, a secret value will need to be set. The
secret would be the passphrase used to decrypt the vTPM state.
The following is a simple example of using
<code><a href="#settingSecrets">virsh secret-set-value</a></code>
to set the secret value. The
<a href="html/libvirt-libvirt-secret.html#virSecretSetValue">
<code>virSecretSetValue</code></a> API may also be used to set
a more secure secret without using printable/readable characters.
</p>
<h2><a id="settingSecrets">Setting secret values in virsh</a></h2>
<p>
To set the value of the secret you can use the following virsh commands.
If the secret is a password-like string (printable characters, no newline)
you can use:
</p>
<pre>
# virsh secret-set-value --interactive 6dd3e4a5-1d76-44ce-961f-f119f5aad935
Enter new value for secret:
Secret value set
</pre>
<p>
Another secure option is to read the secret from a file. This way the
secret can contain any bytes (even NUL and non-printable characters). The
length of the secret is the length of the input file. Alternatively the
<code>--plain</code> option can be omitted if the file contents are
base64-encoded.
</p>
<pre>
# virsh secret-set-value 6dd3e4a5-1d76-44ce-961f-f119f5aad935 --file --plain secretinfile
Secret value set
</pre>
<p>
<b>WARNING</b> The following approach is <b>insecure</b> and deprecated.
The secret can also be set via an argument. Note that other users may see
the actual secret in the process listing!
The secret must be base64 encoded.
</p>
<pre>
# MYSECRET=`printf %s "open sesame" | base64`
# virsh secret-set-value 6dd3e4a5-1d76-44ce-961f-f119f5aad935 $MYSECRET
Secret value set
</pre>
</body>
</html>

332
docs/formatsecret.rst Normal file
View File

@@ -0,0 +1,332 @@
.. role:: since
=================
Secret XML format
=================
.. contents::
Secret XML
----------
Secrets stored by libvirt may have attributes associated with them, using the
``secret`` element. The ``secret`` element has two optional attributes, each
with values '``yes``' and '``no``', and defaulting to '``no``':
``ephemeral``
This secret must only be kept in memory, never stored persistently.
``private``
The value of the secret must not be revealed to any caller of libvirt, nor to
any other node.
The top-level ``secret`` element may contain the following elements:
``uuid``
An unique identifier for this secret (not necessarily in the UUID format). If
omitted when defining a new secret, a random UUID is generated.
``description``
A human-readable description of the purpose of the secret.
``usage``
Specifies what this secret is used for. A mandatory ``type`` attribute
specifies the usage category, currently only ``volume``, ``ceph``, ``iscsi``,
``tls``, and ``vtpm`` are defined. Specific usage categories are described
below.
Usage type "volume"
~~~~~~~~~~~~~~~~~~~
This secret is associated with a volume, whether the format is either for a
"luks" encrypted volume. Each volume will have a unique secret associated with
it and it is safe to delete the secret after the volume is deleted. The
``<usage type='volume'>`` element must contain a single ``volume`` element that
specifies the path of the volume this secret is associated with. For example,
create a volume-secret.xml file as follows:
::
<secret ephemeral='no' private='yes'>
<description>Super secret name of my first puppy</description>
<uuid>0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f</uuid>
<usage type='volume'>
<volume>/var/lib/libvirt/images/puppyname.img</volume>
</usage>
</secret>
Define the secret and set the passphrase as follows:
::
# virsh secret-define volume-secret.xml
Secret 0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f created
See `virsh secret-set-value <#settingSecrets>`__ on how to set the value of the
secret.
The volume type secret can be supplied either in volume XML during creation of a
`storage volume <formatstorage.html#StorageVol>`__ in order to provide the
passphrase to encrypt the volume or in domain XML `disk
device <formatdomain.html#elementsDisks>`__ in order to provide the passphrase
to decrypt the volume, :since:`since 2.1.0` . An example follows:
::
# cat luks-secret.xml
<secret ephemeral='no' private='yes'>
<description>LUKS Sample Secret</description>
<uuid>f52a81b2-424e-490c-823d-6bd4235bc57</uuid>
<usage type='volume'>
<volume>/var/lib/libvirt/images/luks-sample.img</volume>
</usage>
</secret>
# virsh secret-define luks-secret.xml
Secret f52a81b2-424e-490c-823d-6bd4235bc57 created
See `virsh secret-set-value <#settingSecrets>`__ on how to set the value of the
secret.
The volume type secret can be supplied in domain XML for a luks storage volume
`encryption <formatstorageencryption.html>`__ as follows:
::
<encryption format='luks'>
<secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc57'/>
</encryption>
Usage type "ceph"
~~~~~~~~~~~~~~~~~
This secret is associated with a Ceph RBD (rados block device). The
``<usage type='ceph'>`` element must contain a single ``name`` element that
specifies a usage name for the secret. The Ceph secret can then be used by UUID
or by this usage name via the ``<auth>`` element of a `disk
device <formatdomain.html#elementsDisks>`__ or a `storage pool
(rbd) <formatstorage.html>`__. :since:`Since 0.9.7` . The following is an
example of the steps to be taken. First create a ceph-secret.xml file:
::
<secret ephemeral='no' private='yes'>
<description>CEPH passphrase example</description>
<usage type='ceph'>
<name>ceph_example</name>
</usage>
</secret>
Next, use ``virsh secret-define ceph-secret.xml`` to define the secret and
``virsh secret-set-value`` using the generated UUID value and a base64 generated
secret value in order to define the chosen secret pass phrase.
::
# virsh secret-define ceph-secret.xml
Secret 1b40a534-8301-45d5-b1aa-11894ebb1735 created
#
# virsh secret-list
UUID Usage
-----------------------------------------------------------
1b40a534-8301-45d5-b1aa-11894ebb1735 cephx ceph_example
See `virsh secret-set-value <#settingSecrets>`__ on how to set the value of the
secret.
The ceph secret can then be used by UUID or by the usage name via the ``<auth>``
element in a domain's `<disk> <formatdomain.html#elementsDisks>`__ element as
follows:
::
<auth username='myname'>
<secret type='ceph' usage='ceph_example'/>
</auth>
As well as the ``<auth>`` element in a `storage pool
(rbd) <formatstorage.html>`__ ``<source>`` element as follows:
::
<auth type='ceph' username='myname'>
<secret usage='ceph_example'/>
</auth>
Usage type "iscsi"
~~~~~~~~~~~~~~~~~~
This secret is associated with an iSCSI target for CHAP authentication. The
``<usage type='iscsi'>`` element must contain a single ``target`` element that
specifies a usage name for the secret. The iSCSI secret can then be used by UUID
or by this usage name via the ``<auth>`` element of a `disk
device <formatdomain.html#elementsDisks>`__ or a `storage pool
(iscsi) <formatstorage.html>`__. :since:`Since 1.0.4` . The following is an
example of the XML that may be used to generate a secret for iSCSI CHAP
authentication. Assume the following sample entry in an iSCSI authentication
file:
::
<target iqn.2013-07.com.example:iscsi-pool>
backing-store /home/tgtd/iscsi-pool/disk1
backing-store /home/tgtd/iscsi-pool/disk2
incominguser myname mysecret
</target>
Define an iscsi-secret.xml file to describe the secret. Use the ``incominguser``
username used in your iSCSI authentication configuration file as the value for
the ``username`` attribute. The ``description`` attribute should contain
configuration specific data. The ``target`` name may be any name of your
choosing to be used as the ``usage`` when used in the pool or disk XML
description.
::
<secret ephemeral='no' private='yes'>
<description>Passphrase for the iSCSI example.com server</description>
<usage type='iscsi'>
<target>libvirtiscsi</target>
</usage>
</secret>
Next, use ``virsh secret-define iscsi-secret.xml`` to define the secret and
``virsh secret-set-value`` using the generated UUID value and a base64 generated
secret value in order to define the chosen secret pass phrase. The pass phrase
must match the password used in the iSCSI authentication configuration file.
::
# virsh secret-define secret.xml
Secret c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 created
# virsh secret-list
UUID Usage
-----------------------------------------------------------
c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 iscsi libvirtiscsi
See `virsh secret-set-value <#settingSecrets>`__ on how to set the value of the
secret.
The iSCSI secret can then be used by UUID or by the usage name via the
``<auth>`` element in a domain's `<disk> <formatdomain.html#elementsDisks>`__
element as follows:
::
<auth username='myname'>
<secret type='iscsi' usage='libvirtiscsi'/>
</auth>
As well as the ``<auth>`` element in a `storage pool
(iscsi) <formatstorage.html>`__ ``<source>`` element as follows:
::
<auth type='chap' username='myname'>
<secret usage='libvirtiscsi'/>
</auth>
Usage type "tls"
~~~~~~~~~~~~~~~~
This secret may be used in order to provide the passphrase for the private key
used to provide TLS credentials. The ``<usage type='tls'>`` element must contain
a single ``name`` element that specifies a usage name for the secret.
:since:`Since 2.3.0` . The following is an example of the expected XML and
processing to define the secret:
::
# cat tls-secret.xml
<secret ephemeral='no' private='yes'>
<description>sample tls secret</description>
<usage type='tls'>
<name>TLS_example</name>
</usage>
</secret>
# virsh secret-define tls-secret.xml
Secret 718c71bd-67b5-4a2b-87ec-a24e8ca200dc created
# virsh secret-list
UUID Usage
-----------------------------------------------------------
718c71bd-67b5-4a2b-87ec-a24e8ca200dc tls TLS_example
A secret may also be defined via the
`virSecretDefineXML <html/libvirt-libvirt-secret.html#virSecretDefineXML>`__
API. Once the secret is defined, a secret value will need to be set. The secret
would be the passphrase used to access the TLS credentials. The following is a
simple example of using ``virsh secret-set-value`` to set the secret value. The
`virSecretSetValue <html/libvirt-libvirt-secret.html#virSecretSetValue>`__ API
may also be used to set a more secure secret without using printable/readable
characters.
Usage type "vtpm"
~~~~~~~~~~~~~~~~~
This secret is associated with a virtualized TPM (vTPM) and serves as a
passphrase for deriving a key from for encrypting the state of the vTPM. The
``<usage type='vtpm'>`` element must contain a single ``name`` element that
specifies a usage name for the secret. The vTPM secret can then be used by UUID
via the ``<encryption>`` element of a `tpm <formatdomain.html#elementsTpm>`__
when using an emulator. :since:`Since 5.6.0` . The following is an example of
the steps to be taken. First create a vtpm-secret.xml file:
::
# cat vtpm-secret.xml
<secret ephemeral='no' private='yes'>
<description>sample vTPM secret</description>
<usage type='vtpm'>
<name>VTPM_example</name>
</usage>
</secret>
# virsh secret-define vtpm-secret.xml
Secret 6dd3e4a5-1d76-44ce-961f-f119f5aad935 created
# virsh secret-list
UUID Usage
----------------------------------------------------------------------------------------
6dd3e4a5-1d76-44ce-961f-f119f5aad935 vtpm VTPM_example
A secret may also be defined via the
`virSecretDefineXML <html/libvirt-libvirt-secret.html#virSecretDefineXML>`__
API. Once the secret is defined, a secret value will need to be set. The secret
would be the passphrase used to decrypt the vTPM state. The following is a
simple example of using ``virsh secret-set-value`` to set the secret value. The
`virSecretSetValue <html/libvirt-libvirt-secret.html#virSecretSetValue>`__ API
may also be used to set a more secure secret without using printable/readable
characters.
Setting secret values in virsh
------------------------------
To set the value of the secret you can use the following virsh commands. If the
secret is a password-like string (printable characters, no newline) you can use:
::
# virsh secret-set-value --interactive 6dd3e4a5-1d76-44ce-961f-f119f5aad935
Enter new value for secret:
Secret value set
Another secure option is to read the secret from a file. This way the secret can
contain any bytes (even NUL and non-printable characters). The length of the
secret is the length of the input file. Alternatively the ``--plain`` option can
be omitted if the file contents are base64-encoded.
::
# virsh secret-set-value 6dd3e4a5-1d76-44ce-961f-f119f5aad935 --file --plain secretinfile
Secret value set
**WARNING** The following approach is **insecure** and deprecated. The secret
can also be set via an argument. Note that other users may see the actual secret
in the process listing! The secret must be base64 encoded.
::
# MYSECRET=`printf %s "open sesame" | base64`
# virsh secret-set-value 6dd3e4a5-1d76-44ce-961f-f119f5aad935 $MYSECRET
Secret value set

View File

@@ -1,352 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Snapshot XML format</h1>
<ul id="toc"></ul>
<h2><a id="SnapshotAttributes">Snapshot XML</a></h2>
<p>
Snapshots are one form
of <a href="kbase/domainstatecapture.html">domain state
capture</a>. There are several types of snapshots:
</p>
<dl>
<dt>disk snapshot</dt>
<dd>Contents of disks (whether a subset or all disks associated
with the domain) are saved at a given point of time, and can
be restored back to that state. On a running guest, a disk
snapshot is likely to be only crash-consistent rather than
clean (that is, it represents the state of the disk on a
sudden power outage, and may need fsck or journal replays to
be made consistent); on an inactive guest, a disk snapshot is
clean if the disks were clean when the guest was last shut
down. Disk snapshots exist in two forms: internal (file
formats such as qcow2 track both the snapshot and changes
since the snapshot in a single file) and external (the
snapshot is one file, and the changes since the snapshot are
in another file).</dd>
<dt>memory state (or VM state)</dt>
<dd>Tracks only the state of RAM and all other resources in use
by the VM. If the disks are unmodified between the time a VM
state snapshot is taken and restored, then the guest will
resume in a consistent state; but if the disks are modified
externally in the meantime, this is likely to lead to data
corruption.</dd>
<dt>full system</dt>
<dd>A combination of disk snapshots for all disks as well as VM
memory state, which can be used to resume the guest from where it
left off with symptoms similar to hibernation (that is, TCP
connections in the guest may have timed out, but no files or
processes are lost).</dd>
</dl>
<p>
Libvirt can manage all three types of snapshots. For now, VM
state (memory) snapshots are created only by
the <code>virDomainSave()</code>, <code>virDomainSaveFlags</code>,
and <code>virDomainManagedSave()</code> functions, and restored
via the <code>virDomainRestore()</code>,
<code>virDomainRestoreFlags()</code>, <code>virDomainCreate()</code>,
and <code>virDomainCreateWithFlags()</code> functions (as well
as via domain autostart). With managed snapshots, libvirt
tracks all information internally; with save images, the user
tracks the snapshot file, but libvirt provides functions such
as <code>virDomainSaveImageGetXMLDesc()</code> to work with
those files.
</p>
<p>Full system snapshots are created
by <code>virDomainSnapshotCreateXML()</code> with no flags, while
disk snapshots are created by the same function with
the <code>VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY</code>
flag. Regardless of the flags provided, restoration of the
snapshot is handled by
the <code>virDomainRevertToSnapshot()</code> function. For
these types of snapshots, libvirt tracks each snapshot as a
separate <code>virDomainSnapshotPtr</code> object, and maintains
a tree relationship of which snapshots descended from an earlier
point in time.
</p>
<p>
Attributes of libvirt snapshots are stored as child elements of
the <code>domainsnapshot</code> element. At snapshot creation
time, normally only the <code>name</code>, <code>description</code>,
and <code>disks</code> elements are settable; the rest of the
fields are ignored on creation, and will be filled in by
libvirt in for informational purposes
by <code>virDomainSnapshotGetXMLDesc()</code>. However, when
redefining a snapshot (<span class="since">since 0.9.5</span>),
with the <code>VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</code> flag
of <code>virDomainSnapshotCreateXML()</code>, all of the XML
described here is relevant on input, even the fields that are
normally described as readonly for output.
</p>
<p>
Snapshots are maintained in a hierarchy. A domain can have a
current snapshot, which is the most recent snapshot compared to
the current state of the domain (although a domain might have
snapshots without a current snapshot, if snapshots have been
deleted in the meantime). Creating or reverting to a snapshot
sets that snapshot as current, and the prior current snapshot is
the parent of the new snapshot. Branches in the hierarchy can
be formed by reverting to a snapshot with a child, then creating
another snapshot. For now, the creation of external snapshots
when checkpoints exist is forbidden, although future work will
make it possible to integrate these two concepts.
</p>
<p>
The top-level <code>domainsnapshot</code> element may contain
the following elements:
</p>
<dl>
<dt><code>name</code></dt>
<dd>The optional name for this snapshot. If the name is
omitted, libvirt will create a name based on the time of the
creation.
</dd>
<dt><code>description</code></dt>
<dd>An optional human-readable description of the snapshot. If
the description is omitted when initially creating the
snapshot, then this field will be empty.
</dd>
<dt><code>memory</code></dt>
<dd>On input, this is an optional request for how to handle VM
memory state. For an offline domain or a disk-only snapshot,
attribute <code>snapshot</code> must be <code>no</code>, since
there is no VM state saved; otherwise, the attribute can
be <code>internal</code> if the memory state is piggy-backed with
other internal disk state, or <code>external</code> along with
a second attribute <code>file</code> giving the absolute path
of the file holding the VM memory state. <span class="since">Since
1.0.1</span>
</dd>
<dt><code>disks</code></dt>
<dd>On input, this is an optional listing of specific
instructions for disk snapshots; it is needed when making a
snapshot of only a subset of the disks associated with a
domain, or when overriding the domain defaults for how to
snapshot each disk, or for providing specific control over
what file name is created in an external snapshot. On output,
this is fully populated to show the state of each disk in the
snapshot, including any properties that were generated by the
hypervisor defaults. For full system snapshots, this field is
ignored on input and omitted on output (a full system snapshot
implies that all disks participate in the snapshot process).
This element has a list of <code>disk</code>
sub-elements, describing anywhere from zero to all of the
disks associated with the domain. <span class="since">Since
0.9.5</span>
<dl>
<dt><code>disk</code></dt>
<dd>This sub-element describes the snapshot properties of a
specific disk. The attribute <code>name</code> is
mandatory, and must match either the <code>&lt;target
dev='name'/&gt;</code> (recommended) or an unambiguous
<code>&lt;source file='name'/&gt;</code> of one of
the <a href="formatdomain.html#elementsDisks">disk
devices</a> specified for the domain at the time of the
snapshot. The attribute <code>snapshot</code> is
optional, and the possible values are the same as the
<code>snapshot</code> attribute for
<a href="formatdomain.html#elementsDisks">disk devices</a>
(<code>no</code>, <code>internal</code>,
or <code>external</code>). Some hypervisors like ESX
require that if specified, the snapshot mode must not
override any snapshot mode attached to the corresponding
domain disk, while others like qemu allow this field to
override the domain default.
<dl>
<dt><code>source</code></dt>
<dd>If the snapshot mode is external (whether specified
or inherited), then there is an optional sub-element
<code>source</code>, with an attribute <code>file</code>
giving the name of the new file.
If <code>source</code> is not
given and the disk is backed by a local image file (not
a block device or remote storage), a file name is
generated that consists of the existing file name
with anything after the trailing dot replaced by the
snapshot name. Remember that with external
snapshots, the original file name becomes the read-only
snapshot, and the new file name contains the read-write
delta of all disk changes since the snapshot.
<p/>
The <code>source</code> element also may contain the
<code>seclabel</code> element (described in the
<a href="formatdomain.html#seclabel">domain XML documentation</a>)
which can be used to override the domain security labeling policy
for <code>source</code>.
</dd>
<dt><code>driver</code></dt>
<dd>An optional sub-element <code>driver</code>,
with an attribute <code>type</code> giving the driver type (such
as qcow2), of the new file created by the external
snapshot of the new file.
Optionally <code>metadata_cache</code> sub-element can be used
with same semantics as the identically named subelement of the
domain definition disk's driver.
</dd>
<dt><code>seclabel</code></dt>
</dl>
<span class="since">Since 1.2.2</span> the <code>disk</code> element
supports an optional attribute <code>type</code> if the
<code>snapshot</code> attribute is set to <code>external</code>.
This attribute specifies the snapshot target storage type and allows
to overwrite the default <code>file</code> type. The <code>type</code>
attribute along with the format of the <code>source</code>
sub-element is identical to the <code>source</code> element used in
domain disk definitions. See the
<a href="formatdomain.html#elementsDisks">disk devices</a> section
documentation for further information.
Libvirt currently supports the <code>type</code> element in the qemu
driver and supported values are <code>file</code>, <code>block</code>
and <code>network</code> with a protocol of <code>gluster</code>
<span class="since">(since 1.2.2)</span>.
</dd>
</dl>
</dd>
<dt><code>creationTime</code></dt>
<dd>A readonly representation of the time this snapshot was
created. The time is specified in seconds since the Epoch,
UTC (i.e. Unix time).
</dd>
<dt><code>state</code></dt>
<dd>A readonly representation of the state of the domain at the
time this snapshot was taken. If a full system snapshot was
created, then this is the state of the domain at that
time. When the domain is reverted to this snapshot, the
domain's state will default to this state, unless overridden
by <code>virDomainRevertToSnapshot()</code> flags to revert to
a running or paused state. Additionally, this field can be the
value "disk-snapshot" (<span class="since">since 0.9.5</span>)
when it represents only a disk snapshot (no VM memory state),
and reverting to this snapshot will default to an inactive
guest.
</dd>
<dt><code>parent</code></dt>
<dd>Readonly, present only if this snapshot has a parent. The
parent name is given by the sub-element <code>name</code>. The
parent relationship allows tracking a tree of related snapshots.
</dd>
<dt><code>domain</code></dt>
<dd>A readonly representation of the domain that this snapshot
was taken against. Older versions of libvirt stored only a
single child element, uuid; reverting to a snapshot like this
is risky if the current state of the domain differs from the
state that the domain was created in, and requires the use of
the <code>VIR_DOMAIN_SNAPSHOT_REVERT_FORCE</code> flag
in <code>virDomainRevertToSnapshot()</code>. Newer versions
of libvirt (<span class="since">since 0.9.5</span>) store the
entire inactive <a href="formatdomain.html">domain
configuration</a> at the time of the snapshot
(<span class="since">since 0.9.5</span>). The domain will have
security-sensitive information omitted
unless the flag <code>VIR_DOMAIN_SNAPSHOT_XML_SECURE</code> is
provided on a read-write connection.
</dd>
<dt><code>cookie</code></dt>
<dd>An optional readonly representation of a save image cookie
containing additional data libvirt may need to properly
restore a domain from an active snapshot when such data cannot
be stored directly in the <code>domain</code> to maintain
compatibility with older libvirt or hypervisor.
</dd>
</dl>
<h2><a id="example">Examples</a></h2>
<p>Using this XML to create a disk snapshot of just vda on a qemu
domain with two disks:</p>
<pre>
&lt;domainsnapshot&gt;
&lt;description&gt;Snapshot of OS install and updates&lt;/description&gt;
&lt;disks&gt;
&lt;disk name='vda'&gt;
&lt;source file='/path/to/new'/&gt;
&lt;/disk&gt;
&lt;disk name='vdb' snapshot='no'/&gt;
&lt;disk name='vdc'&gt;
&lt;source file='/path/to/newc'&gt;
&lt;seclabel model='dac' relabel='no'/&gt;
&lt;/source&gt;
&lt;/disk&gt;
&lt;/disks&gt;
&lt;/domainsnapshot&gt;</pre>
<p>will result in XML similar to this from
<code>virDomainSnapshotGetXMLDesc()</code>:</p>
<pre>
&lt;domainsnapshot&gt;
&lt;name&gt;1270477159&lt;/name&gt;
&lt;description&gt;Snapshot of OS install and updates&lt;/description&gt;
&lt;state&gt;running&lt;/state&gt;
&lt;creationTime&gt;1270477159&lt;/creationTime&gt;
&lt;parent&gt;
&lt;name&gt;bare-os-install&lt;/name&gt;
&lt;/parent&gt;
&lt;memory snapshot='no'/&gt;
&lt;disks&gt;
&lt;disk name='vda' snapshot='external'&gt;
&lt;driver type='qcow2'/&gt;
<b>&lt;source file='/path/to/new'/&gt;</b>
&lt;/disk&gt;
&lt;disk name='vdb' snapshot='no'/&gt;
&lt;/disks&gt;
&lt;domain&gt;
&lt;name&gt;fedora&lt;/name&gt;
&lt;uuid&gt;93a5c045-6457-2c09-e56c-927cdf34e178&lt;/uuid&gt;
&lt;memory&gt;1048576&lt;/memory&gt;
...
&lt;devices&gt;
&lt;disk type='file' device='disk'&gt;
&lt;driver name='qemu' type='raw'/&gt;
<b>&lt;source file='/path/to/old'/&gt;</b>
&lt;target dev='vda' bus='virtio'/&gt;
&lt;/disk&gt;
&lt;disk type='file' device='disk' snapshot='external'&gt;
&lt;driver name='qemu' type='raw'/&gt;
&lt;source file='/path/to/old2'/&gt;
&lt;target dev='vdb' bus='virtio'/&gt;
&lt;/disk&gt;
...
&lt;/devices&gt;
&lt;/domain&gt;
&lt;/domainsnapshot&gt;</pre>
<p>With that snapshot created, <code>/path/to/old</code> is the
read-only backing file to the new active
file <code>/path/to/new</code>. The <code>&lt;domain&gt;</code>
element within the snapshot xml records the state of the domain
just before the snapshot; a call
to <code>virDomainGetXMLDesc()</code> will show that the domain
has been changed to reflect the snapshot:
</p>
<pre>
&lt;domain&gt;
&lt;name&gt;fedora&lt;/name&gt;
&lt;uuid&gt;93a5c045-6457-2c09-e56c-927cdf34e178&lt;/uuid&gt;
&lt;memory&gt;1048576&lt;/memory&gt;
...
&lt;devices&gt;
&lt;disk type='file' device='disk'&gt;
&lt;driver name='qemu' type='qcow2'/&gt;
<b>&lt;source file='/path/to/new'/&gt;</b>
&lt;target dev='vda' bus='virtio'/&gt;
&lt;/disk&gt;
&lt;disk type='file' device='disk' snapshot='external'&gt;
&lt;driver name='qemu' type='raw'/&gt;
&lt;source file='/path/to/old2'/&gt;
&lt;target dev='vdb' bus='virtio'/&gt;
&lt;/disk&gt;
...
&lt;/devices&gt;
&lt;/domain&gt;</pre>
</body>
</html>

304
docs/formatsnapshot.rst Normal file
View File

@@ -0,0 +1,304 @@
.. role:: since
===================
Snapshot XML format
===================
.. contents::
Snapshot XML
------------
Snapshots are one form of `domain state
capture <kbase/domainstatecapture.html>`__. There are several types of
snapshots:
disk snapshot
Contents of disks (whether a subset or all disks associated with the domain)
are saved at a given point of time, and can be restored back to that state.
On a running guest, a disk snapshot is likely to be only crash-consistent
rather than clean (that is, it represents the state of the disk on a sudden
power outage, and may need fsck or journal replays to be made consistent); on
an inactive guest, a disk snapshot is clean if the disks were clean when the
guest was last shut down. Disk snapshots exist in two forms: internal (file
formats such as qcow2 track both the snapshot and changes since the snapshot
in a single file) and external (the snapshot is one file, and the changes
since the snapshot are in another file).
memory state (or VM state)
Tracks only the state of RAM and all other resources in use by the VM. If the
disks are unmodified between the time a VM state snapshot is taken and
restored, then the guest will resume in a consistent state; but if the disks
are modified externally in the meantime, this is likely to lead to data
corruption.
full system
A combination of disk snapshots for all disks as well as VM memory state,
which can be used to resume the guest from where it left off with symptoms
similar to hibernation (that is, TCP connections in the guest may have timed
out, but no files or processes are lost).
Libvirt can manage all three types of snapshots. For now, VM state (memory)
snapshots are created only by the ``virDomainSave()``, ``virDomainSaveFlags``,
and ``virDomainManagedSave()`` functions, and restored via the
``virDomainRestore()``, ``virDomainRestoreFlags()``, ``virDomainCreate()``, and
``virDomainCreateWithFlags()`` functions (as well as via domain autostart). With
managed snapshots, libvirt tracks all information internally; with save images,
the user tracks the snapshot file, but libvirt provides functions such as
``virDomainSaveImageGetXMLDesc()`` to work with those files.
Full system snapshots are created by ``virDomainSnapshotCreateXML()`` with no
flags, while disk snapshots are created by the same function with the
``VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY`` flag. Regardless of the flags provided,
restoration of the snapshot is handled by the ``virDomainRevertToSnapshot()``
function. For these types of snapshots, libvirt tracks each snapshot as a
separate ``virDomainSnapshotPtr`` object, and maintains a tree relationship of
which snapshots descended from an earlier point in time.
Attributes of libvirt snapshots are stored as child elements of the
``domainsnapshot`` element. At snapshot creation time, normally only the
``name``, ``description``, and ``disks`` elements are settable; the rest of the
fields are ignored on creation, and will be filled in by libvirt in for
informational purposes by ``virDomainSnapshotGetXMLDesc()``. However, when
redefining a snapshot ( :since:`since 0.9.5` ), with the
``VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE`` flag of
``virDomainSnapshotCreateXML()``, all of the XML described here is relevant on
input, even the fields that are normally described as readonly for output.
Snapshots are maintained in a hierarchy. A domain can have a current snapshot,
which is the most recent snapshot compared to the current state of the domain
(although a domain might have snapshots without a current snapshot, if snapshots
have been deleted in the meantime). Creating or reverting to a snapshot sets
that snapshot as current, and the prior current snapshot is the parent of the
new snapshot. Branches in the hierarchy can be formed by reverting to a snapshot
with a child, then creating another snapshot. For now, the creation of external
snapshots when checkpoints exist is forbidden, although future work will make it
possible to integrate these two concepts.
The top-level ``domainsnapshot`` element may contain the following elements:
``name``
The optional name for this snapshot. If the name is omitted, libvirt will
create a name based on the time of the creation.
``description``
An optional human-readable description of the snapshot. If the description
is omitted when initially creating the snapshot, then this field will be
empty.
``memory``
On input, this is an optional request for how to handle VM memory state. For
an offline domain or a disk-only snapshot, attribute ``snapshot`` must be
``no``, since there is no VM state saved; otherwise, the attribute can be
``internal`` if the memory state is piggy-backed with other internal disk
state, or ``external`` along with a second attribute ``file`` giving the
absolute path of the file holding the VM memory state. :since:`Since 1.0.1`
``disks``
On input, this is an optional listing of specific instructions for disk
snapshots; it is needed when making a snapshot of only a subset of the disks
associated with a domain, or when overriding the domain defaults for how to
snapshot each disk, or for providing specific control over what file name is
created in an external snapshot. On output, this is fully populated to show
the state of each disk in the snapshot, including any properties that were
generated by the hypervisor defaults. For full system snapshots, this field
is ignored on input and omitted on output (a full system snapshot implies
that all disks participate in the snapshot process). This element has a list
of ``disk`` sub-elements, describing anywhere from zero to all of the disks
associated with the domain. :since:`Since 0.9.5`
``disk``
This sub-element describes the snapshot properties of a specific disk.
The attribute ``name`` is mandatory, and must match either the ``<target
dev='name'/>`` (recommended) or an unambiguous ``<source file='name'/>``
of one of the `disk devices <formatdomain.html#elementsDisks>`__
specified for the domain at the time of the snapshot. The attribute
``snapshot`` is optional, and the possible values are the same as the
``snapshot`` attribute for `disk devices
<formatdomain.html#elementsDisks>`__ (``no``, ``internal``, or
``external``). Some hypervisors like ESX require that if specified, the
snapshot mode must not override any snapshot mode attached to the
corresponding domain disk, while others like qemu allow this field to
override the domain default.
:since:`Since 8.2.0` the ``snapshot`` attribute supports the ``manual``
value which instructs the hypervisor to create the snapshot and keep a
synchronized state by pausing the VM which allows to snapshot disk
storage from outside of the hypervisor if the storage provider supports
it. The caller is responsible for resuming a VM paused by requesting a
``manual`` snapshot. When reverting such snapshot, the expectation is that
the storage is configured in a way where the hypervisor will see the
correct image state.
:since:`Since 1.2.2` the ``disk`` element supports an optional attribute
``type`` if the ``snapshot`` attribute is set to ``external``. This
attribute specifies the snapshot target storage type and allows to
overwrite the default ``file`` type. The ``type`` attribute along with
the format of the ``source`` sub-element is identical to the ``source``
element used in domain disk definitions. See the `disk devices
<formatdomain.html#elementsDisks>`__ section documentation for further
information. Libvirt currently supports the ``type`` element in the qemu
driver and supported values are ``file``, ``block`` and ``network``
:since:`(since 1.2.2)`.
``source``
If the snapshot mode is external (whether specified or inherited),
then there is an optional sub-element ``source``, with an attribute
``file`` giving the name of the new file. If ``source`` is not given
and the disk is backed by a local image file (not a block device or
remote storage), a file name is generated that consists of the
existing file name with anything after the trailing dot replaced by
the snapshot name. Remember that with external snapshots, the original
file name becomes the read-only snapshot, and the new file name
contains the read-write delta of all disk changes since the snapshot.
The ``source`` element also may contain the ``seclabel`` element
(described in the `domain XML documentation
<formatdomain.html#seclabel>`__) which can be used to override the
domain security labeling policy for ``source``.
``driver``
An optional sub-element ``driver``, with an attribute ``type`` giving
the driver type (such as qcow2), of the new file created by the
external snapshot of the new file. Optionally ``metadata_cache``
sub-element can be used with same semantics as the identically named
subelement of the domain definition disk's driver.
``creationTime``
A readonly representation of the time this snapshot was created. The time is
specified in seconds since the Epoch, UTC (i.e. Unix time).
``state``
A readonly representation of the state of the domain at the time this
snapshot was taken. If a full system snapshot was created, then this is the
state of the domain at that time. When the domain is reverted to this
snapshot, the domain's state will default to this state, unless overridden
by ``virDomainRevertToSnapshot()`` flags to revert to a running or paused
state. Additionally, this field can be the value "disk-snapshot" (
:since:`since 0.9.5`) when it represents only a disk snapshot (no VM memory
state), and reverting to this snapshot will default to an inactive guest.
``parent``
Readonly, present only if this snapshot has a parent. The parent name is
given by the sub-element ``name``. The parent relationship allows tracking a
tree of related snapshots.
``domain``
A readonly representation of the domain that this snapshot was taken
against. Older versions of libvirt stored only a single child element,
uuid; reverting to a snapshot like this is risky if the current state of the
domain differs from the state that the domain was created in, and requires
the use of the ``VIR_DOMAIN_SNAPSHOT_REVERT_FORCE`` flag in
``virDomainRevertToSnapshot()``. Newer versions of libvirt ( :since:`since
0.9.5` ) store the entire inactive `domain configuration
<formatdomain.html>`__ at the time of the snapshot ( :since:`since 0.9.5` ).
The domain will have security-sensitive information omitted unless the flag
``VIR_DOMAIN_SNAPSHOT_XML_SECURE`` is provided on a read-write connection.
``cookie``
An optional readonly representation of a save image cookie containing
additional data libvirt may need to properly restore a domain from an active
snapshot when such data cannot be stored directly in the ``domain`` to
maintain compatibility with older libvirt or hypervisor.
Examples
--------
Using this XML to create a disk snapshot of just vda on a qemu domain with two
disks:
::
<domainsnapshot>
<description>Snapshot of OS install and updates</description>
<disks>
<disk name='vda'>
<source file='/path/to/new'/>
</disk>
<disk name='vdb' snapshot='no'/>
<disk name='vdc'>
<source file='/path/to/newc'>
<seclabel model='dac' relabel='no'/>
</source>
</disk>
</disks>
</domainsnapshot>
will result in XML similar to this from ``virDomainSnapshotGetXMLDesc()``:
::
<domainsnapshot>
<name>1270477159</name>
<description>Snapshot of OS install and updates</description>
<state>running</state>
<creationTime>1270477159</creationTime>
<parent>
<name>bare-os-install</name>
</parent>
<memory snapshot='no'/>
<disks>
<disk name='vda' snapshot='external'>
<driver type='qcow2'/>
<source file='/path/to/new'/>
</disk>
<disk name='vdb' snapshot='no'/>
</disks>
<domain>
<name>fedora</name>
<uuid>93a5c045-6457-2c09-e56c-927cdf34e178</uuid>
<memory>1048576</memory>
...
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/path/to/old'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='file' device='disk' snapshot='external'>
<driver name='qemu' type='raw'/>
<source file='/path/to/old2'/>
<target dev='vdb' bus='virtio'/>
</disk>
...
</devices>
</domain>
</domainsnapshot>
With that snapshot created, ``/path/to/old`` is the read-only backing file to
the new active file ``/path/to/new``. The ``<domain>`` element within the
snapshot xml records the state of the domain just before the snapshot; a call to
``virDomainGetXMLDesc()`` will show that the domain has been changed to reflect
the snapshot:
::
<domain>
<name>fedora</name>
<uuid>93a5c045-6457-2c09-e56c-927cdf34e178</uuid>
<memory>1048576</memory>
...
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/path/to/new'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='file' device='disk' snapshot='external'>
<driver name='qemu' type='raw'/>
<source file='/path/to/old2'/>
<target dev='vdb' bus='virtio'/>
</disk>
...
</devices>
</domain>

View File

@@ -143,7 +143,7 @@
<h2><a id="example">Examples</a></h2> <h2><a id="example">Examples</a></h2>
<p> <p>
Assuming a <a href="formatsecret.html#VolumeUsageType"> Assuming a <a href="formatsecret.html#usage-type-volume">
<code>luks volume type secret</code></a> is already defined, <code>luks volume type secret</code></a> is already defined,
a simple example specifying use of the <code>luks</code> format a simple example specifying use of the <code>luks</code> format
for either volume creation without a specific cipher being defined or for either volume creation without a specific cipher being defined or

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Terminology and goals</h1>
<p>To avoid ambiguity about the terms used, here are the definitions
for some of the specific concepts used in libvirt documentation:</p>
<ul>
<li>a <strong>node</strong> is a single physical machine</li>
<li>an <strong>hypervisor</strong> is a layer of software allowing to
virtualize a node in a set of virtual machines with possibly different
configurations than the node itself</li>
<li>a <strong>domain</strong> is an instance of an operating system
(or subsystem in the case of container virtualization) running on a
virtualized machine provided by the hypervisor</li>
</ul>
<p class="image">
<img alt="Hypervisor and domains running on a node" src="images/node.gif"/>
</p>
<p>Now we can define the goal of libvirt: <b> to provide a common and
stable layer sufficient to securely manage domains on a node, possibly
remote</b>.</p>
<p> As a result, libvirt should provide all APIs needed to do the
management, such as: provision, create, modify, monitor, control, migrate
and stop the domains - within the limits of the support of the hypervisor
for those operations.
Not all hypervisors provide the same operations; but if an operation is
useful for domain management of even one specific hypervisor it is worth
providing in libvirt.
Multiple nodes
may be accessed with libvirt simultaneously, but the APIs are limited to
single node operations. Node resource operations which are needed
for the management and provisioning of domains are also in the scope of
the libvirt API, such as interface setup, firewall rules, storage management
and general provisioning APIs. Libvirt will also provide the state
monitoring APIs needed to implement management policies, obviously
checking domain state but also exposing local node resource consumption.
</p>
<p>This implies the following sub-goals:</p>
<ul>
<li>All API can be carried remotely though secure APIs</li>
<li>While most API will be generic in term of hypervisor or Host OS,
some API may be targeted to a single virtualization environment
as long as the semantic for the operations from a domain management
perspective is clear</li>
<li>the API should allow to do efficiently and cleanly all the operations
needed to manage domains on a node, including resource provisioning and
setup</li>
<li>the API will not try to provide high level virtualization policies or
multi-nodes management features like load balancing, but the API should be
sufficient so they can be implemented on top of libvirt</li>
<li>stability of the API is a big concern, libvirt should isolate
applications from the frequent changes expected at the lower level of the
virtualization framework</li>
<li>the node being managed may be on a different physical machine than
the management program using libvirt, to this effect libvirt supports
remote access, but should only do so by using secure protocols.</li>
<li>libvirt will provide APIs to enumerate, monitor and use the resources
available on the managed node, including CPUs, memory, storage, networking,
and NUMA partitions.</li>
</ul>
<p>So libvirt is intended to be a building block for higher level
management tools and for applications focusing on virtualization of a
single node (the only exception being domain migration between node
capabilities which involves more than one node).</p>
</body>
</html>

56
docs/goals.rst Normal file
View File

@@ -0,0 +1,56 @@
=====================
Terminology and goals
=====================
To avoid ambiguity about the terms used, here are the definitions for some of
the specific concepts used in libvirt documentation:
- a **node** is a single physical machine
- an **hypervisor** is a layer of software allowing to virtualize a node in a
set of virtual machines with possibly different configurations than the node
itself
- a **domain** is an instance of an operating system (or subsystem in the case
of container virtualization) running on a virtualized machine provided by the
hypervisor
Now we can define the goal of libvirt: **to provide a common and stable layer
sufficient to securely manage domains on a node, possibly remote**.
As a result, libvirt should provide all APIs needed to do the management, such
as: provision, create, modify, monitor, control, migrate and stop the domains -
within the limits of the support of the hypervisor for those operations. Not all
hypervisors provide the same operations; but if an operation is useful for
domain management of even one specific hypervisor it is worth providing in
libvirt. Multiple nodes may be accessed with libvirt simultaneously, but the
APIs are limited to single node operations. Node resource operations which are
needed for the management and provisioning of domains are also in the scope of
the libvirt API, such as interface setup, firewall rules, storage management and
general provisioning APIs. Libvirt will also provide the state monitoring APIs
needed to implement management policies, obviously checking domain state but
also exposing local node resource consumption.
This implies the following sub-goals:
- All API can be carried remotely though secure APIs
- While most API will be generic in term of hypervisor or Host OS, some API may
be targeted to a single virtualization environment as long as the semantic
for the operations from a domain management perspective is clear
- the API should allow to do efficiently and cleanly all the operations needed
to manage domains on a node, including resource provisioning and setup
- the API will not try to provide high level virtualization policies or
multi-nodes management features like load balancing, but the API should be
sufficient so they can be implemented on top of libvirt
- stability of the API is a big concern, libvirt should isolate applications
from the frequent changes expected at the lower level of the virtualization
framework
- the node being managed may be on a different physical machine than the
management program using libvirt, to this effect libvirt supports remote
access, but should only do so by using secure protocols.
- libvirt will provide APIs to enumerate, monitor and use the resources
available on the managed node, including CPUs, memory, storage, networking,
and NUMA partitions.
So libvirt is intended to be a building block for higher level management tools
and for applications focusing on virtualization of a single node (the only
exception being domain migration between node capabilities which involves more
than one node).

View File

@@ -1,298 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Project governance</h1>
<ul id="toc"></ul>
<p>
The libvirt project operates as a meritocratic, consensus-based community.
Anyone with an interest in the project can join the community, contributing
to the ongoing development of the project's work. This pages describes how
that participation takes place and how contributors earn merit, and thus
influence, within the community.
</p>
<h2><a id="codeofconduct">Code of conduct</a></h2>
<p>
The libvirt project community covers people from a wide variety of
countries, backgrounds and positions. This global diversity is a great
strength of the project, but can also lead to communication issues,
which may in turn cause unhappiness. To maximise happiness of the
project community taken as a whole, all members (whether users,
contributors or committers) are expected to abide by the project's
code of conduct. At a high level the code can be summarized as
<em>"be excellent to each other"</em>. Expanding on this:
</p>
<ul>
<li><strong>Be respectful:</strong> disagreements between people are to
be expected and are usually the sign of healthy debate and engagement.
Disagreements can lead to frustration and even anger for some members.
Turning to personal insults, intimidation or threatening behaviour does
not improve the situation though. Participants should thus take care to
ensure all communications / interactions stay professional at all times.</li>
<li><strong>Be considerate:</strong> remember that the community has members
with a diverse background many of whom have English as a second language.
What might appear impolite, may simply be a result of a lack of knowledge
of the English language. Bear in mind that actions will have an impact
on other community members and the project as a whole, so take potential
consequences into account before pursuing a course of action.</li>
<li><strong>Be forgiving:</strong> humans are fallible and as such prone
to make mistakes and inexplicably change their positions at times. Don't
assume that other members are acting with malicious intent. Be prepared
to forgive people who make mistakes and assist each other in learning
from them. Playing a blame game doesn't help anyone.</li>
</ul>
<h2><a id="roles">Roles and responsibilities</a></h2>
<h3><a href="users">Users</a></h3>
<p>
The users are anyone who has a need for the output of the project.
There are no rules or requirements to become a user of libvirt. Even
if the software does not yet work on their OS platform, a person can
be considered a potential future user and welcomed to participate.
</p>
<p>
Participation by users is key to ensuring the project moves in the
right direction, satisfying their real world needs. Users are
encouraged to participate in the broader libvirt community in any
number of ways:
</p>
<ul>
<li>Evangelism: spread the word about what libvirt is doing, how it
helps solve your problems. This can be via blog articles, social
media postings, video blogs, user group / conference presentations
and any other method of disseminating information</li>
<li>Feedback: let the developers know about what does and does not
work with the project. Talk to developers on the project's
IRC channel and mailing list, or find them at conferences. Tell
them what gaps the project has or where they should look for
future development</li>
<li>Moral support: developers live for recognition of the positive
impact their work has on users' lives. Give thanks to the developers
when evangelising the project, or when meeting them at user groups,
conferences, etc.</li>
</ul>
<p>
The above is not an exhaustive list of things users can do to
participate in the project. Further ideas and suggestions are
welcome. Users are encouraged to take their participation
further and become contributors to the project in any of the
ways listed in the next section.
</p>
<h3><a id="contributors">Contributors</a></h3>
<p>
The contributors are community members who have some concrete impact
to the ongoing development of the project. There are many ways in which
members can contribute, with no requirement to be a software engineer.
Many users can in fact consider themselves contributors merely by
engaging in evangelism for the project.
</p>
<ul>
<li>Bug reporting: improve the quality of the project by reporting
any problems found either to the project's own bug tracker, or to
that of the OS vendor shipping the libvirt code.</li>
<li>User help: join the <a href="contact.html">IRC channel or mailing list</a>
to assist or advice other users in troubleshooting the problems they face.</li>
<li>Feature requests: help set the direction for future work by
reporting details of features which are missing to the project's
own bug tracker or mailing lists.</li>
<li>Graphical design: contribute to the development of the project's
websites / wiki brand with improved graphics, styling or layout.</li>
<li>Code development: write and submit patches to address bugs or implement
new features</li>
<li>Architectural design: improve the usefulness of the project
by providing feedback on the design of proposed features, to
ensure they satisfy the broadest applicable needs and survive
the long term</li>
<li>Code review: look at patches which are submitted and critique
the code to identify bugs, potential design problems or other
issues which should be addressed before the code is accepted</li>
<li>Documentation: contribute to content on personal blogs, the
website, wiki, code comments, or any of the formal documentation
efforts.</li>
<li>Translation: join the Fedora transifex community to improve the
quality of translations needed by the libvirt project.</li>
<li>Testing: try proposed patches or release candidates and report
whether the build passes and the changes work as expected.</li>
</ul>
<p>
The above is not an exhaustive list of things members can do to
contribute to the project. Further ideas and suggestions are
welcome.
</p>
<p>
There are no special requirements to becoming a contributor other
than having the interest and ability to provide a contribution. The
libvirt project <strong>does not require</strong> any
<em>"Contributor License Agreement"</em>
to be signed prior to engagement with the community. However for
contributing patches, providing a 'Signed-off-by' line with the
author's legal name and e-mail address to demonstrate agreement
and compliance with the <a href="https://developercertificate.org/">
Developer Certificate of Origin</a> is required.
</p>
<p>
In making a non-patch contribution to the project, the community
member is implicitly stating that they accept the terms of the license
under which the work they are contributing to is distributed. They are
also implicitly stating that they have the legal right to make the
contribution, if doing so on behalf of a broader organization /
company. Most of the project's code is distributed under the GNU
Lesser General Public License, version 2.1 or later. Details of the
exact license under which contributions will be presumed to be
covered are found in the source repositories, or website in question.
</p>
<h3><a id="committers">Committers</a></h3>
<p>
The committers are the subset of contributors who have direct access
to commit code to the project's primary source code repositories, which
are currently using the GIT software. The committers are chosen based
on the quality of their contributions over a period of time. This includes
both the quality of code they submit, as well as the quality of reviews
they provide on other contributors' submissions and a demonstration that
they understand day-to-day operation of the project and its goals. There
is no minimum level of contribution required in order to become a committer,
though 2-3 months worth of quality contribution would be a rough guide.
</p>
<p>
There are no special requirements to becoming a committer other than to
have shown a willingness and ability to contribute to the project over
an extended period of time. Proposals for elevating contributors to
committers are typically made by existing committers, though contributors
are also welcome to make proposals. The decision to approve the elevation
of a contributor to a committer is made through "rough consensus" between
the existing committers.
</p>
<p>
The aim in elevating contributors to committers is to ensure that there
is a broad base of experience and expertize across all areas of the
project's work. Committers are not required to have knowledge across
all areas of the project's work. While an approved committer has the
technical ability to commit code to any area of the project, by convention
they will only commit to areas they feel themselves to be qualified to
evaluate the contribution. If in doubt, committers will defer to the
opinion of other committers with greater expertize in an area.
</p>
<p>
The committers hold the ultimate control over what contributions are
accepted by the project, however, this does not mean they have the
right to do whatever they want. Where there is debate and disagreement
between contributors, committers are expected to look at the issues with
an unbiased point of view and help achieve a "rough consensus". If the
committer has a conflict of interest in the discussion, for example due
to their position of employment, they are expected to put the needs of
the community project first. If they cannot put the community project
first, they must declare their conflict of interest, and allow other
non-conflicted committers to make any final decision.
</p>
<p>
The committers are expected to monitor contributions to areas of the
project where they have expertize and ensure that either some form of
feedback is provided to the contributor, or to accept their contribution.
There is no formal minimum level of approval required to accept a
contribution. Positive review by any committer experienced in the area
of work is considered to be enough to justify acceptance in normal
circumstances. Where one committer explicitly rejects a contribution,
however, other committers should not override that rejection without
first establishing a "rough consensus" amongst the broader group of
committers.
</p>
<p>
Being a committer is a privilege, not a right. In exceptional
circumstances, the privilege may be removed from an active
contributor. Such decisions will be taken based on "rough
consensus" amongst other committers. In the event that a committer
is no longer able to participate in the project, after some period
of inactivity passes, they may be asked to confirm that they wish
to retain their role as a committer.
</p>
<h3><a id="secteam">Security team</a></h3>
<p>
The security team consists of a subset of the project committers
along with representatives from vendors shipping the project's
software. The subset of project committers is chosen to be the
minimal size necessary to provide expertise spanning most of
the project's work. Further project committers may be requested
to engage in resolving specific security issues on a case by
case basis. Any vendor who is shipping the project's software
may submit a request for one or more of their representatives
to join the security team. Such requests must by approved by
existing members of the team vouching for the integrity of
the nominated person or organization.
</p>
<p>
Members of the security team are responsible for triaging and
resolving any security issues that are reported to the project.
They are expected to abide by the project's documented
<a href="securityprocess.html">security process</a>. In particular
they must respect any embargo period agreed amongst the team
before disclosing a private issue.
</p>
<h2><a id="roughconsensus">Rough consensus</a></h2>
<p>
A core concept for governance of the project described above is
that of "rough consensus". To expand on this, it is a process
of decision making that involves the following steps
</p>
<ul>
<li>Proposal</li>
<li>Discussion</li>
<li>Vote (exceptional circumstances only)</li>
<li>Decision</li>
</ul>
<p>
To put this into words, any contributor is welcome to make a proposal
for consideration. Any contributor may participate in the discussions
around the proposal. The discussion will usually result in agreement
between the interested parties, or at least agreement between the
committers. Only in the very exceptional circumstance where there
is disagreement between committers, would a vote be considered.
Even in these exceptional circumstances, it is usually found to be
obvious what the majority opinion of the committers is. In the event
that even a formal vote is tied, the committers will have to hold
ongoing discussions until the stalemate is resolved or the proposal
withdrawn.
</p>
<p>
The overall goal of the "rough consensus" process is to ensure that
decisions can be made within the project, with a minimum level of
bureaucracy and process. Implicit in this is that any person who does
not explicitly reject to a proposal is assumed to be supportive, or
at least agnostic.
</p>
</body>
</html>

232
docs/governance.rst Normal file
View File

@@ -0,0 +1,232 @@
.. role:: anchor(raw)
:format: html
==================
Project governance
==================
.. contents::
The libvirt project operates as a meritocratic, consensus-based community.
Anyone with an interest in the project can join the community, contributing to
the ongoing development of the project's work. This pages describes how that
participation takes place and how contributors earn merit, and thus influence,
within the community.
:anchor:`<a id="codeofconduct"/>`
Code of conduct
---------------
The libvirt project community covers people from a wide variety of countries,
backgrounds and positions. This global diversity is a great strength of the
project, but can also lead to communication issues, which may in turn cause
unhappiness. To maximise happiness of the project community taken as a whole,
all members (whether users, contributors or committers) are expected to abide by
the project's code of conduct. At a high level the code can be summarized as
*"be excellent to each other"*. Expanding on this:
- **Be respectful:** disagreements between people are to be expected and are
usually the sign of healthy debate and engagement. Disagreements can lead to
frustration and even anger for some members. Turning to personal insults,
intimidation or threatening behaviour does not improve the situation though.
Participants should thus take care to ensure all communications /
interactions stay professional at all times.
- **Be considerate:** remember that the community has members with a diverse
background many of whom have English as a second language. What might appear
impolite, may simply be a result of a lack of knowledge of the English
language. Bear in mind that actions will have an impact on other community
members and the project as a whole, so take potential consequences into
account before pursuing a course of action.
- **Be forgiving:** humans are fallible and as such prone to make mistakes and
inexplicably change their positions at times. Don't assume that other members
are acting with malicious intent. Be prepared to forgive people who make
mistakes and assist each other in learning from them. Playing a blame game
doesn't help anyone.
Roles and responsibilities
--------------------------
Users
~~~~~
The users are anyone who has a need for the output of the project. There are no
rules or requirements to become a user of libvirt. Even if the software does not
yet work on their OS platform, a person can be considered a potential future
user and welcomed to participate.
Participation by users is key to ensuring the project moves in the right
direction, satisfying their real world needs. Users are encouraged to
participate in the broader libvirt community in any number of ways:
- Evangelism: spread the word about what libvirt is doing, how it helps solve
your problems. This can be via blog articles, social media postings, video
blogs, user group / conference presentations and any other method of
disseminating information
- Feedback: let the developers know about what does and does not work with the
project. Talk to developers on the project's IRC channel and mailing list, or
find them at conferences. Tell them what gaps the project has or where they
should look for future development
- Moral support: developers live for recognition of the positive impact their
work has on users' lives. Give thanks to the developers when evangelising the
project, or when meeting them at user groups, conferences, etc.
The above is not an exhaustive list of things users can do to participate in the
project. Further ideas and suggestions are welcome. Users are encouraged to take
their participation further and become contributors to the project in any of the
ways listed in the next section.
Contributors
~~~~~~~~~~~~
The contributors are community members who have some concrete impact to the
ongoing development of the project. There are many ways in which members can
contribute, with no requirement to be a software engineer. Many users can in
fact consider themselves contributors merely by engaging in evangelism for the
project.
- Bug reporting: improve the quality of the project by reporting any problems
found either to the project's own bug tracker, or to that of the OS vendor
shipping the libvirt code.
- User help: join the `IRC channel or mailing list <contact.html>`__ to assist
or advice other users in troubleshooting the problems they face.
- Feature requests: help set the direction for future work by reporting details
of features which are missing to the project's own bug tracker or mailing
lists.
- Graphical design: contribute to the development of the project's websites /
wiki brand with improved graphics, styling or layout.
- Code development: write and submit patches to address bugs or implement new
features
- Architectural design: improve the usefulness of the project by providing
feedback on the design of proposed features, to ensure they satisfy the
broadest applicable needs and survive the long term
- Code review: look at patches which are submitted and critique the code to
identify bugs, potential design problems or other issues which should be
addressed before the code is accepted
- Documentation: contribute to content on personal blogs, the website, wiki,
code comments, or any of the formal documentation efforts.
- Translation: join the Fedora transifex community to improve the quality of
translations needed by the libvirt project.
- Testing: try proposed patches or release candidates and report whether the
build passes and the changes work as expected.
The above is not an exhaustive list of things members can do to contribute to
the project. Further ideas and suggestions are welcome.
There are no special requirements to becoming a contributor other than having
the interest and ability to provide a contribution. The libvirt project **does
not require** any *"Contributor License Agreement"* to be signed prior to
engagement with the community. However for contributing patches, providing a
'Signed-off-by' line with the author's legal name and e-mail address to
demonstrate agreement and compliance with the `Developer Certificate of
Origin <https://developercertificate.org/>`__ is required.
In making a non-patch contribution to the project, the community member is
implicitly stating that they accept the terms of the license under which the
work they are contributing to is distributed. They are also implicitly stating
that they have the legal right to make the contribution, if doing so on behalf
of a broader organization / company. Most of the project's code is distributed
under the GNU Lesser General Public License, version 2.1 or later. Details of
the exact license under which contributions will be presumed to be covered are
found in the source repositories, or website in question.
Committers
~~~~~~~~~~
The committers are the subset of contributors who have direct access to commit
code to the project's primary source code repositories, which are currently
using the GIT software. The committers are chosen based on the quality of their
contributions over a period of time. This includes both the quality of code they
submit, as well as the quality of reviews they provide on other contributors'
submissions and a demonstration that they understand day-to-day operation of the
project and its goals. There is no minimum level of contribution required in
order to become a committer, though 2-3 months worth of quality contribution
would be a rough guide.
There are no special requirements to becoming a committer other than to have
shown a willingness and ability to contribute to the project over an extended
period of time. Proposals for elevating contributors to committers are typically
made by existing committers, though contributors are also welcome to make
proposals. The decision to approve the elevation of a contributor to a committer
is made through "rough consensus" between the existing committers.
The aim in elevating contributors to committers is to ensure that there is a
broad base of experience and expertize across all areas of the project's work.
Committers are not required to have knowledge across all areas of the project's
work. While an approved committer has the technical ability to commit code to
any area of the project, by convention they will only commit to areas they feel
themselves to be qualified to evaluate the contribution. If in doubt, committers
will defer to the opinion of other committers with greater expertize in an area.
The committers hold the ultimate control over what contributions are accepted by
the project, however, this does not mean they have the right to do whatever they
want. Where there is debate and disagreement between contributors, committers
are expected to look at the issues with an unbiased point of view and help
achieve a "rough consensus". If the committer has a conflict of interest in the
discussion, for example due to their position of employment, they are expected
to put the needs of the community project first. If they cannot put the
community project first, they must declare their conflict of interest, and allow
other non-conflicted committers to make any final decision.
The committers are expected to monitor contributions to areas of the project
where they have expertize and ensure that either some form of feedback is
provided to the contributor, or to accept their contribution. There is no formal
minimum level of approval required to accept a contribution. Positive review by
any committer experienced in the area of work is considered to be enough to
justify acceptance in normal circumstances. Where one committer explicitly
rejects a contribution, however, other committers should not override that
rejection without first establishing a "rough consensus" amongst the broader
group of committers.
Being a committer is a privilege, not a right. In exceptional circumstances, the
privilege may be removed from an active contributor. Such decisions will be
taken based on "rough consensus" amongst other committers. In the event that a
committer is no longer able to participate in the project, after some period of
inactivity passes, they may be asked to confirm that they wish to retain their
role as a committer.
Security team
~~~~~~~~~~~~~
The security team consists of a subset of the project committers along with
representatives from vendors shipping the project's software. The subset of
project committers is chosen to be the minimal size necessary to provide
expertise spanning most of the project's work. Further project committers may be
requested to engage in resolving specific security issues on a case by case
basis. Any vendor who is shipping the project's software may submit a request
for one or more of their representatives to join the security team. Such
requests must by approved by existing members of the team vouching for the
integrity of the nominated person or organization.
Members of the security team are responsible for triaging and resolving any
security issues that are reported to the project. They are expected to abide by
the project's documented `security process <securityprocess.html>`__. In
particular they must respect any embargo period agreed amongst the team before
disclosing a private issue.
Rough consensus
---------------
A core concept for governance of the project described above is that of "rough
consensus". To expand on this, it is a process of decision making that involves
the following steps
- Proposal
- Discussion
- Vote (exceptional circumstances only)
- Decision
To put this into words, any contributor is welcome to make a proposal for
consideration. Any contributor may participate in the discussions around the
proposal. The discussion will usually result in agreement between the interested
parties, or at least agreement between the committers. Only in the very
exceptional circumstance where there is disagreement between committers, would a
vote be considered. Even in these exceptional circumstances, it is usually found
to be obvious what the majority opinion of the committers is. In the event that
even a formal vote is tied, the committers will have to hold ongoing discussions
until the stalemate is resolved or the proposal withdrawn.
The overall goal of the "rough consensus" process is to ensure that decisions
can be made within the project, with a minimum level of bureaucracy and process.
Implicit in this is that any person who does not explicitly reject to a proposal
is assumed to be supportive, or at least agnostic.

View File

@@ -72,7 +72,6 @@ This page only covers the very basics, so it's recommended that
you also take a look at the following documents: you also take a look at the following documents:
- `Programming languages <programming-languages.html>`__ - `Programming languages <programming-languages.html>`__
- `Developer tooling <developer-tooling.html>`__
- `Advanced test suite usage <advanced-tests.html>`__ - `Advanced test suite usage <advanced-tests.html>`__
- `Adoption of GLib APIs <glib-adoption.html>`__ - `Adoption of GLib APIs <glib-adoption.html>`__
- `Committer guidelines <committer-guidelines.html>`__ - `Committer guidelines <committer-guidelines.html>`__

View File

@@ -10,7 +10,6 @@ docs_image_files = [
'migration-native.png', 'migration-native.png',
'migration-tunnel.png', 'migration-tunnel.png',
'migration-unmanaged-direct.png', 'migration-unmanaged-direct.png',
'node.gif',
] ]
install_data(docs_image_files, install_dir: docs_html_dir / 'images') install_data(docs_image_files, install_dir: docs_html_dir / 'images')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Creator: fig2dev Version 3.2.7b-dev -->
<!-- CreationDate: 2020-07-10 10:25:51 -->
<!-- Magnification: 1 -->
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="150pt" height="159pt"
viewBox="963 1488 2490 2649">
<g fill="none">
<!-- Line -->
<rect x="1275" y="1800" width="1275" height="450" rx="105"
stroke="#000000" stroke-width="8px"/>
<!-- Text -->
<text xml:space="preserve" x="1500" y="2100" fill="#000000" font-family="Times" font-style="normal" font-weight="normal" font-size="240" text-anchor="start">Domain</text>
<!-- Line -->
<rect x="1275" y="2325" width="1275" height="450" rx="105"
stroke="#000000" stroke-width="8px"/>
<!-- Text -->
<text xml:space="preserve" x="1500" y="2625" fill="#000000" font-family="Times" font-style="normal" font-weight="normal" font-size="240" text-anchor="start">Domain</text>
<!-- Line -->
<rect x="1275" y="2850" width="1275" height="450" rx="105"
stroke="#000000" stroke-width="8px"/>
<!-- Text -->
<text xml:space="preserve" x="1500" y="3150" fill="#000000" font-family="Times" font-style="normal" font-weight="normal" font-size="240" text-anchor="start">Domain</text>
<!-- Line -->
<rect x="975" y="1500" width="2400" height="2625"
stroke="#000000" stroke-width="8px"/>
<!-- Line -->
<rect x="1125" y="3450" width="2100" height="525" rx="105"
stroke="#000000" stroke-width="8px"/>
<!-- Text -->
<text xml:space="preserve" x="1500" y="3825" fill="#000000" font-family="Times" font-style="normal" font-weight="normal" font-size="240" text-anchor="start">Hypervisor</text>
<!-- Text -->
<text xml:space="preserve" x="2700" y="2850" fill="#000000" font-family="Times" font-style="normal" font-weight="normal" font-size="240" text-anchor="start">Node</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -21,13 +21,15 @@
<li>is accessible from C, Python, Perl, Go and more</li> <li>is accessible from C, Python, Perl, Go and more</li>
<li>is licensed under open source licenses</li> <li>is licensed under open source licenses</li>
<li>supports <a href="drvqemu.html">KVM</a>, <li>supports <a href="drvqemu.html">KVM</a>,
<a href="drvqemu.html">Hypervisor.framework</a>,
<a href="drvqemu.html">QEMU</a>, <a href="drvxen.html">Xen</a>, <a href="drvqemu.html">QEMU</a>, <a href="drvxen.html">Xen</a>,
<a href="drvvirtuozzo.html">Virtuozzo</a>, <a href="drvvirtuozzo.html">Virtuozzo</a>,
<a href="drvesx.html">VMWare ESX</a>, <a href="drvesx.html">VMWare ESX</a>,
<a href="drvlxc.html">LXC</a>, <a href="drvlxc.html">LXC</a>,
<a href="drvbhyve.html">BHyve</a> and <a href="drvbhyve.html">BHyve</a> and
<a href="drivers.html">more</a></li> <a href="drivers.html">more</a></li>
<li>targets Linux, FreeBSD, <a href="windows.html">Windows</a> and macOS</li> <li>targets Linux, FreeBSD, <a href="windows.html">Windows</a> and
<a href="macos.html">macOS</a></li>
<li>is used by many <a href="apps.html">applications</a></li> <li>is used by many <a href="apps.html">applications</a></li>
</ul> </ul>
<p>Recent / forthcoming <a href="news.html">release changes</a></p> <p>Recent / forthcoming <a href="news.html">release changes</a></p>

View File

@@ -5,7 +5,7 @@ Debug Logs
.. contents:: .. contents::
Turning on debug logs Turning on debug logs
--------------------- =====================
If you `report a bug <https://gitlab.com/libvirt/libvirt/-/issues/new>`__ If you `report a bug <https://gitlab.com/libvirt/libvirt/-/issues/new>`__
against libvirt, in most cases you will be asked to attach debug logs. These against libvirt, in most cases you will be asked to attach debug logs. These
@@ -17,69 +17,184 @@ Moreover, libvirt catches stderr of all running domains. These can be useful as
well. well.
How to turn on debug logs for libvirt Logging settings in libvirt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ===========================
Log levels
----------
Libvirt log messages are classified into 4 priority levels; the higher the
priority level, the less is the volume of produced messages.
The log level setting is controlled by the ``log_filters`` and ``log_outputs``
settings explained in the `Log outputs`_ and `Log filters`_ sections
respectively.
* ``1: DEBUG``
* ``2: INFO``
* ``3: WARNING``
* ``4: ERROR``
For debugging it's necessary to capture the ``DEBUG`` level entries as the name
implies.
Log outputs
-----------
Log outputs describe where the log messages are being recorded. The outputs
are described by a space-separated list of tuples in the following format:
::
level:output
``level`` refers to the minimum priority level of entries recorded in the output.
``output`` is one of the following:
``file:FILENAME``
Logging messages are appended to FILENAME.
``journald``
Logging goes to the ``journald`` logging daemon.
``stderr``
Logging goes to the standard error output stream of the libvirt daemon.
``syslog:name``
Logging goes to syslogd. ``name`` is used to identify the entries.
The default output on systems running ``journald`` is ``3:journald``. Note that
``journald`` can throttle the amount of logs per process so in order to capture
debug logs of a libvirt daemon should go to a file instead (in addition to
theoriginal logging daemon), e.g.:
::
"1:file:/var/log/libvirt/libvirtd.log 3:journald"
Log filters
-----------
Log filters, as the name suggest, help filtering out messages which are
irrelevant to the cause. The log filters is a space-separated list of tuples
list of tuples using the ``level:identifier`` format. Each filter defined this
way will then limit messages coming from a module matching the ``identifier``
pattern (accepts globs too) to the given ``level``."
As ``identifier`` is based on internal naming of modules, preferred way of
configuring your filters is to start with the `Example filter settings`_.
The rule of thumb here is to have more logs rather than less and miss something
important.
Libvirt daemons logging configuration
=====================================
Libvirt daemons can be configured either via a config file or via the
administration API. The configuration location depends on multiple factors.
Session vs system daemons
-------------------------
Libvirt daemons run either in the ``system`` mode or on ``session`` (user)
mode, depending on the configuration of the host and available permission
levels.
The `connection URI <https://libvirt.org/uri.html>`__ influences which daemon
the client will communicate with.
System daemon mode
~~~~~~~~~~~~~~~~~~
* all connection URIs end in ``/system`` e.g. ``qemu:///system``
* config files are usually placed in ``/etc/libvirt``
Session daemon mode
~~~~~~~~~~~~~~~~~~~
* connection URIs end in ``/session``
* config files are usually placed in ``$XDG_CONFIG_HOME/libvirt/`` directory
Modular vs. monolithic daemons
------------------------------
While there is only a single 'libvirtd.conf' configuration file in case of the
monolithic daemon setup, each of the modular daemons has their own
configuration file giving you a lot of possibilities how to configure them
individually including logging. Realistically though, logging will have to be
configured only for a single or a couple of daemons in case debug logs are
requested.
Refer to `documentation about daemons <../daemons.html#checking-whether-modular-monolithic-mode-is-in-use>`__
to figure out which is in use by your system.
Modular daemons
~~~~~~~~~~~~~~~
The configuration of modular daemons is in file named after the daemon. E.g.
for ``qemu:///system`` connection this is the ``virtqemud`` daemon and
correspondingly:
* ``virtqemud.conf`` config file is used
* ``virtqemud:///system`` or ``virtqemud:///session`` admin URI is used
Monolithic daemon
~~~~~~~~~~~~~~~~~
* ``libvirtd.conf`` config file is used
* ``libvirtd:///system`` or ``libvirtd:///session`` admin URI is used
when the modular qemu hypervisor driver ``virtqemud``
Persistent setting Persistent setting
^^^^^^^^^^^^^^^^^^ ------------------
The daemon configuration files location is dependent on `connection In order to setup libvirt logging persistently, follow the steps below:
URI <https://libvirt.org/uri.html>`__. For ``qemu:///system``:
- open the appropriate daemon config file in your favourite editor ::
/etc/libvirt/virtqemud.conf
/etc/libvirt/libvirtd.conf
$XDG_CONFIG_HOME/libvirt/libvirtd.conf
$XDG_CONFIG_HOME/libvirt/virtqemud.conf
- open ``/etc/libvirt/libvirtd.conf`` in your favourite editor - find & replace, or set the appropriate `Log outputs`_ and `Log filters`_, e.g ::
- find & replace, or set these variables:
:: log_filters="3:remote 4:event 3:util.json 3:rpc 1:*"
log_outputs="1:file:/var/log/libvirt/libvirtd.log"
# LEGACY SETTINGS PRIOR LIBVIRT 4.4.0 SEE BELOW! #
log_level = 1
log_filters="1:qemu 3:remote 4:event 3:util.json 3:rpc"
log_outputs="1:file:/var/log/libvirt/libvirtd.log"
::
# PREFERRED SETTINGS AFTER LIBVIRT 4.4.0 #
log_filters="3:remote 4:event 3:util.json 3:rpc 1:*"
log_outputs="1:file:/var/log/libvirt/libvirtd.log"
- save and exit - save and exit
- restart libvirtd service - restart the corresponding service/daemon e.g. ::
:: systemctl restart virtqemud.socket
systemctl restart libvirtd.socket
systemctl restart libvirtd.service systemctl restart libvirtd.service
In the config variables above, we have set logging level to 1 (debug level), set
some filters (to filter out noise), e.g. from rpc only warnings (=level 3) and
above will be reported. The logs are saved into
``/var/log/libvirt/libvirtd.log``. Since libvirt **4.4.0** log filters support
shell globbing, therefore the usage of ``log_level`` is considered deprecated in
favour of pure usage of ``log_filters``.
In case you want to get the client logs, you need to set this environment
variable:
::
export LIBVIRT_LOG_OUTPUTS="1:file:/tmp/libvirt_client.log"
However, when you are using the session mode ``qemu:///session`` or you run the *Note:* Libvirt prior to the ``libvirt-4.4.0`` release didn't support globbing
``libvirtd`` as unprivileged user you will find configuration file under patterns and thus requires more configuration. See
``$XDG_CONFIG_HOME/libvirt/libvirtd.conf``. `Legacy (pre-4.4.0) libvirt daemon logging configuration`_.
Runtime setting Runtime setting
^^^^^^^^^^^^^^^ ---------------
Debugging anomalies can be very painful, especially when trying to reproduce it Debugging anomalies can be very painful, especially when trying to reproduce it
after the daemon restarts, since the new session can make the anomaly after the daemon restarts, since the new session can make the anomaly
"disappear". Therefore, it's possible to enable the debug logs during runtime "disappear". Therefore, it's possible to enable the debug logs during runtime
using libvirt administration API. To use it conveniently, there's a virt-admin using libvirt administration API. To use it conveniently, there's the
client provided by the libvirt-admin package. Use the package manager provided ``virt-admin`` client provided by the ``libvirt-admin`` package. Use the
by your distribution to install this package. Once you have it installed, run package manager provided by your distribution to install this package.
the following as root to see the set of log filters currently being active:
**Important**: Substitute ``virt-admin -c $ADMIN_URI`` according to the
guideline in the sections above in place of ``virt-admin`` in the examples
below if needed.
The following command allows to query the list of currently active log filters:
:: ::
@@ -91,12 +206,6 @@ own set of filters:
:: ::
## LEGACY APPROACH ENUMERATING ALL THE DESIRED MODULES ##
# virt-admin daemon-log-filters "1:util 1:libvirt 1:storage 1:network 1:nodedev 1:qemu"
::
## CURRENT APPROACH USING SHELL GLOBBING ##
# virt-admin daemon-log-filters "3:remote 4:util.json 4:rpc 1:*" # virt-admin daemon-log-filters "3:remote 4:util.json 4:rpc 1:*"
Analogically, the same procedure can be performed with log outputs: Analogically, the same procedure can be performed with log outputs:
@@ -112,7 +221,7 @@ once you're finished debugging, just remember to save the original sets of
filters and outputs and restore them at the end the same way as described above. filters and outputs and restore them at the end the same way as described above.
Removing filters and outputs Removing filters and outputs
'''''''''''''''''''''''''''' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's also possible to remove all the filters and produce an enormous log file, It's also possible to remove all the filters and produce an enormous log file,
but it is not recommended since some of libvirt's modules can produce a large but it is not recommended since some of libvirt's modules can produce a large
@@ -135,8 +244,45 @@ setting which depends on the host configuration, *journald* in our case:
# virt-admin daemon-log-outputs "" # virt-admin daemon-log-outputs ""
Logging outputs: 2:journald Logging outputs: 2:journald
Legacy (pre-4.4.0) libvirt daemon logging configuration
-------------------------------------------------------
Old libvirt versions didn't support globbing (e.g. ``1:*``) to configure
logging, thus it's required to explicitly set logging level to 1 (debug level)
with the ``log_level`` setting and then filter out the noise with a tailored log
``log_filters`` string.
::
# LEGACY SETTINGS PRIOR LIBVIRT 4.4.0
log_level = 1
log_filters="1:qemu 3:remote 4:event 3:util.json 3:rpc"
log_outputs="1:file:/var/log/libvirt/libvirtd.log"
Or using ``virt-admin``:
::
## LEGACY APPROACH ENUMERATING ALL THE DESIRED MODULES ##
# virt-admin daemon-log-filters "1:util 1:libvirt 1:storage 1:network 1:nodedev 1:qemu"
Client library logging
======================
By default the client library doesn't produce any logs and usually usually it's
not very interesting on its own anyway.
In case you want to get the client logs, logging is controlled via the
``LIBVIRT_LOG_OUTPUTS`` and ``LIBVIRT_LOG_FILTERS`` environment variables.
Generally when client logs are needed make sure you don't filter them:
::
export LIBVIRT_LOG_OUTPUTS="1:file:/tmp/libvirt_client.log"
What to attach? What to attach?
--------------- ===============
Now you should go and reproduce the bug. Once you're finished, attach: Now you should go and reproduce the bug. Once you're finished, attach:
@@ -154,9 +300,11 @@ Now you should go and reproduce the bug. Once you're finished, attach:
- If you are asked for client logs, ``/tmp/libvirt_client.log``. - If you are asked for client logs, ``/tmp/libvirt_client.log``.
- Ideally don't tear down the environment in case additional information is - Ideally don't tear down the environment in case additional information is
required. required.
- Consider whether you view any of the information in the debug logs
sensitive: `Sensitive information in debug logs`_.
Example filter settings Example filter settings
----------------------- =======================
Some filter setting suggestions for debugging more specific things. Unless it's Some filter setting suggestions for debugging more specific things. Unless it's
explicitly stated, these work on libvirt 4.4.0 and later. Please note that some explicitly stated, these work on libvirt 4.4.0 and later. Please note that some
@@ -164,7 +312,7 @@ of the filters below may not log enough information for filing a proper libvirt
bug. Usually it's better to log more than less. bug. Usually it's better to log more than less.
Targeted logging for debugging QEMU VMs Targeted logging for debugging QEMU VMs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ---------------------------------------
Specifying only some sections allows for a targeted filter configuration which Specifying only some sections allows for a targeted filter configuration which
works on all versions and is sufficient for most cases. works on all versions and is sufficient for most cases.
@@ -174,7 +322,7 @@ works on all versions and is sufficient for most cases.
1:libvirt 1:qemu 1:conf 1:security 3:event 3:json 3:file 3:object 1:util 1:libvirt 1:qemu 1:conf 1:security 3:event 3:json 3:file 3:object 1:util
Less verbose logging for QEMU VMs Less verbose logging for QEMU VMs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ---------------------------------
Some subsystems are very noisy and usually not the culprit of the problems. They Some subsystems are very noisy and usually not the culprit of the problems. They
can be silenced individually for a less verbose log while still logging can be silenced individually for a less verbose log while still logging
@@ -186,10 +334,32 @@ A permissive filter is good for development use cases.
3:remote 4:event 3:util.json 3:util.object 3:util.dbus 3:util.netlink 3:node_device 3:rpc 3:access 1:* 3:remote 4:event 3:util.json 3:util.object 3:util.dbus 3:util.netlink 3:node_device 3:rpc 3:access 1:*
Minimalistic QEMU QMP monitor logging Minimalistic QEMU QMP monitor logging
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -------------------------------------
This filter logs only QMP traffic and skips most of libvirt's messages. This filter logs only QMP traffic and skips most of libvirt's messages.
:: ::
2:qemu.qemu_monitor 3:* 2:qemu.qemu_monitor 3:*
Sensitive information in debug logs
===================================
Debug logs may contain information that certain users may consider sensitive
although generally it's okay to share debuglogs publicly.
Information which could be deemed sensitive:
- hostname of the host
- names of VMs and other objects
- paths to disk images
- IP addresses of guests and the host
- hostnames/IP addresses of disks accessed via network
Libvirt's debug logs only ever have passwords and disk encryption secrets in
encrypted form without the key being part of the log. There's one notable
exception, that ``VNC/SPICE`` passwords can be found in the logs.
In case you decide to mask information you consider sensitive from the posted
debug logs, make sure that the masking doesn't introduce ambiguity.

View File

@@ -55,6 +55,9 @@ Usage
`Memory devices <memorydevices.html>`__ `Memory devices <memorydevices.html>`__
Memory devices and their use Memory devices and their use
`Snapshots <snapshots.html>`__
Details about snapshotting a VM
Internals / Debugging Internals / Debugging
--------------------- ---------------------

View File

@@ -18,6 +18,7 @@ docs_kbase_files = [
'rpm-deployment', 'rpm-deployment',
's390_protected_virt', 's390_protected_virt',
'secureusage', 'secureusage',
'snapshots',
'systemtap', 'systemtap',
'virtiofs', 'virtiofs',
] ]

48
docs/kbase/snapshots.rst Normal file
View File

@@ -0,0 +1,48 @@
=========
Snapshots
=========
.. contents::
Manual storage snapshotting
===========================
Certain use cases such as block storage on LVM or disks backed via storage
exported through the ``vhost-user-blk`` protocol may require that snapshots are
done in conjunction with the storage provider which is not managed by **libvirt**.
To achieve this such disks can use ``snapshot`` mode ``manual``. When a snapshot
has a disk in manual mode the following happens:
#. ``libvirt`` takes snapshot of the VM memory if requested
#. If a live snapshot is requested (``VIR_DOMAIN_SNAPSHOT_CREATE_LIVE``) the
VM runs until the memory snapshot phase completes and is then paused.
#. Otherwise the VM is paused right away.
#. Snapshot of disks which are marked for external snapsot is executed
#. The API return success, the VM is paused.
#. The user snapshots the externally managed storage
#. The user resumes the execution of the VM (``virsh resume $VM``)
Overview of manual snapshots
----------------------------
Manual snapshot of a disk is requested by setting the ``snapshot`` property to
``manual`` in the snapshot XML ::
<domainsnapshot>
<memory file='/path/to/memory/img'/>
<disks>
<disk name='vda' snapshot='manual'/>
<disk name='vdb' snapshot='external'/>
<disk name='vdc' snapshot='no'/>
</disks>
</domainsnapshot>
or ``--diskspec vda,snapshot=manual`` when using ``virsh snapshot-create-as``::
$ virsh snapshot-create-as --diskspec vda,snapshot=manual \
--diskspec vdb,snapshot=external \
--diskspec vdc,snapshot=no $VM \
--memspec file=/path/to/memory/img

44
docs/macos.rst Normal file
View File

@@ -0,0 +1,44 @@
.. role:: since
=============
macOS support
=============
.. contents::
Libvirt works both as client (for most drivers) and server (for the
`QEMU driver <drvqemu.html>`__) on macOS.
:since:`Since 8.1.0`, the "hvf" domain type can be used to run
hardware-accelerated VMs on macOS via
`Hypervisor.framework <https://developer.apple.com/documentation/hypervisor>`__.
QEMU version 2.12 or newer is needed for this to work.
Installation
============
libvirt client (virsh), server (libvirtd) and development headers can be
installed from `Homebrew <https://brew.sh>`__:
::
brew install libvirt
Running libvirtd locally
========================
The server can be started manually:
::
$ libvirtd
or on system boot:
::
$ brew services start libvirt
Once started, you can use virsh as you would on Linux.

View File

@@ -41,6 +41,7 @@ Tools
* `virt-admin(1) <virt-admin.html>`__ - daemon administration interface * `virt-admin(1) <virt-admin.html>`__ - daemon administration interface
* `virsh(1) <virsh.html>`__ - management user interface * `virsh(1) <virsh.html>`__ - management user interface
* `virt-qemu-run(1) <virt-qemu-run.html>`__ - run standalone QEMU instances * `virt-qemu-run(1) <virt-qemu-run.html>`__ - run standalone QEMU instances
* `libvirt-guests(8) <libvirt-guests.html>`__ - suspend/resume running libvirt guests
Key codes Key codes
========= =========

View File

@@ -0,0 +1,151 @@
==============
libvirt-guests
==============
-------------------------------------
suspend/resume running libvirt guests
-------------------------------------
:Manual section: 8
:Manual group: Virtualization Support
.. contents::
SYNOPSIS
========
``libvirt-guests`` *COMMAND*
DESCRIPTION
===========
``libvirt-guests`` is a service that can be used to coordinate guest and host
lifecycle actions. By default, ``libvirt-guests`` will suspend running guests
when the host shuts down, and restore them to their pre-shutdown state when
the host reboots.
``libvirt-guests`` is typically under control of systemd. When
``libvirt-guests.service`` is enabled, systemd will call ``libvirt-guests``
with the ``start`` *COMMAND* when the host boots. Conversely, systemd will call
``libvirt-guests`` with the ``stop`` *COMMAND* when the host shuts down.
``libvirt-guests`` can be used directly. In addition to the ``start`` and
``stop`` *COMMAND*\s, it also supports ``status``, ``restart``, ``condrestart``,
``try-restart``, ``reload``, ``force-reload``, ``gueststatus``, and
``shutdown`` *COMMAND*\s.
FILES
=====
``libvirt-guests`` defines several variables to control service behavior.
The default value of these variables can be overridden in:
* ``@SYSCONFDIR@/sysconfig/libvirt-guests``
The following variables are supported:
- URIS=default
URIs to check for running guests. Example:
``URIS='default xen:///system xen+tcp://host/system lxc:///system'``
- ON_BOOT=start
Action taken on host boot
* start
All guests which were running on shutdown are started on boot regardless
of their autostart settings
* ignore
``libvirt-guests`` won't start any guest on boot, however, guests marked
as autostart will still be automatically started by libvirtd
- START_DELAY=0
Number of seconds to wait between each guest start. Set to 0 to allow parallel
startup.
- ON_SHUTDOWN=suspend
Action taken on host shutdown
* suspend
All running guests are suspended using virsh managedsave
* shutdown
All running guests are asked to shutdown. Please be careful with this
settings since there is no way to distinguish between a guest which is
stuck or ignores shutdown requests and a guest which just needs a long
time to shutdown. When setting ON_SHUTDOWN=shutdown, you must also set
SHUTDOWN_TIMEOUT to a value suitable for your guests.
- PARALLEL_SHUTDOWN=0
Number of guests will be shutdown concurrently, taking effect when
"ON_SHUTDOWN" is set to "shutdown". If Set to 0, guests will be shutdown one
after another. Number of guests on shutdown at any time will not exceed number
set in this variable.
- SHUTDOWN_TIMEOUT=300
Number of seconds we're willing to wait for a guest to shut down. If parallel
shutdown is enabled, this timeout applies as a timeout for shutting down all
guests on a single URI defined in the variable URIS. If this is 0, then there
is no time out (use with caution, as guests might not respond to a shutdown
request). The default value is 300 seconds (5 minutes).
- BYPASS_CACHE=0
If non-zero, try to bypass the file system cache when saving and
restoring guests, even though this may give slower operation for
some file systems.
- SYNC_TIME=0
If non-zero, try to sync guest time on domain resume. Be aware, that
this requires guest agent with support for time synchronization
running in the guest. By default, this functionality is turned off.
BUGS
====
Please report all bugs you discover. This should be done via either:
#. the mailing list
`https://libvirt.org/contact.html <https://libvirt.org/contact.html>`_
#. the bug tracker
`https://libvirt.org/bugs.html <https://libvirt.org/bugs.html>`_
Alternatively, you may report bugs to your software distributor / vendor.
AUTHORS
=======
Please refer to the AUTHORS file distributed with libvirt.
LICENSE
=======
``libvirt-guests`` is distributed under the terms of the GNU LGPL v2.1+.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE
SEE ALSO
========
libvirtd(8), `https://libvirt.org/ <https://libvirt.org/>`_

View File

@@ -21,6 +21,7 @@ docs_man_files = [
{ 'name': 'virt-qemu-run', 'section': '1', 'install': conf.has('WITH_QEMU') }, { 'name': 'virt-qemu-run', 'section': '1', 'install': conf.has('WITH_QEMU') },
{ 'name': 'virt-xml-validate', 'section': '1', 'install': true }, { 'name': 'virt-xml-validate', 'section': '1', 'install': true },
{ 'name': 'libvirt-guests', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
{ 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, { 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
{ 'name': 'virt-sanlock-cleanup', 'section': '8', 'install': conf.has('WITH_SANLOCK') }, { 'name': 'virt-sanlock-cleanup', 'section': '8', 'install': conf.has('WITH_SANLOCK') },
{ 'name': 'virt-ssh-helper', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, { 'name': 'virt-ssh-helper', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },

View File

@@ -1455,7 +1455,7 @@ create
:: ::
create FILE [--console] [--paused] [--autodestroy] create FILE [--console] [--paused] [--autodestroy]
[--pass-fds N,M,...] [--validate] [--pass-fds N,M,...] [--validate] [--reset-nvram]
Create a domain from an XML <file>. Optionally, *--validate* option can be Create a domain from an XML <file>. Optionally, *--validate* option can be
passed to validate the format of the input XML file against an internal RNG passed to validate the format of the input XML file against an internal RNG
@@ -1478,6 +1478,9 @@ of open file descriptors which should be pass on into the guest. The
file descriptors will be re-numbered in the guest, starting from 3. This file descriptors will be re-numbered in the guest, starting from 3. This
is only supported with container based virtualization. is only supported with container based virtualization.
If *--reset-nvram* is specified, any existing NVRAM file will be deleted
and re-initialized from its pristine template.
**Example:** **Example:**
#. prepare a template from an existing domain (skip directly to 3a if writing #. prepare a template from an existing domain (skip directly to 3a if writing
@@ -1714,13 +1717,16 @@ domdirtyrate-calc
:: ::
domdirtyrate-calc <domain> [--seconds <sec>] domdirtyrate-calc <domain> [--seconds <sec>]
--mode=[page-sampling | dirty-bitmap | dirty-ring]
Calculate an active domain's memory dirty rate which may be expected by Calculate an active domain's memory dirty rate which may be expected by
user in order to decide whether it's proper to be migrated out or not. user in order to decide whether it's proper to be migrated out or not.
The ``seconds`` parameter can be used to calculate dirty rate in a The ``seconds`` parameter can be used to calculate dirty rate in a
specific time which allows 60s at most now and would be default to 1s specific time which allows 60s at most now and would be default to 1s
if missing. The calculated dirty rate information is available by calling if missing. These three *page-sampling, dirty-bitmap, dirty-ring* modes
'domstats --dirtyrate'. are mutually exclusive and alternative when specify calculation mode,
*page-sampling* is the default mode if missing. The calculated dirty
rate information is available by calling 'domstats --dirtyrate'.
domdisplay domdisplay
@@ -2768,11 +2774,14 @@ Note that this command requires a guest agent to be configured and running in
the domain's guest OS. the domain's guest OS.
When run without any arguments, this command prints all information types that When run without any arguments, this command prints all information types that
are supported by the guest agent. You can limit the types of information that are supported by the guest agent at that point, omitting unavailable ones.
are returned by specifying one or more flags. If a requested information Success is always reported in this case.
type is not supported, the processes will provide an exit code of 1.
Available information types flags are *--user*, *--os*, You can limit the types of information that are returned by specifying one or
more flags. Available information types flags are *--user*, *--os*,
*--timezone*, *--hostname*, *--filesystem*, *--disk* and *--interface*. *--timezone*, *--hostname*, *--filesystem*, *--disk* and *--interface*.
If an explicitly requested information type is not supported by the guest agent
at that point, the processes will provide an exit code of 1.
Note that depending on the hypervisor type and the version of the guest agent Note that depending on the hypervisor type and the version of the guest agent
running within the domain, not all of the following information may be running within the domain, not all of the following information may be
@@ -3733,7 +3742,7 @@ restore
:: ::
restore state-file [--bypass-cache] [--xml file] restore state-file [--bypass-cache] [--xml file]
[{--running | --paused}] [{--running | --paused}] [--reset-nvram]
Restores a domain from a ``virsh save`` state file. See *save* for more info. Restores a domain from a ``virsh save`` state file. See *save* for more info.
@@ -3751,6 +3760,9 @@ save image to decide between running or paused; passing either the
*--running* or *--paused* flag will allow overriding which state the *--running* or *--paused* flag will allow overriding which state the
domain should be started in. domain should be started in.
If *--reset-nvram* is specified, any existing NVRAM file will be deleted
and re-initialized from its pristine template.
``Note``: To avoid corrupting file system contents within the domain, you ``Note``: To avoid corrupting file system contents within the domain, you
should not reuse the saved state file for a second ``restore`` unless you should not reuse the saved state file for a second ``restore`` unless you
have also reverted all storage volumes back to the same contents as when have also reverted all storage volumes back to the same contents as when
@@ -4347,7 +4359,7 @@ start
start domain-name-or-uuid [--console] [--paused] start domain-name-or-uuid [--console] [--paused]
[--autodestroy] [--bypass-cache] [--force-boot] [--autodestroy] [--bypass-cache] [--force-boot]
[--pass-fds N,M,...] [--pass-fds N,M,...] [--reset-nvram]
Start a (previously defined) inactive domain, either from the last Start a (previously defined) inactive domain, either from the last
``managedsave`` state, or via a fresh boot if no managedsave state is ``managedsave`` state, or via a fresh boot if no managedsave state is
@@ -4366,6 +4378,9 @@ of open file descriptors which should be pass on into the guest. The
file descriptors will be re-numbered in the guest, starting from 3. This file descriptors will be re-numbered in the guest, starting from 3. This
is only supported with container based virtualization. is only supported with container based virtualization.
If *--reset-nvram* is specified, any existing NVRAM file will be deleted
and re-initialized from its pristine template.
suspend suspend
------- -------
@@ -7349,7 +7364,8 @@ snapshot-revert
:: ::
snapshot-revert domain {snapshot | --current} [{--running | --paused}] [--force] snapshot-revert domain {snapshot | --current} [{--running | --paused}]
[--force] [--reset-nvram]
Revert the given domain to the snapshot specified by *snapshot*, or to Revert the given domain to the snapshot specified by *snapshot*, or to
the current snapshot with *--current*. Be aware the current snapshot with *--current*. Be aware
@@ -7395,6 +7411,9 @@ requires the use of *--force* to proceed:
likely cause extensive filesystem corruption or crashes due to swap content likely cause extensive filesystem corruption or crashes due to swap content
mismatches when run. mismatches when run.
If *--reset-nvram* is specified, any existing NVRAM file will be deleted
and re-initialized from its pristine template.
snapshot-delete snapshot-delete
--------------- ---------------
@@ -7878,7 +7897,8 @@ qemu-monitor-command
:: ::
qemu-monitor-command domain { [--hmp] | [--pretty] [--return-value] } command... qemu-monitor-command domain { [--hmp] | [--pretty] [--return-value] }
[--pass-fds N,M,...] command...
Send an arbitrary monitor command *command* to domain *domain* through the Send an arbitrary monitor command *command* to domain *domain* through the
QEMU monitor. The results of the command will be printed on stdout. QEMU monitor. The results of the command will be printed on stdout.
@@ -7911,6 +7931,9 @@ extracted rather than passing through the full reply from QEMU.
If *--hmp* is passed, the command is considered to be a human monitor command If *--hmp* is passed, the command is considered to be a human monitor command
and libvirt will automatically convert it into QMP and convert the result back. and libvirt will automatically convert it into QMP and convert the result back.
If *--pass-fds* is specified, the argument is a comma separated list
of open file descriptors which should be passed on to qemu along with the
command.
qemu-agent-command qemu-agent-command
------------------ ------------------

View File

@@ -55,7 +55,7 @@ The ``virt-admin`` program understands the following *OPTIONS*.
``-c``, ``--connect`` *URI* ``-c``, ``--connect`` *URI*
Connect to the specified *URI*, as if by the ``connect`` command, Connect to the specified *URI*, as if by the ``connect`` command,
instead of the default connection. instead of the default connection. See `NOTES`_.
``-d``, ``--debug`` *LEVEL* ``-d``, ``--debug`` *LEVEL*
@@ -90,12 +90,15 @@ virt-admin is coming from.
NOTES NOTES
===== =====
Running ``virt-admin`` requires root privileges due to the The ``virt-admin`` supports both the monolithic ``libvirtd`` daemon and the
communications channels used to talk to the daemon. Consider changing the `modular daemons <https://www.libvirt.org/daemons.html#modular-driver-daemons>`__
*unix_sock_group* ownership setting to grant access to specific set of users whichever is in use by your system. The connection *URI* used with
or modifying *unix_sock_rw_perms* permissions. Daemon configuration file ``-c/--connect`` or the `connect`_ command is based on the name of the
provides more information about setting permissions. controlled daemon e.g.: ``virtqemud:///system``, ``libvirtd:///system``.
Running ``virt-admin`` requires root privileges when communicating with the
system instance of a daemon (*URI* ending in ``/system``) due to the
communications channels used to talk to the daemon.
GENERIC COMMANDS GENERIC COMMANDS
================ ================
@@ -198,6 +201,8 @@ If *LIBVIRT_ADMIN_DEFAULT_URI* or *uri_default* (see below) were set,
active connection is executed. Note that this only applies if there is no active connection is executed. Note that this only applies if there is no
connection at all or there is an inactive one. connection at all or there is an inactive one.
See `NOTES`_ on picking the correct *URI* corresponding to a libvirt daemon.
To find the currently used URI, check the *uri* command documented below. To find the currently used URI, check the *uri* command documented below.

View File

@@ -19,16 +19,10 @@ docs_assets = [
docs_html_in_files = [ docs_html_in_files = [
'404', '404',
'bugs',
'cgroups', 'cgroups',
'contact',
'contribute',
'csharp', 'csharp',
'dbus', 'dbus',
'devguide',
'docs', 'docs',
'downloads',
'drivers',
'drvbhyve', 'drvbhyve',
'drvesx', 'drvesx',
'drvhyperv', 'drvhyperv',
@@ -42,77 +36,81 @@ docs_html_in_files = [
'drvvirtuozzo', 'drvvirtuozzo',
'drvvmware', 'drvvmware',
'drvxen', 'drvxen',
'errors',
'firewall', 'firewall',
'format',
'formatcaps', 'formatcaps',
'formatdomaincaps', 'formatdomaincaps',
'format',
'formatnetwork', 'formatnetwork',
'formatnetworkport', 'formatnetworkport',
'formatnode', 'formatnode',
'formatnwfilter', 'formatnwfilter',
'formatsecret',
'formatsnapshot',
'formatstoragecaps', 'formatstoragecaps',
'formatstorageencryption', 'formatstorageencryption',
'goals',
'governance',
'hooks', 'hooks',
'index', 'index',
'internals', 'internals',
'java', 'java',
'logging', 'logging',
'nss',
'pci-hotplug',
'php', 'php',
'python', 'python',
'remote', 'remote',
'securityprocess',
'storage', 'storage',
'strategy',
'support',
'testapi',
'testsuites',
'testtck',
'tlscerts', 'tlscerts',
'uri', 'uri',
'virshcmdref',
'windows', 'windows',
] ]
docs_rst_files = [ docs_rst_files = [
'aclpolkit', 'aclpolkit',
'advanced-tests', 'advanced-tests',
'api_extension',
'api', 'api',
'api_extension',
'apps', 'apps',
'auditlog', 'auditlog',
'auth', 'auth',
'bindings',
'best-practices', 'best-practices',
'bindings',
'bugs',
'ci', 'ci',
'coding-style', 'coding-style',
'committer-guidelines', 'committer-guidelines',
'compiling', 'compiling',
'contact',
'contribute',
'daemons', 'daemons',
'developer-tooling', 'downloads',
'drvqemu', 'drivers',
'drvch', 'drvch',
'drvqemu',
'errors',
'formatbackup', 'formatbackup',
'formatcheckpoint', 'formatcheckpoint',
'formatdomain', 'formatdomain',
'formatsecret',
'formatsnapshot',
'formatstorage', 'formatstorage',
'glib-adoption', 'glib-adoption',
'goals',
'governance',
'hacking', 'hacking',
'libvirt-go', 'libvirt-go',
'libvirt-go-xml', 'libvirt-go-xml',
'macos',
'migration', 'migration',
'newreposetup', 'newreposetup',
'nss',
'pci-addresses', 'pci-addresses',
'pci-hotplug',
'platforms', 'platforms',
'programming-languages', 'programming-languages',
'securityprocess',
'strategy',
'styleguide', 'styleguide',
'submitting-patches', 'submitting-patches',
'support',
'testapi',
'testsuites',
'testtck',
] ]
# list of web targets to build for docs/web rule # list of web targets to build for docs/web rule
@@ -132,7 +130,7 @@ aclperms_gen = custom_target(
) )
docs_timestamp = run_command( docs_timestamp = run_command(
python3_prog, meson_timestamp_prog.path(), env: runutf8 python3_prog, meson_timestamp_prog.path(), env: runutf8, check: true,
).stdout().strip() ).stdout().strip()
site_xsl = files('site.xsl') site_xsl = files('site.xsl')
@@ -171,6 +169,47 @@ docs_lxc_api_xml = docs_api_generated[1]
docs_qemu_api_xml = docs_api_generated[2] docs_qemu_api_xml = docs_api_generated[2]
docs_admin_api_xml = docs_api_generated[3] docs_admin_api_xml = docs_api_generated[3]
docs_programs_groups = [
{ 'name': 'rst2html5', 'prog': [ 'rst2html5', 'rst2html5.py', 'rst2html5-3' ] },
{ 'name': 'rst2man', 'prog': [ 'rst2man', 'rst2man.py', 'rst2man-3' ] },
]
foreach item : docs_programs_groups
prog = find_program(item.get('prog'), dirs: libvirt_sbin_path)
varname = item.get('name').underscorify()
conf.set_quoted(varname.to_upper(), prog.path())
set_variable('@0@_prog'.format(varname), prog)
endforeach
# There are two versions of rst2html5 in the wild: one is the version
# coming from the docutils package, and the other is the one coming
# from the rst2html5 package. These versions are subtly different,
# and the libvirt documentation can only be successfully generated
# using the docutils version. Every now and then, users will report
# build failures that can be traced back to having the wrong version
# installed.
#
# The only reliable way to tell the two binaries apart seems to be
# looking look at their version information: the docutils version
# will report
#
# rst2html5 (Docutils ..., Python ..., on ...)
#
# whereas the rst2html5 version will report
#
# rst2html5 ... (Docutils ..., Python ..., on ...)
#
# with the additional bit of information being the version number for
# the rst2html5 package itself.
#
# Use this knowledge to detect the version that we know doesn't work
# for building libvirt and reject it
rst2html5_version = run_command(rst2html5_prog, '--version', check: true)
rst2html5_version = rst2html5_version.stdout().split(' ')
if rst2html5_version[1] != '(Docutils'
error('Please uninstall the rst2html5 package and install the docutils package')
endif
docs_rst2html5_gen = generator( docs_rst2html5_gen = generator(
rst2html5_prog, rst2html5_prog,
output: '@BASENAME@.html.in', output: '@BASENAME@.html.in',
@@ -294,8 +333,6 @@ subdir('js')
subdir('kbase') subdir('kbase')
subdir('logos') subdir('logos')
subdir('manpages') subdir('manpages')
subdir('schemas')
foreach file : docs_assets foreach file : docs_assets
# This hack enables us to view the web pages # This hack enables us to view the web pages

View File

@@ -1,189 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Libvirt NSS module</h1>
<ul id="toc"></ul>
<p>
When it comes to managing guests and executing commands inside them, logging
into guest operating system and doing the job is convenient. Users are used
to ssh in this case. Ideally:
</p>
<code>ssh user@virtualMachine</code>
<p>
would be nice. But depending on virtual network configuration it might not
be always possible. For instance, when using libvirt NATed network it's
dnsmasq (spawned by libvirt) who assigns IP addresses to domains. But by
default, the dnsmasq process is then not consulted when it comes to host
name translation. Users work around this problem by configuring their
libvirt network to assign static IP addresses and maintaining
<code>/etc/hosts</code> file in sync. But this puts needless burden onto
users. This is where NSS module comes handy.
</p>
<h2><a id="Installation">Installation</a></h2>
<p>
Installing the module is really easy:
</p>
<pre>
# yum install libvirt-nss
</pre>
<h2><a id="Configuration">Configuration</a></h2>
<p>
Enabling the module is really easy. Just add <b>libvirt</b> into
<code>/etc/nsswitch.conf</code> file. For instance:
</p>
<pre>
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf:
passwd: compat
shadow: compat
group: compat
hosts: files libvirt dns
# ...
</pre>
<p>
So, in this specific case, whenever ssh program is looking up the host user
is trying to connect to, <b>files</b> module is consulted first (which
boils down to looking up the host name in <code>/etc/hosts</code> file), if
not found <b>libvirt</b> module is consulted then. The DNS is the last
effort then, if none of the previous modules matched the host in question.
Therefore users should consider the order in which they want the modules to
lookup given host name.
</p>
<h2><a id="Sources">Sources of information</a></h2>
<p>
As of <code>v3.0.0</code> release, libvirt offers two NSS modules
implementing two different methods of hostname translation. The first and
older method is implemented by <code>libvirt</code> plugin and
basically looks up the hostname to IP address translation in DHCP server
records. Therefore this is dependent on hostname provided by guests. Thing
is, not all the guests out there provide one in DHCP transactions, or not
every sysadmin out there believes all the guests. Hence libvirt implements
second method in <code>libvirt_guest</code> module which does libvirt guest
name to IP address translation (regardless of hostname set in the guest).
</p>
<p>
To enable either of the modules put their name into the
<code>nsswitch.conf</code> file. For instance, to enable
<code>libvirt_guest</code> module:
</p>
<pre>
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf:
hosts: files libvirt_guest dns
# ...
</pre>
<p>Or users can enable both at the same time:</p>
<pre>
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf:
hosts: files libvirt libvirt_guest dns
# ...
</pre>
<p>
This configuration will mean that if hostname is not found by the
<code>libvirt</code> module (e.g. because a guest did not sent hostname
during DHCP transaction), the <code>libvirt_guest</code> module is
consulted (and if the hostname matches libvirt guest name it will be
resolved).
</p>
<h2><a id="Internals">How does it work?</a></h2>
<p>
Whenever an Unix process wants to do a host name translation
<a href="https://linux.die.net/man/3/gethostbyname"><code>gethostbyname()</code></a>
or some variant of it is called. This is a glibc function that takes a
string containing the host name, crunch it and produces a list of IP
addresses assigned to that host. Now, glibc developers made a really good
decision when implementing the internals of the function when they decided
to make the function pluggable. Since there can be several sources for the
records (e.g. <code>/etc/hosts</code> file, DNS, LDAP, etc.) it would not
make much sense to create one big implementation containing all possible
cases. What they have done instead is this pluggable mechanism. Small
plugins implementing nothing but specific technology for lookup process are
provided and the function then calls those plugins. There is just one
configuration file that instructs the lookup function in which order should
the plugins be called and which plugins should be loaded. For more info
reading <a href="https://en.wikipedia.org/wiki/Name_Service_Switch">wiki
page</a> is recommended.
</p>
<p>
And this is point where libvirt comes in. Libvirt provides plugin for the
NSS ecosystem. For some time now libvirt keeps a list of assigned IP
addresses for libvirt networks. The NSS plugin does no more than search the
list trying to find matching record for given host name. When found,
matching IP address is returned to the caller. If not found, translation
process continues with the next plugin configured. At this point it is
important to stress the order in which plugins are called. Users should be
aware that a hostname might match in multiple plugins and right after first
match, translation process is terminated and no other plugin is consulted.
Therefore, if there are two different records for the same host name users
should carefully chose the lookup order.
</p>
<h2><a id="Limitations">Limitations</a></h2>
<ol>
<li>The <code>libvirt</code> NSS module matches only hostnames provided by guest.
If the libvirt name and one advertised by guest differs, the latter is
matched. However, as of <code>v3.0.0</code> there are two libvirt NSS modules
translating both hostnames provided by guest and libvirt guest names.</li>
<li>The module works only in that cases where IP addresses are assigned by
dnsmasq spawned by libvirt. Libvirt NATed networks are typical
example.</li>
</ol>
<p>
<i>The following paragraph describes implementation limitation of the
<code>libvirt</code> NSS module.</i>
These limitation are result of libvirt's internal implementation. While
libvirt can report IP addresses regardless of their origin, a public API
must be used to obtain those. However, for the API a connection object is
required. Doing that for every name translation request would be too
costly. Fortunately, libvirt spawns dnsmasq for NATed networks. Not only
that, it provides small executable that on each IP address space change
updates an internal list of addresses thus keeping it in sync. The NSS
module then merely consults the list trying to find the match. Users can
view the list themselves:
</p>
<pre>
virsh net-dhcp-leases $network
</pre>
<p>
where <code>$network</code> iterates through all running networks. So the module
does merely the same as
</p>
<pre>
virsh domifaddr --source lease $domain
</pre>
<p>
If there's no record for either of the aforementioned commands, it's
very likely that NSS module won't find anything and vice versa.
As of <code>v3.0.0</code> libvirt provides <code>libvirt_guest</code> NSS
module that doesn't have this limitation. However, the statement is still
true for the <code>libvirt</code> NSS module.
</p>
</body>
</html>

154
docs/nss.rst Normal file
View File

@@ -0,0 +1,154 @@
==================
Libvirt NSS module
==================
.. contents::
When it comes to managing guests and executing commands inside them, logging
into guest operating system and doing the job is convenient. Users are used to
ssh in this case. Ideally:
``ssh user@virtualMachine``
would be nice. But depending on virtual network configuration it might not be
always possible. For instance, when using libvirt NATed network it's dnsmasq
(spawned by libvirt) who assigns IP addresses to domains. But by default, the
dnsmasq process is then not consulted when it comes to host name translation.
Users work around this problem by configuring their libvirt network to assign
static IP addresses and maintaining ``/etc/hosts`` file in sync. But this puts
needless burden onto users. This is where NSS module comes handy.
Installation
------------
Installing the module is really easy:
::
# yum install libvirt-nss
Configuration
-------------
Enabling the module is really easy. Just add **libvirt** into
``/etc/nsswitch.conf`` file. For instance:
::
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf:
passwd: compat
shadow: compat
group: compat
hosts: files libvirt dns
# ...
So, in this specific case, whenever ssh program is looking up the host user is
trying to connect to, **files** module is consulted first (which boils down to
looking up the host name in ``/etc/hosts`` file), if not found **libvirt**
module is consulted then. The DNS is the last effort then, if none of the
previous modules matched the host in question. Therefore users should consider
the order in which they want the modules to lookup given host name.
Sources of information
----------------------
As of ``v3.0.0`` release, libvirt offers two NSS modules implementing two
different methods of hostname translation. The first and older method is
implemented by ``libvirt`` plugin and basically looks up the hostname to IP
address translation in DHCP server records. Therefore this is dependent on
hostname provided by guests. Thing is, not all the guests out there provide one
in DHCP transactions, or not every sysadmin out there believes all the guests.
Hence libvirt implements second method in ``libvirt_guest`` module which does
libvirt guest name to IP address translation (regardless of hostname set in the
guest).
To enable either of the modules put their name into the ``nsswitch.conf`` file.
For instance, to enable ``libvirt_guest`` module:
::
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf:
hosts: files libvirt_guest dns
# ...
Or users can enable both at the same time:
::
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf:
hosts: files libvirt libvirt_guest dns
# ...
This configuration will mean that if hostname is not found by the ``libvirt``
module (e.g. because a guest did not sent hostname during DHCP transaction), the
``libvirt_guest`` module is consulted (and if the hostname matches libvirt guest
name it will be resolved).
How does it work?
-----------------
Whenever an Unix process wants to do a host name translation
`gethostbyname() <https://linux.die.net/man/3/gethostbyname>`__ or some variant
of it is called. This is a glibc function that takes a string containing the
host name, crunch it and produces a list of IP addresses assigned to that host.
Now, glibc developers made a really good decision when implementing the
internals of the function when they decided to make the function pluggable.
Since there can be several sources for the records (e.g. ``/etc/hosts`` file,
DNS, LDAP, etc.) it would not make much sense to create one big implementation
containing all possible cases. What they have done instead is this pluggable
mechanism. Small plugins implementing nothing but specific technology for lookup
process are provided and the function then calls those plugins. There is just
one configuration file that instructs the lookup function in which order should
the plugins be called and which plugins should be loaded. For more info reading
`wiki page <https://en.wikipedia.org/wiki/Name_Service_Switch>`__ is
recommended.
And this is point where libvirt comes in. Libvirt provides plugin for the NSS
ecosystem. For some time now libvirt keeps a list of assigned IP addresses for
libvirt networks. The NSS plugin does no more than search the list trying to
find matching record for given host name. When found, matching IP address is
returned to the caller. If not found, translation process continues with the
next plugin configured. At this point it is important to stress the order in
which plugins are called. Users should be aware that a hostname might match in
multiple plugins and right after first match, translation process is terminated
and no other plugin is consulted. Therefore, if there are two different records
for the same host name users should carefully chose the lookup order.
Limitations
-----------
#. The ``libvirt`` NSS module matches only hostnames provided by guest. If the
libvirt name and one advertised by guest differs, the latter is matched.
However, as of ``v3.0.0`` there are two libvirt NSS modules translating both
hostnames provided by guest and libvirt guest names.
#. The module works only in that cases where IP addresses are assigned by
dnsmasq spawned by libvirt. Libvirt NATed networks are typical example.
*The following paragraph describes implementation limitation of the ``libvirt``
NSS module.* These limitation are result of libvirt's internal implementation.
While libvirt can report IP addresses regardless of their origin, a public API
must be used to obtain those. However, for the API a connection object is
required. Doing that for every name translation request would be too costly.
Fortunately, libvirt spawns dnsmasq for NATed networks. Not only that, it
provides small executable that on each IP address space change updates an
internal list of addresses thus keeping it in sync. The NSS module then merely
consults the list trying to find the match. Users can view the list themselves:
::
virsh net-dhcp-leases $network
where ``$network`` iterates through all running networks. So the module does
merely the same as
::
virsh domifaddr --source lease $domain
If there's no record for either of the aforementioned commands, it's very likely
that NSS module won't find anything and vice versa. As of ``v3.0.0`` libvirt
provides ``libvirt_guest`` NSS module that doesn't have this limitation.
However, the statement is still true for the ``libvirt`` NSS module.

View File

@@ -187,7 +187,7 @@
</div> </div>
</xsl:if> </xsl:if>
<div id="conduct"> <div id="conduct">
Participants in the libvirt project agree to abide by <a href="{$href_base}governance.html#codeofconduct">the project code of conduct</a> Participants in the libvirt project agree to abide by <a href="{$href_base}governance.html#code-of-conduct">the project code of conduct</a>
</div> </div>
<br class="clear"/> <br class="clear"/>
</div> </div>
@@ -215,11 +215,11 @@
</xsl:element> </xsl:element>
</xsl:template> </xsl:template>
<xsl:template match="text()" mode="copy"> <xsl:template match="text()" mode="copy" priority="0">
<xsl:value-of select="."/> <xsl:value-of select="."/>
</xsl:template> </xsl:template>
<xsl:template match="node()" mode="copy"> <xsl:template match="*" mode="copy">
<xsl:element name="{name()}"> <xsl:element name="{name()}">
<xsl:copy-of select="./@*"/> <xsl:copy-of select="./@*"/>
<xsl:apply-templates mode="copy" /> <xsl:apply-templates mode="copy" />

View File

@@ -1,185 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>PCI topology and hotplug</h1>
<ul id="toc"></ul>
<p>
Perhaps surprisingly, most libvirt guests support only limited PCI
device hotplug out of the box, or even none at all.
</p>
<p>
The reason for this apparent limitation is the fact that each
hotplugged PCI device might require additional PCI controllers to
be added to the guest. Since most PCI controllers can't be
hotplugged, they need to be added before the guest is started;
however, libvirt has no way of knowing in advance how many devices
will be hotplugged during the guest's lifetime, thus making it
impossible to automatically provide the right amount of PCI
controllers: any arbitrary number would end up being too big
for some users, and too small for others.
</p>
<p>
Ultimately, the user is the only one who knows how much the guest
will need to grow dynamically, so the responsibility of planning
a suitable PCI topology in advance falls on them.
</p>
<p>
This document aims at providing all the information needed to
successfully plan the PCI topology of a guest. Note that the
details can vary a lot between architectures and even machine
types, hence the way it's organized.
</p>
<h2><a id="x86_64">x86_64 architecture</a></h2>
<h3><a id="x86_64-q35">q35 machine type</a></h3>
<p>
This is a PCI Express native machine type. The default PCI topology
looks like
</p>
<pre>
&lt;controller type='pci' index='0' model='pcie-root'/&gt;
&lt;controller type='pci' index='1' model='pcie-root-port'&gt;
&lt;model name='pcie-root-port'/&gt;
&lt;target chassis='1' port='0x10'/&gt;
&lt;address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/&gt;
&lt;/controller&gt;</pre>
<p>
and supports hotplugging a single PCI Express device, either
emulated or assigned from the host.
</p>
<p>
If you have a very specific use case, such as the appliances
used by <a href="https://libguestfs.org/">libguestfs</a> behind
the scenes to access disk images, and this automatically-added
<code>pcie-root-port</code> controller ends up being a nuisance,
you can prevent libvirt from adding it by manually managing PCI
controllers and addresses according to your needs.
</p>
<p>
Slots on the <code>pcie-root</code> controller do not support
hotplug, so the device will be hotplugged into the
<code>pcie-root-port</code> controller. If you plan to hotplug
more than a single PCI Express device, you should add a suitable
number of <code>pcie-root-port</code> controllers when defining
the guest: for example, add
</p>
<pre>
&lt;controller type='pci' model='pcie-root'/&gt;
&lt;controller type='pci' model='pcie-root-port'/&gt;
&lt;controller type='pci' model='pcie-root-port'/&gt;
&lt;controller type='pci' model='pcie-root-port'/&gt;</pre>
<p>
if you expect to hotplug up to three PCI Express devices,
either emulated or assigned from the host. That's all the
information you need to provide: libvirt will fill in the
remaining details automatically. Note that you need to add
the <code>pcie-root</code> controller along with the
<code>pcie-root-port</code> controllers or you will get an
error.
</p>
<p>
Note that if you're adding PCI controllers to a guest and at
the same time you're also adding PCI devices, some of the
controllers will be used for the newly-added devices and won't
be available for hotplug once the guest has been started.
</p>
<p>
If you expect to hotplug legacy PCI devices, then you will need
specialized controllers, since all those mentioned above are
intended for PCI Express devices only: add
</p>
<pre>
&lt;controller type='pci' model='pcie-to-pci-bridge'/&gt;</pre>
<p>
and you'll be able to hotplug up to 31 legacy PCI devices,
either emulated or assigned from the host, in the slots
from 0x01 to 0x1f of the <code>pcie-to-pci-bridge</code> controller.
</p>
<h3><a id="x86_64-i440fx">i440fx (pc) machine type</a></h3>
<p>
This is a legacy PCI native machine type. The default PCI
topology looks like
</p>
<pre>
&lt;controller type='pci' index='0' model='pci-root'/&gt;</pre>
<p>
where each of the 31 slots (from 0x01 to 0x1f) on the
<code>pci-root</code> controller is hotplug capable and
can accept a legacy PCI device, either emulated or
assigned from the guest.
</p>
<h2><a id="ppc64">ppc64 architecture</a></h2>
<h3><a id="ppc64-pseries">pseries machine type</a></h3>
<p>
The default PCI topology for the <code>pseries</code> machine
type looks like
</p>
<pre>
&lt;controller type='pci' index='0' model='pci-root'&gt;
&lt;model name='spapr-pci-host-bridge'/&gt;
&lt;target index='0'/&gt;
&lt;/controller&gt;</pre>
<p>
The 31 slots, from 0x01 to 0x1f, on a <code>pci-root</code>
controller are all hotplug capable and, despite the name
suggesting otherwise, starting with QEMU 2.9 all of them
can accept PCI Express devices in addition to legacy PCI
devices; however, libvirt will only place emulated devices
on the default <code>pci-root</code> controller.
</p>
<p>
In order to take advantage of improved error reporting and
recovering capabilities, PCI devices assigned from the
host need to be isolated by placing each on a separate
<code>pci-root</code> controller, which has to be prepared
in advance for hotplug to work: for example, add
</p>
<pre>
&lt;controller type='pci' model='pci-root'/&gt;
&lt;controller type='pci' model='pci-root'/&gt;
&lt;controller type='pci' model='pci-root'/&gt;</pre>
<p>
if you expect to hotplug up to three PCI devices assigned
from the host.
</p>
<h2><a id="aarch64">aarch64 architecture</a></h2>
<h3><a id="aarch64-virt">mach-virt (virt) machine type</a></h3>
<p>
This machine type mostly behaves the same as the
<a href="#x86_64-q35">q35 machine type</a>, so you can just
refer to that section for information.
</p>
<p>
The only difference worth mentioning is that using legacy
PCI for <code>mach-virt</code> guests is extremely uncommon,
so you'll probably never need to add controllers other than
<code>pcie-root-port</code>.
</p>
</body>
</html>

146
docs/pci-hotplug.rst Normal file
View File

@@ -0,0 +1,146 @@
========================
PCI topology and hotplug
========================
.. contents::
Perhaps surprisingly, most libvirt guests support only limited PCI device
hotplug out of the box, or even none at all.
The reason for this apparent limitation is the fact that each hotplugged PCI
device might require additional PCI controllers to be added to the guest. Since
most PCI controllers can't be hotplugged, they need to be added before the guest
is started; however, libvirt has no way of knowing in advance how many devices
will be hotplugged during the guest's lifetime, thus making it impossible to
automatically provide the right amount of PCI controllers: any arbitrary number
would end up being too big for some users, and too small for others.
Ultimately, the user is the only one who knows how much the guest will need to
grow dynamically, so the responsibility of planning a suitable PCI topology in
advance falls on them.
This document aims at providing all the information needed to successfully plan
the PCI topology of a guest. Note that the details can vary a lot between
architectures and even machine types, hence the way it's organized.
x86_64 architecture
-------------------
q35 machine type
~~~~~~~~~~~~~~~~
This is a PCI Express native machine type. The default PCI topology looks like
::
<controller type='pci' index='0' model='pcie-root'/>
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='1' port='0x10'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</controller>
and supports hotplugging a single PCI Express device, either emulated or
assigned from the host.
If you have a very specific use case, such as the appliances used by
`libguestfs <https://libguestfs.org/>`__ behind the scenes to access disk
images, and this automatically-added ``pcie-root-port`` controller ends up being
a nuisance, you can prevent libvirt from adding it by manually managing PCI
controllers and addresses according to your needs.
Slots on the ``pcie-root`` controller do not support hotplug, so the device will
be hotplugged into the ``pcie-root-port`` controller. If you plan to hotplug
more than a single PCI Express device, you should add a suitable number of
``pcie-root-port`` controllers when defining the guest: for example, add
::
<controller type='pci' model='pcie-root'/>
<controller type='pci' model='pcie-root-port'/>
<controller type='pci' model='pcie-root-port'/>
<controller type='pci' model='pcie-root-port'/>
if you expect to hotplug up to three PCI Express devices, either emulated or
assigned from the host. That's all the information you need to provide: libvirt
will fill in the remaining details automatically. Note that you need to add the
``pcie-root`` controller along with the ``pcie-root-port`` controllers or you
will get an error.
Note that if you're adding PCI controllers to a guest and at the same time
you're also adding PCI devices, some of the controllers will be used for the
newly-added devices and won't be available for hotplug once the guest has been
started.
If you expect to hotplug legacy PCI devices, then you will need specialized
controllers, since all those mentioned above are intended for PCI Express
devices only: add
::
<controller type='pci' model='pcie-to-pci-bridge'/>
and you'll be able to hotplug up to 31 legacy PCI devices, either emulated or
assigned from the host, in the slots from 0x01 to 0x1f of the
``pcie-to-pci-bridge`` controller.
i440fx (pc) machine type
~~~~~~~~~~~~~~~~~~~~~~~~
This is a legacy PCI native machine type. The default PCI topology looks like
::
<controller type='pci' index='0' model='pci-root'/>
where each of the 31 slots (from 0x01 to 0x1f) on the ``pci-root`` controller is
hotplug capable and can accept a legacy PCI device, either emulated or assigned
from the guest.
ppc64 architecture
------------------
pseries machine type
~~~~~~~~~~~~~~~~~~~~
The default PCI topology for the ``pseries`` machine type looks like
::
<controller type='pci' index='0' model='pci-root'>
<model name='spapr-pci-host-bridge'/>
<target index='0'/>
</controller>
The 31 slots, from 0x01 to 0x1f, on a ``pci-root`` controller are all hotplug
capable and, despite the name suggesting otherwise, starting with QEMU 2.9 all
of them can accept PCI Express devices in addition to legacy PCI devices;
however, libvirt will only place emulated devices on the default ``pci-root``
controller.
In order to take advantage of improved error reporting and recovering
capabilities, PCI devices assigned from the host need to be isolated by placing
each on a separate ``pci-root`` controller, which has to be prepared in advance
for hotplug to work: for example, add
::
<controller type='pci' model='pci-root'/>
<controller type='pci' model='pci-root'/>
<controller type='pci' model='pci-root'/>
if you expect to hotplug up to three PCI devices assigned from the host.
aarch64 architecture
--------------------
mach-virt (virt) machine type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This machine type mostly behaves the same as the `q35 machine
type <#q35-machine-type>`__, so you can just refer to that section for
information.
The only difference worth mentioning is that using legacy PCI for ``mach-virt``
guests is extremely uncommon, so you'll probably never need to add controllers
other than ``pcie-root-port``.

View File

@@ -42,8 +42,10 @@ The project aims to support the most recent major version at all times. Support
for the previous major version will be dropped 2 years after the new major for the previous major version will be dropped 2 years after the new major
version is released or when the vendor itself drops support, whichever comes version is released or when the vendor itself drops support, whichever comes
first. In this context, third-party efforts to extend the lifetime of a distro first. In this context, third-party efforts to extend the lifetime of a distro
are not considered, even when they are endorsed by the vendor (eg. Debian LTS). are not considered, even when they are endorsed by the vendor (e.g. Debian
Within each major release, only the most recent minor release is considered. LTS); the same is true of repositories that contain packages backported from
later releases (e.g. Debian backports). Within each major release, only the
most recent minor release is considered.
For the purposes of identifying supported software versions available on Linux, For the purposes of identifying supported software versions available on Linux,
the project will look at CentOS, Debian, Fedora, openSUSE, RHEL, SLES and the project will look at CentOS, Debian, Fedora, openSUSE, RHEL, SLES and

View File

@@ -138,9 +138,9 @@ Blank lines and comments beginning with <code>#</code> are ignored.
<td> 1 (on) </td> <td> 1 (on) </td>
<td> <td>
Listen for secure TLS connections on the public TCP/IP port. Listen for secure TLS connections on the public TCP/IP port.
Note: it is also necessary to start the server in listening mode by Note: it is also necessary to start the server in listening mode
running it with --listen or editing /etc/sysconfig/libvirtd by uncommenting the LIBVIRTD_ARGS="--listen" line by running it with --listen or adding a LIBVIRTD_ARGS="--listen"
to cause the server to come up in listening mode whenever it is started. line to /etc/sysconfig/libvirtd.
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@@ -1,119 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Security Process</h1>
<ul id="toc"></ul>
<p>
The libvirt project believes in responsible disclosure of
security problems, to allow vendors time to prepare and
distribute patches for problems ahead of their publication.
This page describes how the process works and how to report
potential security issues.
</p>
<h2><a id="reporting">Reporting security issues</a></h2>
<p>
In the event that a bug in libvirt is found which is
believed to have (potential) security implications there
is a dedicated contact to which a bug report / notification
should be directed. Send an email with as many details of
the problem as possible (ideally with steps to reproduce)
to the following email address:
</p>
<pre>
<a href="mailto:libvirt-security@redhat.com">libvirt-security@redhat.com</a></pre>
<p>
NB. while this email address is backed by a mailing list, it
is invitation only and moderated for non-members. As such you
will receive an auto-reply indicating the report is held for
moderation. Postings by non-members will be approved by a
moderator and the reporter copied on any replies.
</p>
<h2><a id="secnotice">Security notices</a></h2>
<p>
Information for all historical security issues is maintained in
machine parsable format in the
<a href="https://gitlab.com/libvirt/libvirt-security-notice">libvirt-security-notice GIT repository</a> and
<a href="https://security.libvirt.org">published online</a>
in text, HTML and XML formats. Security notices are published
on the <a href="https://libvirt.org/contact.html#email">libvirt-announce mailing list</a>
when any embargo is lifted, or as soon as triaged if already
public knowledge.
</p>
<h2><a id="seclist">Security team</a></h2>
<p>
The libvirt security team is made up of a subset of the libvirt
core development team which covers the various distro maintainers
of libvirt, along with nominated security engineers representing
the various vendors who distribute libvirt. The team is responsible
for analysing incoming reports from users to identify whether a
security problem exists and its severity. It then works to produce
a fix for all official stable branches of libvirt and coordinate
embargo dates between vendors to allow simultaneous release of the
fix by all affected parties.
</p>
<p>
If you are a security representative of a vendor distributing
libvirt and would like to join the security team, send an email
to the afore-mentioned security address. Typically an existing
member of the security team will have to vouch for your credentials
before membership is approved. All members of the security team
are <strong>required to respect the embargo policy</strong>
described below.
</p>
<h2><a id="embargo">Publication embargo policy</a></h2>
<p>
The libvirt security team operates a policy of
<a href="https://en.wikipedia.org/wiki/Responsible_disclosure">responsible disclosure</a>.
As such any security issue reported, that is not already publicly disclosed
elsewhere, will have an embargo date assigned. Members of the security team agree
not to publicly disclose any details of the security issue until the embargo
date expires.
</p>
<p>
The general aim of the team is to have embargo dates which
are two weeks or less in duration. If a problem is identified
with a proposed patch for a security issue, requiring further
investigation and bug fixing, the embargo clock may be restarted.
In exceptional circumstances longer initial embargoes may be
negotiated by mutual agreement between members of the security
team and other relevant parties to the problem. Any such extended
embargoes will aim to be at most one month in duration.
</p>
<h2><a id="cve">CVE allocation</a></h2>
<p>
The libvirt security team will associate each security issue with
a CVE number. The CVE numbers will usually be allocated by one of
the vendor security engineers on the security team.
</p>
<h2><a id="branches">Branch fixing policy</a></h2>
<p>
The libvirt community maintains one or more stable release branches
at any given point in time. The security team will aim to publish
fixes for GIT master (which will become the next major release) and
each currently maintained stable release branch. The distro maintainers
will be responsible for backporting the officially published fixes to
other release branches where applicable.
</p>
</body>
</html>

89
docs/securityprocess.rst Normal file
View File

@@ -0,0 +1,89 @@
================
Security Process
================
.. contents::
The libvirt project believes in responsible disclosure of security problems, to
allow vendors time to prepare and distribute patches for problems ahead of their
publication. This page describes how the process works and how to report
potential security issues.
Reporting security issues
-------------------------
In the event that a bug in libvirt is found which is believed to have
(potential) security implications there is a dedicated contact to which a bug
report / notification should be directed. Send an email with as many details of
the problem as possible (ideally with steps to reproduce) to the following email
address:
::
libvirt-security@redhat.com
NB. while this email address is backed by a mailing list, it is invitation only
and moderated for non-members. As such you will receive an auto-reply indicating
the report is held for moderation. Postings by non-members will be approved by a
moderator and the reporter copied on any replies.
Security notices
----------------
Information for all historical security issues is maintained in machine parsable
format in the `libvirt-security-notice GIT
repository <https://gitlab.com/libvirt/libvirt-security-notice>`__ and
`published online <https://security.libvirt.org>`__ in text, HTML and XML
formats. Security notices are published on the `libvirt-announce mailing
list <https://libvirt.org/contact.html#email>`__ when any embargo is lifted, or
as soon as triaged if already public knowledge.
Security team
-------------
The libvirt security team is made up of a subset of the libvirt core development
team which covers the various distro maintainers of libvirt, along with
nominated security engineers representing the various vendors who distribute
libvirt. The team is responsible for analysing incoming reports from users to
identify whether a security problem exists and its severity. It then works to
produce a fix for all official stable branches of libvirt and coordinate embargo
dates between vendors to allow simultaneous release of the fix by all affected
parties.
If you are a security representative of a vendor distributing libvirt and would
like to join the security team, send an email to the afore-mentioned security
address. Typically an existing member of the security team will have to vouch
for your credentials before membership is approved. All members of the security
team are **required to respect the embargo policy** described below.
Publication embargo policy
--------------------------
The libvirt security team operates a policy of `responsible
disclosure <https://en.wikipedia.org/wiki/Responsible_disclosure>`__. As such
any security issue reported, that is not already publicly disclosed elsewhere,
will have an embargo date assigned. Members of the security team agree not to
publicly disclose any details of the security issue until the embargo date
expires.
The general aim of the team is to have embargo dates which are two weeks or less
in duration. If a problem is identified with a proposed patch for a security
issue, requiring further investigation and bug fixing, the embargo clock may be
restarted. In exceptional circumstances longer initial embargoes may be
negotiated by mutual agreement between members of the security team and other
relevant parties to the problem. Any such extended embargoes will aim to be at
most one month in duration.
CVE allocation
--------------
The libvirt security team will associate each security issue with a CVE number.
The CVE numbers will usually be allocated by one of the vendor security
engineers on the security team.
Branch fixing policy
--------------------
The security team will publish fixes for GIT master (which will become the next
major release). The distro maintainers will be responsible for backporting the
officially published fixes to other release branches where applicable.

View File

@@ -1,133 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Project Strategy</h1>
<p>
This document attempts to outline the libvirt project strategy for
the near future. Think of this as a high level vision or to-do list
setting the direction for the project and its developers to take.
</p>
<h2>Language consolidation</h2>
<p>
At time of writing libvirt uses the following languages:
</p>
<dl>
<dt>C</dt>
<dd>The core libvirt library, daemons, and helper tools are all written
in the C language.</dd>
<dt>Python</dt>
<dd>Various supporting build/test scripts are written in Python, with
compatibility for Python 3.</dd>
<dt>Perl</dt>
<dd>Various supporting build/test scripts are written in Perl. It is
also used for many syntax-check inline rules</dd>
<dt>Shell</dt>
<dd>Shell is used for some simple build/test scripts. At runtime
libvirt avoids shell except when using SSH tunnels to a remote
host</dd>
<dt>XSLT</dt>
<dd>The website uses XSLT for its templating system. The API
documentation is also autogenerated from an XML description
using XSLT</dd>
<dt>HTML</dt>
<dd>The website documentation is all written in plain HTML. Some HTML
is also auto-generated for API documentation</dd>
<dt>Meson</dt>
<dd>The core build system uses the new Meson build system</dd>
<dt>make</dt>
<dd>The syntax-check uses make recipes</dd>
<dt>awk/sed</dt>
<dd>A number of the syntax-check inline rules involve use of awk/sed
scripts</dd>
<dt>POD</dt>
<dd>The command line manual pages are typically written in Perl's POD
format, and converted to troff</dd>
</dl>
<p>
The wide range of languages used present a knowledge burden for
developers involved in libvirt, especially when there are multiple
languages all used in the same problem spaces. This is most notable
in the build system which uses a combination of Meson, shell, awk,
sed, Perl and Python, with debugging requiring
understanding of the interactions between many languages. The
popularity of Perl has declined, while Python has become
more popular. This directly influences the amount and quality of
contributions that can be expected for programs written in the
respective languages.
</p>
<p>
The C language has served libvirt well over the years, but its age shows
giving rise to limitations which negatively impact the project in terms
of code quality, reliability, and efficiency of development. Most notably
its lack of memory safety means that many code bugs become trivially
exploitable security flaws or denial of service. The lack of a high
level portable runtime results in a lot of effort being spent to
ensure cross platform portability. The modern languages Rust and Go
provide viable options for low level systems programming, in a way that
is not practical with other common languages such as Python and Java.
There is thus a desire to make use of either Rust or Go, or a combination
of both, to incrementally replace existing use of C, and also for
greenfield development.
</p>
<p>
With this in mind the libvirt project has set a vision for language
usage in the future:
</p>
<dl>
<dt>C</dt>
<dd>Large parts of the core libvirt library, daemons, and helper tools
will continue to make use in the C language. Integration of other
languages will be an incremental, targeted process where they can
bring the greatest benefit.</dd>
<dt>Rust / Go</dt>
<dd>Parts of the core libvirt library, daemons and helper tools are to
leverage Rust or Go or both to replace C.</dd>
<dt>Meson</dt>
<dd>The core build system is to be written in Meson.</dd>
<dt>Python</dt>
<dd>Various supporting build/test scripts are written in Python 3
compatible mode only.</dd>
<dt>reStructuredText</dt>
<dd>The website and command man pages are to be written in RST, using
Sphinx as the engine to convert to end user formats like HTML, troff,
etc</dd>
</dl>
<p>
Some notable points from the above. Whether the core library / daemons
will use Rust or Go internally is still to be decided based on more
detailed evaluation to identify the best fit. The need to link and embed
this functionality in other processes has complex interactions both at a
technical and non-technical level. For standalone helper tools, either
language is viable, but there are fewer concerns around interactions with
other in-process code from 3rd parties. Thus a different decision may be
made for daemons/libraries vs tools. Any rewrite proposed for existing
functionality will have to weigh up the benefits of the new code,
against the risk of introducing regressions with respect to the previous
code.
</p>
<p>
Using the RST format for documentation allows for the use of XSLT to be
eliminated from the build process. RST and the Sphinx toolkit are widely
used, as seen by the huge repository of content on
<a href="https://readthedocs.org/">Read The Docs</a>.
The ability to embed raw HTML in the RST docs will greatly facilitate its
adoption, avoiding the need for a big bang conversion of existing content.
Given the desire to eliminate Perl usage, replacing the use of POD
documentation for manual pages is an obvious followup task. RST is the
obvious choice to achieve alignment with the website, allowing the man
pages to be easily published online with other docs. It is further
anticipated that the current API docs generator which uses XSLT to
convert the XML API description would be converted to something which
generates RST using Python instead of XSLT.
</p>
</body>
</html>

105
docs/strategy.rst Normal file
View File

@@ -0,0 +1,105 @@
================
Project Strategy
================
This document attempts to outline the libvirt project strategy for the near
future. Think of this as a high level vision or to-do list setting the direction
for the project and its developers to take.
Language consolidation
----------------------
At time of writing libvirt uses the following languages:
C
The core libvirt library, daemons, and helper tools are all written in the C
language.
Python
Various supporting build/test scripts are written in Python, with
compatibility for Python 3.
Perl
Various supporting build/test scripts are written in Perl. It is also used
for many syntax-check inline rules
Shell
Shell is used for some simple build/test scripts. At runtime libvirt avoids
shell except when using SSH tunnels to a remote host
XSLT
The website uses XSLT for its templating system. The API documentation is
also autogenerated from an XML description using XSLT
HTML
The website documentation is all written in plain HTML. Some HTML is also
auto-generated for API documentation
Meson
The core build system uses the new Meson build system
make
The syntax-check uses make recipes
awk/sed
A number of the syntax-check inline rules involve use of awk/sed scripts
POD
The command line manual pages are typically written in Perl's POD format, and
converted to troff
The wide range of languages used present a knowledge burden for developers
involved in libvirt, especially when there are multiple languages all used in
the same problem spaces. This is most notable in the build system which uses a
combination of Meson, shell, awk, sed, Perl and Python, with debugging requiring
understanding of the interactions between many languages. The popularity of Perl
has declined, while Python has become more popular. This directly influences the
amount and quality of contributions that can be expected for programs written in
the respective languages.
The C language has served libvirt well over the years, but its age shows giving
rise to limitations which negatively impact the project in terms of code
quality, reliability, and efficiency of development. Most notably its lack of
memory safety means that many code bugs become trivially exploitable security
flaws or denial of service. The lack of a high level portable runtime results in
a lot of effort being spent to ensure cross platform portability. The modern
languages Rust and Go provide viable options for low level systems programming,
in a way that is not practical with other common languages such as Python and
Java. There is thus a desire to make use of either Rust or Go, or a combination
of both, to incrementally replace existing use of C, and also for greenfield
development.
With this in mind the libvirt project has set a vision for language usage in the
future:
C
Large parts of the core libvirt library, daemons, and helper tools will
continue to make use in the C language. Integration of other languages will
be an incremental, targeted process where they can bring the greatest
benefit.
Rust / Go
Parts of the core libvirt library, daemons and helper tools are to leverage
Rust or Go or both to replace C.
Meson
The core build system is to be written in Meson.
Python
Various supporting build/test scripts are written in Python 3 compatible mode
only.
reStructuredText
The website and command man pages are to be written in RST, using Sphinx as
the engine to convert to end user formats like HTML, troff, etc
Some notable points from the above. Whether the core library / daemons will use
Rust or Go internally is still to be decided based on more detailed evaluation
to identify the best fit. The need to link and embed this functionality in other
processes has complex interactions both at a technical and non-technical level.
For standalone helper tools, either language is viable, but there are fewer
concerns around interactions with other in-process code from 3rd parties. Thus a
different decision may be made for daemons/libraries vs tools. Any rewrite
proposed for existing functionality will have to weigh up the benefits of the
new code, against the risk of introducing regressions with respect to the
previous code.
Using the RST format for documentation allows for the use of XSLT to be
eliminated from the build process. RST and the Sphinx toolkit are widely used,
as seen by the huge repository of content on `Read The
Docs <https://readthedocs.org/>`__. The ability to embed raw HTML in the RST
docs will greatly facilitate its adoption, avoiding the need for a big bang
conversion of existing content. Given the desire to eliminate Perl usage,
replacing the use of POD documentation for manual pages is an obvious followup
task. RST is the obvious choice to achieve alignment with the website, allowing
the man pages to be easily published online with other docs. It is further
anticipated that the current API docs generator which uses XSLT to convert the
XML API description would be converted to something which generates RST using
Python instead of XSLT.

View File

@@ -1,258 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Support guarantees</h1>
<ul id="toc"></ul>
<p>
This document will outline the support status / guarantees around the
very interfaces that libvirt exposes to applications and/or system
administrators. The intent is to help users understand what features they
can rely upon in particular scenarios, and whether they are likely to
suffer disruption during upgrades.
</p>
<h2><a id="publicAPI">Primary public API</a></h2>
<p>
The main public API provided by <code>libvirt.so</code> and described
in <code>libvirt/libvirt.h</code> exposes the primary hypervisor
agnostic management interface of libvirt. This API has the strongest
guarantee of any part of libvirt with a promise to keep backwards
compatibility forever. Specific details are as follows:
</p>
<dl>
<dt>Functions</dt>
<dd>Functions will never be removed from the public API, and will
never have parameters added, removed or changed in their signature.
IOW they will be ABI compatible forever. The semantics implied by
a specific set of parameters passed to the function will remain
unchanged. Where a parameter accepts a bitset of feature flags, or
an enumerated value, further flags / enum values may be supported
in the future. Where a parameter accepts one of a set of related
constants, further constants may be supported in the future.
</dd>
<dt>Struct types</dt>
<dd>Once defined in a release, struct definitions will never have any
fields add, removed or changed in any way. Their size and layout is
fixed forever. If a struct name starts with an underscore, it is
considered acceptable to rename it. Applications should thus always
use the corresponding typedef in preference to the struct name.
</dd>
<dt>Union types</dt>
<dd>Once defined in a release, union definitions will never have any
existing fields removed or changed. New union choices may be added,
provided that they don't change the size of the existing union
definition. If a struct name starts with an underscore, it is
considered acceptable to rename it. Applications should thus always
use the corresponding typedef in preference to the struct name.
</dd>
<dt>Type definitions</dt>
<dd>Most custom data types used in the APIs have corresponding typedefs
provided for their stable names. The typedefs should always be used
in preference to the underlying data type name, as the latter are not
guaranteed to be stable.
</dd>
<dt>Enumerations</dt>
<dd>Once defined in a release, existing enumeration values will never
be removed or renamed. New enumeration values may be introduced at
any time. Every enumeration will have a '_LAST' value which indicates
the current highest enumeration value, which may increase with new
releases. If an enumeration name starts with an underscore, it is
considered acceptable to rename it. Applications should thus always
use the corresponding typedef in preference to the enum name.
</dd>
<dt>Constants</dt>
<dd>Once defined in a release, existing constants will never be removed
or have their value changed. Most constants are grouped into related
sets, and within each set, new constants may be introduced. APIs which
use the constants may thus accept or return new constant values over
time.
</dd>
<dt>Symbol versions</dt>
<dd>Where the platform library format permits, APIs defined in libvirt.so
library will have version information associated. Each API will be
tagged with the version in which it was introduced, and this won't
be changed thereafter.
</dd>
</dl>
<h2><a id="hvAPI">Hypervisor specific APIs</a></h2>
<p>
A number of hypervisor drivers provide additional libraries with hypervisor
specific APIs, extending the core libvirt API. These add-on libraries follow
the same general principles described above, however, they are <strong>not</strong>
guaranteed to be preserved forever. The project reserves the right to remove
hypervisor specific APIs in any new release, or to change their semantics.
That said the project will endeavour to maintain API compatibility for as long
as is practical.
</p>
<p>
Use of some hypervisor specific APIs may result in the running guest being
marked as "tainted" if the API is at risk of having unexpected interactions
with normal libvirt operations. An application which chooses to make use of
hypervisor specific APIs should validate their operation with each new release
of libvirt and each new release of the underlying hypervisor. The semantics
may change in unexpected ways, or have unforeseen interactions with libvirt's
operation.
</p>
<h2><a id="apierrors">Error reporting</a></h2>
<p>
Most API calls are subject to failure and so will report error codes and
messages. Libvirt defines error codes for a wide variety of scenarios, some
represent very specific problems, while others are general purpose for
broad classes of problem. Over time the error codes reported are liable
to change, usually changing from a generic error to a more specific error.
Thus applications should be careful about checking for &amp; taking action
upon specific error codes, as their behaviour may change across releases.
</p>
<h2><a id="xmlschema">XML schemas</a></h2>
<p>
The main objects exposed via the primary libvirt public API are usually
configured via XML documents following specific schemas. The XML schemas
are considered to be stable formats, whose compatibility will be maintained
forever. Specific details are as follows:
</p>
<dl>
<dt>Attributes</dt>
<dd>Attributes defined on an XML element will never be removed or
renamed. New attributes may be defined. If the set of valid values
for an attribute are determined by an enumeration, the permitted
values will never be removed or renamed, only new values defined.
None the less, specific hypervisors may reject usage of certain
values according to their feature set.
</dd>
<dt>Elements</dt>
<dd>Elements defined will never be removed or renamed. New child
elements may be defined at any time. In places where only a
single instance of a named XML element is used, future versions
may be extended to permit multiple instances of the named XML
element to be used. An element which currently has no content
may later gain child elements.
</dd>
</dl>
<p>
Some hypervisor drivers may choose to allow use of hypervisor specific
extensions to the XML documents. These extensions will always be
contained within a hypervisor specific XML namespace. There is generally
no guarantee of long term support for the hypervisor specific extensions
across releases, though the project will endeavour to preserve them as
long as is possible. Applications choosing to use hypervisor specific
extensions should validate their operation against new libvirt or
hypervisor releases.
</p>
<h2><a id="configfiles">Configuration files</a></h2>
<p>
A number of programs / daemons provided libvirt rely on host filesystem
configuration files. These configuration files are accompanied by augeas
lens for easy manipulation by applications. There is in general no
guarantee that parameters available in the configuration file will be
preserved across releases, though the project will endeavour to preserve
them as long as is possible. If a configuration option is dropped from
the file, the augeas lens will retain the ability to read that configuration
parameter, so that it is able to read &amp; update historically modified
files.
The default configuration files ship with all parameters commented out
such that a deployment relies on the built-in defaults of the application
in question. There is no guarantee that the defaults will remain the same
across releases. A deployment that expects a particular value for a
configuration parameter should consider defining it explicitly, instead
of relying on the defaults.
</p>
<h2><a id="hvdrivers">Hypervisor drivers</a></h2>
<p>
The libvirt project provides support for a wide variety of hypervisor
drivers. These drivers target certain versions of the hypervisor's
underlying management APIs. In general libvirt aims to work with any
hypervisor version that is still broadly supported by its vendor.
When a vendor discontinues support for a particular hypervisor
version it will be dropped by libvirt. Libvirt may choose to drop
support for a particular hypervisor version prior to the vendor
ending support, if it deems that the likely usage is too small to
justify the ongoing maintenance cost.
</p>
<p>
Each hypervisor release will implement a distinct subset of features
that can be expressed in the libvirt APIs and XML formats. While the
XML schema syntax will be stable across releases, libvirt is unable
to promise that it will always be able to support usage of the same
features across hypervisor releases. Where a hypervisor changes the
way a feature is implemented, the project will endeavour to adapt
to the new implementation to provide the same semantics. In cases
where the feature is discontinued by the hypervisor, libvirt will
return an error indicating it is not supported. Likewise libvirt will
make reasonable efforts to keep API calls working across hypervisor
releases even if the underlying implementation changes. In cases where
this is impossible, a suitable error will be reported. The list of
APIs which have implementations <a href="hvsupport.html">is detailed separately</a>.
</p>
<h2><a id="rpcproto">RPC protocol</a></h2>
<p>
For some hypervisor drivers, the libvirt.so library communicates with
separate libvirt daemons to perform work. This communication takes
place over a binary RPC protocol defined by libvirt. The protocol uses
the XDR format for data encoding, and the message packet format is
defined in libvirt source code.
</p>
<p>
Applications are encouraged to use the primary libvirt.so library which
transparently talks to the daemons, so that they are not exposed to the
hypervisor driver specific details. None the less, the RPC protocol
associated with the libvirtd is considered to be a long term stable ABI.
It will only ever have new messages added to it, existing messages will
not be removed, nor have their contents changed. Thus if an application
does wish to provide its own client side implementation of the RPC
protocol this is supported, with the caveat that the application will
loose the ability to work with certain hypervisors libvirt supports.
The project reserves the right to define new authentication and encryption
options for the protocol, and the defaults used in this area may change
over time. This is particularly true of the TLS ciphers permitted. Thus
applications choosing to implement the RPC protocol must be prepared to
track support for new security options. If defaults are changed, however,
it will generally be possible to reconfigure the daemon to use the old
defaults, albeit with possible implications for system security.
</p>
<p>
Other daemons besides, libvirtd, also use the same RPC protocol, but
with different message types defined. These RPC protocols are all
considered to be private implementations that are liable to change
at any time. Applications must not attempt to talk to these other
daemons directly.
</p>
<h2><a id="virsh">virsh client</a></h2>
<p>
The virsh program provides a simple client to interact with an arbitrary libvirt
hypervisor connection. Since it uses the primary public API of libvirt, it should
generally inherit the guarantees associated with that API, and with the hypervisor
driver. The commands that virsh exposes, and the arguments they accept are all
considered to be long term stable. Existing commands and arguments will not be
removed or renamed. New commands and arguments may be added in new releases.
The text output format produced by virsh commands is not generally guaranteed to
be stable if it contains compound data (eg formatted tables or lists). Commands
which output single data items (ie an object name, or an XML document), can be
treated as having stable format.
</p>
</body>
</html>

207
docs/support.rst Normal file
View File

@@ -0,0 +1,207 @@
==================
Support guarantees
==================
.. contents::
This document will outline the support status / guarantees around the very
interfaces that libvirt exposes to applications and/or system administrators.
The intent is to help users understand what features they can rely upon in
particular scenarios, and whether they are likely to suffer disruption during
upgrades.
Primary public API
------------------
The main public API provided by ``libvirt.so`` and described in
``libvirt/libvirt.h`` exposes the primary hypervisor agnostic management
interface of libvirt. This API has the strongest guarantee of any part of
libvirt with a promise to keep backwards compatibility forever. Specific details
are as follows:
Functions
Functions will never be removed from the public API, and will never have
parameters added, removed or changed in their signature. IOW they will be ABI
compatible forever. The semantics implied by a specific set of parameters
passed to the function will remain unchanged. Where a parameter accepts a
bitset of feature flags, or an enumerated value, further flags / enum values
may be supported in the future. Where a parameter accepts one of a set of
related constants, further constants may be supported in the future.
Struct types
Once defined in a release, struct definitions will never have any fields add,
removed or changed in any way. Their size and layout is fixed forever. If a
struct name starts with an underscore, it is considered acceptable to rename
it. Applications should thus always use the corresponding typedef in
preference to the struct name.
Union types
Once defined in a release, union definitions will never have any existing
fields removed or changed. New union choices may be added, provided that they
don't change the size of the existing union definition. If a struct name
starts with an underscore, it is considered acceptable to rename it.
Applications should thus always use the corresponding typedef in preference
to the struct name.
Type definitions
Most custom data types used in the APIs have corresponding typedefs provided
for their stable names. The typedefs should always be used in preference to
the underlying data type name, as the latter are not guaranteed to be stable.
Enumerations
Once defined in a release, existing enumeration values will never be removed
or renamed. New enumeration values may be introduced at any time. Every
enumeration will have a '_LAST' value which indicates the current highest
enumeration value, which may increase with new releases. If an enumeration
name starts with an underscore, it is considered acceptable to rename it.
Applications should thus always use the corresponding typedef in preference
to the enum name.
Constants
Once defined in a release, existing constants will never be removed or have
their value changed. Most constants are grouped into related sets, and within
each set, new constants may be introduced. APIs which use the constants may
thus accept or return new constant values over time.
Symbol versions
Where the platform library format permits, APIs defined in libvirt.so library
will have version information associated. Each API will be tagged with the
version in which it was introduced, and this won't be changed thereafter.
Hypervisor specific APIs
------------------------
A number of hypervisor drivers provide additional libraries with hypervisor
specific APIs, extending the core libvirt API. These add-on libraries follow the
same general principles described above, however, they are **not** guaranteed to
be preserved forever. The project reserves the right to remove hypervisor
specific APIs in any new release, or to change their semantics. That said the
project will endeavour to maintain API compatibility for as long as is
practical.
Use of some hypervisor specific APIs may result in the running guest being
marked as "tainted" if the API is at risk of having unexpected interactions with
normal libvirt operations. An application which chooses to make use of
hypervisor specific APIs should validate their operation with each new release
of libvirt and each new release of the underlying hypervisor. The semantics may
change in unexpected ways, or have unforeseen interactions with libvirt's
operation.
Error reporting
---------------
Most API calls are subject to failure and so will report error codes and
messages. Libvirt defines error codes for a wide variety of scenarios, some
represent very specific problems, while others are general purpose for broad
classes of problem. Over time the error codes reported are liable to change,
usually changing from a generic error to a more specific error. Thus
applications should be careful about checking for & taking action upon specific
error codes, as their behaviour may change across releases.
XML schemas
-----------
The main objects exposed via the primary libvirt public API are usually
configured via XML documents following specific schemas. The XML schemas are
considered to be stable formats, whose compatibility will be maintained forever.
Specific details are as follows:
Attributes
Attributes defined on an XML element will never be removed or renamed. New
attributes may be defined. If the set of valid values for an attribute are
determined by an enumeration, the permitted values will never be removed or
renamed, only new values defined. None the less, specific hypervisors may
reject usage of certain values according to their feature set.
Elements
Elements defined will never be removed or renamed. New child elements may be
defined at any time. In places where only a single instance of a named XML
element is used, future versions may be extended to permit multiple instances
of the named XML element to be used. An element which currently has no
content may later gain child elements.
Some hypervisor drivers may choose to allow use of hypervisor specific
extensions to the XML documents. These extensions will always be contained
within a hypervisor specific XML namespace. There is generally no guarantee of
long term support for the hypervisor specific extensions across releases, though
the project will endeavour to preserve them as long as is possible. Applications
choosing to use hypervisor specific extensions should validate their operation
against new libvirt or hypervisor releases.
Configuration files
-------------------
A number of programs / daemons provided libvirt rely on host filesystem
configuration files. These configuration files are accompanied by augeas lens
for easy manipulation by applications. There is in general no guarantee that
parameters available in the configuration file will be preserved across
releases, though the project will endeavour to preserve them as long as is
possible. If a configuration option is dropped from the file, the augeas lens
will retain the ability to read that configuration parameter, so that it is able
to read & update historically modified files. The default configuration files
ship with all parameters commented out such that a deployment relies on the
built-in defaults of the application in question. There is no guarantee that the
defaults will remain the same across releases. A deployment that expects a
particular value for a configuration parameter should consider defining it
explicitly, instead of relying on the defaults.
Hypervisor drivers
------------------
The libvirt project provides support for a wide variety of hypervisor drivers.
These drivers target certain versions of the hypervisor's underlying management
APIs. In general libvirt aims to work with any hypervisor version that is still
broadly supported by its vendor. When a vendor discontinues support for a
particular hypervisor version it will be dropped by libvirt. Libvirt may choose
to drop support for a particular hypervisor version prior to the vendor ending
support, if it deems that the likely usage is too small to justify the ongoing
maintenance cost.
Each hypervisor release will implement a distinct subset of features that can be
expressed in the libvirt APIs and XML formats. While the XML schema syntax will
be stable across releases, libvirt is unable to promise that it will always be
able to support usage of the same features across hypervisor releases. Where a
hypervisor changes the way a feature is implemented, the project will endeavour
to adapt to the new implementation to provide the same semantics. In cases where
the feature is discontinued by the hypervisor, libvirt will return an error
indicating it is not supported. Likewise libvirt will make reasonable efforts to
keep API calls working across hypervisor releases even if the underlying
implementation changes. In cases where this is impossible, a suitable error will
be reported. The list of APIs which have implementations `is detailed
separately <hvsupport.html>`__.
RPC protocol
------------
For some hypervisor drivers, the libvirt.so library communicates with separate
libvirt daemons to perform work. This communication takes place over a binary
RPC protocol defined by libvirt. The protocol uses the XDR format for data
encoding, and the message packet format is defined in libvirt source code.
Applications are encouraged to use the primary libvirt.so library which
transparently talks to the daemons, so that they are not exposed to the
hypervisor driver specific details. None the less, the RPC protocol associated
with the libvirtd is considered to be a long term stable ABI. It will only ever
have new messages added to it, existing messages will not be removed, nor have
their contents changed. Thus if an application does wish to provide its own
client side implementation of the RPC protocol this is supported, with the
caveat that the application will loose the ability to work with certain
hypervisors libvirt supports. The project reserves the right to define new
authentication and encryption options for the protocol, and the defaults used in
this area may change over time. This is particularly true of the TLS ciphers
permitted. Thus applications choosing to implement the RPC protocol must be
prepared to track support for new security options. If defaults are changed,
however, it will generally be possible to reconfigure the daemon to use the old
defaults, albeit with possible implications for system security.
Other daemons besides, libvirtd, also use the same RPC protocol, but with
different message types defined. These RPC protocols are all considered to be
private implementations that are liable to change at any time. Applications must
not attempt to talk to these other daemons directly.
virsh client
------------
The virsh program provides a simple client to interact with an arbitrary libvirt
hypervisor connection. Since it uses the primary public API of libvirt, it
should generally inherit the guarantees associated with that API, and with the
hypervisor driver. The commands that virsh exposes, and the arguments they
accept are all considered to be long term stable. Existing commands and
arguments will not be removed or renamed. New commands and arguments may be
added in new releases. The text output format produced by virsh commands is not
generally guaranteed to be stable if it contains compound data (eg formatted
tables or lists). Commands which output single data items (ie an object name, or
an XML document), can be treated as having stable format.

View File

@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>libvirt-test-API: Python based test suite </h1>
<p>Libvirt-test-API is a powerful test tool designed to complement
existing libvirt test tools such as libvirt-TCK and the internal
test suite. It aims at functional regression testing, trying to
exercise nearly all the API by the way of the Python bindings.</p>
<p>The test API currently covers:</p>
<ul>
<li>domain: all classical lifetime operations, installation of
various guests OSes, snapshots</li>
<li>interfaces: define, create, destroy, undefine, NPIV</li>
<li>virtual networks: define, create, destroy, undefine</li>
<li>storage: regression tests for most storage types and configurations
dir, disk, netfs, iSCSI, multipath</li>
</ul>
<p>Some of the tests need dedicated local resources whose definitions
are stored in a configuration file. The tests are defined using
Python modules defining the code for the test, this is called
a <tt>test case</tt>, and test <tt>configuration files</tt> using one
or more test case to define a given test scenario.</p>
<p>For more details you can look at:</p>
<ul>
<li> A <a href="https://libvirt.org/sources/libvirt-test-API/Libvirt-test-API.pdf">documentation PDF</a>
file describing the test suite and how to write test cases
and test scenarios.</li>
</ul>
<p> Libvirt-test-API is maintained using
<a href="https://gitlab.com/libvirt/libvirt-test-API">a GIT
repository</a>, and comment, patches and reviews are carried
on the <a href="contact.html">libvir-list</a> development list.</p>
</body>
</html>

34
docs/testapi.rst Normal file
View File

@@ -0,0 +1,34 @@
=========================================
libvirt-test-API: Python based test suite
=========================================
Libvirt-test-API is a powerful test tool designed to complement existing libvirt
test tools such as libvirt-TCK and the internal test suite. It aims at
functional regression testing, trying to exercise nearly all the API by the way
of the Python bindings.
The test API currently covers:
- domain: all classical lifetime operations, installation of various guests
OSes, snapshots
- interfaces: define, create, destroy, undefine, NPIV
- virtual networks: define, create, destroy, undefine
- storage: regression tests for most storage types and configurations dir,
disk, netfs, iSCSI, multipath
Some of the tests need dedicated local resources whose definitions are stored in
a configuration file. The tests are defined using Python modules defining the
code for the test, this is called a test case, and test configuration files
using one or more test case to define a given test scenario.
For more details you can look at:
- A `documentation
PDF <https://libvirt.org/sources/libvirt-test-API/Libvirt-test-API.pdf>`__
file describing the test suite and how to write test cases and test
scenarios.
Libvirt-test-API is maintained using `a GIT
repository <https://gitlab.com/libvirt/libvirt-test-API>`__, and comment,
patches and reviews are carried on the `libvir-list <contact.html>`__
development list.

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Test suites</h1>
<p>There is a few test suites available to developers for testing
a given version of libvirt:</p>
<ul>
<li>the internal test suite: present in the source code, it is run
by developers before submitting patches upstream, it is also
suggested to have it run and pass as part of the packaging
process for distributions. It is run by launching:
<pre>make check (libvirt 6.6.0 and older)</pre>
<pre>ninja test (libvirt 6.7.0 and newer)</pre>
in a source tree after compilation has finished. It doesn't
really make functional testing but checks that large portions
of the code not interacting directly with virtualization
functions properly.
</li>
<li>the <a href="testtck.html">TCK test suite</a> is a functional
test suite implemented using the
<a href="https://search.cpan.org/dist/Sys-Virt/">Perl bindings</a>
of libvirt. It is available separately as a
<a href="ftp://libvirt.org/libvirt/tck/">download</a>, as a
<a href="https://rpmfind.net/linux/rpm2html/search.php?query=libvirt-tck">package</a>
in Fedora distributions, but best is probably to get
the <a href="https://gitlab.com/libvirt/libvirt-tck">version
from GIT</a>.
</li>
<li>the <a href="testapi.html">libvirt-test-API</a> is also a functional
test suite, but implemented using the
<a href="python.html">Python bindings</a>
of libvirt. It is available separately as a
<a href="ftp://libvirt.org/libvirt/libvirt-test-API/">download</a>,
or directly get
the <a href="https://gitlab.com/libvirt/libvirt-test-API/">version
from GIT</a>.
</li>
</ul>
</body>
</html>

37
docs/testsuites.rst Normal file
View File

@@ -0,0 +1,37 @@
===========
Test suites
===========
There is a few test suites available to developers for testing a given version
of libvirt:
- the internal test suite: present in the source code, it is run by developers
before submitting patches upstream, it is also suggested to have it run and
pass as part of the packaging process for distributions. It is run by
launching:
::
make check (libvirt 6.6.0 and older)
::
ninja test (libvirt 6.7.0 and newer)
in a source tree after compilation has finished. It doesn't really make
functional testing but checks that large portions of the code not interacting
directly with virtualization functions properly.
- the `TCK test suite <testtck.html>`__ is a functional test suite implemented
using the `Perl bindings <https://search.cpan.org/dist/Sys-Virt/>`__ of
libvirt. It is available separately as a
`download <ftp://libvirt.org/libvirt/tck/>`__, as a
`package <https://rpmfind.net/linux/rpm2html/search.php?query=libvirt-tck>`__
in Fedora distributions, but best is probably to get the `version from
GIT <https://gitlab.com/libvirt/libvirt-tck>`__.
- the `libvirt-test-API <testapi.html>`__ is also a functional test suite, but
implemented using the `Python bindings <python.html>`__ of libvirt. It is
available separately as a
`download <ftp://libvirt.org/libvirt/libvirt-test-API/>`__, or directly get
the `version from GIT <https://gitlab.com/libvirt/libvirt-test-API/>`__.

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>libvirt TCK : Technology Compatibility Kit</h1>
<p>The libvirt TCK provides a framework for performing testing
of the integration between libvirt drivers, the underlying virt
hypervisor technology, related operating system services and system
configuration. The idea (and name) is motivated by the Java TCK.</p>
<p>In particular the libvirt TCK is intended to address the following
scenarios:</p>
<ul>
<li>Validate that a new libvirt driver is in compliance
with the (possibly undocumented!) driver API semantics</li>
<li>Validate that an update to an existing driver does not
change the API semantics in a non-compliant manner</li>
<li>Validate that a new hypervisor release is still providing
compatibility with the corresponding libvirt driver usage</li>
<li>Validate that an OS distro deployment consisting of a
hypervisor and libvirt release is configured correctly</li>
</ul>
<p>Thus the libvirt TCK will allow developers, administrators and users
to determine the level of compatibility of their platform, and
evaluate whether it will meet their needs, and get awareness of any
regressions that may have occurred since a previous test run.</p>
<p>For more details you can look at:</p>
<ul>
<li> The initial
<a href="https://www.redhat.com/archives/libvir-list/2009-April/msg00176.html">mail
from Daniel Berrange</a> presenting the project.</li>
<li> The <a href="https://fedoraproject.org/wiki/Features/VirtTCK">page
describing VirtTCK</a> the inclusion of libvirt-TCK as a
Fedora Feature.</li>
</ul>
<p> Libvirt-TCK is maintained using
<a href="https://gitlab.com/libvirt/libvirt-tck">a GIT
repository</a>, and comment, patches and reviews are carried
on the <a href="contact.html">libvir-list</a> development list.</p>
</body>
</html>

37
docs/testtck.rst Normal file
View File

@@ -0,0 +1,37 @@
==========================================
libvirt TCK : Technology Compatibility Kit
==========================================
The libvirt TCK provides a framework for performing testing of the integration
between libvirt drivers, the underlying virt hypervisor technology, related
operating system services and system configuration. The idea (and name) is
motivated by the Java TCK.
In particular the libvirt TCK is intended to address the following scenarios:
- Validate that a new libvirt driver is in compliance with the (possibly
undocumented!) driver API semantics
- Validate that an update to an existing driver does not change the API
semantics in a non-compliant manner
- Validate that a new hypervisor release is still providing compatibility with
the corresponding libvirt driver usage
- Validate that an OS distro deployment consisting of a hypervisor and libvirt
release is configured correctly
Thus the libvirt TCK will allow developers, administrators and users to
determine the level of compatibility of their platform, and evaluate whether it
will meet their needs, and get awareness of any regressions that may have
occurred since a previous test run.
For more details you can look at:
- The initial `mail from Daniel
Berrange <https://www.redhat.com/archives/libvir-list/2009-April/msg00176.html>`__
presenting the project.
- The `page describing
VirtTCK <https://fedoraproject.org/wiki/Features/VirtTCK>`__ the inclusion of
libvirt-TCK as a Fedora Feature.
Libvirt-TCK is maintained using `a GIT
repository <https://gitlab.com/libvirt/libvirt-tck>`__, and comment, patches and
reviews are carried on the `libvir-list <contact.html>`__ development list.

View File

@@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Virsh Command Reference</h1>
<ul id="toc"></ul>
<h2><a id="description">Description</a></h2>
<p>
The new <b>Virsh Command Reference</b>, for documenting the commands
in virsh, has recently been started. Only covering the Virtual
Networking commands initially, it will expand to cover all virsh
commands over time.
</p>
<p>
If you would like to assist, content contributions are gladly accepted.
Please email <a href="mailto:jclift@redhat.com">Justin Clift</a>
directly, or get in contact through any of the
<a href="contact.html">official libvirt mailing lists</a>.
</p>
<h2><a id="viewing">Viewing Online</a></h2>
<p>
The latest version can be viewed directly online:
</p>
<ul>
<li>
<a href="https://libvirt.org/sources/virshcmdref/html/">Standard HTML format, multiple pages</a>
</li>
<li>
<a href="https://libvirt.org/sources/virshcmdref/html-single/">HTML format, one long page</a>
</li>
</ul>
<h2><a id="downloading">Downloading</a></h2>
<p>
The latest version of the Virsh Command Reference can be downloaded:
</p>
<ul>
<li>
Standard HTML format, multiple pages
(<a href="https://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-multi-page.tar.gz">.tar.gz</a>)
(<a href="https://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-multi-page.tar.bz2">.tar.bz2</a>)
(<a href="https://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-multi-page.zip">.zip</a>)
</li>
<li>
HTML format, one long page
(<a href="https://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-single.tar.gz">.tar.gz</a>)
(<a href="https://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-single.tar.bz2">.tar.bz2</a>)
(<a href="https://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-single.zip">.zip</a>)
</li>
<li>
<a href="https://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1.pdf">PDF format</a>
</li>
<li>
<a href="https://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1.epub">ePub format</a>
</li>
</ul>
<h2><a id="git">DocBook source GIT repository</a></h2>
<p>
The DocBook source is archived in a <a
href="https://git-scm.com/">git</a> repository available on
<a href="https://gitlab.com/libvirt/libvirt-virshcmdref">gitlab.com</a>.
</p>
</body>
</html>

View File

@@ -12,18 +12,8 @@
#define G_N_ELEMENTS(Array) (sizeof(Array) / sizeof(*(Array))) #define G_N_ELEMENTS(Array) (sizeof(Array) / sizeof(*(Array)))
#define STREQ(a, b) (strcmp(a, b) == 0) #define STREQ(a, b) (strcmp(a, b) == 0)
#define NULLSTR(s) ((s) ? (s) : "<null>") #define NULLSTR(s) ((s) ? (s) : "<null>")
#define G_STATIC_ASSERT(cond) _Static_assert(cond, "verify (" #cond ")")
#if (4 < __GNUC__ + (6 <= __GNUC_MINOR__) \ #define G_GNUC_UNUSED __attribute__((__unused__))
&& (201112L <= __STDC_VERSION__ || !defined __STRICT_ANSI__) \
&& !defined __cplusplus)
# define G_STATIC_ASSERT(cond) _Static_assert(cond, "verify (" #cond ")")
#else
# define G_STATIC_ASSERT(cond)
#endif
#ifndef G_GNUC_UNUSED
# define G_GNUC_UNUSED __attribute__((__unused__))
#endif
int run = 1; int run = 1;

View File

@@ -198,6 +198,7 @@ typedef enum {
VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING = 1 << 0, /* Run after revert */ VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING = 1 << 0, /* Run after revert */
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED = 1 << 1, /* Pause after revert */ VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED = 1 << 1, /* Pause after revert */
VIR_DOMAIN_SNAPSHOT_REVERT_FORCE = 1 << 2, /* Allow risky reverts */ VIR_DOMAIN_SNAPSHOT_REVERT_FORCE = 1 << 2, /* Allow risky reverts */
VIR_DOMAIN_SNAPSHOT_REVERT_RESET_NVRAM = 1 << 3, /* Re-initialize NVRAM from template */
} virDomainSnapshotRevertFlags; } virDomainSnapshotRevertFlags;
/* Revert the domain to a point-in-time snapshot. The /* Revert the domain to a point-in-time snapshot. The

View File

@@ -62,7 +62,7 @@ typedef enum {
# ifdef VIR_ENUM_SENTINELS # ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_LAST VIR_DOMAIN_LAST
/* /*
* NB: this enum value will increase over time as new events are * NB: this enum value will increase over time as new states are
* added to the libvirt API. It reflects the last state supported * added to the libvirt API. It reflects the last state supported
* by this version of the libvirt API. * by this version of the libvirt API.
*/ */
@@ -302,6 +302,7 @@ typedef enum {
VIR_DOMAIN_START_BYPASS_CACHE = 1 << 2, /* Avoid file system cache pollution */ VIR_DOMAIN_START_BYPASS_CACHE = 1 << 2, /* Avoid file system cache pollution */
VIR_DOMAIN_START_FORCE_BOOT = 1 << 3, /* Boot, discarding any managed save */ VIR_DOMAIN_START_FORCE_BOOT = 1 << 3, /* Boot, discarding any managed save */
VIR_DOMAIN_START_VALIDATE = 1 << 4, /* Validate the XML document against schema */ VIR_DOMAIN_START_VALIDATE = 1 << 4, /* Validate the XML document against schema */
VIR_DOMAIN_START_RESET_NVRAM = 1 << 5, /* Re-initialize NVRAM from template */
} virDomainCreateFlags; } virDomainCreateFlags;
@@ -696,7 +697,7 @@ typedef enum {
VIR_DOMAIN_CORE_DUMP_FORMAT_LAST VIR_DOMAIN_CORE_DUMP_FORMAT_LAST
/* /*
* NB: this enum value will increase over time as new formats are * NB: this enum value will increase over time as new formats are
* added to the libvirt API. It reflects the last state supported * added to the libvirt API. It reflects the last format supported
* by this version of the libvirt API. * by this version of the libvirt API.
*/ */
# endif # endif
@@ -1268,6 +1269,7 @@ typedef enum {
VIR_DOMAIN_SAVE_BYPASS_CACHE = 1 << 0, /* Avoid file system cache pollution */ VIR_DOMAIN_SAVE_BYPASS_CACHE = 1 << 0, /* Avoid file system cache pollution */
VIR_DOMAIN_SAVE_RUNNING = 1 << 1, /* Favor running over paused */ VIR_DOMAIN_SAVE_RUNNING = 1 << 1, /* Favor running over paused */
VIR_DOMAIN_SAVE_PAUSED = 1 << 2, /* Favor paused over running */ VIR_DOMAIN_SAVE_PAUSED = 1 << 2, /* Favor paused over running */
VIR_DOMAIN_SAVE_RESET_NVRAM = 1 << 3, /* Re-initialize NVRAM from template */
} virDomainSaveRestoreFlags; } virDomainSaveRestoreFlags;
int virDomainSave (virDomainPtr domain, int virDomainSave (virDomainPtr domain,
@@ -2909,7 +2911,7 @@ typedef enum {
# ifdef VIR_ENUM_SENTINELS # ifdef VIR_ENUM_SENTINELS
VIR_KEYCODE_SET_LAST VIR_KEYCODE_SET_LAST
/* /*
* NB: this enum value will increase over time as new events are * NB: this enum value will increase over time as new keycode sets are
* added to the libvirt API. It reflects the last keycode set supported * added to the libvirt API. It reflects the last keycode set supported
* by this version of the libvirt API. * by this version of the libvirt API.
*/ */
@@ -3281,7 +3283,7 @@ typedef enum {
* @conn: virConnect connection * @conn: virConnect connection
* @dom: The domain on which the event occurred * @dom: The domain on which the event occurred
* @event: The specific virDomainEventType which occurred * @event: The specific virDomainEventType which occurred
* @detail: event specific detail information * @detail: event specific detail information (virDomainEvent*DetailType)
* @opaque: opaque user data * @opaque: opaque user data
* *
* A callback function to be registered, and called when a domain event occurs * A callback function to be registered, and called when a domain event occurs
@@ -3783,7 +3785,7 @@ typedef enum {
* virConnectDomainEventWatchdogCallback: * virConnectDomainEventWatchdogCallback:
* @conn: connection object * @conn: connection object
* @dom: domain on which the event occurred * @dom: domain on which the event occurred
* @action: action that is to be taken due to watchdog firing * @action: action that is to be taken due to watchdog firing (virDomainEventWatchdogAction)
* @opaque: application specified data * @opaque: application specified data
* *
* The callback signature to use when registering for an event of type * The callback signature to use when registering for an event of type
@@ -3817,7 +3819,7 @@ typedef enum {
* @dom: domain on which the event occurred * @dom: domain on which the event occurred
* @srcPath: The host file on which the IO error occurred * @srcPath: The host file on which the IO error occurred
* @devAlias: The guest device alias associated with the path * @devAlias: The guest device alias associated with the path
* @action: action that is to be taken due to the IO error * @action: action that is to be taken due to the IO error (virDomainEventIOErrorAction)
* @opaque: application specified data * @opaque: application specified data
* *
* The callback signature to use when registering for an event of type * The callback signature to use when registering for an event of type
@@ -3836,7 +3838,7 @@ typedef void (*virConnectDomainEventIOErrorCallback)(virConnectPtr conn,
* @dom: domain on which the event occurred * @dom: domain on which the event occurred
* @srcPath: The host file on which the IO error occurred * @srcPath: The host file on which the IO error occurred
* @devAlias: The guest device alias associated with the path * @devAlias: The guest device alias associated with the path
* @action: action that is to be taken due to the IO error * @action: action that is to be taken due to the IO error (virDomainEventIOErrorAction)
* @reason: the cause of the IO error * @reason: the cause of the IO error
* @opaque: application specified data * @opaque: application specified data
* *
@@ -3940,7 +3942,7 @@ typedef virDomainEventGraphicsSubject *virDomainEventGraphicsSubjectPtr;
* virConnectDomainEventGraphicsCallback: * virConnectDomainEventGraphicsCallback:
* @conn: connection object * @conn: connection object
* @dom: domain on which the event occurred * @dom: domain on which the event occurred
* @phase: the phase of the connection * @phase: the phase of the connection (virDomainEventGraphicsPhase)
* @local: the local server address * @local: the local server address
* @remote: the remote client address * @remote: the remote client address
* @authScheme: the authentication scheme activated * @authScheme: the authentication scheme activated
@@ -4054,7 +4056,7 @@ typedef void (*virConnectDomainEventDiskChangeCallback)(virConnectPtr conn,
void *opaque); void *opaque);
/** /**
* virConnectDomainEventTrayChangeReason: * virDomainEventTrayChangeReason:
* *
* The reason describing why the callback was called * The reason describing why the callback was called
*/ */
@@ -4072,7 +4074,7 @@ typedef enum {
* @conn: connection object * @conn: connection object
* @dom: domain on which the event occurred * @dom: domain on which the event occurred
* @devAlias: device alias * @devAlias: device alias
* @reason: why the tray status was changed? * @reason: why the tray status was changed? (virDomainEventTrayChangeReason)
* @opaque: application specified data * @opaque: application specified data
* *
* This callback occurs when the tray of a removable device is moved. * This callback occurs when the tray of a removable device is moved.
@@ -4653,7 +4655,7 @@ typedef void (*virConnectDomainEventBlockThresholdCallback)(virConnectPtr conn,
* (virDomainMemoryFailureRecipientType) * (virDomainMemoryFailureRecipientType)
* @action: the action of hardware memory failure * @action: the action of hardware memory failure
* (virDomainMemoryFailureActionType) * (virDomainMemoryFailureActionType)
* @flags: the flags of hardware memory failure * @flags: the flags of hardware memory failure (virDomainMemoryFailureFlags)
* @opaque: application specified data * @opaque: application specified data
* *
* The callback occurs when the hypervisor handles the hardware memory * The callback occurs when the hypervisor handles the hardware memory
@@ -5257,6 +5259,19 @@ typedef enum {
# endif # endif
} virDomainDirtyRateStatus; } virDomainDirtyRateStatus;
/**
* virDomainDirtyRateCalcFlags:
*
* Flags OR'ed together to provide specific behaviour when calculating dirty page
* rate for a Domain
*
*/
typedef enum {
VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING = 0, /* default mode - page-sampling */
VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP = 1 << 0, /* dirty-bitmap mode */
VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING = 1 << 1, /* dirty-ring mode */
} virDomainDirtyRateCalcFlags;
int virDomainStartDirtyRateCalc(virDomainPtr domain, int virDomainStartDirtyRateCalc(virDomainPtr domain,
int seconds, int seconds,
unsigned int flags); unsigned int flags);

View File

@@ -262,7 +262,7 @@ typedef enum {
* virConnectNetworkEventLifecycleCallback: * virConnectNetworkEventLifecycleCallback:
* @conn: connection object * @conn: connection object
* @net: network on which the event occurred * @net: network on which the event occurred
* @event: The specific virNetworkEventLifeCycleType which occurred * @event: The specific virNetworkEventLifecycleType which occurred
* @detail: contains some details on the reason of the event. * @detail: contains some details on the reason of the event.
* It will be 0 for the while. * It will be 0 for the while.
* @opaque: application specified data * @opaque: application specified data

View File

@@ -229,7 +229,7 @@ typedef enum {
* virConnectNodeDeviceEventLifecycleCallback: * virConnectNodeDeviceEventLifecycleCallback:
* @conn: connection object * @conn: connection object
* @dev: node device on which the event occurred * @dev: node device on which the event occurred
* @event: The specific virNodeDeviceEventLifeCycleType which occurred * @event: The specific virNodeDeviceEventLifecycleType which occurred
* @detail: contains some details on the reason of the event. * @detail: contains some details on the reason of the event.
* @opaque: application specified data * @opaque: application specified data
* *

Some files were not shown because too many files have changed in this diff Show More