1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-08-18 13:50:02 +03:00

Compare commits

...

526 Commits

Author SHA1 Message Date
aff8961dd1 Release of libvirt-8.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-05-02 13:33:03 +02:00
9684c7c97e Translated using Weblate (Polish)
Currently translated at 22.3% (2331 of 10419 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-04-30 12:51:30 +02:00
d0289cfa0e Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10419 of 10419 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-04-28 14:46:06 +02:00
755bd47b5f Translated using Weblate (Korean)
Currently translated at 100.0% (10419 of 10419 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-04-28 14:46:06 +02:00
413bf1ed54 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-04-28 14:46:06 +02:00
a055308668 tests: don't set G_DEBUG=fatal-warnings on macOS
On macOS when BROKEN_POLL is set in GLib, our tests will periodically
trigger a warning:

  (process:50880): GLib-WARNING **: 02:54:15.272: poll(2) failed due to: Bad file descriptor.

Our code is inherantly racy, calling g_source_destroy which
removes the FD from the event thread poll asynchronously but
we close the FD immediately after g_source_destroy returns.

With poll() this results in POLLNVAL which we're ignoring, but
with select() it generates the BADF error on macOS.

We need to ignore the warnings on macOS to avoid abort()ing
our test programs.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/303
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-04-28 13:45:44 +01:00
d4d5cebdf1 ci: print stack traces on macOS if any tests fail
Mostly the tests should fail cleanly, but sometimes the test might crash
or abort. In this case we'll need to know the stack traces in order to
debug the problem. Fortunately on the Cirrus CI macOS instances, the
crash reporting service is active and saving crashes to the directory
~/Library/Logs/DiagnosticReports/

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-04-28 13:36:34 +01:00
297ef539d0 NEWS: Mention bump of minimum qemu version to qemu-3.1
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-28 13:38:08 +02:00
381498796c cpu: Remove pointless check
These two pointers can never be NULL since they are initialised to a reference
of a struct.  This became apparent when commit 210a195394 added a VIR_DEBUG
which used both pointers because due to the concise condition the compiler saw
that if the "and" part of the condition did short-circuit (and it assumed that
can happen) the second variable would not be initialised, but it is used in the
debugging message, so the build failed with:

  In file included from ../src/cpu/cpu_x86.c:27:
  ../src/cpu/cpu_x86.c: In function ‘virCPUx86DataIsIdentical’:
  ../src/util/virlog.h:79:5: error: ‘bdata’ may be used uninitialized in this
  function [-Werror=maybe-uninitialized]

Fix this by just assigning the helper pointers and remove the condition
altogether.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-27 09:42:59 +02:00
6975ed0a94 scripts: apibuild: add parsing variable's comments
scripts/apibuild.py did not consider exporting external variable's
comments into the XML API. This commits fixes that.

Noe that the way that CParser is designed, it is currently possible to
lose a parsed comment when parsing other fields as self.comment in
several places. I've added a comment to highlight this.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 17:54:33 +02:00
4bce59d963 scripts: apibuild: factor out comment cleaning
So we can use for comments that are being hold in helper variables.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 17:54:30 +02:00
034600e601 scripts: apibuild: parse 'Since' for functions
This patch adds 'version' parameter to generated XML API for functions
and functypes.

The 'version' metadata has been added with e0e0bf6628 by parsing .syms
files. This commit does not override that but it will warn if there is
not 'Since' metadata with new additions.

There is not clear benefit for keeping both. For now, I've added a
warning in case there is a mismatch between the version provided by
.syms and docstring.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 17:54:28 +02:00
b7472a1d79 scripts: apibuild: parse 'Since' for macros
This patch adds 'version' parameter to the generated XML API for
macros

It'll require, for new additions, to add a comment with the version
that the macro was added. An example bellow of code diff and
the change in the generated XML.

Note that the Since tag is removed from the comment as there is a
proper field for it in the XML.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 17:54:27 +02:00
8be766e39c scripts: apibuild: parse 'Since' for typedefs
This patch adds 'version' parameter to the generated XML API for
typedefs

It'll require, for new additions, to add a comment with the version
that the typedef value was added. An example bellow of code diff and
the change in the generated XML.

Note that the Since tag is removed from the comment as there is a
proper field for it in the XML.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 17:54:25 +02:00
2f1c01e672 scripts: apibuild: fix parsing block comments from typedef enum
Removed the TODO as we can rely to the serialize_typedef() the job to
report missing comments.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 17:54:22 +02:00
7958b7d9c5 scripts: apibuild: parse 'Since' version for enums
This patch adds 'version' parameter to the generated XML API for
enums.

It'll require, for new additions, to add a comment with the version
that the enum value was added.

Note that the Since tag is removed from the comment as there is a
proper field for it in the XML.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 17:54:17 +02:00
60d62c5ea1 include: Move version information
It belongs to the comment for VIR_DOMAIN_AFFECT_CONFIG, not to
the unrelated one immediately after it.

Fixes: 807cdbf759
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 17:38:35 +02:00
a45e4b42fe ci: print test suite logs on failure for Cirrus jobs
We don't have access to the 'testlog.txt' file, so we need meson to
print the failures for any broken tests directly.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-04-26 13:17:52 +01:00
85a5d64618 docstring: function: admin: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given function was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 12:31:41 +02:00
c628bce03b docstring: function: libvirt: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given function was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 12:31:41 +02:00
032724b9c4 docstring: typedef: admin: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given typedef was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 12:31:41 +02:00
a1d3324f02 docstring: macros: admin: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given macro was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 12:31:41 +02:00
da6d307a34 docstring: enums: admin: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given enum value was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 12:31:41 +02:00
807cdbf759 docstring: enums: libvirt: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given enum value was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 12:31:41 +02:00
aad910c228 include: Remove more comments between enum values
apibuild.py mistakes these as being a continuation of the
previous comment.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 12:31:41 +02:00
6237f2b84b include: Fix docstring indentation
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 12:31:40 +02:00
7852d30bff docstring: avoid sc_prohibit_nonreentrant in a comment
Follow up patch will add Since metadata to enum values of
virStorageVolWipeAlgorithm.

This patch is necessary to avoid breaking the build with
syntax-check.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 11:25:25 +02:00
1ae8b1df02 docstring: remove comments between enum values
scripts/apibuild.py does not handle well enum's with comments between
values. The outcome depends on whether the enum value has its own
docstring or not and if there is spaces between the enum values or
not.

This commit removes some generic comments that I have spotted.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 11:25:23 +02:00
469f3467e1 docstring: typedef: fix a few version
Fixes: 034432e47b
Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-26 11:25:17 +02:00
ec02f5719a po: Refresh potfile for v8.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-04-26 09:48:53 +02:00
2d345da361 tests: qemucapabilities: Update qemu caps dump for the qemu-7.0.0 release on x86_64
Few minor changes in qemu since the last update:
    - 'cocoa' display and corresponding props (not present in this build)

Changes in build:
    - dbus display driver re-enabled
    - gtk display support re-disabled
    - xen support re-disabled

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-26 09:23:52 +02:00
3974911773 virHostCPUGetCPUIDFilterVolatile: Filter out topology data on AMD
AMD cpus report Core (compute unit) identifiers of the cpu running the
instruction under leaf 0x8000001e. This data is not needed for libvirt
and actually breaks caching of the qemu capabilities where we check that
all of the CPU flags to be identical.

Mask out all of leaf 0x8000001e.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:38:01 +02:00
d946aa27c2 virHostCPUGetCPUID: Limit the buffer size ranges
Raise the lower bound to '64' as that seems to currently be the first
size that can fit the CPU data for a modern cpu.

Lower the upper bound to an arbitrary 65536. So many cpu features ougth
to be enough for everyone.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:38:01 +02:00
fe91f0999c virHostCPUGetCPUID: Fix possible allocation of huge amount of memory
In case when the 'KVM_GET_SUPPORTED_CPUID' ioctl on /dev/kvm would
fail for other reason than the documented E2BIG, our code would continue
looping and calling it while always increasing the memory buffer even
when that will not help.

Rewrite the function to allow another iteration only with the correct
errno.

Additionally rename the 'i' variable to 'alloc_size' as it's not a pure
iterator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:38:01 +02:00
231a6db96d util: virhostcpu: Extract filtering of the returned data from virHostCPUGetCPUID
Move the filtering code into virHostCPUGetCPUIDFilterVolatile.

This also removes a safe but very questionable reuse of 'i' iterator in
the both the top level and nested loop. It's safe for now as the to
level loop will not iterate any more in the current state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:38:01 +02:00
25327c9d69 virHostCPUGetCPUID: Add comment on how KVM_GET_SUPPORTED_CPUID works
The commit adding the code fetching host CPU flags via the
KVM_GET_SUPPORTED_CPUID didn't describe at all why such an alghorithm is
needed.

Add a comment from the documentation outlining how the userspace
function is expected to allocate memory here.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:38:01 +02:00
fe027c9b0a virCPUx86DataGetHost: Fix construction of the returned data
The function returns 'virCPUData' but doesn't do two important steps
which other code takes:

1) leaves with all-zero data is stripped from the XML output
2) the data is expected to be sorted in the array

Now the 'virHostCPUGetCPUID' helper returns both all 0 leaves and
doesn't order them as we expect.

If this is then used in conjunction with 'virCPUx86DataIsIdentical'
together with data which made a roundtrip to XML and back the result
will be always false even if the data itself is identical.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:38:01 +02:00
210a195394 virCPUx86DataIsIdentical: Add debug output
Without this it's impossible to debug scenarios when this function
returns a mismatch but the formatted data looks identical.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:38:01 +02:00
9223ebbc85 virsh: cmdBlockcopy: Fix generator of block copy disk XML
In a recent commit I've attempted to rewrite the XML generator to use
virXMLFormatElement instead of manual steps. Unfortunately the commit
had multiple problems resulting in a garbled XML:

1) in certain cases the wrong buffer was used resulting in misplaced
   snippets
2) the child element buffer was improperly set up so sub-elements were
   not indented

This resulted in following XML being generated:

 $ virsh blockcopy cd vda /tmp/test.copy --raw --print-xml
 type='file''/tmp/test.copy'/>
 <driver type='raw'/>
 <disk>
 <source file=</disk>

To fix this we'll generate the '<source>' element in one go and use the
proper buffer for it and other places.

Fixes: 1cd95f858a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2078274
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:37:05 +02:00
69ee066523 virsh: cmdBlockcopy: Add '--print-xml' flag
Useful for knowing how to construct the XML and debugging.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:37:05 +02:00
f0c3398bc4 tests: qemuxml2*: Add testing of authenticated http/ftp disks
Extend the 'disk-cdrom-network' to cover this instance. This also
validates that the parameters of -blockdev conform to the QAPI schema.

Also add the xml2xml variant of this test case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
ddf5673e4e conf: schema: Allow authentication for FTP(S) and HTTP(S) disks
The code already handles this so we just need to allow it in the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
22eec2ae0e conf: schemas: Split out definition for 'ftp' protocol
Separate it so that further addition can target 'ftp' only.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
ad957d92a6 qemu: domain: Inline qemuDomainStorageSourceHasAuth
The iSCSI hostdev code doesn't require the check for the empty drive
and the check for the protocol because those are already guaranteed at
that point.

In qemuDomainSecretStorageSourcePrepare we don't need to check the
network disk type either as it's now guaranteed by the definition
validator.

Thus both callers can simply check whether src->auth is present and the
helper can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
3172b0ed3f qemu: domain: Inline qemuDomainDiskHasEncryptionSecret
Since we are already checking that the encryption format can be only
_LUKS and _LUKS2 this wrapper function doesn't make much sense any more.

The only one caller can do this internally.

The move of virStorageSourceIsEmpty is correct as there are no secrets
to setup if the disk is empty anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
6fe2ca9ac1 qemuDomainStorageSourceHasAuth: Don't decide based on protocol
The validation should be the only point to decide whether authentication
is supported for a disk backing protocol. The rest of the code can then
simply always enable it.

This also fixes a crash when authentication is requested e.g. for a HTTP
backed disk as the blockdev props formatter expects that it was already
set up.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
4c6498d48a virDomainDiskDefValidateSourceChainOne: Reject authentication for protocols which don't support it
Only certain disk protocols support authentication. Add validation for
this field.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
b1f5f14a5c qemuBlockStorageSourceGetRBDProps: Simplify handling of encryption format
Remove the impossible error message about the 'qcow2' encryption format
not being supported. We validated before that it can't happen.

Additionally the code can be simplified by removing error handling from
impossible code paths as the last resort is virJSONValueCreate not
allowing NULL argument with the 's:' modifier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
487f15b26a qemuDomainValidateStorageSource: Add validation of 'encryption' support
Reject encryption requests for unsupported image format types.

Add negative test for the rejected cases as well as modify
'disk-network-rbd-encryption' case to validate that with librbd
encryption the format doesn't matter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
7c9459b88b qemuDomainValidateStorageSource: Reorganize encryption config validation
Move the two ad-hoc checks below into the block which already tests
whether encryption is requested.

If we first disallow the old-style qcow2 encryption we can remove a
whole block of validation later on.

Also the capability check for qcow2+luks can be simplified by moving it
into the same block.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
a2b85fcc48 conf: schema: Fix alignment in 'diskSourceNetworkProtocolHTTPS' schema definition
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-25 16:34:59 +02:00
3fdedbe6c6 docs: formatdomain: Remove old unreferenced HTML anchors
Most of the anchors that were forward ported to formatdomain.rst when it
was converted are not actually referenced by our documentation. Since
it's now quite some time after the conversion was done we can remove
them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
13608488f8 docs: bugs: Remove raw HTML anchor 'quality'
Modify the gitlab templates linking to it and remove the raw HTML.

Note that also the default template needs to be changed directly in
gitlab.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
f843cdab7f docs: contact: Remove HTML anchors and adjust documents using them
Modify the name of the 'IRC discussion' paragraph to just 'IRC' so that
the links keep working and remove the raw HTML anchors.

Adjustment is needed for documents which were using the '#email' anchor
which has now become '#mailing-lists'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
fb2ebfd927 docs: governance: Remove unused HTML anchors
The 'codeofconduct' anchor is unused as of 523f2de82e .

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
d30be2cf25 docs: uri: Rewrite section about transport protocols and extra parameters
Avoid the table and add a brief description of the transport protocol.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
e40645c105 docs: uri: Move the 'test' hypervisor under a 'local hypervisors heading
Add a new heading 'Local hypervisor URIs' and move the sections about
'qemu', 'xen' and 'test' under it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
339a2e7d65 docs: uri: Consolidate paragraphs on Xen URIs
Mention the legacy 'xen' string usage under the Xen hypervisor uri
section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
a18324f7e8 docs: uri: Remove old 'NULL URI' section
We now have an paragraph about default URI choice if the passed pointer
is NULL. Add the two related bits from the 'NULL and empty string URIs'
from the legacy section to the current one and remove the old stuff.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
ab301453bc docs: Convert 'uri' page to rst
Adjust links in the process.

Note that the conversion to the table is temporary and upcoming patch
will modify it for better readability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
51ed2a01d7 docs: remote: Remove 'Limitations' paragraph
The paragraph talks about lack of fine grained access control which was
already added a long time ago.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
eefe52b8f0 docs: Convert 'remote' page to rst
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
52b1f222df docs: Convert 'storage' page to rst
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
6479917212 docs: storage: rename headers to remove duplicate names
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
fb4d109648 Correct links to TLS certificate setup page
When the setup of TLS certs was originally split out of
'docs/remote.html' ( df99aa311a ) links refering to it were not
fixed.

Adjust them to point to the correct document.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
aa2b8e3b0b docs: formatsecret: Correct link to storage volume XML definition
The anchor name was not fixed when the 'formatstorage' document was
converted to rst.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-25 16:33:01 +02:00
de0a50833f include: Fix vertical spacing between comments and symbols
There should be no empty lines between a docstring comment and
the symbol it documents.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 15:04:07 +02:00
db56fa77e9 include: Fix vertical spacing inside comments
There should be no empty lines between the Since tag in a
docstring comment and the end marker.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 15:04:04 +02:00
02411a4597 docstring: Fix generated documentation of virStorageVolInfoFlags
The API xml description file generator doesn't properly handle cases
when there's either a single comment or mixed use of pre- and post-
comments explaining the values.

Modify the comments to avoid the problem and also append version
information for the exposed values.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 10:04:18 +02:00
4b120e51f1 docstring: libvirt-common: Add 'Since version' metadata
Similarly to previous commits but with the targeting libvirt-common
in a batch.

Either create or append to existing docstring, the version (git tag)
that a given typedef, enum value, macro or function was introduced
in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 10:03:50 +02:00
36dbddec24 docstring: function: lxc: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given function was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 10:02:55 +02:00
5e6a75ae1c docstring: function: qemu: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given function was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 10:02:22 +02:00
d0c2a7c1db docstring: typedef: qemu:: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given typedef was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 10:00:57 +02:00
034432e47b docstring: typedef: libvirt:: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given typedef was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 10:00:34 +02:00
7a1dbde50e docstring: macros: libvirt: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given macro was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 09:52:05 +02:00
c061b628eb docstring: enums: qemu: Add 'Since version' metadata
Either create or append to existing docstring, the version (git tag)
that a given enum value was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 09:45:09 +02:00
89f35b1214 docstring: variable: Move docstring from source to header file
virConnectAuthPtrDefault is the only variable that we export and
with the documentation being at the C file, it makes harder to find
it.

With this patch, the documentation of this variable can be found by
those who look at the header file for guidance plus, it will also be
included in the XML API, as the followup patch will fix apibuild.py
to store what is documented in the header file for this variable.

Note that the apibuild, does not do the same with .c files. It'd
require adding it for (parsing) recursion, similar to what is done
for functions.  Considering the pros/cons, seems more reasonable to
move the docstring to the header file instead.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-22 09:45:00 +02:00
c08dad9ae2 docstring: Fix generated documentation of virConnectListAllNodeDeviceFlags
scripts/apibuild.py does not handle well enum's with comments
between values.  The outcome depends on whether the enum value has
its own docstring or not and if there is spaces between the enum
values or not.

Either way, virConnectListAllNodeDeviceFlags documentation is
explicit that this enum is about filtering node devices. We can move
the information that it is either by "capability" or "active" state
to the block of comment above.

Using git diff --word-diff to show the fixed ouput xml (redacted).

  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE' ... [-info='Inactive-]{+info='Active+} devices'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD' ... [-info='vDPA-]{+info='s390 AP Card+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX' ... [-Queue'/>-]{+Matrix'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE' ... [-Card device'/>-]{+Queue'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV' ... [-info='Mediated-]{+info='CCW+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV' ... [-info='CCW-]{+info='CSS+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM' ... [-info='Capable of scsi_generic'/>-]{+info='DRM device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST' ... [-info='Storage device'/>-]{+info='FC Host Bus Adapter'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV' ... [-info='Capable of mediated devices'/>-]{+info='Mediated device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES' ... [-info='DRM device'/>-]{+info='Capable of mediated devices'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET' ... [-info='USB interface'/>-]{+info='Network device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV' ... [-info='System capability'/>-]{+info='PCI device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI' ... [-Target'/>-]{+device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC' ... [-vport'/>-]{+scsi_generic'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST' ... [-info='Network device'/>-]{+info='SCSI Host Bus Adapter'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET' ... [-Host Bus Adapter'/>-]{+Target'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE' ... [-info='SCSI-]{+info='Storage+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM' ... [-info='filter the devices by cap type'/>-]{+info='System capability'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV' ... [-info='PCI-]{+info='USB+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE' ... [-device'/>-]{+interface'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA' ... [-info='CSS-]{+info='vDPA+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPD' ... [-info='s390 AP Matrix'/>-]{+info='Device with VPD'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS' ... [-info='FC Host Bus Adapter'/>-]{+info='Capable of vport'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_INACTIVE' ... [-info='Device with VPD filter the devices by active state'/>-]{+info='Inactive devices'/>+}

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-21 19:02:08 +02:00
ea42cc69cc qemu: disarm fake reboot flag on reset
This is a quite an old (created at 2016) patch fixing an issue for at
that time contemporary Fedora 23. virsh reboot returns success (yet
after hanging for a while), VM is rebooted sucessfully too but then
shutdown from inside guest causes reboot and not shutdown.

VM has agent installed. So virsh reboot first tries to reboot VM thru
the agent. The agent calls 'shutdown -r' command. Typically it returns
instantly but on this distro for some reason it takes time. I did not
investigate the cause but the command waits in dbus client code,
probably waits for reply. The libvirt waits 60s for agent command to
execute and then errors out. Next reboot API falls back to ACPI shutdown
which returns successfully thus the reboot command return success too.

Yet shutdown command in guest eventually successfull and guest is truly
rebooted. So libvirt does not receive SHUTDOWN event and fake reboot
flag which is armed on fallback path stays armed. Thus next shutdown
from guest leads to reboot.

The issue has 100% repro on Fedora 23. On modern distros I can't
reproduce it at all. Shutdown command is asynchronous and returns
immediately even if I start some service that ignores TERM signal and
thus shutdown procedure waits for 90s (if I not mistaken) before sending
KILL.

Yet I guess it is nice to have this patch to be more robust.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nikolay.shirokovskiy@openvz.org>
2022-04-21 16:25:29 +01:00
04736179b2 qemu: Check usage count of qemu:override node
When <qemu:override> is the only usage of the qemu namespace the entire
section is mistakenly removed. Add check for use count.

Signed-off-by: Justin Gatzen <justin.gatzen@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-21 11:09:54 +02:00
abafffb931 qemu_processpriv: Fix #error message
The point of qemu_processpriv.h file is to allow a small subset
of functions to be called from test suite but not elsewhere. This
is implemented by requiring everybody that includes the file to
define a macro. If not done so, an error is printed at compile
time. However, this error message contains a typo because it
mentions qemu_process_priv.h while the file is called
qemu_processpriv.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-20 14:55:00 +02:00
d97f8807d2 apparmor: Allow swtpm to use its own apparmor profile
Signed-off-by: Lena Voytek <lena.voytek@canonical.com>
2022-04-20 11:55:21 +00:00
eac8de54a6 domain_cgroup: Fix a condition in virDomainCgroupConnectCgroup()
While parts of QEMU's CGroup code were moved under hypervisor
agnostic location (src/hypervisor/) a typo sneaked in. The
inspiration for virDomainCgroupConnectCgroup() comes from
qemuConnectCgroup(). The former is called upon reconnecting to a
running domain (after daemon restart). While the latter returned
early if the daemon was running unprivileged, the former returns
early if the daemon runs privileged. This is obviously wrong,
because root can set up CGroups.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075765
Fixes: 788e2b58cb
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-20 09:52:56 +02:00
136b821f18 Fix copy-paste error in virNetServerSetClientAuthenticated
Fixes: db16792aa9
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 17:07:07 +02:00
e0cafba3c4 docs: Convert 'formatnode' page to rst
The conversion also included a change to the layout of the document.
Specifically the individual 'capabilty' types are now separated under
individual headings rather than part of the original definition list.

This reduces nesting but also esures that proper anchors are generated
automatically.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
2a8946ca7e docs: Convert 'formatnetwork' page to rst
Additionally hyperlinks in other parts of the documentation are updated
to match.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
8b3d9314ae docs: Convert 'formatcaps' page to rst
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
f01f957792 docs: Convert 'formatnwfilter' page to rst
Also adjust direct links from other pages.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
5002ed37f3 docs: pci-hotplug: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
5b1eb476a4 docs: kbase/tlscerts: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
ffef3fcd7b docs: kbase/launch_security_sev: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
a87d8d4277 docs: drvsecret: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
6d9ae27f62 docs: drvnodedev: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
a070fecbf8 docs: drvesx: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
79070dd24c docs: drvbhve: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:48 +02:00
182a12789a docs: drivers: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:47 +02:00
fb0fc32ba9 docs: api: Fix local anchor links
Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:47 +02:00
b7d936c5c2 docs: meson: Sort list of RST files to build
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-19 16:19:47 +02:00
703054cfec qemu: Retire QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-19 15:43:17 +02:00
a277dea0a7 qemu: Stop setting QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-19 15:43:17 +02:00
519a2c5577 qemu: Assume QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT
All QEMU versions we support have this feature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-19 15:43:17 +02:00
b506874f9f qemu: Retire QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-19 15:43:17 +02:00
72427767dd qemu: Stop setting QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-19 15:43:17 +02:00
9f1925d718 qemu: Assume QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT
All QEMU versions we support have this feature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-19 15:43:17 +02:00
4b3b14138b tests: Drop pseries-machine-max-cpu-compat
This was supposed to test the behavior when
QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT is present, but these
days that's always the case and pseries-cpu-compat already
provides all the coverage we need.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-19 15:43:17 +02:00
8f651ad4d2 util: Fix stubs for virProcessGet{Stat,Sched}Info()
Commit d73852c499 moved the original QEMU-specific helpers to
the utils module, which resulted in build failures on non-Unix
platforms due to the unconditional use of Unix-only symbols such
as _SC_CLK_TCK.

To deal with that situation, commit d7c64453aa made the helpers
Linux-only and added stubs for other platforms that, when called,
would always fail with ENOSYS.

However the original helpers had been carefully written so that,
while they would only be able to produce useful output on Linux,
they would still succeed on the other Unix platforms where we
build the QEMU driver.

Restore the original behavior so that calling APIs such as
virDomainGetInfo() can once again work on FreeBSD and macOS.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/298
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-19 15:43:12 +02:00
48b9a6ae31 qemu: Fetch info on NVDIMM-s too when updating memory devices
Sometimes it may come handy to learn what address is a NVDIMM
mapped to inside a guest. While users can provide an address they
want to have NVDIMM mapped to, it's optional. Fortunately, when a
domain is being started we issue the 'query-memory-devices'
monitor command and the reply is the same for 'dimm' and 'nvdimm'
types. Therefore, updating NVDIMM address is trivial.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-19 13:31:53 +02:00
6be7beb3bd vz_driver: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:43 +02:00
c8f5b33631 security_manager: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:43 +02:00
122efa6a07 virnetserverclient: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:43 +02:00
db16792aa9 virnetserver: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:43 +02:00
42fccb4716 virNetServerProcessClients: Remove goto
This gets rid of the goto and prepares the function for automatic
mutex management.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:43 +02:00
0c4b391e2a virstorageobject: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:42 +02:00
bafcc61548 virStorageVolObjNew: Move locking to usage site
This allows a later patch to replace virObjectLock/Unlock
pairs with automatic mutex management code.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:42 +02:00
d12417de63 virStorageVolObjEndAPI: Remove
This allows a later patch to replace virObjectLock/Unlock
pairs with automatic mutex management code.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:42 +02:00
8283450370 virStoragePoolObjAddVol: Simplify error path
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:42 +02:00
a5af1a437c virstorageobj: Replace deprecated virHash functions
Checking for duplicate / NULL keys beforehand will simplify error
handling in a later patch significantly.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-14 19:03:42 +02:00
08e097f605 ci: Drop openSUSE Leap 15.2
It has reached end of life in January 2022.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-14 17:59:34 +02:00
60375a96cd ci: Move codestyle job to openSUSE Leap 15.3
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-14 17:59:33 +02:00
e33366fc19 ci: Add openSUSE Leap 15.3
It was released in June 2021.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-14 17:59:31 +02:00
67e3589120 ci: Add Alpine Linux 3.15
It was released in November 2021.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-14 17:59:30 +02:00
de390af9d7 ci: Simplify Alpine Linux 3.14 definition
Using the extended definition format is only necessary when
the defaults are not good enough, but that's not the case here.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-14 17:59:28 +02:00
766a2d2e52 ci: Drop FreeBSD -CURRENT
All build jobs for the target are explicitly disabled, so
there's no point in keeping the variables file around and we
can simply not mention it in the manifest at all.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-14 17:59:11 +02:00
c08b2ac24f docs: Fix spelling for Homebrew
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-14 11:54:28 +02:00
f647a4b8dd qemu: fix one more race on undefining and create
[1] closes gap in virDomainObjListRemove so that concurrent thread can
not step in and obtain the domain while domain is temporary unlocked. But
there is another gap exist:

thread B - executes create API
thread C - executes undefine API

- thread A executes some job on domain
- threads B and C obtains domain from list and wait for job condition
- thread A finishes its job and C grabs job condition, removes domain
  from list and finishes
- thread B grabs job condition and start the domain, unfortunately
  is not in the list already

[1] commit c7d1c139ca
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Thu Dec 11 11:14:08 2014 +0100

    qemu: avoid rare race when undefining domain

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-13 17:48:46 +03:00
e55302596b qemu: drop needless acquiring job removing domain
Acquiring job introduced in commit [1] to fix a race described in the
commit. Actually it does not help because we get domain in create API
before acuiring job. Then [2] fixed the race but [1] was not reverted even
it is does not required by [2] to work properly.

[1] commit b629c64e5e
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Thu Oct 30 14:38:35 2014 +0100

    qemu: avoid rare race when undefining domain

[2] commit c7d1c139ca
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Thu Dec 11 11:14:08 2014 +0100

    qemu: avoid rare race when undefining domain

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-13 17:46:02 +03:00
b66a36e719 qemu: cleanup code to relece SPICE ports
SPICE ports cleanup looks overly complicated. We can just set *reserved
flags whenever port is reserved (auto or non auto).

Also *Reserved flags are not cleared on stop in case of reconnect with
autoport (flags are set on reconnect in qemuProcessGraphicsReservePorts
call). Yeah config is freed in the end of stopping domain but still.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-13 17:45:56 +03:00
39d93fd8b0 qemu: cleanup code to release VNC websocket port
VNC websocket port cleanup looks a bit repetetive. Let's set websocketReserved
flag whenever we reserve port (auto or not).

Also websocketReserved flag is not cleared on stop in case of reconnect with
auto port (flags is set on reconnect in qemuProcessGraphicsReservePorts
call). Yeah config is freed in the end of stopping domain but still.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-13 17:45:49 +03:00
2f99afbd9a qemu: fix releasing VNC websocket port domain does not own
Scenario is with two domains with same VNC websocket port.

- start first domain
- start second, it will fail as port is occupied

As a result port will be released which breaks port reservation logic.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-13 17:45:39 +03:00
658ce2c3d4 qemu: cleanup code to release VNC port
Code to release VNC port looks repetitive. The reason is there were
originally 2 functions to release ports - for auto and non-auto cases.

Also portReserved flag is not cleared on stop in case of reconnect with
auto port (flags is set on reconnect in qemuProcessGraphicsReservePorts call).
Yeah config is freed in the end of stopping domain but still.

Let's use this flag whenever we reserve port (auto or not). This makes
things clearer.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-13 17:45:12 +03:00
8b60342f76 docs: Adapt to semantic tag usage of docutils-0.17 and later
Docutils-0.17 switched to using <main> instead of a <div
class='document'> and <section> instead of <div class='section'>.

To ensure that our pages still work we need to slightly adapt our XSL
stylesheet to select the <main> tag properly and adapt the CSS to also
select the 'section' element instead of a class and to apply to a <main>
tag with the appropriate names.

Docutils-0.17 also changed to use 'h2' for section heading instead of
'h1'.

Note the styles applied to the 'main' element with certain id can't be
made more universal by just applying to the id itself, as in certain
cases (e.g. 'documentation') we also have sections with that name. This
was previously ensured by also matching the 'document' class which would
make it equal to the 'main' element.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-04-13 13:02:06 +02:00
b27937972f docs/css: Simplify selector for heading of 'knowledge-base' and 'documentation' pages
Select direct 'h1' children of elements named 'knowledge-base' and
'documentation. It's simpler and will also work properly with
docutils-0.17 and later where we don't have a div with class 'document'
wrapping everything.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-04-13 13:02:06 +02:00
67263604e6 docs: man: Add description of 'calc_mode' and 'vcpu.<num>.megabytes_per_second' dirtyrate mode
Commit 42d36b65a3 added new fields to the API docs but didn't add the
virsh man page equivalent.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2073867
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-13 13:00:22 +02:00
a89b17c2a7 docs: kbase: internals: Make 'overview' page useful and link to it
While the content is slightly outdated it's still a good primer on how
an API call traverses through the client library and to the remote
driver.

To make the page useful, this commit:
 - removes the paragraphs which were intended to serve as a directory
   page for the 'internals' subdirectory
 - adds a note saying that some facts might not be up to date
 - adds linking to this page from the kbase directory page
 - adds more monospace formatting around function names

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
b51afd97e5 docs: Convert 'internals' to RST and move it to 'kbase/internal/overview.rst'
Note that this document was not referenced from any top level page. This
patch does a straight conversion and leaves it unreferenced.

Next patch will then modify it to serve as an overview (hence the new
name) of how an API call happens.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
d14ba4ff71 docs: Remove empty 'internals' subfolder
All documents were now moved away so we don't need this any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
2356b07424 docs: Convert 'internals/rpc' page to RST and move it to 'kbase/internals'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
d838439794 docs: Convert 'internals/locking' page to rst and move it to 'kbase/internals'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
dc57ae6fe1 docs: Convert 'internals/eventloop' page to rst and move it to 'kbase/internals'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
879546fdd4 docs: Convert 'internals/command' to rst and move it to 'kbase/internals'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
a2a089c65e docs: Convert 'docs' index page to rst
Along with the conversion we need to adapt the stylesheets to apply to
the new document similarly to how we do that in the knowledge base.

Note that one visible difference is that now a 'Documentation' heading
is visible on top of the page.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
fca82f4e28 docs: kbase: Section of 'internals' documents into a subfolder
Add an 'internals' subfolder to 'docs/kbase' to house all the documents
under internals. The output files are still under 'docs/kbase'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
98ffd82060 docs: Simplify passing of 'href_base' XSL variable
Historically we had two top level XSL files for top level and nested
documents which only differ in what they pass for 'href_base' to the
main 'page.xsl' file.

We can instead pass the variable as argument from the build system so
that we have just one XSL file and also allow for more nested document
trees in the future.

The '404' page is special even with the current XSL way so we add a
special case for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
c72249674d kbase: index: Split off 'internals' section
Add a separate column of documents regarding internals of libvirt and
move the 'migrationinternals' and 'incrementalbackupinternals' pages
under the new heading.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 12:53:32 +02:00
7be42d7d0b conf: Move validation checks from virDomainDiskDefIotuneParse into domain_validate.c
Move validation from virDomainDiskDefIotuneParse into the validation callback.

Signed-off-by: Moteen Shah <codeguy.moteen@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-12 10:24:47 +02:00
df757e88fd virsh: fix event registration for single event
Allocate a larger 'data' array than strictly needed
for simplicity and use 'ndata' as the index when
filling it to put the single event at the first unused
place, instead of at its index in the virshDomainEventCallbacks
array.

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

Fixes: c6bb274693
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-11 17:03:49 +02:00
c11fb2132f nwfilterStateInitialize: Simplify and fix error handling
Under certain circumstances nwfilterStateInitialize could leak memory:
If e.g. the call to virNWFilterConfLayerInit fails, the error path
err_techdrivers_shutdown does not free the previously allocated memory
held in driver->stateDir.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-08 16:43:16 +02:00
8bbb8d6a58 virNWFilterDriverState: Destroy mutex safely
Allow nwfilterStateCleanupLocked to be called on a partially constructed
driver object.

This enables the next patch to simplify and fix error handling in
nwfilterStateInitialize.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-08 16:43:16 +02:00
008162e12a nwfilterDriverRemoveDBusMatches: Prevent unsubscribing from null id
Allow nwfilterDriverRemoveDBusMatches to be called without
nwfilterDriverInstallDBusMatches being called previously.

This enables a later patch to use nwfilterDriverRemoveDBusMatches
as a cleanup function safely.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-08 16:43:16 +02:00
879ecd602f virNWFilterSnoopState: Prevent mutex leak
virNWFilterDHCPSnoopShutdown would never destroy the mutexes created
in virNWFilterDHCPSnoopInit. Additionally, if in virNWFilterDHCPSnoopInit
the call to virMutexInitRecursive succeeds and the call to virMutexInit
fails, this would lead to either virNWFilterSnoopState.snoopLock being
initialized twice or virNWFilterSnoopState.activeLock destroyed without
being initialized first.

This enables a later patch to use virNWFilterDHCPSnoopShutdown as a
cleanup function safely, as it is a no-op if virNWFilterSnoopState was
not yet initialized.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-08 16:43:16 +02:00
db2989c3a5 virNWFilterObjListFree: Prevent null pointer derefernce
Allow virNWFilterObjListFree to be called with a NULL argument.
This enables a later patch to use virNWFilterObjListFree as a
cleanup function safely, as it is a no-op if virNWFilterObj was
not yet initialized.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-08 16:43:16 +02:00
74884bef1e qemu: Drop QEMU_CAPS_INCOMING_DEFER
The capability is not used anymore since "-incoming defer" is supported
by all QEMU versions we care about.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-08 10:27:02 +02:00
fa9c730bdd qemu: Simplify qemuProcessIncomingDef
All QEMU releases currently supported by libvirt already understand
"-incoming defer". We can drop the code handling "-incoming URI".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-04-08 10:27:02 +02:00
f7ed8d929f vboxSetBootDeviceOrder: Remove whitespace alignment in VIR_DEBUG statements
Don't try to align the output, it's not future-proof and it's for
debugging only.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-08 09:32:47 +02:00
3dd6f0e3de virDomainLoaderDefFormat: Use modern XML formatting approach
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-08 09:32:47 +02:00
68d1056392 virXMLFormatElement: Introduce virXMLFormatElementInternal
The new function aggregates the internal working of virXMLFormatElement
and virXMLFormatElementEmpty and also allows skipping the newline
after the opening tag to allow using this helper also in cases where we
don't format any child elements but directly a value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-08 09:32:47 +02:00
a8682ab791 drivers: Group global features together
All these features are supposed to be handled by the call to
virDriverFeatureIsGlobal() placed right above the switch
statement, so if any of them is actually encountered inside
the switch statement it means there's a bug in the driver and
we should report an error.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-07 18:59:08 +02:00
4e6d0da550 docs: Convert 'formatstoragecaps' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-07 17:15:52 +02:00
9c54820eb5 docs: Convert 'formatdomaincaps' to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-07 17:15:52 +02:00
cc05c4e5e4 ci: Refresh Dockerfiles and vars files
In this batch:
- dnsmasq is dropped as build dependency
- Alpine Edge rpcgen package collision fix

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-07 16:19:42 +02:00
89a95e8bd2 docs: convert 'csharp' page to rst
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-04-07 15:10:26 +02:00
30e2f85373 docs: csharp: Remove project-specific information
The enumeration of functions and types supported by the bindings was
moved to the 'README.rst' file in the 'libvirt-csharp' repo:

https://gitlab.com/libvirt/libvirt-csharp/-/merge_requests/8

Remove the corresponding bits from the main repository.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-04-07 15:10:26 +02:00
99d7ca5a4c docs: convert 'windows' page to rst
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-04-07 15:10:26 +02:00
b74d418b03 docs: Move 'tlscerts' page to 'kbase/'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-04-07 15:10:26 +02:00
04deb69bd3 docs: convert 'tlscerts' page to rst
Note that links from the first table leading to sections of this
document further below were removed for simplicity.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-04-07 15:10:26 +02:00
d2978caea7 docs: convert 'python' page to rst
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-04-07 15:10:26 +02:00
6c5ee55c3d docs: convert 'dbus' page to rst
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-04-07 15:10:26 +02:00
629282d884 lib: Set up cpuset controller for restrictive numatune
The aim of 'restrictive' numatune mode is to rely solely on
CGroups to have QEMU running on configured NUMA nodes.  However,
we were never setting the cpuset controller when a domain was
starting up. We are doing so only when
virDomainSetNumaParameters() is called (aka live pinning).

This is obviously wrong. Fortunately, fix is simple as
'restrictive' is similar to 'strict' - every location where
VIR_DOMAIN_NUMATUNE_MEM_STRICT occurs can be audited and
VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE case can be added.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2070380
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-07 12:12:11 +02:00
5c6622eff7 ch: Explicitly forbid live changing nodeset for strict numatune
This is similar to v7.10.0-354-g06f405c627 except this time it
fixes CH driver.

With strict numatune we can't guarantee that all memory is moved
to new location. Therefore, let's forbid moving memory in that
case. However, allow it for restrictive mode, which is documented
to be best effort.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-07 12:12:08 +02:00
85a6474907 hypervisor: Drop dead code in virDomainCgroupSetupGlobalCpuCgroup()
Since its introduction in v1.3.2-43-gef1fa55e46 there is a dead
code in virDomainCgroupSetupGlobalCpuCgroup() (well,
qemuSetupGlobalCpuCgroup() back then). The code formats NUMA
nodeset but never sets it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-07 12:12:05 +02:00
cc4542e5d3 lib: Don't short circuit around virDomainCgroupSetupVcpuBW()
The virDomainCgroupSetupVcpuBW() is a NOP if both period and
quota to set are zero. There's no need to check in all the
callers for this special case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-07 12:11:50 +02:00
19a5b054ac lib: Use virReportSystemError() more
Instead of reporting virReportError(..., g_strerror(), ...) let's
use proper virReportSystemError(). Generated with help of cocci:

  @@
  expression c;
  @@
      <...
  -   virReportError(c,
  +   virReportSystemError(errno,
                         ...,
  -                      g_strerror(errno),
                         ...);
      ...>

But then I had to hand fix format strings, because I'm not sure
if cocci even knows how to do that. And even if it did, I surely
don't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-07 12:11:22 +02:00
4f8ae0353f tools: snapshot: remove pointless checks
There's no need to check whether a flag is not set just to set it
in that case.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-07 12:02:31 +02:00
9890eb0056 qemu: Rename @main variable in qemuDomainRemoveLogs()
Older GCC fails to understand that 'char *main' is a variable and
not main() function. Rename the variable to appease old GCC.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
2022-04-06 10:25:15 +02:00
7940fe02d5 AUTHORS: change my (Nikolay Shirokovskiy) email
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
2022-04-06 11:00:53 +03:00
4fba5770d2 tools: support --remove-logs flag on destroing domain
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-06 10:48:04 +03:00
a414cb76e3 qemu: support VIR_DOMAIN_DESTROY_REMOVE_LOGS flag
Note that we attempt to remove logs only if virtlogd is in use.
Otherwise we do not know the pattern for rotated files.

For example for VM named "foo" we can not use "foo.log*" pattern to
remove rotated logs as we can have VM named "foo.log" with log
"foo.log.log".  We can add extra check that filename does not end with
".log" but for VM "foo.log" we can have rotated log "foo.log.log.1". Ok
let's check we don't have "log" in filename part corresponging to * but
what if someone will use logrotate with "%Y.log-%m-%d" 'dateformat'
option. In this case the check will exclude proper rotated files.

Yes, the last example if quite artificial but it shows it is difficult
to find out correctly rotated files when rotated files pattern is not
known. Thus the above decision only to support case with virtlogd when
we know the pattern.

Another reason for not removing log files when logrotate is present is
that due to races some files can escape deletion. For example foo.log.3
will be rotated to foo.log.4 after removing function will read directory
files and thus foo.log.4 will not be deleted.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-06 10:48:04 +03:00
ce3f707af5 libvirt: introduce VIR_DOMAIN_DESTROY_REMOVE_LOGS flag
If this flag is set on calling virDomainDestroyFlags flags then remove
per domain logs if possible.

This can be used by libguestfs to delete logs for temporary domain.
Otherwise such logs will stay wasting disk resources.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-06 10:48:04 +03:00
5e9d8f094c virsh: Remove any reference of KVM device assignment
The KVM device assignment was removed in v5.7.0-rc1~103 but virsh
and its manpage still mention it. Don't do that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-04-06 09:40:13 +02:00
e53c02ea20 virportallocator: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
5b48de594d ch_monitor: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
8c6e726f7d datatypes: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
61d51f2d15 vbox_common: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
a38f4d53f8 qemu_agent: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
dd057af7ae node_device_udev: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
86f048c85e interface_backend_netcf: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
29bb566a22 node_device_driver: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
1e4d85af32 bridge_driver: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
bc2d929e95 virnetdaemon: Use automatic mutex management
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:59:08 +02:00
4e4def21d3 qemu_command: Generate cmd line for virtio-net.rss hash properties
Also, validate that the requested feature is supported by QEMU.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:36:30 +02:00
7ab013655d qemu_capabilities: Add capability for virtio-net "rss" and "hash".
Introduce QEMU_CAPS_VIRTIO_RSS capability which tracks
virtio-net.rss attribute introduced in qemu-5.2.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:36:29 +02:00
a8b1cbe77e domain_conf: Add configs for virtio net RSS and Hash report.
Added "rss" and "rss_hash_report" configuration that should be
used with qemu virtio RSS. Both options are triswitches. Used as
"driver" options and affects only NIC with model type "virtio".
In other patches - options should turn on virtio-net RSS and hash
properties.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 15:36:27 +02:00
167ac6354c network: Convert managed property of hostdev-pci ports correctly
virNetworkForwardDef.managed is a bool but
virNetworkPortDef.hostdevpci.managed is a virTristateBool, which
means that the current code performs the following incorrect
conversion:

  false -> BOOL_ABSENT
  true  -> BOOL_YES

Using the virTristateBoolFromBool() helper solves the issue.

Fixes: 6cb0ec48bd
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:35 +02:00
06f5c092b8 conf: Format managed property of hostdev-pci ports correctly
The property is parsed using virTristateBoolTypeFromString() but
formatted as if it was a regular bool, which results in the
following incorrect conversion:

  BOOL_ABSENT -> managed='no'
  BOOL_YES    -> managed='yes'
  BOOL_NO     -> managed='yes'

Use the virTristateBoolTypeToString() helper to ensure the
setting can survive a roundtrip conversion.

Fixes: 4b4a981d60
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:33 +02:00
77c638c3c7 conf: Restore error checking in VideoAccelDefParseXML()
The check that ensures that at least one property among accel3d,
accel2d and rendernode has been provided by the user had been
lost during the conversion to virXMLPropTristateBool().

Fixes: 0fe2d8dd33
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:31 +02:00
2ad7039e7c qemu: Don't ignore XMLParseAllowReboot() errors
The function may fail and report an error, in which case we
should not just continue as if nothing happened.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:30 +02:00
d83d9dde1d qemu: Accept <allowReboot value='default'/>
Up until a few commits ago, libvirt produced this XML and so
we need to be able to read it back to prevent a bunch of

  error : virXMLPropEnumInternal:516 : XML error: Invalid value
  for attribute 'value' in element 'allowReboot': 'default'

messages from being logged on daemon upgrade when there are
running guests.

Fixes: 0fe2d8dd33
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:28 +02:00
fd3ca84c3e util: Introduce virXMLPropTristateBoolAllowDefault()
We need it for a single scenario in which prop='default' has to
be treated as valid input.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:24 +02:00
c49651ac17 qemu: Format <allowReboot> conditionally
If the value is VIR_TRISTATE_BOOL_ABSENT we should just omit
the element entirely.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:22 +02:00
817aa45025 conf: Use virTristateBoolToBool() more
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:21 +02:00
f655f27b66 conf: Don't pass PROP_NONZERO to virXMLPropTristateBool()
It's the default behavior.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 13:40:07 +02:00
67c77744d7 tests: Fixing compiler warning in cputest
Found when building on Fedora 36 on s390x.

 C compiler for the host machine: gcc (gcc 12.0.1 "gcc (GCC) 12.0.1 20220308 (Red Hat 12.0.1-0)")
 C linker for the host machine: gcc ld.bfd 2.37-24

 In function ‘cpuTestUpdateLiveCompare’,
     inlined from ‘cpuTestUpdateLive’ at ../dist-unpack/libvirt-8.2.5/tests/cputest.c:784:12:
 ../dist-unpack/libvirt-8.2.5/tests/cputest.c:696:21: warning: potential null pointer dereference [-Wnull-dereference]
   696 |              featAct->policy == VIR_CPU_FEATURE_REQUIRE) ||
       |              ~~~~~~~^~~~~~~~

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-05 10:32:41 +02:00
5d0eeb8cd7 virsh: Provide completer for PCI backend drivers
Related: https://gitlab.com/libvirt/libvirt/-/issues/9
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-04 16:30:48 +02:00
4f0480a11c virsh: Provide completer for CPU architectures
Related: https://gitlab.com/libvirt/libvirt/-/issues/9
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-04 16:30:44 +02:00
11ad758910 virsh: Provide completer for virtualization types
Related: https://gitlab.com/libvirt/libvirt/-/issues/9
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-04 16:30:40 +02:00
5c03346184 qemu: capabilities: Retire QEMU_CAPS_STORAGE_WERROR and QEMU_CAPS_USB_STORAGE_WERROR
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
d3f7b6fe2f qemu: Always assume QEMU_CAPS_STORAGE_WERROR
All supported QEMUs now accept werror/rerror as argument for the
frontend disk device, so we can remove the old code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
cb1d044e38 qemu: capabilities: Retire QEMU_CAPS_OVERCOMMIT
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
edfd78d7f6 qemu: command: Always assume QEMU_CAPS_OVERCOMMIT
Starting with qemu-3.1 we always have the '-overcommit' argument and use
it instead of '-realtime'. Remove the capability check and fix all
fake-caps tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
22acc863c7 qemu: capabilities: Retire QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_MIGRATABLE
The flag was based on a version check which no longer made sense. Remove
the flag by replacing it's only use by an arch-check which is equivalent
at this point.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
b72318f36d qemu: capabilities: Retire QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
47b6829edc qemu: Always assume QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
All qemu versions now support FD passing either directly or via FDset.
Assume that we always have this capability so that we can simplify
chardev handling in many cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
0ce4f98d82 qemu: capabilities: Remove probing of QEMU_CAPS_NUMA via 'query-command-line-options'
For modern qemu versions we use the presence of 'set-numa-node' qmp
command.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
b948802ced qemu: capabilities: Remove tautological version checks
Some version checks no longer make sense as the minimum supported qemu
is now qemu-3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
6b62a8e977 qemu: Formally deprecate support for qemu < 3.1
As of April 23 2022, Ubuntu 20.04 will be out for two years, which means
we no longer have to support Ubuntu 18.04 along with qemu-2.11 shipped
with it.

This then brings the minimum qemu version we have to support to
qemu-3.1:

   Debian 10/Stable: 3.1
 OpenSUSE Leap 15.3: 5.2
       Ubuntu 20.04: 4.2
    RHEL/Centos 8.4: 4.2

Next event in this space will be 2023/07/06 when Debian 11 will be out
for two years.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
931c1de5d3 tests: qemucapabilities: Remove qemu-3.0 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
c7e09b7b5f tests: qemucapabilities: Remove qemu-2.12 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
04748f0cef tests: qemucapabilities: Remove qemu-2.11 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
e6c8705b7f qemuxml2agvtest: Retire tests based on qemu-3.0
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
6139ac8b5e qemuxml2agvtest: Retire tests based on qemu-2.12
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
7674bafe4f qemuxml2agvtest: Retire tests based on qemu-2.11
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
e3ab7900da ci: Drop Ubuntu 1804
As of April 23 2022, Ubuntu 20.04 will be out for two years, which per
our platform support policy means we no longer have to support
Ubuntu 18.04.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
950b1c115c news: Document virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 10:36:30 +02:00
c377822460 docs: Document virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 10:36:30 +02:00
19734c3050 qemu: Generate command line for virtio-iommu
https://bugzilla.redhat.com/show_bug.cgi?id=1653327

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 10:36:28 +02:00
e015606984 tests: Add test for virtio-iommu address
virtio-iommu needs to be an integrated device, and our address
assignment code will make sure that is the case. If the user has
provided an explicit address, however, we should make sure any
addresses pointing to a different bus are rejected.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:31:00 +02:00
fc6cde6cb1 qemu: Validate address type for virtio-iommu
virtio-iommu is a PCI device and attempts to use a different
address type should be rejected.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:31:00 +02:00
f119336162 qemu: Assign PCI address to virtio-iommu
The device is configured to be an integrated endpoint, as is
necessary for it to function correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
b0eb1e193f conf: Add virDomainDeviceInfo to virDomainIOMMUDef
This is needed so that IOMMU devices can have addresses.

Existing IOMMU devices (intel-iommu and SMMUv3) are system
devices and as such don't have an address associated to them, but
virtio-iommu is a PCI device and needs one.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
7620b1a09a qemu: Validate use of ACPI with virtio-iommu
virtio-iommu doesn't work without ACPI, so we need to make sure
the latter is enabled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
28ddd917be qemu: Validate capabilities for virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
d8072c0015 qemu: Validate machine type used with virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
428ba3608a tests: Add test cases for virtio-iommu
These represent valid uses of the device.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
579f430e3e conf: Introduce virtio model for <iommu>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
672c227037 qemu: Introduce QEMU_CAPS_VIRTIO_IOMMU_BOOT_BYPASS
This capability detects the availability of the boot-bypass
property of the virtio-iommu-pci device.

This property was only introduced in QEMU 7.0 but, since the
device has been around for much longer, we end up querying its
properties for several more releases. As I don't have convenient
access to the 10+ binaries necessary to regenerate the replies,
I just put some fake data in there.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
fd6442f381 qemu: Introduce QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI
This capability detects the availability of the virtio-iommu-pci
device.

Note that, while this device is present even in somewhat old
versions of QEMU, it's only some recent changes that made it
actually usable for our purposes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
99a042ea13 qemu: Tweak some code
The altered code is functionally equivalent to the previous one,
but it's already laid down in a way that will make further
changes easier and less messy.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
afd03c21e4 conf: Introduce VIR_PCI_CONNECT_INTEGRATED
This new flag can be used to convince the PCI address assignment
algorithm to place a device directly on the root bus. It will be
used to implement support for virtio-iommu, which needs to be an
integrated device in order to work correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
b7f5ad4610 tests: Add capabilities for QEMU 7.0.0 on aarch64
The QEMU binary is built from the v7.0.0-rc2 tag.

This causes the argument to -device to be generated in JSON
format, same as what 1a691fe1c8 has done for x86_64.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-01 19:29:50 +02:00
c3d0236e67 tests: Update capabilities for QEMU 7.0.0 on ppc64
The QEMU binary is built from the v7.0.0-rc2 tag.

Some of the additional capabilities that show up are a
consequence of more features being enabled in this build than
in the one used to generate the replies initially.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-01 19:29:23 +02:00
fd10c72f1c tests: Update capabilities for QEMU 7.0.0 on x86_64
The QEMU binary is built from the v7.0.0-rc2 tag.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-01 18:35:44 +02:00
fb7016a704 qemu: Dissolve virQEMUCapsFindBinaryForArch()
With the recent changes, virQEMUCapsGetDefaultEmulator() has
become a trivial wrapper around this function, as well as its
only caller. Clean up the situation by merging the two.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
2022-04-01 18:35:27 +02:00
0a301b1969 qemu: Don't assume that /usr/libexec/qemu-kvm exists
On a machine where no QEMU binary is installed, we end up logging

  libvirtd: Cannot check QEMU binary /usr/libexec/qemu-kvm:
  No such file or directory

which is not very useful in general, and downright misleading in
the case of operating systems that are not derived from RHEL.

This is a consequence of treating that specific path in a different
way from all other possible QEMU binary paths, and specifically of
not checking whether the file actually exists but sort of assuming
that it must do if we haven't found another QEMU binary earlier.

Address the issue by trying this path out in
virQEMUCapsFindBinaryForArch(), along with all the other possible
ones, and making sure it exists before returning it.

Reported-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
2022-04-01 18:35:21 +02:00
c890c4962f qemu: Clean up virQEMUCapsFindBinaryForArch()
If we get to the bottom of the function we know that none of the
attempts to locate a QEMU binary has been successful, so we can
simply return NULL directly.

This makes it unnecessary variable used to store the path, for
which we can use a more descriptive name.

Lastly, comparing with NULL explicitly is somewhat uncommon in
libvirt and more verbose than the equivalent implicit comparison,
so get rid of it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
2022-04-01 18:34:54 +02:00
f3248cca90 docs: Convert 'php' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:20 +02:00
cac7f5dfb4 docs: logging: Replace example by link to kbase/debuglogs.html
The 'debuglogs' knowledge base page has way more info and examples on
how to set logging use it instead of the ad-hoc examples.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:20 +02:00
e2ba9d1525 docs: Convert 'logging' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:20 +02:00
1b2477c674 docs: Convert 'java' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:20 +02:00
8ec0e9a800 docs: Convert 'hooks' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:20 +02:00
9c2876f58c docs: formatstorageencryption: Re-style encryption type headers
Use backticks to force monospace font instead of double quotes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:20 +02:00
8d21bc3455 docs: formatstorageencryption: Drop empty 'default' paragraph
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:20 +02:00
4dfbf28e6a docs: Convert 'formatstorageencryption' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
ca5ddcc748 docs: Fix heading of 'formatnetworkport' page
The top level heading didn't contain the word 'port'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
8ebafe5178 docs: Convert 'formatnetworkport' to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
63b12805f2 docs: Convert 'format' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
51213f4d29 docs: Convert 'firewall' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
5da6e17313 docs: Convert 'drvxen' page to rST
Fix the referenced anchor in 'formatdomain.rst' right away.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
1832e5ec6d docs: Convert 'drvvmware' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
8971cb41c5 docs: Convert 'drvvirtuozzo' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
96a0436afb docs: Convert 'drvvbox' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
ada572f045 docs: Convert 'drvtest' page to rST
The first sentence was moved up a paragraph to stop treating the first
sub-heading as a page subtitle.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
849e56390e docs: Convert 'drvsecret' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
01682a0c20 docs: Convert 'drvopenvz' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
19b1fef54a docs: Convert 'drvnodedev' page to rST
Fix one cross link anchor along with the conversion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
05a514b0b3 docs: Convert 'drvlxc' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
c4611b327e docs: Convert 'drvhyperv' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
f5d7825d35 docs: Convert 'drvesx' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
4717e591cb docs: Convert 'drvbhyve' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
42b5e496a7 docs: Convert 'cgroups' page to rST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
492576edb8 docs: Remove empty unreferenced 'drvremote' page
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-04-01 16:33:19 +02:00
b94239a61e meson: Use dicts to initialize cfg_data objects
Instead of creating an empty object and then setting keys one
at a time, it is possible to pass a dict object to
configuration_data(). This is nicer because it doesn't require
repeating the name of the cfg_data object over and over.

There is one exception: the 'conf' object, where we store values
that are used directly by C code. In that case, using a dict
object is not feasible for two reasons: first of all, replacing
the set_quoted() calls would result in awkward code with a lot
of calls to format(); moreover, since code that modifies it is
sprinkled all over the place, refactoring it would probably
make things more complicated rather than simpler.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-04-01 15:33:19 +02:00
64a7b8203b qemu: Use real defaults for user and group in qemu.conf
The default values used by the library are determined at configure
time based on a number of factors, and we should reflect them in
the installed configuration file to make the comments it contains
more useful.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/263
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-01 15:32:48 +02:00
9f1bd0fb97 util: Improve macOS workaround
Since the workaround is specific to macOS, only disable compiler
warnings when building on that platform.

While at it, update the comment to reflect the fact that the
workaround is needed for all versions of the OS, including the
modern ones that we currently target.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-04-01 15:32:20 +02:00
3fa815f4f7 qemu: Rename virDomainAsyncJobPhase{From,To}String
Recent refactor (v8.1.0-217-ga193f4bef6) generalized job related enums
and functions by changing "qemu" prefix to "vir" and moving them to
src/hypervisor/domain_job.[ch]. This was in most cases a good thing, but
async job phases are driver specific and the corresponding functions
remained in src/qemu/qemu_domainjob.[ch], but still their prefix was
changed to "vir". Let's change it back to "qemu".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 12:33:03 +02:00
0e4ee0ed3b Post-release version bump to 8.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-04-01 12:29:50 +02:00
d8a915bcec Release of libvirt-8.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-04-01 12:23:38 +02:00
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
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
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
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
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
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
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
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
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
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
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
2ddf220718 po: Refresh potfile for v8.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-03-28 13:53:45 +02:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
e1754a1a5b Fix typo in NEWS
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2022-03-02 09:17:30 +01:00
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
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
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
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
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
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
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
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
1196 changed files with 82024 additions and 267923 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:
- containers
- builds
- integration_tests
- sanity_checks
.script_variables: &script_variables |
@ -14,7 +15,9 @@ stages:
export VIR_TEST_VERBOSE="1"
export VIR_TEST_DEBUG="1"
include: '/ci/gitlab.yml'
include:
- '/ci/gitlab.yml'
- '/ci/integration.yml'
.native_build_job:
extends: .gitlab_native_build_job
@ -30,7 +33,8 @@ include: '/ci/gitlab.yml'
- meson dist -C build --no-tests
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
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
meson compile -C build;
meson test -C build --no-suite syntax-check --print-errorlogs;
@ -76,9 +80,9 @@ website:
codestyle:
stage: sanity_checks
image: $CI_REGISTRY_IMAGE/ci-opensuse-leap-152:latest
image: $CI_REGISTRY_IMAGE/ci-opensuse-leap-153:latest
needs:
- x86_64-opensuse-leap-152-container
- x86_64-opensuse-leap-153-container
before_script:
- *script_variables
script:

View File

@ -1,4 +1,4 @@
<!-- See https://libvirt.org/bugs.html#quality for guidance -->
<!-- See https://libvirt.org/bugs.html#how-to-file-high-quality-bug-reports -->
## Software environment
- Operating system:

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 }

View File

@ -25,7 +25,7 @@ The primary maintainers and people with commit access rights:
* Laine Stump <laine@redhat.com>
* Martin Kletzander <mkletzan@redhat.com>
* Michal Prívozník <mprivozn@redhat.com>
* Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
* Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
* Pavel Hrdina <phrdina@redhat.com>
* Peter Krempa <pkrempa@redhat.com>
* Pino Toscano <ptoscano@redhat.com>

106
NEWS.rst
View File

@ -8,6 +8,110 @@ the changes introduced by each of them.
For a more fine-grained view, use the `git log`_.
v8.3.0 (2022-05-02)
===================
* **Removed features**
* qemu: Remove support for QEMU < 3.1
In accordance with our platform support policy, the oldest supported QEMU
version is now bumped from 2.11 to 3.1.
* **New features**
* qemu: Introduce support for virtio-iommu
This IOMMU device can be used with both Q35 and ARM virt guests.
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)
===================
@ -63,7 +167,7 @@ v8.1.0 (2022-03-01)
* 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 neiter systemd nor the daemons clean up the
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``.

View File

@ -1,14 +1,7 @@
syntax_check_conf = configuration_data()
syntax_check_conf.set('top_srcdir', meson.source_root())
syntax_check_conf.set('top_builddir', meson.build_root())
flake8_path = ''
if flake8_prog.found()
flake8_path = flake8_prog.path()
endif
syntax_check_conf.set('flake8_path', flake8_path)
syntax_check_conf.set('runutf8', ' '.join(runutf8))
syntax_check_conf.set('PYTHON3', python3_prog.path())
if host_machine.system() == 'freebsd' or host_machine.system() == 'darwin'
make_prog = find_program('gmake')
@ -33,8 +26,15 @@ else
grep_prog = find_program('grep')
endif
syntax_check_conf.set('GREP', grep_prog.path())
syntax_check_conf.set('SED', sed_prog.path())
syntax_check_conf = configuration_data({
'top_srcdir': meson.source_root(),
'top_builddir': meson.build_root(),
'flake8_path': flake8_path,
'runutf8': ' '.join(runutf8),
'PYTHON3': python3_prog.path(),
'GREP': grep_prog.path(),
'SED': sed_prog.path(),
})
configure_file(
input: 'Makefile.in',

View File

@ -921,7 +921,6 @@ http_sites += www.javvin.com
# 404 links
http_sites += publib.boulder.ibm.com
http_sites += kerneltrap.org
http_sites += valloric.github.io
http_sites += www.microsoft.com
http_sites += xenbits.xen.org
http_sites += lovezutto.googlepages.com
@ -1549,7 +1548,7 @@ sc_spacing-check:
{ echo '$(ME): incorrect formatting' 1>&2; exit 1; }
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
sc_header-ifdef:
@ -1620,7 +1619,7 @@ exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic = \
^src/rpc/gendispatch\.pl$$
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 = \
^build-aux/syntax-check\.mk$$
@ -1713,7 +1712,7 @@ exclude_file_name_regexp--sc_prohibit_backslash_alignment = \
^build-aux/syntax-check\.mk$$
exclude_file_name_regexp--sc_prohibit_select = \
^build-aux/syntax-check\.mk|src/util/vireventglibwatch\.c$$
^build-aux/syntax-check\.mk|src/util/vireventglibwatch\.c|tests/meson\.build$$
exclude_file_name_regexp--sc_prohibit_config_h_in_headers = \
^config\.h$$

View File

@ -26,4 +26,4 @@ build_task:
- meson setup build
- meson dist -C build --no-tests
- meson compile -C build
- meson test -C build --no-suite syntax-check
- meson test -C build --no-suite syntax-check --print-errorlogs || (cat ~/Library/Logs/DiagnosticReports/*.crash && exit 1)

View File

@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja'
PACKAGING_COMMAND='pkg'
PIP3='/usr/local/bin/pip-3.8'
PKGS='augeas bash-completion ca_root_nss ccache codespell cppi curl cyrus-sasl diffutils diskscrub dnsmasq fusefs-libs gettext git glib gmake gnugrep gnutls gsed libpcap libpciaccess libssh libssh2 libxml2 libxslt meson ninja perl5 pkgconf polkit py38-docutils py38-flake8 python3 qemu readline yajl'
PKGS='augeas bash-completion ca_root_nss ccache codespell cppi curl cyrus-sasl diffutils diskscrub fusefs-libs gettext git glib gmake gnugrep gnutls gsed libpcap libpciaccess libssh libssh2 libxml2 libxslt meson ninja perl5 pkgconf polkit py38-docutils py38-flake8 python3 qemu readline yajl'
PYPI_PKGS=''
PYTHON='/usr/local/bin/python3'

View File

@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja'
PACKAGING_COMMAND='pkg'
PIP3='/usr/local/bin/pip-3.8'
PKGS='augeas bash-completion ca_root_nss ccache codespell cppi curl cyrus-sasl diffutils diskscrub dnsmasq fusefs-libs gettext git glib gmake gnugrep gnutls gsed libpcap libpciaccess libssh libssh2 libxml2 libxslt meson ninja perl5 pkgconf polkit py38-docutils py38-flake8 python3 qemu readline yajl'
PKGS='augeas bash-completion ca_root_nss ccache codespell cppi curl cyrus-sasl diffutils diskscrub fusefs-libs gettext git glib gmake gnugrep gnutls gsed libpcap libpciaccess libssh libssh2 libxml2 libxslt meson ninja perl5 pkgconf polkit py38-docutils py38-flake8 python3 qemu readline yajl'
PYPI_PKGS=''
PYTHON='/usr/local/bin/python3'

View File

@ -1,16 +0,0 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool manifest ci/manifest.yml
#
# https://gitlab.com/libvirt/libvirt-ci
CCACHE='/usr/local/bin/ccache'
CPAN_PKGS=''
CROSS_PKGS=''
MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja'
PACKAGING_COMMAND='pkg'
PIP3='/usr/local/bin/pip-3.8'
PKGS='augeas bash-completion ca_root_nss ccache codespell cppi curl cyrus-sasl diffutils diskscrub dnsmasq fusefs-libs gettext git glib gmake gnugrep gnutls gsed libpcap libpciaccess libssh libssh2 libxml2 libxslt meson ninja perl5 pkgconf polkit py38-docutils py38-flake8 python3 qemu readline yajl'
PYPI_PKGS=''
PYTHON='/usr/local/bin/python3'

View File

@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja'
PACKAGING_COMMAND='brew'
PIP3='/usr/local/bin/pip3'
PKGS='augeas bash-completion ccache codespell cppi curl diffutils dnsmasq docutils flake8 gettext git glib gnu-sed gnutls grep libiscsi libpcap libssh libssh2 libxml2 libxslt make meson ninja perl pkg-config python3 qemu readline rpcgen scrub yajl'
PKGS='augeas bash-completion ccache codespell cppi curl diffutils docutils flake8 gettext git glib gnu-sed gnutls grep libiscsi libpcap libssh libssh2 libxml2 libxslt make meson ninja perl pkg-config python3 qemu readline rpcgen scrub yajl'
PYPI_PKGS=''
PYTHON='/usr/local/bin/python3'

View File

@ -22,7 +22,6 @@ RUN dnf update -y && \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

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: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 \
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,80 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool manifest ci/manifest.yml
#
# https://gitlab.com/libvirt/libvirt-ci
FROM docker.io/library/alpine:3.15
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 \
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,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 \
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

@ -6,7 +6,7 @@
FROM quay.io/centos/centos:stream8
RUN dnf update -y && \
RUN dnf distro-sync -y && \
dnf install 'dnf-command(config-manager)' -y && \
dnf config-manager --set-enabled -y powertools && \
dnf install -y centos-release-advanced-virtualization && \
@ -22,7 +22,6 @@ RUN dnf update -y && \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -6,7 +6,7 @@
FROM quay.io/centos/centos:stream9
RUN dnf update -y && \
RUN dnf distro-sync -y && \
dnf install 'dnf-command(config-manager)' -y && \
dnf config-manager --set-enabled -y crb && \
dnf install -y \
@ -22,7 +22,6 @@ RUN dnf update -y && \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -20,7 +20,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -20,7 +20,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -19,7 +19,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -20,7 +20,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -30,7 +30,6 @@ exec "$@"' > /usr/bin/nosync && \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -26,7 +26,6 @@ exec "$@"' > /usr/bin/nosync && \
cpp \
cppi \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -26,7 +26,6 @@ exec "$@"' > /usr/bin/nosync && \
cpp \
cppi \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -30,7 +30,6 @@ exec "$@"' > /usr/bin/nosync && \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -27,7 +27,6 @@ exec "$@"' > /usr/bin/nosync && \
cpp \
cppi \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -27,7 +27,6 @@ exec "$@"' > /usr/bin/nosync && \
cpp \
cppi \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -31,7 +31,6 @@ exec "$@"' > /usr/bin/nosync && \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
firewalld-filesystem \

View File

@ -4,7 +4,7 @@
#
# https://gitlab.com/libvirt/libvirt-ci
FROM registry.opensuse.org/opensuse/leap:15.2
FROM registry.opensuse.org/opensuse/leap:15.3
RUN zypper update -y && \
zypper install -y \
@ -21,7 +21,6 @@ RUN zypper update -y && \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
fuse-devel \

View File

@ -21,7 +21,6 @@ RUN zypper dist-upgrade -y && \
cyrus-sasl-devel \
device-mapper-devel \
diffutils \
dnsmasq \
dwarves \
ebtables \
fuse-devel \

View File

@ -1,108 +0,0 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool manifest ci/manifest.yml
#
# https://gitlab.com/libvirt/libvirt-ci
FROM docker.io/library/ubuntu:18.04
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y eatmydata && \
eatmydata apt-get dist-upgrade -y && \
eatmydata apt-get install --no-install-recommends -y \
augeas-lenses \
augeas-tools \
bash-completion \
ca-certificates \
ccache \
clang \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \
gcc \
gettext \
git \
glusterfs-common \
grep \
iproute2 \
iptables \
kmod \
libacl1-dev \
libapparmor-dev \
libattr1-dev \
libaudit-dev \
libblkid-dev \
libc-dev-bin \
libc6-dev \
libcap-ng-dev \
libcurl4-gnutls-dev \
libdevmapper-dev \
libfuse-dev \
libglib2.0-dev \
libgnutls28-dev \
libiscsi-dev \
libnetcf-dev \
libnl-3-dev \
libnl-route-3-dev \
libnuma-dev \
libopenwsman-dev \
libparted-dev \
libpcap0.8-dev \
libpciaccess-dev \
librbd-dev \
libreadline-dev \
libsanlock-dev \
libsasl2-dev \
libselinux1-dev \
libssh-dev \
libssh2-1-dev \
libtirpc-dev \
libudev-dev \
libxen-dev \
libxml2-dev \
libxml2-utils \
libyajl-dev \
locales \
lvm2 \
make \
nfs-common \
ninja-build \
numad \
open-iscsi \
perl-base \
pkgconf \
policykit-1 \
python3 \
python3-docutils \
python3-pip \
python3-setuptools \
python3-wheel \
qemu-utils \
scrub \
sed \
sheepdog \
systemtap-sdt-dev \
wireshark-dev \
xsltproc && \
eatmydata apt-get autoremove -y && \
eatmydata apt-get autoclean -y && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales && \
dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /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
RUN pip3 install meson==0.56.0
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

@ -20,7 +20,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
codespell \
cpp \
diffutils \
dnsmasq-base \
dwarves \
ebtables \
flake8 \

View File

@ -10,8 +10,7 @@
stage: containers
needs: []
services:
- name: registry.gitlab.com/libvirt/libvirt-ci/docker-dind:master
alias: docker
- docker:dind
before_script:
- export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest"
- export COMMON_TAG="$CI_REGISTRY/libvirt/libvirt/ci-$NAME:latest"
@ -87,6 +86,27 @@ x86_64-almalinux-8-container:
NAME: almalinux-8
x86_64-alpine-314-container:
extends: .container_job
allow_failure: false
variables:
NAME: alpine-314
x86_64-alpine-315-container:
extends: .container_job
allow_failure: false
variables:
NAME: alpine-315
x86_64-alpine-edge-container:
extends: .container_job
allow_failure: true
variables:
NAME: alpine-edge
x86_64-centos-stream-8-container:
extends: .container_job
allow_failure: false
@ -143,11 +163,11 @@ x86_64-fedora-rawhide-container:
NAME: fedora-rawhide
x86_64-opensuse-leap-152-container:
x86_64-opensuse-leap-153-container:
extends: .container_job
allow_failure: false
variables:
NAME: opensuse-leap-152
NAME: opensuse-leap-153
x86_64-opensuse-tumbleweed-container:
@ -157,13 +177,6 @@ x86_64-opensuse-tumbleweed-container:
NAME: opensuse-tumbleweed
x86_64-ubuntu-1804-container:
extends: .container_job
allow_failure: false
variables:
NAME: ubuntu-1804
x86_64-ubuntu-2004-container:
extends: .container_job
allow_failure: false
@ -400,6 +413,33 @@ x86_64-almalinux-8-clang:
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-315:
extends: .native_build_job
needs:
- x86_64-alpine-315-container
allow_failure: false
variables:
NAME: alpine-315
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:
extends: .native_build_job
needs:
@ -407,6 +447,10 @@ x86_64-centos-stream-8:
allow_failure: false
variables:
NAME: centos-stream-8
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
x86_64-centos-stream-9:
@ -416,6 +460,10 @@ x86_64-centos-stream-9:
allow_failure: false
variables:
NAME: centos-stream-9
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
x86_64-debian-10:
@ -461,6 +509,10 @@ x86_64-fedora-34:
allow_failure: false
variables:
NAME: fedora-34
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
x86_64-fedora-35:
@ -470,6 +522,10 @@ x86_64-fedora-35:
allow_failure: false
variables:
NAME: fedora-35
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
x86_64-fedora-rawhide:
@ -492,13 +548,13 @@ x86_64-fedora-rawhide-clang:
RPM: skip
x86_64-opensuse-leap-152:
x86_64-opensuse-leap-153:
extends: .native_build_job
needs:
- x86_64-opensuse-leap-152-container
- x86_64-opensuse-leap-153-container
allow_failure: false
variables:
NAME: opensuse-leap-152
NAME: opensuse-leap-153
RPM: skip
@ -512,15 +568,6 @@ x86_64-opensuse-tumbleweed:
RPM: skip
x86_64-ubuntu-1804:
extends: .native_build_job
needs:
- x86_64-ubuntu-1804-container
allow_failure: false
variables:
NAME: ubuntu-1804
x86_64-ubuntu-2004:
extends: .native_build_job
needs:

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

@ -18,13 +18,31 @@ targets:
RPM: skip
CC: clang
alpine-314: x86_64
alpine-315: x86_64
alpine-edge:
jobs:
- arch: x86_64
allow-failure: true
centos-stream-8:
jobs:
- arch: x86_64
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
centos-stream-9:
jobs:
- arch: x86_64
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
debian-10:
jobs:
- arch: x86_64
@ -126,11 +144,21 @@ targets:
- arch: s390x
allow-failure: true
fedora-34: x86_64
fedora-34:
jobs:
- arch: x86_64
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
fedora-35:
jobs:
- arch: x86_64
artifacts:
expire_in: 1 day
paths:
- libvirt-rpms
- arch: mingw32
allow-failure: true
@ -161,13 +189,7 @@ targets:
freebsd-13: x86_64
freebsd-current:
jobs:
- arch: x86_64
allow-failure: true
builds: False
opensuse-leap-152:
opensuse-leap-153:
jobs:
- arch: x86_64
variables:
@ -187,8 +209,6 @@ targets:
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
ubuntu-1804: x86_64
ubuntu-2004:
jobs:
- arch: x86_64

View File

@ -219,7 +219,7 @@ Daemon and Remote Access
Access to libvirt drivers is primarily handled by the libvirtd daemon
through the `remote <remote.html>`__ driver via an
`RPC <internals/rpc.html>`__. Some hypervisors do support client-side
`RPC <kbase/internals/rpc.html>`__. Some hypervisors do support client-side
connections and responses, such as Test, OpenVZ, VMware, VirtualBox
(vbox), ESX, Hyper-V, Xen, and Virtuozzo. The libvirtd daemon service is
started on the host at system boot time and can also be restarted at any
@ -234,8 +234,9 @@ The libvirt client `applications <apps.html>`__ use a `URI <uri.html>`__
to obtain the ``virConnectPtr``. The ``virConnectPtr`` keeps track of
the driver connection plus a variety of other connections (network,
interface, storage, etc.). The ``virConnectPtr`` is then used as a
parameter to other virtualization `functions <#Functions>`__. Depending
upon the driver being used, calls will be routed through the remote
parameter to other virtualization functions
(see `Functions and Naming Conventions`_).
Depending upon the driver being used, calls will be routed through the remote
driver to the libvirtd daemon. The daemon will reference the connection
specific driver in order to retrieve the requested information and then
pass back status and/or data through the connection back to the

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
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
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>

120
docs/bugs.rst Normal file
View File

@ -0,0 +1,120 @@
=============
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.
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

@ -1,424 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Control Groups Resource Management</h1>
<ul id="toc"></ul>
<p>
The QEMU and LXC drivers make use of the Linux "Control Groups" facility
for applying resource management to their virtual machines and containers.
</p>
<h2><a id="requiredControllers">Required controllers</a></h2>
<p>
The control groups filesystem supports multiple "controllers". By default
the init system (such as systemd) should mount all controllers compiled
into the kernel at <code>/sys/fs/cgroup/$CONTROLLER-NAME</code>. Libvirt
will never attempt to mount any controllers itself, merely detect where
they are mounted.
</p>
<p>
The QEMU driver is capable of using the <code>cpuset</code>,
<code>cpu</code>, <code>cpuacct</code>, <code>memory</code>,
<code>blkio</code> and <code>devices</code> controllers.
None of them are compulsory. If any controller is not mounted,
the resource management APIs which use it will cease to operate.
It is possible to explicitly turn off use of a controller,
even when mounted, via the <code>/etc/libvirt/qemu.conf</code>
configuration file.
</p>
<p>
The LXC driver is capable of using the <code>cpuset</code>,
<code>cpu</code>, <code>cpuacct</code>, <code>freezer</code>,
<code>memory</code>, <code>blkio</code> and <code>devices</code>
controllers. The <code>cpuacct</code>, <code>devices</code>
and <code>memory</code> controllers are compulsory. Without
them mounted, no containers can be started. If any of the
other controllers are not mounted, the resource management APIs
which use them will cease to operate.
</p>
<h2><a id="currentLayout">Current cgroups layout</a></h2>
<p>
As of libvirt 1.0.5 or later, the cgroups layout created by libvirt has been
simplified, in order to facilitate the setup of resource control policies by
administrators / management applications. The new layout is based on the concepts
of "partitions" and "consumers". A "consumer" is a cgroup which holds the
processes for a single virtual machine or container. A "partition" is a cgroup
which does not contain any processes, but can have resource controls applied.
A "partition" will have zero or more child directories which may be either
"consumer" or "partition".
</p>
<p>
As of libvirt 1.1.1 or later, the cgroups layout will have some slight
differences when running on a host with systemd 205 or later. The overall
tree structure is the same, but there are some differences in the naming
conventions for the cgroup directories. Thus the following docs split
in two, one describing systemd hosts and the other non-systemd hosts.
</p>
<h3><a id="currentLayoutSystemd">Systemd cgroups integration</a></h3>
<p>
On hosts which use systemd, each consumer maps to a systemd scope unit,
while partitions map to a system slice unit.
</p>
<h4><a id="systemdScope">Systemd scope naming</a></h4>
<p>
The systemd convention is for the scope name of virtual machines / containers
to be of the general format <code>machine-$NAME.scope</code>. Libvirt forms the
<code>$NAME</code> part of this by concatenating the driver type with the id
and truncated name of the guest, and then escaping any systemd reserved
characters.
So for a guest <code>demo</code> running under the <code>lxc</code> driver,
we get a <code>$NAME</code> of <code>lxc-12345-demo</code> which when escaped
is <code>lxc\x2d12345\x2ddemo</code>. So the complete scope name is
<code>machine-lxc\x2d12345\x2ddemo.scope</code>.
The scope names map directly to the cgroup directory names.
</p>
<h4><a id="systemdSlice">Systemd slice naming</a></h4>
<p>
The systemd convention for slice naming is that a slice should include the
name of all of its parents prepended on its own name. So for a libvirt
partition <code>/machine/engineering/testing</code>, the slice name will
be <code>machine-engineering-testing.slice</code>. Again the slice names
map directly to the cgroup directory names. Systemd creates three top level
slices by default, <code>system.slice</code> <code>user.slice</code> and
<code>machine.slice</code>. All virtual machines or containers created
by libvirt will be associated with <code>machine.slice</code> by default.
</p>
<h4><a id="systemdLayout">Systemd cgroup layout</a></h4>
<p>
Given this, a possible systemd cgroups layout involving 3 qemu guests,
3 lxc containers and 3 custom child slices, would be:
</p>
<pre>
$ROOT
|
+- system.slice
| |
| +- libvirtd.service
|
+- machine.slice
|
+- machine-qemu\x2d1\x2dvm1.scope
| |
| +- libvirt
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- machine-qemu\x2d2\x2dvm2.scope
| |
| +- libvirt
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- machine-qemu\x2d3\x2dvm3.scope
| |
| +- libvirt
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- machine-engineering.slice
| |
| +- machine-engineering-testing.slice
| | |
| | +- machine-lxc\x2d11111\x2dcontainer1.scope
| |
| +- machine-engineering-production.slice
| |
| +- machine-lxc\x2d22222\x2dcontainer2.scope
|
+- machine-marketing.slice
|
+- machine-lxc\x2d33333\x2dcontainer3.scope
</pre>
<p>
Prior libvirt 7.1.0 the topology doesn't have extra
<code>libvirt</code> directory.
</p>
<h3><a id="currentLayoutGeneric">Non-systemd cgroups layout</a></h3>
<p>
On hosts which do not use systemd, each consumer has a corresponding cgroup
named <code>$VMNAME.libvirt-{qemu,lxc}</code>. Each consumer is associated
with exactly one partition, which also have a corresponding cgroup usually
named <code>$PARTNAME.partition</code>. The exceptions to this naming rule
is the top level default partition for virtual machines and containers
<code>/machine</code>.
</p>
<p>
Given this, a possible non-systemd cgroups layout involving 3 qemu guests,
3 lxc containers and 2 custom child slices, would be:
</p>
<pre>
$ROOT
|
+- machine
|
+- qemu-1-vm1.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- qeme-2-vm2.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- qemu-3-vm3.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- engineering.partition
| |
| +- testing.partition
| | |
| | +- lxc-11111-container1.libvirt-lxc
| |
| +- production.partition
| |
| +- lxc-22222-container2.libvirt-lxc
|
+- marketing.partition
|
+- lxc-33333-container3.libvirt-lxc
</pre>
<h2><a id="customPartiton">Using custom partitions</a></h2>
<p>
If there is a need to apply resource constraints to groups of
virtual machines or containers, then the single default
partition <code>/machine</code> may not be sufficiently
flexible. The administrator may wish to sub-divide the
default partition, for example into "testing" and "production"
partitions, and then assign each guest to a specific
sub-partition. This is achieved via a small element addition
to the guest domain XML config, just below the main <code>domain</code>
element
</p>
<pre>
...
&lt;resource&gt;
&lt;partition&gt;/machine/production&lt;/partition&gt;
&lt;/resource&gt;
...
</pre>
<p>
Note that the partition names in the guest XML are using a
generic naming format, not the low level naming convention
required by the underlying host OS. That is, you should not include
any of the <code>.partition</code> or <code>.slice</code>
suffixes in the XML config. Given a partition name
<code>/machine/production</code>, libvirt will automatically
apply the platform specific translation required to get
<code>/machine/production.partition</code> (non-systemd)
or <code>/machine.slice/machine-production.slice</code>
(systemd) as the underlying cgroup name
</p>
<p>
Libvirt will not auto-create the cgroups directory to back
this partition. In the future, libvirt / virsh will provide
APIs / commands to create custom partitions, but currently
this is left as an exercise for the administrator.
</p>
<p>
<strong>Note:</strong> the ability to place guests in custom
partitions is only available with libvirt &gt;= 1.0.5, using
the new cgroup layout. The legacy cgroups layout described
later in this document did not support customization per guest.
</p>
<h3><a id="createSystemd">Creating custom partitions (systemd)</a></h3>
<p>
Given the XML config above, the admin on a systemd based host would
need to create a unit file <code>/etc/systemd/system/machine-production.slice</code>
</p>
<pre>
# cat &gt; /etc/systemd/system/machine-testing.slice &lt;&lt;EOF
[Unit]
Description=VM testing slice
Before=slices.target
Wants=machine.slice
EOF
# systemctl start machine-testing.slice
</pre>
<h3><a id="createNonSystemd">Creating custom partitions (non-systemd)</a></h3>
<p>
Given the XML config above, the admin on a non-systemd based host
would need to create a cgroup named '/machine/production.partition'
</p>
<pre>
# cd /sys/fs/cgroup
# for i in blkio cpu,cpuacct cpuset devices freezer memory net_cls perf_event
do
mkdir $i/machine/production.partition
done
# for i in cpuset.cpus cpuset.mems
do
cat cpuset/machine/$i > cpuset/machine/production.partition/$i
done
</pre>
<h2><a id="resourceAPIs">Resource management APIs/commands</a></h2>
<p>
Since libvirt aims to provide an API which is portable across
hypervisors, the concept of cgroups is not exposed directly
in the API or XML configuration. It is considered to be an
internal implementation detail. Instead libvirt provides a
set of APIs for applying resource controls, which are then
mapped to corresponding cgroup tunables
</p>
<h3>Scheduler tuning</h3>
<p>
Parameters from the "cpu" controller are exposed via the
<code>schedinfo</code> command in virsh.
</p>
<pre>
# virsh schedinfo demo
Scheduler : posix
cpu_shares : 1024
vcpu_period : 100000
vcpu_quota : -1
emulator_period: 100000
emulator_quota : -1</pre>
<h3>Block I/O tuning</h3>
<p>
Parameters from the "blkio" controller are exposed via the
<code>bkliotune</code> command in virsh.
</p>
<pre>
# virsh blkiotune demo
weight : 500
device_weight : </pre>
<h3>Memory tuning</h3>
<p>
Parameters from the "memory" controller are exposed via the
<code>memtune</code> command in virsh.
</p>
<pre>
# virsh memtune demo
hard_limit : 580192
soft_limit : unlimited
swap_hard_limit: unlimited
</pre>
<h3>Network tuning</h3>
<p>
The <code>net_cls</code> is not currently used. Instead traffic
filter policies are set directly against individual virtual
network interfaces.
</p>
<h2><a id="legacyLayout">Legacy cgroups layout</a></h2>
<p>
Prior to libvirt 1.0.5, the cgroups layout created by libvirt was different
from that described above, and did not allow for administrator customization.
Libvirt used a fixed, 3-level hierarchy <code>libvirt/{qemu,lxc}/$VMNAME</code>
which was rooted at the point in the hierarchy where libvirtd itself was
located. So if libvirtd was placed at <code>/system/libvirtd.service</code>
by systemd, the groups for each virtual machine / container would be located
at <code>/system/libvirtd.service/libvirt/{qemu,lxc}/$VMNAME</code>. In addition
to this, the QEMU drivers further child groups for each vCPU thread and the
emulator thread(s). This leads to a hierarchy that looked like
</p>
<pre>
$ROOT
|
+- system
|
+- libvirtd.service
|
+- libvirt
|
+- qemu
| |
| +- vm1
| | |
| | +- emulator
| | +- vcpu0
| | +- vcpu1
| |
| +- vm2
| | |
| | +- emulator
| | +- vcpu0
| | +- vcpu1
| |
| +- vm3
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- lxc
|
+- container1
|
+- container2
|
+- container3
</pre>
<p>
Although current releases are much improved, historically the use of deep
hierarchies has had a significant negative impact on the kernel scalability.
The legacy libvirt cgroups layout highlighted these problems, to the detriment
of the performance of virtual machines and containers.
</p>
</body>
</html>

364
docs/cgroups.rst Normal file
View File

@ -0,0 +1,364 @@
==================================
Control Groups Resource Management
==================================
.. contents::
The QEMU and LXC drivers make use of the Linux "Control Groups" facility for
applying resource management to their virtual machines and containers.
Required controllers
--------------------
The control groups filesystem supports multiple "controllers". By default the
init system (such as systemd) should mount all controllers compiled into the
kernel at ``/sys/fs/cgroup/$CONTROLLER-NAME``. Libvirt will never attempt to
mount any controllers itself, merely detect where they are mounted.
The QEMU driver is capable of using the ``cpuset``, ``cpu``, ``cpuacct``,
``memory``, ``blkio`` and ``devices`` controllers. None of them are compulsory.
If any controller is not mounted, the resource management APIs which use it will
cease to operate. It is possible to explicitly turn off use of a controller,
even when mounted, via the ``/etc/libvirt/qemu.conf`` configuration file.
The LXC driver is capable of using the ``cpuset``, ``cpu``, ``cpuacct``,
``freezer``, ``memory``, ``blkio`` and ``devices`` controllers. The ``cpuacct``,
``devices`` and ``memory`` controllers are compulsory. Without them mounted, no
containers can be started. If any of the other controllers are not mounted, the
resource management APIs which use them will cease to operate.
Current cgroups layout
----------------------
As of libvirt 1.0.5 or later, the cgroups layout created by libvirt has been
simplified, in order to facilitate the setup of resource control policies by
administrators / management applications. The new layout is based on the
concepts of "partitions" and "consumers". A "consumer" is a cgroup which holds
the processes for a single virtual machine or container. A "partition" is a
cgroup which does not contain any processes, but can have resource controls
applied. A "partition" will have zero or more child directories which may be
either "consumer" or "partition".
As of libvirt 1.1.1 or later, the cgroups layout will have some slight
differences when running on a host with systemd 205 or later. The overall tree
structure is the same, but there are some differences in the naming conventions
for the cgroup directories. Thus the following docs split in two, one describing
systemd hosts and the other non-systemd hosts.
Systemd cgroups integration
~~~~~~~~~~~~~~~~~~~~~~~~~~~
On hosts which use systemd, each consumer maps to a systemd scope unit, while
partitions map to a system slice unit.
Systemd scope naming
^^^^^^^^^^^^^^^^^^^^
The systemd convention is for the scope name of virtual machines / containers to
be of the general format ``machine-$NAME.scope``. Libvirt forms the ``$NAME``
part of this by concatenating the driver type with the id and truncated name of
the guest, and then escaping any systemd reserved characters. So for a guest
``demo`` running under the ``lxc`` driver, we get a ``$NAME`` of
``lxc-12345-demo`` which when escaped is ``lxc\x2d12345\x2ddemo``. So the
complete scope name is ``machine-lxc\x2d12345\x2ddemo.scope``. The scope names
map directly to the cgroup directory names.
Systemd slice naming
^^^^^^^^^^^^^^^^^^^^
The systemd convention for slice naming is that a slice should include the name
of all of its parents prepended on its own name. So for a libvirt partition
``/machine/engineering/testing``, the slice name will be
``machine-engineering-testing.slice``. Again the slice names map directly to the
cgroup directory names. Systemd creates three top level slices by default,
``system.slice`` ``user.slice`` and ``machine.slice``. All virtual machines or
containers created by libvirt will be associated with ``machine.slice`` by
default.
Systemd cgroup layout
^^^^^^^^^^^^^^^^^^^^^
Given this, a possible systemd cgroups layout involving 3 qemu guests, 3 lxc
containers and 3 custom child slices, would be:
::
$ROOT
|
+- system.slice
| |
| +- libvirtd.service
|
+- machine.slice
|
+- machine-qemu\x2d1\x2dvm1.scope
| |
| +- libvirt
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- machine-qemu\x2d2\x2dvm2.scope
| |
| +- libvirt
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- machine-qemu\x2d3\x2dvm3.scope
| |
| +- libvirt
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- machine-engineering.slice
| |
| +- machine-engineering-testing.slice
| | |
| | +- machine-lxc\x2d11111\x2dcontainer1.scope
| |
| +- machine-engineering-production.slice
| |
| +- machine-lxc\x2d22222\x2dcontainer2.scope
|
+- machine-marketing.slice
|
+- machine-lxc\x2d33333\x2dcontainer3.scope
Prior libvirt 7.1.0 the topology doesn't have extra ``libvirt`` directory.
Non-systemd cgroups layout
~~~~~~~~~~~~~~~~~~~~~~~~~~
On hosts which do not use systemd, each consumer has a corresponding cgroup
named ``$VMNAME.libvirt-{qemu,lxc}``. Each consumer is associated with exactly
one partition, which also have a corresponding cgroup usually named
``$PARTNAME.partition``. The exceptions to this naming rule is the top level
default partition for virtual machines and containers ``/machine``.
Given this, a possible non-systemd cgroups layout involving 3 qemu guests, 3 lxc
containers and 2 custom child slices, would be:
::
$ROOT
|
+- machine
|
+- qemu-1-vm1.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- qeme-2-vm2.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- qemu-3-vm3.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- engineering.partition
| |
| +- testing.partition
| | |
| | +- lxc-11111-container1.libvirt-lxc
| |
| +- production.partition
| |
| +- lxc-22222-container2.libvirt-lxc
|
+- marketing.partition
|
+- lxc-33333-container3.libvirt-lxc
Using custom partitions
-----------------------
If there is a need to apply resource constraints to groups of virtual machines
or containers, then the single default partition ``/machine`` may not be
sufficiently flexible. The administrator may wish to sub-divide the default
partition, for example into "testing" and "production" partitions, and then
assign each guest to a specific sub-partition. This is achieved via a small
element addition to the guest domain XML config, just below the main ``domain``
element
::
...
<resource>
<partition>/machine/production</partition>
</resource>
...
Note that the partition names in the guest XML are using a generic naming
format, not the low level naming convention required by the underlying host OS.
That is, you should not include any of the ``.partition`` or ``.slice`` suffixes
in the XML config. Given a partition name ``/machine/production``, libvirt will
automatically apply the platform specific translation required to get
``/machine/production.partition`` (non-systemd) or
``/machine.slice/machine-production.slice`` (systemd) as the underlying cgroup
name
Libvirt will not auto-create the cgroups directory to back this partition. In
the future, libvirt / virsh will provide APIs / commands to create custom
partitions, but currently this is left as an exercise for the administrator.
**Note:** the ability to place guests in custom partitions is only available
with libvirt >= 1.0.5, using the new cgroup layout. The legacy cgroups layout
described later in this document did not support customization per guest.
Creating custom partitions (systemd)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Given the XML config above, the admin on a systemd based host would need to
create a unit file ``/etc/systemd/system/machine-production.slice``
::
# cat > /etc/systemd/system/machine-testing.slice <<EOF
[Unit]
Description=VM testing slice
Before=slices.target
Wants=machine.slice
EOF
# systemctl start machine-testing.slice
Creating custom partitions (non-systemd)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Given the XML config above, the admin on a non-systemd based host would need to
create a cgroup named '/machine/production.partition'
::
# cd /sys/fs/cgroup
# for i in blkio cpu,cpuacct cpuset devices freezer memory net_cls perf_event
do
mkdir $i/machine/production.partition
done
# for i in cpuset.cpus cpuset.mems
do
cat cpuset/machine/$i > cpuset/machine/production.partition/$i
done
Resource management APIs/commands
---------------------------------
Since libvirt aims to provide an API which is portable across hypervisors, the
concept of cgroups is not exposed directly in the API or XML configuration. It
is considered to be an internal implementation detail. Instead libvirt provides
a set of APIs for applying resource controls, which are then mapped to
corresponding cgroup tunables
Scheduler tuning
~~~~~~~~~~~~~~~~
Parameters from the "cpu" controller are exposed via the ``schedinfo`` command
in virsh.
::
# virsh schedinfo demo
Scheduler : posix
cpu_shares : 1024
vcpu_period : 100000
vcpu_quota : -1
emulator_period: 100000
emulator_quota : -1
Block I/O tuning
~~~~~~~~~~~~~~~~
Parameters from the "blkio" controller are exposed via the ``bkliotune`` command
in virsh.
::
# virsh blkiotune demo
weight : 500
device_weight :
Memory tuning
~~~~~~~~~~~~~
Parameters from the "memory" controller are exposed via the ``memtune`` command
in virsh.
::
# virsh memtune demo
hard_limit : 580192
soft_limit : unlimited
swap_hard_limit: unlimited
Network tuning
~~~~~~~~~~~~~~
The ``net_cls`` is not currently used. Instead traffic filter policies are set
directly against individual virtual network interfaces.
Legacy cgroups layout
---------------------
Prior to libvirt 1.0.5, the cgroups layout created by libvirt was different from
that described above, and did not allow for administrator customization. Libvirt
used a fixed, 3-level hierarchy ``libvirt/{qemu,lxc}/$VMNAME`` which was rooted
at the point in the hierarchy where libvirtd itself was located. So if libvirtd
was placed at ``/system/libvirtd.service`` by systemd, the groups for each
virtual machine / container would be located at
``/system/libvirtd.service/libvirt/{qemu,lxc}/$VMNAME``. In addition to this,
the QEMU drivers further child groups for each vCPU thread and the emulator
thread(s). This leads to a hierarchy that looked like
::
$ROOT
|
+- system
|
+- libvirtd.service
|
+- libvirt
|
+- qemu
| |
| +- vm1
| | |
| | +- emulator
| | +- vcpu0
| | +- vcpu1
| |
| +- vm2
| | |
| | +- emulator
| | +- vcpu0
| | +- vcpu1
| |
| +- vm3
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- lxc
|
+- container1
|
+- container2
|
+- container3
Although current releases are much improved, historically the use of deep
hierarchies has had a significant negative impact on the kernel scalability. The
legacy libvirt cgroups layout highlighted these problems, to the detriment of
the performance of virtual machines and containers.

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>

87
docs/contact.rst Normal file
View File

@ -0,0 +1,87 @@
===================================
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.
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.
IRC
---
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#mailing-lists>`__, 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#mailing-lists>`__ 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

@ -1,470 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>C# API bindings</h1>
<ul id="toc"></ul>
<h2><a id="description">Description</a></h2>
<p>
The C# libvirt bindings are a class library. They use a Microsoft
Visual Studio project architecture, and have been tested with Windows
.NET, and Mono, on both Linux and Windows.
</p>
<p>
Compiling them produces <b>LibvirtBindings.dll</b>, which can
be added as a .NET reference to any .NET project needing access
to libvirt.
</p>
<h2><a id="requirements">Requirements</a></h2>
<p>
These bindings depend upon the libvirt libraries being installed.
</p>
<p>
In the .NET case, this is <b>libvirt-0.dll</b>, produced from
compiling libvirt for windows.
</p>
<h2><a id="git">GIT source repository</a></h2>
<p>
The C# bindings source code is maintained in a <a
href="https://git-scm.com/">git</a> repository available on
<a href="https://gitlab.com/libvirt/libvirt-csharp">gitlab.com</a>:
</p>
<pre>
git clone https://gitlab.com/libvirt/libvirt-csharp.git
</pre>
<h2><a id="usage">Usage</a></h2>
<p>
The libvirt C# bindings class library exposes the <b>Libvirt</b>
namespace. This namespace exposes all of the needed types (enum,
struct), plus many classes exposing the libvirt API methods.
</p>
<p>
These classes are grouped into functional areas, with each class
exposing libvirt methods related to that area.
</p>
<p>
For example, the libvirt methods related to connections, such as
<b>virConnectOpenAuth</b> and <b>virConnectNumOfDomains</b>, are in
the <b>Connect</b> class.
<br />
They are accessed as <b>Connect.OpenAuth</b>, and
<b>Connect.NumOfDomains</b> respectively.
</p>
<p>
In the same manner, the other class name mappings are:
</p>
<table class="top_table">
<tr><th>Name of libvirt function</th><th>C# class name</th></tr>
<tr><td>virDomain...</td><td>Domain</td></tr>
<tr><td>virEvent...</td><td>Event</td></tr>
<tr><td>virInterface...</td><td>Interface</td></tr>
<tr><td>virNetwork...</td><td>Network</td></tr>
<tr><td>virNode...</td><td>Node</td></tr>
<tr><td>virSecret...</td><td>Secret</td></tr>
<tr><td>virStoragePool...</td><td>StoragePool</td></tr>
<tr><td>virStorageVolume...</td><td>StorageVolume</td></tr>
<tr><td>virStream...</td><td>Stream</td></tr>
</table>
<p>
There are some additions as well:
</p>
<ul>
<li>
There is a class named <b>Library</b>, exposing the
<b>virGetVersion</b> and <b>virInitialize</b> methods
</li>
<li>
There is a class named <b>Errors</b>, exposing the error
related methods. For example, <b>virSetErrorFunc</b> and
<b>virConnResetLastError</b>.
</li>
</ul>
<h2><a id="authors">Authors</a></h2>
<p>
The C# bindings are the work of Arnaud Champion
&lt;<a href="mailto:arnaud.champion AT devatom.fr">arnaud.champion AT devatom.fr</a>&gt;,
based upon the previous work of Jaromír Červenka.
</p>
<h2><a id="notes">Test Configuration</a></h2>
<p>
Testing is performed using the following configurations:
</p>
<ul>
<li>Windows 7 (64 bits) / .Net 4</li>
<li>Windows 7 (64 bits) / Mono 2.6.7 (compiled in 32 bits)</li>
<li>Ubuntu 10.10 amd64 / Mono 2.6.7 (compiled in 64 bits)</li>
</ul>
<h2><a id="type">Type Coverage</a></h2>
<p>
Coverage of the libvirt types is:
</p>
<table class="top_table">
<tr><th>Type</th><th>Name</th><th>Binding?</th><th>Tested?</th><th>Sample Code?</th><th>Works?</th><th>Tested .Net/Windows Works?</th><th>Tested Mono (32-bit)/Windows Works?</th><th>Tested Mono (64-bit)/Linux Works?</th></tr>
<tr><td>enum</td><td>virCPUCompareResult</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virConnect</td><td>Yes, an IntPtr as the struct is not public</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virConnectAuth</td><td>Yes</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>struct</td><td>virConnectCredential</td><td>Yes</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virConnectCredentialType</td><td>Yes</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virConnectFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virDomain</td><td>Yes, an IntPtr as the struct is not public</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virDomainBlockInfo</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virDomainBlockStatsInfo</td><td>Yes</td><td>Yes</td><td>virDomainStats</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainCoreDumpFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainCreateFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainDeviceModifyFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainEventDefinedDetailType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>struct</td><td>virDomainEventGraphicsAddress</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainEventGraphicsAddressType</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainEventGraphicsPhase</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virDomainEventGraphicsSubject</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virDomainEventGraphicsSubjectIdentity</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainEventID</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainEventIOErrorAction</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainEventResumedDetailType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainEventStartedDetailType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainEventStoppedDetailType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainEventSuspendedDetailType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainEventType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainEventUndefinedDetailType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>enum</td><td>virDomainEventWatchdogAction</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virDomainInfo</td><td>Yes</td><td>Yes</td><td>virConnectSetErrorFunc, virDomainStats</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>struct</td><td>virDomainInterfaceStatsStruct</td><td>Yes</td><td>Yes</td><td>virDomainStats</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>struct</td><td>virDomainJobInfo</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainJobType</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainMemoryFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virDomainMemoryStatStruct</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainMemoryStatTags</td><td>Yes</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainMigrateFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virDomainSnapshot</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainSnapshotDeleteFlags</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainState</td><td>Yes</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virDomainXMLFlags</td><td>Yes</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virEventHandleType</td><td>Yes</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>struct</td><td>virInterface</td><td>Yes, an IntPtr as the struct is not public</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virInterfaceXMLFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virNWFilter</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virNetwork</td><td>Yes, an IntPtr as the struct is not public</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virNodeDevice</td><td>Yes, an IntPtr as the struct is not public</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virNodeInfo</td><td>Yes</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virSchedParameter</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virSchedParameterType</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virSecret</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virSecretUsageType</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virSecurityLabel</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virSecurityModel</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virStoragePoolBuildFlags</td><td>Yes</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virStoragePoolDeleteFlags</td><td>Yes</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virStoragePoolInfo</td><td>Yes</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virStoragePool</td><td>Yes, an IntPtr as the struct is not public</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virStoragePoolState</td><td>Yes</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virStorageVol</td><td>Yes, an IntPtr as the struct is not public</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virStorageVolDeleteFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virStorageVolInfo</td><td>Yes</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virStorageVolType</td><td>Yes</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virStream</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virStreamEventType</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virStreamFlags</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virVcpuInfo</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>enum</td><td>virVcpuState</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>struct</td><td>virError</td><td>Yes</td><td>Yes</td><td>virConnectSetErrorFunc, virDomainStats</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
</table>
<p></p>
<h2><a id="funccover">Function Coverage</a></h2>
<p>
Coverage of the libvirt functions is:
</p>
<table class="top_table">
<tr><th>Name</th><th>Binding?</th><th>Type?</th><th>Tested?</th><th>Sample Code?</th><th>Working?</th><th>Tested .Net/Windows Works?</th><th>Tested Mono (32-bit)/Windows Works?</th><th>Tested Mono (64-bit)/Linux Works?</th></tr>
<tr><td>virConnectAuthCallback</td><td>Yes</td><td>delegate</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectBaselineCPU</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectClose</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectCompareCPU</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventCallback</td><td>Yes</td><td>delegate</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventDeregister</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventDeregisterAny</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventGenericCallback</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventGraphicsCallback</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventIOErrorCallback</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventIOErrorReasonCallback</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventRTCChangeCallback</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventRegister</td><td>Yes</td><td>function</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectDomainEventRegisterAny</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainEventWatchdogCallback</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainXMLFromNative</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectDomainXMLToNative</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectFindStoragePoolSources</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectGetCapabilities</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectGetHostname</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectGetLibVersion</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectGetMaxVcpus</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectGetType</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectGetURI</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectGetVersion</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectIsEncrypted</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectIsSecure</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectListDefinedDomains</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectListDefinedInterfaces </td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectListDefinedNetworks</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectListDefinedStoragePools</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectListDomains</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectListInterfaces</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes, if the host handle the method</td><td></td><td></td><td></td></tr>
<tr><td>virConnectListNWFilters </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectListNetworks</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectListSecrets</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectListStoragePools</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpen</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectNumOfDefinedDomains</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectNumOfDefinedInterfaces</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectNumOfDefinedNetworks</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectNumOfDefinedStoragePools</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectNumOfDomains</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectNumOfInterfaces</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectNumOfNWFilters</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virConnectNumOfNetworks </td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virConnectNumOfSecrets</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectNumOfStoragePools</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpen</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectOpen</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpen, virEventRegisterImpl, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectOpenAuth</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnectOpenReadOnly</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virConnectRef</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainAbortJob</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainAttachDevice</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainAttachDeviceFlags</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainBlockPeek</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainBlockStats</td><td>Yes</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainCoreDump</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainCreate</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainCreateLinux</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainCreateWithFlags</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainCreateXML</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainDefineXML</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainDestroy</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainDetachDevice</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainDetachDeviceFlags</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainFree</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetAutostart</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetBlockInfo</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetConnect</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetID</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetInfo</td><td>Yes</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainGetJobInfo</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetMaxMemory</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetMaxVcpus</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetName</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainGetOSType</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetSchedulerParameters</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetSchedulerType</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetSecurityLabel</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetUUID</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetUUIDString</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetVcpus</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainGetXMLDesc</td><td>Yes</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainHasCurrentSnapshot</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainHasManagedSaveImage</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainInterfaceStats </td><td>No</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainIsActive</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainIsPersistent</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainLookupByID</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectOpenAuth, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainLookupByName</td><td>Yes</td><td>function</td><td>Yes</td><td>virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virDomainLookupByUUID</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainLookupByUUIDString</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainManagedSave </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainManagedSaveRemove</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainMemoryPeek</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainMemoryStats</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainMigrate</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainMigrateSetMaxDowntime</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainMigrateToURI </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainPinVcpu</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainReboot</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainRef </td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainRestore</td><td>Yes </td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainResume </td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainRevertToSnapshot</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSave</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainSetAutostart</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainSetMaxMemory </td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainSetMemory</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainSetSchedulerParameters</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSetVcpus</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virDomainShutdown</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainSnapshotCreateXML</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSnapshotCurrent</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSnapshotDelete</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSnapshotFree</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSnapshotGetXMLDesc</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSnapshotListNames</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSnapshotLookupByName</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSnapshotNum</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virDomainSuspend</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainUndefine</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virDomainUpdateDeviceFlags</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virEventAddHandleFunc</td><td>Yes</td><td>delegate</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virEventAddTimeoutFunc</td><td>Yes</td><td>delegate</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virEventHandleCallback</td><td>Yes</td><td>delegate</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virEventRegisterImpl</td><td>Yes</td><td>function</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virEventRemoveHandleFunc</td><td>Yes</td><td>delegate</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virEventRemoveTimeoutFunc</td><td>Yes</td><td>delegate</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virEventTimeoutCallback</td><td>Yes</td><td>delegate</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virEventUpdateHandleFunc</td><td>Yes</td><td>delegate</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virEventUpdateTimeoutFunc</td><td>Yes</td><td>delegate</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virFreeCallback</td><td>Yes</td><td>function</td><td>Yes</td><td>virEventRegisterImpl</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virGetVersion</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virInitialize</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceCreate</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceDefineXML</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceDestroy</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceFree</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceGetConnect</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceGetMACString</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceGetName</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceGetXMLDesc</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceIsActive</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceLookupByMACString</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceLookupByName</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceRef </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virInterfaceUndefine</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterDefineXML</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterFree</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterGetName</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterGetUUID</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterGetUUIDString</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterGetXMLDesc</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterLookupByName </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterLookupByUUID</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterLookupByUUIDString</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterRef </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNWFilterUndefine</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNetworkCreate</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkCreateXML</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkDefineXML</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkDestroy</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkFree</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkGetAutostart</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkGetBridgeName</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkGetConnect</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkGetName</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkGetUUID</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNetworkGetUUIDString </td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkGetXMLDesc</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkIsActive</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkIsPersistent</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkLookupByName</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkLookupByUUID</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkLookupByUUIDString</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkRef</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkSetAutostart</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNetworkUndefine</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceCreateXML</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceDestroy</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceDettach</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceFree</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceGetName</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceGetParent</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceGetXMLDesc</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceListCaps</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceLookupByName</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceNumOfCaps</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceReAttach</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceRef</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeDeviceReset</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeGetCellsFreeMemory</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeGetFreeMemory</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNodeGetInfo</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virNodeGetSecurityModel </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virNodeListDevices</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virNodeNumOfDevices</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virSecretDefineXML</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretFree </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretGetConnect</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretGetUUID</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretGetUUIDString </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretGetUsageID</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretGetUsageType</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretGetValue</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretGetXMLDesc</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretLookupByUUID</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretLookupByUUIDString</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretLookupByUsage</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretRef</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretSetValue</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virSecretUndefine</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolBuild</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolCreate</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolCreateXML </td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolDefineXML</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolDelete</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolDestroy</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolFree</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolGetAutostart</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolGetConnect</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolGetInfo</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolGetName</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolGetUUID</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolGetUUIDString</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolGetXMLDesc</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolIsActive</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolIsPersistent</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolListVolumes</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolLookupByName</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolLookupByUUID</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolLookupByUUIDString</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolLookupByVolume</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolNumOfVolumes</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolRef</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolRefresh</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolSetAutostart</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStoragePoolUndefine</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolCreateXML</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolCreateXMLFrom</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolDelete</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolFree</td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolGetConnect </td><td>Yes</td><td>function</td><td>No</td><td></td><td>Maybe</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolGetInfo</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolGetKey</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolGetName</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolGetPath</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolGetXMLDesc </td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolLookupByKey</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolLookupByName</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolLookupByPath</td><td>Yes</td><td>function</td><td>Yes</td><td></td><td>Yes</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolRef</td><td>Yes</td><td>function</td><td>No</td><td></td><td>No</td><td></td><td></td><td></td></tr>
<tr><td>virStorageVolWipe</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamAbort </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamEventAddCallback</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamEventCallback</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamEventRemoveCallback</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamEventUpdateCallback</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamFinish </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamFree </td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamNew</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamRecv</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamRecvAll</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamRef</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamSend</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamSendAll</td><td>No</td><td>function</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamSinkFunc</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virStreamSourceFunc</td><td>No</td><td>delegate</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>virGetLastError</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectSetErrorFunc</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virConnSetErrorFunc</td><td>Yes</td><td>function</td><td>Yes</td><td>virConnectSetErrorFunc</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
<tr><td>virErrorFunc</td><td>Yes</td><td>delegate</td><td>Yes</td><td>virConnectSetErrorFunc, virDomainInfos</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>
</table>
</body>
</html>

38
docs/csharp.rst Normal file
View File

@ -0,0 +1,38 @@
===============
C# API bindings
===============
Description
-----------
The C# libvirt bindings are a class library. They use a Microsoft Visual Studio
project architecture, and have been tested with Windows .NET, and Mono, on both
Linux and Windows.
Compiling them produces **LibvirtBindings.dll**, which can be added as a .NET
reference to any .NET project needing access to libvirt.
Requirements
------------
These bindings depend upon the libvirt libraries being installed.
In the .NET case, this is **libvirt-0.dll**, produced from compiling libvirt for
windows.
GIT source repository
---------------------
The C# bindings source code is maintained in a ``git`` repository available on
`gitlab.com <https://gitlab.com/libvirt/libvirt-csharp>`__:
::
git clone https://gitlab.com/libvirt/libvirt-csharp.git
Authors
-------
The C# bindings are the work of Arnaud Champion <`arnaud.champion AT
devatom.fr <mailto:arnaud.champion%20AT%20devatom.fr>`__>, based upon the
previous work of Jaromír Červenka.

View File

@ -95,6 +95,7 @@
margin-right: 1em;
}
main,
.document {
margin-left: auto;
margin-right: auto;
@ -104,9 +105,13 @@
width: 70em;
}
main#index,
#index.document,
#docs.document,
main#hvsupport,
#hvsupport.document,
main#documentation,
#documentation.document,
main#knowledge-base,
#knowledge-base.document
{
width: inherit;
@ -397,6 +402,9 @@ h6:hover > a.headerlink {
}
div.panel,
#documentation section,
#documentation .section,
#knowledge-base section,
#knowledge-base .section
{
width: 24%;
@ -406,6 +414,9 @@ div.panel,
}
div.panel h2,
#documentation section h2,
#documentation .section h1,
#knowledge-base section h2,
#knowledge-base .section h1 {
margin-top: 0px;
padding: 0.5em;
@ -423,15 +434,12 @@ div.panel h2,
height: 300px;
}
#knowledge-base.document > h1 {
#documentation > h1,
#knowledge-base > h1 {
text-align: center;
padding: 1em;
}
#docs.document h1 {
visibility: hidden;
}
br.clear {
clear: both;
border: 0px;
@ -485,11 +493,13 @@ br.clear {
}
div.panel dd,
#documentation dd,
#knowledge-base dd {
font-size: smaller;
}
div.panel a,
#documentation a,
#knowledge-base a {
text-decoration: none;
}
@ -497,6 +507,9 @@ div.panel a,
div.panel ul,
div.panel p,
div.panel dl,
#documentation ul,
#documentation p,
#documentation dl,
#knowledge-base ul,
#knowledge-base p,
#knowledge-base dl {
@ -505,16 +518,19 @@ div.panel dl,
}
div.panel ul,
#documentation ul,
#knowledge-base ul {
margin-left: 1em;
}
div.panel dt,
#documentation dt,
#knowledge-base dt {
margin: 0px;
}
div.panel dd,
#documentation dd,
#knowledge-base dd {
margin: 0px;
margin-bottom: 1em;

View File

@ -100,7 +100,7 @@ optionally, one or two TCP sockets:
with full read-write privileges. A connection to this socket gives the
client privileges that are equivalent to having a root shell. Access control
can be enforced either through validation of `x509 certificates
<tlscerts.html>`__, and/or by enabling an `authentication mechanism
<kbase/tlscerts.html>`__, and/or by enabling an `authentication mechanism
<auth.html>`__.
NB, some distros will use ``/run`` instead of ``/var/run``.

View File

@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>D-Bus API bindings</h1>
<ul id="toc"></ul>
<h2><a id="description">Description</a></h2>
<p>
libvirt-dbus wraps libvirt API to provide a high-level object-oriented
API better suited for dbus-based applications.
</p>
<h2><a id="git">GIT source repository</a></h2>
<p>
The D-Bus bindings source code is maintained in a
<a href="https://git-scm.com/">git</a> repository available on
<a href="https://gitlab.com/libvirt/libvirt-dbus">gitlab.com</a>:
</p>
<pre>
git clone https://gitlab.com/libvirt/libvirt-dbus.git
</pre>
<h2><a id="usage">Usage</a></h2>
<p>
libvirt-dbus exports libvirt API using D-Bus objects with methods and
properties described by interfaces. Currently only local connection
to libvirt is exported and the list of supported drivers depends
on the type of the bus connection (session or system).
</p>
<p>
The name of the libvirt-dbus service is <code>org.libvirt</code>.
libvirt-dbus distributes an interface XML descriptions which can be
usually found at <code>/usr/share/dbus-1/interfaces/</code>.
</p>
<p>
By default unprivileged user has access only to the session D-Bus
connection. In order to allow specific user "foo" to access the system
D-Bus connection you need to create a file
<code>/etc/dbus-1/system.d/org.libvirt.conf</code> that contains:
</p>
<pre>
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"&gt;
&lt;busconfig&gt;
&lt;policy user="foo"&gt;
&lt;allow send_destination="org.libvirt"/&gt;
&lt;/policy&gt;
&lt;/busconfig&gt;
</pre>
<p>
To get a list of supported drivers for the specific bus connection
you can run these commands (not all drivers may be available on
the host):
</p>
<pre>
gdbus introspect --xml --session --dest org.libvirt --object-path /org/libvirt
gdbus introspect --xml --system --dest org.libvirt --object-path /org/libvirt
</pre>
<p>
Every object is introspectable so you can get a list of available
interfaces with methods, signals and properties running this command:
</p>
<pre>
gdbus introspect --xml --system --dest org.libvirt --object-path /org/libvirt/QEMU
</pre>
<p>
To get a list of domains for specific connection driver you can run
this command:
</p>
<pre>
gdbus call --system --dest org.libvirt --object-path /org/libvirt/QEMU \
--method org.libvirt.Connect.ListDomains 0
</pre>
</body>
</html>

75
docs/dbus.rst Normal file
View File

@ -0,0 +1,75 @@
==================
D-Bus API bindings
==================
.. contents::
Description
-----------
libvirt-dbus wraps libvirt API to provide a high-level object-oriented API
better suited for dbus-based applications.
GIT source repository
---------------------
The D-Bus bindings source code is maintained in a `git <https://git-scm.com/>`__
repository available on
`gitlab.com <https://gitlab.com/libvirt/libvirt-dbus>`__:
::
git clone https://gitlab.com/libvirt/libvirt-dbus.git
Usage
-----
libvirt-dbus exports libvirt API using D-Bus objects with methods and properties
described by interfaces. Currently only local connection to libvirt is exported
and the list of supported drivers depends on the type of the bus connection
(session or system).
The name of the libvirt-dbus service is ``org.libvirt``. libvirt-dbus
distributes an interface XML descriptions which can be usually found at
``/usr/share/dbus-1/interfaces/``.
By default unprivileged user has access only to the session D-Bus connection. In
order to allow specific user "foo" to access the system D-Bus connection you
need to create a file ``/etc/dbus-1/system.d/org.libvirt.conf`` that contains:
::
<?xml version="1.0"?>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="foo">
<allow send_destination="org.libvirt"/>
</policy>
</busconfig>
To get a list of supported drivers for the specific bus connection you can run
these commands (not all drivers may be available on the host):
::
gdbus introspect --xml --session --dest org.libvirt --object-path /org/libvirt
gdbus introspect --xml --system --dest org.libvirt --object-path /org/libvirt
Every object is introspectable so you can get a list of available interfaces
with methods, signals and properties running this command:
::
gdbus introspect --xml --system --dest org.libvirt --object-path /org/libvirt/QEMU
To get a list of domains for specific connection driver you can run this
command:
::
gdbus call --system --dest org.libvirt --object-path /org/libvirt/QEMU \
--method org.libvirt.Connect.ListDomains 0

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

@ -1,191 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body id="docs">
<h1>Documentation</h1>
<div class="panel">
<h2>Deployment / operation</h2>
<dl>
<dt><a href="apps.html">Applications</a></dt>
<dd>Applications known to use libvirt</dd>
<dt><a href="manpages/index.html">Manual pages</a></dt>
<dd>Manual pages for libvirt tools / daemons</dd>
<dt><a href="windows.html">Windows</a></dt>
<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>
<dd>Migrating guests between machines</dd>
<dt><a href="daemons.html">Daemons</a></dt>
<dd>Overview of the daemons provided by libvirt</dd>
<dt><a href="remote.html">Remote access</a></dt>
<dd>Enable remote access over TCP</dd>
<dt><a href="tlscerts.html">TLS certs</a></dt>
<dd>Generate and deploy x509 certificates for TLS</dd>
<dt><a href="auth.html">Authentication</a></dt>
<dd>Configure authentication for the libvirt daemon</dd>
<dt><a href="acl.html">Access control</a></dt>
<dd>Configure access control libvirt APIs with <a href="aclpolkit.html">polkit</a></dd>
<dt><a href="logging.html">Logging</a></dt>
<dd>The library and the daemon logging support</dd>
<dt><a href="auditlog.html">Audit log</a></dt>
<dd>Audit trail logs for host operations</dd>
<dt><a href="firewall.html">Firewall</a></dt>
<dd>Firewall and network filter configuration</dd>
<dt><a href="hooks.html">Hooks</a></dt>
<dd>Hooks for system specific management</dd>
<dt><a href="nss.html">NSS module</a></dt>
<dd>Enable domain host name translation to IP addresses</dd>
<dt><a href="https://wiki.libvirt.org/page/FAQ">FAQ</a></dt>
<dd>Frequently asked questions</dd>
</dl>
</div>
<div class="panel">
<h2>Application development</h2>
<dl>
<dt><a href="html/index.html">API reference</a></dt>
<dd>Reference manual for the C public API, split in
<a href="html/libvirt-libvirt-common.html">common</a>,
<a href="html/libvirt-libvirt-domain.html">domain</a>,
<a href="html/libvirt-libvirt-domain-checkpoint.html">domain checkpoint</a>,
<a href="html/libvirt-libvirt-domain-snapshot.html">domain snapshot</a>,
<a href="html/libvirt-virterror.html">error</a>,
<a href="html/libvirt-libvirt-event.html">event</a>,
<a href="html/libvirt-libvirt-host.html">host</a>,
<a href="html/libvirt-libvirt-interface.html">interface</a>,
<a href="html/libvirt-libvirt-network.html">network</a>,
<a href="html/libvirt-libvirt-nodedev.html">node device</a>,
<a href="html/libvirt-libvirt-nwfilter.html">network filter</a>,
<a href="html/libvirt-libvirt-secret.html">secret</a>,
<a href="html/libvirt-libvirt-storage.html">storage</a>,
<a href="html/libvirt-libvirt-stream.html">stream</a>
and
<a href="html/index-admin.html">admin</a>,
<a href="html/index-qemu.html">QEMU</a>,
<a href="html/index-lxc.html">LXC</a> libs
</dd>
<dt><a href="bindings.html">Language bindings and API modules</a></dt>
<dd>Bindings of the libvirt API for
<a href="csharp.html">c#</a>,
<a href="https://pkg.go.dev/libvirt.org/go/libvirt">go</a>,
<a href="java.html">java</a>,
<a href="https://libvirt.org/ocaml/">ocaml</a>,
<a href="https://search.cpan.org/dist/Sys-Virt/">perl</a>,
<a href="python.html">python</a>,
<a href="php.html">php</a>,
<a href="https://libvirt.org/ruby/">ruby</a>
and integration API modules for
<a href="dbus.html">D-Bus</a></dd>
<dt><a href="format.html">XML schemas</a></dt>
<dd>Description of the XML schemas for
<a href="formatdomain.html">domains</a>,
<a href="formatnetwork.html">networks</a>,
<a href="formatnetworkport.html">network ports</a>,
<a href="formatnwfilter.html">network filtering</a>,
<a href="formatstorage.html">storage</a>,
<a href="formatstorageencryption.html">storage encryption</a>,
<a href="formatcaps.html">capabilities</a>,
<a href="formatdomaincaps.html">domain capabilities</a>,
<a href="formatstoragecaps.html">storage pool capabilities</a>,
<a href="formatnode.html">node devices</a>,
<a href="formatsecret.html">secrets</a>,
<a href="formatsnapshot.html">snapshots</a>,
<a href="formatcheckpoint.html">checkpoints</a>,
<a href="formatbackup.html">backup jobs</a></dd>
<dt><a href="uri.html">URI format</a></dt>
<dd>The URI formats used for connecting to libvirt</dd>
<dt><a href="cgroups.html">CGroups</a></dt>
<dd>Control groups integration</dd>
<dt><a href="drivers.html">Drivers</a></dt>
<dd>Hypervisor specific driver information</dd>
<dt><a href="support.html">Support guarantees</a></dt>
<dd>Details of support status for various interfaces</dd>
<dt><a href="hvsupport.html">Driver support</a></dt>
<dd>matrix of API support per hypervisor per release</dd>
<dt><a href="kbase/index.html">Knowledge Base</a></dt>
<dd>Task oriented guides to key features</dd>
</dl>
</div>
<div class="panel">
<h2>Project development</h2>
<dl>
<dt><a href="hacking.html">Contributor guidelines</a></dt>
<dd>General hacking guidelines for contributors</dd>
<dt><a href="styleguide.html">Docs style guide</a></dt>
<dd>Style guidelines for reStructuredText docs</dd>
<dt><a href="strategy.html">Project strategy</a></dt>
<dd>Sets a vision for future direction &amp; technical choices</dd>
<dt><a href="ci.html">CI Testing</a></dt>
<dd>Details of the Continuous Integration testing strategy</dd>
<dt><a href="bugs.html">Bug reports</a></dt>
<dd>How and where to report bugs and request features</dd>
<dt><a href="compiling.html">Compiling</a></dt>
<dd>How to compile libvirt</dd>
<dt><a href="goals.html">Goals</a></dt>
<dd>Terminology and goals of libvirt API</dd>
<dt><a href="api.html">API concepts</a></dt>
<dd>The libvirt API concepts</dd>
<dt><a href="api_extension.html">API extensions</a></dt>
<dd>Adding new public libvirt APIs</dd>
<dt><a href="internals/eventloop.html">Event loop and worker pool</a></dt>
<dd>Libvirt's event loop and worker pool mode</dd>
<dt><a href="internals/command.html">Spawning commands</a></dt>
<dd>Spawning commands from libvirt driver code</dd>
<dt><a href="internals/rpc.html">RPC protocol &amp; APIs</a></dt>
<dd>RPC protocol information and API / dispatch guide</dd>
<dt><a href="internals/locking.html">Lock managers</a></dt>
<dd>Use lock managers to protect disk content</dd>
<dt><a href="testsuites.html">Functional testing</a></dt>
<dd>Testing libvirt with <a href="testtck.html">TCK test suite</a> and
<a href="testapi.html">Libvirt-test-API</a></dd>
<dt><a href="newreposetup.html">New repo setup</a></dt>
<dd>Procedure for configuring new git repositories for libvirt</dd>
</dl>
</div>
<br class="clear"/>
</body>
</html>

163
docs/docs.rst Normal file
View File

@ -0,0 +1,163 @@
=============
Documentation
=============
Deployment / operation
----------------------
`Applications <apps.html>`__
Applications known to use libvirt
`Manual pages <manpages/index.html>`__
Manual pages for libvirt tools / daemons
`Windows <windows.html>`__
Downloads for Windows
`macOS <macos.html>`__
Working with libvirt on macOS
`Migration <migration.html>`__
Migrating guests between machines
`Daemons <daemons.html>`__
Overview of the daemons provided by libvirt
`Remote access <remote.html>`__
Enable remote access over TCP
`TLS certs <tlscerts.html>`__
Generate and deploy x509 certificates for TLS
`Authentication <auth.html>`__
Configure authentication for the libvirt daemon
`Access control <acl.html>`__
Configure access control libvirt APIs with `polkit <aclpolkit.html>`__
`Logging <logging.html>`__
The library and the daemon logging support
`Audit log <auditlog.html>`__
Audit trail logs for host operations
`Firewall <firewall.html>`__
Firewall and network filter configuration
`Hooks <hooks.html>`__
Hooks for system specific management
`NSS module <nss.html>`__
Enable domain host name translation to IP addresses
`FAQ <https://wiki.libvirt.org/page/FAQ>`__
Frequently asked questions
Application development
-----------------------
`API reference <html/index.html>`__
Reference manual for the C public API, split in
`common <html/libvirt-libvirt-common.html>`__,
`domain <html/libvirt-libvirt-domain.html>`__,
`domain checkpoint <html/libvirt-libvirt-domain-checkpoint.html>`__,
`domain snapshot <html/libvirt-libvirt-domain-snapshot.html>`__,
`error <html/libvirt-virterror.html>`__,
`event <html/libvirt-libvirt-event.html>`__,
`host <html/libvirt-libvirt-host.html>`__,
`interface <html/libvirt-libvirt-interface.html>`__,
`network <html/libvirt-libvirt-network.html>`__,
`node device <html/libvirt-libvirt-nodedev.html>`__,
`network filter <html/libvirt-libvirt-nwfilter.html>`__,
`secret <html/libvirt-libvirt-secret.html>`__,
`storage <html/libvirt-libvirt-storage.html>`__,
`stream <html/libvirt-libvirt-stream.html>`__ and
`admin <html/index-admin.html>`__,
`QEMU <html/index-qemu.html>`__,
`LXC <html/index-lxc.html>`__ libs
`Language bindings and API modules <bindings.html>`__
Bindings of the libvirt API for
`c# <csharp.html>`__,
`go <https://pkg.go.dev/libvirt.org/go/libvirt>`__,
`java <java.html>`__,
`ocaml <https://libvirt.org/ocaml/>`__,
`perl <https://search.cpan.org/dist/Sys-Virt/>`__,
`python <python.html>`__,
`php <php.html>`__,
`ruby <https://libvirt.org/ruby/>`__
and integration API modules for
`D-Bus <dbus.html>`__
`XML schemas <format.html>`__
Description of the XML schemas for
`domains <formatdomain.html>`__,
`networks <formatnetwork.html>`__,
`network ports <formatnetworkport.html>`__,
`network filtering <formatnwfilter.html>`__,
`storage <formatstorage.html>`__,
`storage encryption <formatstorageencryption.html>`__,
`capabilities <formatcaps.html>`__,
`domain capabilities <formatdomaincaps.html>`__,
`storage pool capabilities <formatstoragecaps.html>`__,
`node devices <formatnode.html>`__,
`secrets <formatsecret.html>`__,
`snapshots <formatsnapshot.html>`__,
`checkpoints <formatcheckpoint.html>`__,
`backup jobs <formatbackup.html>`__
`URI format <uri.html>`__
The URI formats used for connecting to libvirt
`CGroups <cgroups.html>`__
Control groups integration
`Drivers <drivers.html>`__
Hypervisor specific driver information
`Support guarantees <support.html>`__
Details of support status for various interfaces
`Driver support <hvsupport.html>`__
matrix of API support per hypervisor per release
`Knowledge Base <kbase/index.html>`__
Task oriented guides to key features
Project development
-------------------
`Contributor guidelines <hacking.html>`__
General hacking guidelines for contributors
`Docs style guide <styleguide.html>`__
Style guidelines for reStructuredText docs
`Project strategy <strategy.html>`__
Sets a vision for future direction & technical choices
`CI Testing <ci.html>`__
Details of the Continuous Integration testing strategy
`Bug reports <bugs.html>`__
How and where to report bugs and request features
`Compiling <compiling.html>`__
How to compile libvirt
`Goals <goals.html>`__
Terminology and goals of libvirt API
`API concepts <api.html>`__
The libvirt API concepts
`API extensions <api_extension.html>`__
Adding new public libvirt APIs
`Functional testing <testsuites.html>`__
Testing libvirt with
`TCK test suite <testtck.html>`__ and
`Libvirt-test-API <testapi.html>`__
`New repo setup <newreposetup.html>`__
Procedure for configuring new git repositories for libvirt

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`_
- `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,583 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Bhyve driver</h1>
<ul id="toc"></ul>
<p>
Bhyve is a FreeBSD hypervisor. It first appeared in FreeBSD 10.0. However, it's
recommended to keep tracking FreeBSD 10-STABLE to make sure all new features
of bhyve are supported.
In order to enable bhyve on your FreeBSD host, you'll need to load the <code>vmm</code>
kernel module. Additionally, <code>if_tap</code> and <code>if_bridge</code> modules
should be loaded for networking support. Also, <span class="since">since 3.2.0</span> the
<code>virt-host-validate(1)</code> supports the bhyve host validation and could be
used like this:
</p>
<pre>
$ virt-host-validate bhyve
BHYVE: Checking for vmm module : PASS
BHYVE: Checking for if_tap module : PASS
BHYVE: Checking for if_bridge module : PASS
BHYVE: Checking for nmdm module : PASS
$
</pre>
<p>
Additional information on bhyve could be obtained on <a href="https://bhyve.org/">bhyve.org</a>.
</p>
<h2><a id="uri">Connections to the Bhyve driver</a></h2>
<p>
The libvirt bhyve driver is a single-instance privileged driver. Some sample
connection URIs are:
</p>
<pre>
bhyve:///system (local access)
bhyve+unix:///system (local access)
bhyve+ssh://root@example.com/system (remote access, SSH tunnelled)
</pre>
<h2><a id="exconfig">Example guest domain XML configurations</a></h2>
<h3>Example config</h3>
<p>
The bhyve driver in libvirt is in its early stage and under active development. So it supports
only limited number of features bhyve provides.
</p>
<p>
Note: in older libvirt versions, only a single network device and a single
disk device were supported per-domain. However,
<span class="since">since 1.2.6</span> the libvirt bhyve driver supports
up to 31 PCI devices.
</p>
<p>
Note: the Bhyve driver in libvirt will boot whichever device is first. If you
want to install from CD, put the CD device first. If not, put the root HDD
first.
</p>
<p>
Note: Only the SATA bus is supported. Only <code>cdrom</code>- and
<code>disk</code>-type disks are supported.
</p>
<pre>
&lt;domain type='bhyve'&gt;
&lt;name&gt;bhyve&lt;/name&gt;
&lt;uuid&gt;df3be7e7-a104-11e3-aeb0-50e5492bd3dc&lt;/uuid&gt;
&lt;memory&gt;219136&lt;/memory&gt;
&lt;currentMemory&gt;219136&lt;/currentMemory&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;os&gt;
&lt;type&gt;hvm&lt;/type&gt;
&lt;/os&gt;
&lt;features&gt;
&lt;apic/&gt;
&lt;acpi/&gt;
&lt;/features&gt;
&lt;clock offset='utc'/&gt;
&lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
&lt;on_reboot&gt;restart&lt;/on_reboot&gt;
&lt;on_crash&gt;destroy&lt;/on_crash&gt;
&lt;devices&gt;
&lt;disk type='file'&gt;
&lt;driver name='file' type='raw'/&gt;
&lt;source file='/path/to/bhyve_freebsd.img'/&gt;
&lt;target dev='hda' bus='sata'/&gt;
&lt;/disk&gt;
&lt;disk type='file' device='cdrom'&gt;
&lt;driver name='file' type='raw'/&gt;
&lt;source file='/path/to/cdrom.iso'/&gt;
&lt;target dev='hdc' bus='sata'/&gt;
&lt;readonly/&gt;
&lt;/disk&gt;
&lt;interface type='bridge'&gt;
&lt;model type='virtio'/&gt;
&lt;source bridge="virbr0"/&gt;
&lt;/interface&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
<p>(The &lt;disk&gt; sections may be swapped in order to install from
<em>cdrom.iso</em>.)</p>
<h3>Example config (Linux guest)</h3>
<p>
Note the addition of &lt;bootloader&gt;.
</p>
<pre>
&lt;domain type='bhyve'&gt;
&lt;name&gt;linux_guest&lt;/name&gt;
&lt;uuid&gt;df3be7e7-a104-11e3-aeb0-50e5492bd3dc&lt;/uuid&gt;
&lt;memory&gt;131072&lt;/memory&gt;
&lt;currentMemory&gt;131072&lt;/currentMemory&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;bootloader&gt;/usr/local/sbin/grub-bhyve&lt;/bootloader&gt;
&lt;os&gt;
&lt;type&gt;hvm&lt;/type&gt;
&lt;/os&gt;
&lt;features&gt;
&lt;apic/&gt;
&lt;acpi/&gt;
&lt;/features&gt;
&lt;clock offset='utc'/&gt;
&lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
&lt;on_reboot&gt;restart&lt;/on_reboot&gt;
&lt;on_crash&gt;destroy&lt;/on_crash&gt;
&lt;devices&gt;
&lt;disk type='file' device='disk'&gt;
&lt;driver name='file' type='raw'/&gt;
&lt;source file='/path/to/guest_hdd.img'/&gt;
&lt;target dev='hda' bus='sata'/&gt;
&lt;/disk&gt;
&lt;disk type='file' device='cdrom'&gt;
&lt;driver name='file' type='raw'/&gt;
&lt;source file='/path/to/cdrom.iso'/&gt;
&lt;target dev='hdc' bus='sata'/&gt;
&lt;readonly/&gt;
&lt;/disk&gt;
&lt;interface type='bridge'&gt;
&lt;model type='virtio'/&gt;
&lt;source bridge="virbr0"/&gt;
&lt;/interface&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
<h3>Example config (Linux UEFI guest, VNC, tablet)</h3>
<p>This is an example to boot into Fedora 25 installation:</p>
<pre>
&lt;domain type='bhyve'&gt;
&lt;name&gt;fedora_uefi_vnc_tablet&lt;/name&gt;
&lt;memory unit='G'&gt;4&lt;/memory&gt;
&lt;vcpu&gt;2&lt;/vcpu&gt;
&lt;os&gt;
&lt;type&gt;hvm&lt;/type&gt;
<b>&lt;loader readonly=&quot;yes&quot; type=&quot;pflash&quot;&gt;/usr/local/share/uefi-firmware/BHYVE_UEFI.fd&lt;/loader&gt;</b>
&lt;/os&gt;
&lt;features&gt;
&lt;apic/&gt;
&lt;acpi/&gt;
&lt;/features&gt;
&lt;clock offset='utc'/&gt;
&lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
&lt;on_reboot&gt;restart&lt;/on_reboot&gt;
&lt;on_crash&gt;destroy&lt;/on_crash&gt;
&lt;devices&gt;
&lt;disk type='file' device='cdrom'&gt;
&lt;driver name='file' type='raw'/&gt;
&lt;source file='/path/to/Fedora-Workstation-Live-x86_64-25-1.3.iso'/&gt;
&lt;target dev='hdc' bus='sata'/&gt;
&lt;readonly/&gt;
&lt;/disk&gt;
&lt;disk type='file' device='disk'&gt;
&lt;driver name='file' type='raw'/&gt;
&lt;source file='/path/to/linux_uefi.img'/&gt;
&lt;target dev='hda' bus='sata'/&gt;
&lt;/disk&gt;
&lt;interface type='bridge'&gt;
&lt;model type='virtio'/&gt;
&lt;source bridge=&quot;virbr0&quot;/&gt;
&lt;/interface&gt;
&lt;serial type=&quot;nmdm&quot;&gt;
&lt;source master=&quot;/dev/nmdm0A&quot; slave=&quot;/dev/nmdm0B&quot;/&gt;
&lt;/serial&gt;
<b>&lt;graphics type='vnc' port='5904'&gt;
&lt;listen type='address' address='127.0.0.1'/&gt;
&lt;/graphics&gt;
&lt;controller type='usb' model='nec-xhci'/&gt;
&lt;input type='tablet' bus='usb'/&gt;</b>
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
<p>Please refer to the <a href="#uefi">UEFI</a> section for a more detailed explanation.</p>
<h2><a id="usage">Guest usage / management</a></h2>
<h3><a id="console">Connecting to a guest console</a></h3>
<p>
Guest console connection is supported through the <code>nmdm</code> device. It could be enabled by adding
the following to the domain XML (<span class="since">Since 1.2.4</span>):
</p>
<pre>
...
&lt;devices&gt;
&lt;serial type="nmdm"&gt;
&lt;source master="/dev/nmdm0A" slave="/dev/nmdm0B"/&gt;
&lt;/serial&gt;
&lt;/devices&gt;
...</pre>
<p>Make sure to load the <code>nmdm</code> kernel module if you plan to use that.</p>
<p>
Then <code>virsh console</code> command can be used to connect to the text console
of a guest.</p>
<p><b>NB:</b> Some versions of bhyve have a bug that prevents guests from booting
until the console is opened by a client. This bug was fixed in
<a href="https://svnweb.freebsd.org/changeset/base/262884">FreeBSD changeset r262884</a>. If
an older version is used, one either has to open a console manually with <code>virsh console</code>
to let a guest boot or start a guest using:</p>
<pre>start --console domname</pre>
<p><b>NB:</b> A bootloader configured to require user interaction will prevent
the domain from starting (and thus <code>virsh console</code> or <code>start
--console</code> from functioning) until the user interacts with it manually on
the VM host. Because users typically do not have access to the VM host,
interactive bootloaders are unsupported by libvirt. <em>However,</em> if you happen to
run into this scenario and also happen to have access to the Bhyve host
machine, you may select a boot option and allow the domain to finish starting
by using an alternative terminal client on the VM host to connect to the
domain-configured null modem device. One example (assuming
<code>/dev/nmdm0B</code> is configured as the slave end of the domain serial
device) is:</p>
<pre>cu -l /dev/nmdm0B</pre>
<h3><a id="xmltonative">Converting from domain XML to Bhyve args</a></h3>
<p>
The <code>virsh domxml-to-native</code> command can preview the actual
<code>bhyve</code> commands that will be executed for a given domain.
It outputs two lines, the first line is a <code>bhyveload</code> command and
the second is a <code>bhyve</code> command.
</p>
<p>Please note that the <code>virsh domxml-to-native</code> doesn't do any
real actions other than printing the command, for example, it doesn't try to
find a proper TAP interface and create it, like what is done when starting
a domain; and always returns <code>tap0</code> for the network interface. So
if you're going to run these commands manually, most likely you might want to
tweak them.</p>
<pre>
# virsh -c "bhyve:///system" domxml-to-native --format bhyve-argv --xml /path/to/bhyve.xml
/usr/sbin/bhyveload -m 214 -d /home/user/vm1.img vm1
/usr/sbin/bhyve -c 2 -m 214 -A -I -H -P -s 0:0,hostbridge \
-s 3:0,virtio-net,tap0,mac=52:54:00:5d:74:e3 -s 2:0,virtio-blk,/home/user/vm1.img \
-s 1,lpc -l com1,/dev/nmdm0A vm1
</pre>
<h3><a id="zfsvolume">Using ZFS volumes</a></h3>
<p>It's possible to use ZFS volumes as disk devices <span class="since">since 1.2.8</span>.
An example of domain XML device entry for that will look like:</p>
<pre>
...
&lt;disk type='volume' device='disk'&gt;
&lt;source pool='zfspool' volume='vol1'/&gt;
&lt;target dev='vdb' bus='virtio'/&gt;
&lt;/disk&gt;
...</pre>
<p>Please refer to the <a href="storage.html">Storage documentation</a> for more details on storage
management.</p>
<h3><a id="grubbhyve">Using grub2-bhyve or Alternative Bootloaders</a></h3>
<p>It's possible to boot non-FreeBSD guests by specifying an explicit
bootloader, e.g. <code>grub-bhyve(1)</code>. Arguments to the bootloader may be
specified as well. If the bootloader is <code>grub-bhyve</code> and arguments
are omitted, libvirt will try and infer boot ordering from user-supplied
&lt;boot order='N'&gt; configuration in the domain. Failing that, it will boot
the first disk in the domain (either <code>cdrom</code>- or
<code>disk</code>-type devices). If the disk type is <code>disk</code>, it will
attempt to boot from the first partition in the disk image.</p>
<pre>
...
&lt;bootloader&gt;/usr/local/sbin/grub-bhyve&lt;/bootloader&gt;
&lt;bootloader_args&gt;...&lt;/bootloader_args&gt;
...
</pre>
<p>Caveat: <code>bootloader_args</code> does not support any quoting.
Filenames, etc, must not have spaces or they will be tokenized incorrectly.</p>
<h3><a id="uefi">Using UEFI bootrom, VNC, and USB tablet</a></h3>
<p><span class="since">Since 3.2.0</span>, in addition to <a href="#grubbhyve">grub-bhyve</a>,
non-FreeBSD guests could be also booted using an UEFI boot ROM, provided both guest OS and
installed <code>bhyve(1)</code> version support UEFI. To use that, <code>loader</code>
should be specified in the <code>os</code> section:</p>
<pre>
&lt;domain type='bhyve'&gt;
...
&lt;os&gt;
&lt;type&gt;hvm&lt;/type&gt;
&lt;loader readonly="yes" type="pflash"&gt;/usr/local/share/uefi-firmware/BHYVE_UEFI.fd&lt;/loader&gt;
&lt;/os&gt;
...
</pre>
<p>This uses the UEFI firmware provided by
the <a href="https://www.freshports.org/sysutils/bhyve-firmware/">sysutils/bhyve-firmware</a>
FreeBSD port.</p>
<p>VNC and the tablet input device could be configured this way:</p>
<pre>
&lt;domain type='bhyve'&gt;
&lt;devices&gt;
...
&lt;graphics type='vnc' port='5904'&gt;
&lt;listen type='address' address='127.0.0.1'/&gt;
&lt;/graphics&gt;
&lt;controller type='usb' model='nec-xhci'/&gt;
&lt;input type='tablet' bus='usb'/&gt;
&lt;/devices&gt;
...
&lt;/domain&gt;
</pre>
<p>This way, VNC will be accessible on <code>127.0.0.1:5904</code>.</p>
<p>Please note that the tablet device requires to have a USB controller
of the <code>nec-xhci</code> model. Currently, only a single controller of this
type and a single tablet are supported per domain.</p>
<p><span class="since">Since 3.5.0</span>, it's possible to configure how the video device is exposed
to the guest using the <code>vgaconf</code> attribute:</p>
<pre>
&lt;domain type='bhyve'&gt;
&lt;devices&gt;
...
&lt;graphics type='vnc' port='5904'&gt;
&lt;listen type='address' address='127.0.0.1'/&gt;
&lt;/graphics&gt;
&lt;video&gt;
&lt;driver vgaconf='on'/&gt;
&lt;model type='gop' heads='1' primary='yes'/&gt;
&lt;/video&gt;
...
&lt;/devices&gt;
...
&lt;/domain&gt;
</pre>
<p>If not specified, bhyve's default mode for <code>vgaconf</code>
will be used. Please refer to the
<a href="https://www.freebsd.org/cgi/man.cgi?query=bhyve&amp;sektion=8&amp;manpath=FreeBSD+12-current">bhyve(8)</a>
manual page and the <a href="https://wiki.freebsd.org/bhyve">bhyve wiki</a> for more details on using
the <code>vgaconf</code> option.</p>
<p><span class="since">Since 3.7.0</span>, it's possible to use <code>autoport</code>
to let libvirt allocate VNC port automatically (instead of explicitly specifying
it with the <code>port</code> attribute):</p>
<pre>
&lt;graphics type='vnc' autoport='yes'&gt;
</pre>
<p><span class="since">Since 6.8.0</span>, it's possible to set framebuffer resolution
using the <code>resolution</code> sub-element:</p>
<pre>
&lt;video&gt;
&lt;model type='gop' heads='1' primary='yes'&gt;
&lt;resolution x='800' y='600'/&gt;
&lt;/model&gt;
&lt;/video&gt;
</pre>
<p><span class="since">Since 6.8.0</span>, VNC server can be configured to use
password based authentication:</p>
<pre>
&lt;graphics type='vnc' port='5904' passwd='foobar'&gt;
&lt;listen type='address' address='127.0.0.1'/&gt;
&lt;/graphics&gt;
</pre>
<p>Note: VNC password authentication is known to be cryptographically weak.
Additionally, the password is passed as a command line argument in clear text.
Make sure you understand the risks associated with this feature before using it.</p>
<h3><a id="clockconfig">Clock configuration</a></h3>
<p>Originally bhyve supported only localtime for RTC. Support for UTC time was introduced in
<a href="https://svnweb.freebsd.org/changeset/base/284894">FreeBSD changeset r284894</a>
for <i>10-STABLE</i> and
in <a href="https://svnweb.freebsd.org/changeset/base/279225">changeset r279225</a>
for <i>-CURRENT</i>. It's possible to use this in libvirt <span class="since">since 1.2.18</span>,
just place the following to domain XML:</p>
<pre>
&lt;domain type="bhyve"&gt;
...
&lt;clock offset='utc'/&gt;
...
&lt;/domain&gt;
</pre>
<p>Please note that if you run the older bhyve version that doesn't support UTC time, you'll
fail to start a domain. As UTC is used as a default when you do not specify clock settings,
you'll need to explicitly specify 'localtime' in this case:</p>
<pre>
&lt;domain type="bhyve"&gt;
...
&lt;clock offset='localtime'/&gt;
...
&lt;/domain&gt;
</pre>
<h3><a id="e1000">e1000 NIC</a></h3>
<p>As of <a href="https://svnweb.freebsd.org/changeset/base/302504">FreeBSD changeset r302504</a>
bhyve supports Intel e1000 network adapter emulation. It's supported in libvirt
<span class="since">since 3.1.0</span> and could be used as follows:</p>
<pre>
...
&lt;interface type='bridge'&gt;
&lt;source bridge='virbr0'/&gt;
&lt;model type='<b>e1000</b>'/&gt;
&lt;/interface&gt;
...
</pre>
<h3><a id="sound">Sound device</a></h3>
<p>As of <a href="https://svnweb.freebsd.org/changeset/base/349355">FreeBSD changeset r349355</a>
bhyve supports sound device emulation. It's supported in libvirt
<span class="since">since 6.7.0</span>.</p>
<pre>
...
&lt;sound model='ich7'&gt;
&lt;audio id='1'/&gt;
&lt;/sound&gt;
&lt;audio id='1' type='oss'&gt;
&lt;input dev='/dev/dsp0'/&gt;
&lt;output dev='/dev/dsp0'/&gt;
&lt;/audio&gt;
...
</pre>
<p>Here, the <code>sound</code> element specifies the sound device as it's exposed
to the guest, with <code>ich7</code> being the only supported model now,
and the <code>audio</code> element specifies how the guest device is mapped
to the host sound device.</p>
<h3><a id="fs-9p">Virtio-9p filesystem</a></h3>
<p>As of <a href="https://svnweb.freebsd.org/changeset/base/366413">FreeBSD changeset r366413</a>
bhyve supports sharing arbitrary directory tree between the guest and the host.
It's supported in libvirt <span class="since">since 6.9.0</span>.</p>
<pre>
...
&lt;filesystem&gt;
&lt;source dir='/shared/dir'/&gt;
&lt;target dir='shared_dir'/&gt;
&lt;/filesystem&gt;
...
</pre>
<p>This share could be made read only by adding the <code>&lt;readonly/&gt;</code> sub-element.</p>
<p>In the Linux guest, this could be mounted using:</p>
<pre>mount -t 9p shared_dir /mnt/shared_dir</pre>
<h3><a id="wired">Wiring guest memory</a></h3>
<p><span class="since">Since 4.4.0</span>, it's possible to specify that guest memory should
be wired and cannot be swapped out as follows:</p>
<pre>
&lt;domain type="bhyve"&gt;
...
&lt;memoryBacking&gt;
&lt;locked/&gt;
&lt;/memoryBacking&gt;
...
&lt;/domain&gt;
</pre>
<h3><a id="cputopology">CPU topology</a></h3>
<p><span class="since">Since 4.5.0</span>, it's possible to specify guest CPU topology, if bhyve
supports that. Support for specifying guest CPU topology was added to bhyve in
<a href="https://svnweb.freebsd.org/changeset/base/332298">FreeBSD changeset r332298</a>
for <i>-CURRENT</i>.
Example:</p>
<pre>
&lt;domain type="bhyve"&gt;
...
&lt;cpu&gt;
&lt;topology sockets='1' cores='2' threads='1'/&gt;
&lt;/cpu&gt;
...
&lt;/domain&gt;
</pre>
<h3><a id="msrs">Ignoring unknown MSRs reads and writes</a></h3>
<p><span class="since">Since 5.1.0</span>, it's possible to make bhyve
ignore accesses to unimplemented Model Specific Registers (MSRs).
Example:</p>
<pre>
&lt;domain type="bhyve"&gt;
...
&lt;features&gt;
...
&lt;msrs unknown='ignore'/&gt;
...
&lt;/features&gt;
...
&lt;/domain&gt;
</pre>
<h3><a id="bhyvecommand">Pass-through of arbitrary bhyve commands</a></h3>
<p><span class="since">Since 5.1.0</span>, it's possible to pass additional command-line
arguments to the bhyve process when starting the domain using the
<code>&lt;bhyve:commandline&gt;</code> element under <code>domain</code>.
To supply an argument, use the element <code>&lt;bhyve:arg&gt;</code> with
the attribute <code>value</code> set to additional argument to be added.
The arg element may be repeated multiple times. To use this XML addition, it is necessary
to issue an XML namespace request (the special <code>xmlns:<i>name</i></code> attribute)
that pulls in <code>http://libvirt.org/schemas/domain/bhyve/1.0</code>;
typically, the namespace is given the name of <code>bhyve</code>.
</p>
<p>Example:</p>
<pre>
&lt;domain type="bhyve" xmlns:bhyve="http://libvirt.org/schemas/domain/bhyve/1.0"&gt;
...
&lt;bhyve:commandline&gt;
&lt;bhyve:arg value='-somebhyvearg'/&gt;
&lt;/bhyve:commandline&gt;
&lt;/domain&gt;
</pre>
<p>Note that these extensions are for testing and development purposes only.
They are <b>unsupported</b>, using them may result in inconsistent state,
and upgrading either bhyve or libvirtd maybe break behavior of a domain that
was relying on a specific commands pass-through.</p>
</body>
</html>

584
docs/drvbhyve.rst Normal file
View File

@ -0,0 +1,584 @@
.. role:: since
============
Bhyve driver
============
.. contents::
Bhyve is a FreeBSD hypervisor. It first appeared in FreeBSD 10.0. However, it's
recommended to keep tracking FreeBSD 10-STABLE to make sure all new features of
bhyve are supported. In order to enable bhyve on your FreeBSD host, you'll need
to load the ``vmm`` kernel module. Additionally, ``if_tap`` and ``if_bridge``
modules should be loaded for networking support. Also, :since:`since 3.2.0` the
``virt-host-validate(1)`` supports the bhyve host validation and could be used
like this:
::
$ virt-host-validate bhyve
BHYVE: Checking for vmm module : PASS
BHYVE: Checking for if_tap module : PASS
BHYVE: Checking for if_bridge module : PASS
BHYVE: Checking for nmdm module : PASS
$
Additional information on bhyve could be obtained on
`bhyve.org <https://bhyve.org/>`__.
Connections to the Bhyve driver
-------------------------------
The libvirt bhyve driver is a single-instance privileged driver. Some sample
connection URIs are:
::
bhyve:///system (local access)
bhyve+unix:///system (local access)
bhyve+ssh://root@example.com/system (remote access, SSH tunnelled)
Example guest domain XML configurations
---------------------------------------
Example config
~~~~~~~~~~~~~~
The bhyve driver in libvirt is in its early stage and under active development.
So it supports only limited number of features bhyve provides.
Note: in older libvirt versions, only a single network device and a single disk
device were supported per-domain. However, :since:`since 1.2.6` the libvirt
bhyve driver supports up to 31 PCI devices.
Note: the Bhyve driver in libvirt will boot whichever device is first. If you
want to install from CD, put the CD device first. If not, put the root HDD
first.
Note: Only the SATA bus is supported. Only ``cdrom``- and ``disk``-type disks
are supported.
::
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<currentMemory>219136</currentMemory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
</os>
<features>
<apic/>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/path/to/bhyve_freebsd.img'/>
<target dev='hda' bus='sata'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='file' type='raw'/>
<source file='/path/to/cdrom.iso'/>
<target dev='hdc' bus='sata'/>
<readonly/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
</devices>
</domain>
(The <disk> sections may be swapped in order to install from *cdrom.iso*.)
Example config (Linux guest)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note the addition of <bootloader>.
::
<domain type='bhyve'>
<name>linux_guest</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>131072</memory>
<currentMemory>131072</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/local/sbin/grub-bhyve</bootloader>
<os>
<type>hvm</type>
</os>
<features>
<apic/>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/path/to/guest_hdd.img'/>
<target dev='hda' bus='sata'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='file' type='raw'/>
<source file='/path/to/cdrom.iso'/>
<target dev='hdc' bus='sata'/>
<readonly/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
</devices>
</domain>
Example config (Linux UEFI guest, VNC, tablet)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is an example to boot into Fedora 25 installation:
::
<domain type='bhyve'>
<name>fedora_uefi_vnc_tablet</name>
<memory unit='G'>4</memory>
<vcpu>2</vcpu>
<os>
<type>hvm</type>
<loader readonly="yes" type="pflash">/usr/local/share/uefi-firmware/BHYVE_UEFI.fd</loader>
</os>
<features>
<apic/>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='cdrom'>
<driver name='file' type='raw'/>
<source file='/path/to/Fedora-Workstation-Live-x86_64-25-1.3.iso'/>
<target dev='hdc' bus='sata'/>
<readonly/>
</disk>
<disk type='file' device='disk'>
<driver name='file' type='raw'/>
<source file='/path/to/linux_uefi.img'/>
<target dev='hda' bus='sata'/>
</disk>
<interface type='bridge'>
<model type='virtio'/>
<source bridge="virbr0"/>
</interface>
<serial type="nmdm">
<source master="/dev/nmdm0A" slave="/dev/nmdm0B"/>
</serial>
<graphics type='vnc' port='5904'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<controller type='usb' model='nec-xhci'/>
<input type='tablet' bus='usb'/>
</devices>
</domain>
Please refer to the `Using UEFI bootrom, VNC, and USB tablet`_ section for a
more detailed explanation.
Guest usage / management
------------------------
Connecting to a guest console
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Guest console connection is supported through the ``nmdm`` device. It could be
enabled by adding the following to the domain XML ( :since:`Since 1.2.4` ):
::
...
<devices>
<serial type="nmdm">
<source master="/dev/nmdm0A" slave="/dev/nmdm0B"/>
</serial>
</devices>
...
Make sure to load the ``nmdm`` kernel module if you plan to use that.
Then ``virsh console`` command can be used to connect to the text console of a
guest.
**NB:** Some versions of bhyve have a bug that prevents guests from booting
until the console is opened by a client. This bug was fixed in `FreeBSD
changeset r262884 <https://svnweb.freebsd.org/changeset/base/262884>`__. If an
older version is used, one either has to open a console manually with
``virsh console`` to let a guest boot or start a guest using:
::
start --console domname
**NB:** A bootloader configured to require user interaction will prevent the
domain from starting (and thus ``virsh console`` or ``start --console`` from
functioning) until the user interacts with it manually on the VM host. Because
users typically do not have access to the VM host, interactive bootloaders are
unsupported by libvirt. *However,* if you happen to run into this scenario and
also happen to have access to the Bhyve host machine, you may select a boot
option and allow the domain to finish starting by using an alternative terminal
client on the VM host to connect to the domain-configured null modem device. One
example (assuming ``/dev/nmdm0B`` is configured as the slave end of the domain
serial device) is:
::
cu -l /dev/nmdm0B
Converting from domain XML to Bhyve args
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh domxml-to-native`` command can preview the actual ``bhyve`` commands
that will be executed for a given domain. It outputs two lines, the first line
is a ``bhyveload`` command and the second is a ``bhyve`` command.
Please note that the ``virsh domxml-to-native`` doesn't do any real actions
other than printing the command, for example, it doesn't try to find a proper
TAP interface and create it, like what is done when starting a domain; and
always returns ``tap0`` for the network interface. So if you're going to run
these commands manually, most likely you might want to tweak them.
::
# virsh -c "bhyve:///system" domxml-to-native --format bhyve-argv --xml /path/to/bhyve.xml
/usr/sbin/bhyveload -m 214 -d /home/user/vm1.img vm1
/usr/sbin/bhyve -c 2 -m 214 -A -I -H -P -s 0:0,hostbridge \
-s 3:0,virtio-net,tap0,mac=52:54:00:5d:74:e3 -s 2:0,virtio-blk,/home/user/vm1.img \
-s 1,lpc -l com1,/dev/nmdm0A vm1
Using ZFS volumes
~~~~~~~~~~~~~~~~~
It's possible to use ZFS volumes as disk devices :since:`since 1.2.8` . An
example of domain XML device entry for that will look like:
::
...
<disk type='volume' device='disk'>
<source pool='zfspool' volume='vol1'/>
<target dev='vdb' bus='virtio'/>
</disk>
...
Please refer to the `Storage documentation <storage.html>`__ for more details on
storage management.
Using grub2-bhyve or Alternative Bootloaders
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's possible to boot non-FreeBSD guests by specifying an explicit bootloader,
e.g. ``grub-bhyve(1)``. Arguments to the bootloader may be specified as well. If
the bootloader is ``grub-bhyve`` and arguments are omitted, libvirt will try and
infer boot ordering from user-supplied <boot order='N'> configuration in the
domain. Failing that, it will boot the first disk in the domain (either
``cdrom``- or ``disk``-type devices). If the disk type is ``disk``, it will
attempt to boot from the first partition in the disk image.
::
...
<bootloader>/usr/local/sbin/grub-bhyve</bootloader>
<bootloader_args>...</bootloader_args>
...
Caveat: ``bootloader_args`` does not support any quoting. Filenames, etc, must
not have spaces or they will be tokenized incorrectly.
Using UEFI bootrom, VNC, and USB tablet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:since:`Since 3.2.0` , in addition to
`Using grub2-bhyve or Alternative Bootloaders`_, non-FreeBSD
guests could be also booted using an UEFI boot ROM, provided both guest OS and
installed ``bhyve(1)`` version support UEFI. To use that, ``loader`` should be
specified in the ``os`` section:
::
<domain type='bhyve'>
...
<os>
<type>hvm</type>
<loader readonly="yes" type="pflash">/usr/local/share/uefi-firmware/BHYVE_UEFI.fd</loader>
</os>
...
This uses the UEFI firmware provided by the
`sysutils/bhyve-firmware <https://www.freshports.org/sysutils/bhyve-firmware/>`__
FreeBSD port.
VNC and the tablet input device could be configured this way:
::
<domain type='bhyve'>
<devices>
...
<graphics type='vnc' port='5904'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<controller type='usb' model='nec-xhci'/>
<input type='tablet' bus='usb'/>
</devices>
...
</domain>
This way, VNC will be accessible on ``127.0.0.1:5904``.
Please note that the tablet device requires to have a USB controller of the
``nec-xhci`` model. Currently, only a single controller of this type and a
single tablet are supported per domain.
:since:`Since 3.5.0` , it's possible to configure how the video device is
exposed to the guest using the ``vgaconf`` attribute:
::
<domain type='bhyve'>
<devices>
...
<graphics type='vnc' port='5904'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<driver vgaconf='on'/>
<model type='gop' heads='1' primary='yes'/>
</video>
...
</devices>
...
</domain>
If not specified, bhyve's default mode for ``vgaconf`` will be used. Please
refer to the
`bhyve(8) <https://www.freebsd.org/cgi/man.cgi?query=bhyve&sektion=8&manpath=FreeBSD+12-current>`__
manual page and the `bhyve wiki <https://wiki.freebsd.org/bhyve>`__ for more
details on using the ``vgaconf`` option.
:since:`Since 3.7.0` , it's possible to use ``autoport`` to let libvirt allocate
VNC port automatically (instead of explicitly specifying it with the ``port``
attribute):
::
<graphics type='vnc' autoport='yes'>
:since:`Since 6.8.0` , it's possible to set framebuffer resolution using the
``resolution`` sub-element:
::
<video>
<model type='gop' heads='1' primary='yes'>
<resolution x='800' y='600'/>
</model>
</video>
:since:`Since 6.8.0` , VNC server can be configured to use password based
authentication:
::
<graphics type='vnc' port='5904' passwd='foobar'>
<listen type='address' address='127.0.0.1'/>
</graphics>
Note: VNC password authentication is known to be cryptographically weak.
Additionally, the password is passed as a command line argument in clear text.
Make sure you understand the risks associated with this feature before using it.
Clock configuration
~~~~~~~~~~~~~~~~~~~
Originally bhyve supported only localtime for RTC. Support for UTC time was
introduced in `FreeBSD changeset
r284894 <https://svnweb.freebsd.org/changeset/base/284894>`__ for *10-STABLE*
and in `changeset r279225 <https://svnweb.freebsd.org/changeset/base/279225>`__
for *-CURRENT*. It's possible to use this in libvirt :since:`since 1.2.18` ,
just place the following to domain XML:
::
<domain type="bhyve">
...
<clock offset='utc'/>
...
</domain>
Please note that if you run the older bhyve version that doesn't support UTC
time, you'll fail to start a domain. As UTC is used as a default when you do not
specify clock settings, you'll need to explicitly specify 'localtime' in this
case:
::
<domain type="bhyve">
...
<clock offset='localtime'/>
...
</domain>
e1000 NIC
~~~~~~~~~
As of `FreeBSD changeset
r302504 <https://svnweb.freebsd.org/changeset/base/302504>`__ bhyve supports
Intel e1000 network adapter emulation. It's supported in libvirt :since:`since
3.1.0` and could be used as follows:
::
...
<interface type='bridge'>
<source bridge='virbr0'/>
<model type='e1000'/>
</interface>
...
Sound device
~~~~~~~~~~~~
As of `FreeBSD changeset
r349355 <https://svnweb.freebsd.org/changeset/base/349355>`__ bhyve supports
sound device emulation. It's supported in libvirt :since:`since 6.7.0` .
::
...
<sound model='ich7'>
<audio id='1'/>
</sound>
<audio id='1' type='oss'>
<input dev='/dev/dsp0'/>
<output dev='/dev/dsp0'/>
</audio>
...
Here, the ``sound`` element specifies the sound device as it's exposed to the
guest, with ``ich7`` being the only supported model now, and the ``audio``
element specifies how the guest device is mapped to the host sound device.
Virtio-9p filesystem
~~~~~~~~~~~~~~~~~~~~
As of `FreeBSD changeset
r366413 <https://svnweb.freebsd.org/changeset/base/366413>`__ bhyve supports
sharing arbitrary directory tree between the guest and the host. It's supported
in libvirt :since:`since 6.9.0` .
::
...
<filesystem>
<source dir='/shared/dir'/>
<target dir='shared_dir'/>
</filesystem>
...
This share could be made read only by adding the ``<readonly/>`` sub-element.
In the Linux guest, this could be mounted using:
::
mount -t 9p shared_dir /mnt/shared_dir
Wiring guest memory
~~~~~~~~~~~~~~~~~~~
:since:`Since 4.4.0` , it's possible to specify that guest memory should be
wired and cannot be swapped out as follows:
::
<domain type="bhyve">
...
<memoryBacking>
<locked/>
</memoryBacking>
...
</domain>
CPU topology
~~~~~~~~~~~~
:since:`Since 4.5.0` , it's possible to specify guest CPU topology, if bhyve
supports that. Support for specifying guest CPU topology was added to bhyve in
`FreeBSD changeset r332298 <https://svnweb.freebsd.org/changeset/base/332298>`__
for *-CURRENT*. Example:
::
<domain type="bhyve">
...
<cpu>
<topology sockets='1' cores='2' threads='1'/>
</cpu>
...
</domain>
Ignoring unknown MSRs reads and writes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:since:`Since 5.1.0` , it's possible to make bhyve ignore accesses to
unimplemented Model Specific Registers (MSRs). Example:
::
<domain type="bhyve">
...
<features>
...
<msrs unknown='ignore'/>
...
</features>
...
</domain>
Pass-through of arbitrary bhyve commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:since:`Since 5.1.0` , it's possible to pass additional command-line arguments
to the bhyve process when starting the domain using the ``<bhyve:commandline>``
element under ``domain``. To supply an argument, use the element ``<bhyve:arg>``
with the attribute ``value`` set to additional argument to be added. The arg
element may be repeated multiple times. To use this XML addition, it is
necessary to issue an XML namespace request (the special ``xmlns:name``
attribute) that pulls in ``http://libvirt.org/schemas/domain/bhyve/1.0``;
typically, the namespace is given the name of ``bhyve``.
Example:
::
<domain type="bhyve" xmlns:bhyve="http://libvirt.org/schemas/domain/bhyve/1.0">
...
<bhyve:commandline>
<bhyve:arg value='-somebhyvearg'/>
</bhyve:commandline>
</domain>
Note that these extensions are for testing and development purposes only. They
are **unsupported**, using them may result in inconsistent state, and upgrading
either bhyve or libvirtd maybe break behavior of a domain that was relying on a
specific commands pass-through.

View File

@ -1,838 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>VMware ESX hypervisor driver</h1>
<ul id="toc"></ul>
<p>
The libvirt VMware ESX driver can manage VMware ESX/ESXi 3.5/4.x/5.x and
VMware GSX 2.0, also called VMware Server 2.0, and possibly later
versions. <span class="since">Since 0.8.3</span> the driver can also
connect to a VMware vCenter 2.5/4.x/5.x (VPX).
</p>
<h2><a id="project">Project Links</a></h2>
<ul>
<li>
The <a href="https://www.vmware.com/">VMware ESX and GSX</a>
hypervisors
</li>
</ul>
<h2><a id="prereq">Deployment pre-requisites</a></h2>
<p>
None. Any out-of-the-box installation of VPX/ESX(i)/GSX should work. No
preparations are required on the server side, no libvirtd must be
installed on the ESX server. The driver uses version 2.5 of the remote,
SOAP based
<a href="https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/">
VMware Virtual Infrastructure API</a> (VI API) to communicate with the
ESX server, like the VMware Virtual Infrastructure Client (VI client)
does. Since version 4.0 this API is called
<a href="https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/">
VMware vSphere API</a>.
</p>
<h2><a id="uri">Connections to the VMware ESX driver</a></h2>
<p>
Some example remote connection URIs for the driver are:
</p>
<pre>
vpx://example-vcenter.com/dc1/srv1 (VPX over HTTPS, select ESX server 'srv1' in datacenter 'dc1')
esx://example-esx.com (ESX over HTTPS)
gsx://example-gsx.com (GSX over HTTPS)
esx://example-esx.com/?transport=http (ESX over HTTP)
esx://example-esx.com/?no_verify=1 (ESX over HTTPS, but doesn't verify the server's SSL certificate)
</pre>
<p>
<strong>Note</strong>: In contrast to other drivers, the ESX driver is
a client-side-only driver. It connects to the ESX server using HTTP(S).
Therefore, the <a href="remote.html">remote transport mechanism</a>
provided by the remote driver and libvirtd will not work, and you
cannot use URIs like <code>esx+ssh://example.com</code>.
</p>
<h3><a id="uriformat">URI Format</a></h3>
<p>
URIs have this general form (<code>[...]</code> marks an optional part).
</p>
<pre>
type://[username@]hostname[:port]/[[folder/...]datacenter/[folder/...][cluster/]server][?extraparameters]
</pre>
<p>
The <code>type://</code> is either <code>esx://</code> or
<code>gsx://</code> or <code>vpx://</code> <span class="since">since 0.8.3</span>.
The driver selects the default port depending on the <code>type://</code>.
For <code>esx://</code> and <code>vpx://</code> the default HTTPS port
is 443, for <code>gsx://</code> it is 8333.
If the port parameter is given, it overrides the default port.
</p>
<p>
A <code>vpx://</code> connection is currently restricted to a single
ESX server. This might be relaxed in the future. The path part of the
URI is used to specify the datacenter and the ESX server in it. If the
ESX server is part of a cluster then the cluster has to be specified too.
</p>
<p>
An example: ESX server <code>example-esx.com</code> is managed by
vCenter <code>example-vcenter.com</code> and part of cluster
<code>cluster1</code>. This cluster is part of datacenter <code>dc1</code>.
</p>
<pre>
vpx://example-vcenter.com/dc1/cluster1/example-esx.com
</pre>
<p>
Datacenters and clusters can be organized in folders, those have to be
specified as well. The driver can handle folders
<span class="since">since 0.9.7</span>.
</p>
<pre>
vpx://example-vcenter.com/folder1/dc1/folder2/example-esx.com
</pre>
<h4><a id="extraparams">Extra parameters</a></h4>
<p>
Extra parameters can be added to a URI as part of the query string
(the part following <code>?</code>). A single parameter is formed by a
<code>name=value</code> pair. Multiple parameters are separated by
<code>&amp;</code>.
</p>
<pre>
?<span style="color: #E50000">no_verify=1</span>&amp;<span style="color: #00B200">auto_answer=1</span>&amp;<span style="color: #0000E5">proxy=socks://example-proxy.com:23456</span>
</pre>
<p>
The driver understands the extra parameters shown below.
</p>
<table class="top_table">
<tr>
<th>Name</th>
<th>Values</th>
<th>Meaning</th>
</tr>
<tr>
<td>
<code>transport</code>
</td>
<td>
<code>http</code> or <code>https</code>
</td>
<td>
Overrides the default HTTPS transport. For <code>esx://</code>
and <code>vpx://</code> the default HTTP port is 80, for
<code>gsx://</code> it is 8222.
</td>
</tr>
<tr>
<td>
<code>vcenter</code>
</td>
<td>
Hostname of a VMware vCenter or <code>*</code>
</td>
<td>
In order to perform a migration the driver needs to know the
VMware vCenter for the ESX server. If set to <code>*</code>,
the driver connects to the vCenter known to the ESX server.
This parameter in useful when connecting to an ESX server only.
</td>
</tr>
<tr>
<td>
<code>no_verify</code>
</td>
<td>
<code>0</code> or <code>1</code>
</td>
<td>
If set to 1, this disables libcurl client checks of the server's
SSL certificate. The default value is 0. See the
<a href="#certificates">Certificates for HTTPS</a> section for
details.
</td>
</tr>
<tr>
<td>
<code>auto_answer</code>
</td>
<td>
<code>0</code> or <code>1</code>
</td>
<td>
If set to 1, the driver answers all
<a href="#questions">questions</a> with the default answer.
If set to 0, questions are reported as errors. The default
value is 0. <span class="since">Since 0.7.5</span>.
</td>
</tr>
<tr>
<td>
<code>proxy</code>
</td>
<td>
<code>[type://]hostname[:port]</code>
</td>
<td>
Allows to specify a proxy for HTTP and HTTPS communication.
<span class="since">Since 0.8.2</span>.
The optional <code>type</code> part may be one of:
<code>http</code>, <code>socks</code>, <code>socks4</code>,
<code>socks4a</code> or <code>socks5</code>. The default is
<code>http</code> and <code>socks</code> is synonymous for
<code>socks5</code>. The optional <code>port</code> allows to
override the default port 1080.
</td>
</tr>
</table>
<h3><a id="auth">Authentication</a></h3>
<p>
In order to perform any useful operation the driver needs to log into
the ESX server. Therefore, only <code>virConnectOpenAuth</code> can be
used to connect to an ESX server, <code>virConnectOpen</code> and
<code>virConnectOpenReadOnly</code> don't work.
To log into an ESX server or vCenter the driver will request
credentials using the callback passed to the
<code>virConnectOpenAuth</code> function. The driver passes the
hostname as challenge parameter to the callback. This enables the
callback to distinguish between requests for ESX server and vCenter.
</p>
<p>
<strong>Note</strong>: During the ongoing driver development, testing
is done using an unrestricted <code>root</code> account. Problems may
occur if you use a restricted account. Detailed testing with restricted
accounts has not been done yet.
</p>
<h3><a id="certificates">Certificates for HTTPS</a></h3>
<p>
By default the ESX driver uses HTTPS to communicate with an ESX server.
Proper HTTPS communication requires correctly configured SSL
certificates. This certificates are different from the ones libvirt
uses for <a href="remote.html">secure communication over TLS</a> to a
libvirtd one a remote server.
</p>
<p>
By default the driver tries to verify the server's SSL certificate
using the CA certificate pool installed on your client computer. With
an out-of-the-box installed ESX server this won't work, because a newly
installed ESX server uses auto-generated self-signed certificates.
Those are signed by a CA certificate that is typically not known to your
client computer and libvirt will report an error like this one:
</p>
<pre>
error: internal error curl_easy_perform() returned an error: Peer certificate cannot be authenticated with known CA certificates (60)
</pre>
<p>
Where are two ways to solve this problem:
</p>
<ul>
<li>
Use the <code>no_verify=1</code> <a href="#extraparams">extra parameter</a>
to disable server certificate verification.
</li>
<li>
Generate new SSL certificates signed by a CA known to your client
computer and replace the original ones on your ESX server. See the
section <i>Replace a Default Certificate with a CA-Signed Certificate</i>
in the <a href="https://www.vmware.com/pdf/vsphere4/r40/vsp_40_esx_server_config.pdf">ESX Configuration Guide</a>
</li>
</ul>
<h3><a id="connproblems">Connection problems</a></h3>
<p>
There are also other causes for connection problems than the
<a href="#certificates">HTTPS certificate</a> related ones.
</p>
<ul>
<li>
As stated before the ESX driver doesn't need the
<a href="remote.html">remote transport mechanism</a>
provided by the remote driver and libvirtd, nor does the ESX driver
support it. Therefore, using an URI including a transport in the
scheme won't work. Only <a href="#uriformat">URIs as described</a>
are supported by the ESX driver. Here's a collection of possible
error messages:
<pre>
$ virsh -c esx+tcp://example.com/
error: unable to connect to libvirtd at 'example.com': Connection refused
</pre>
<pre>
$ virsh -c esx+tls://example.com/
error: Cannot access CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
</pre>
<pre>
$ virsh -c esx+ssh://example.com/
error: cannot recv data: ssh: connect to host example.com port 22: Connection refused
</pre>
<pre>
$ virsh -c esx+ssh://example.com/
error: cannot recv data: Resource temporarily unavailable
</pre>
</li>
<li>
<span class="since">Since 0.7.0</span> libvirt contains the ESX
driver. Earlier versions of libvirt will report a misleading error
about missing certificates when you try to connect to an ESX server.
<pre>
$ virsh -c esx://example.com/
error: Cannot access CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
</pre>
<p>
Don't let this error message confuse you. Setting up certificates
as described on the <a href="remote.html#Remote_certificates">remote transport mechanism</a> page
does not help, as this is not a certificate related problem.
</p>
<p>
To fix this problem you need to update your libvirt to 0.7.0 or newer.
You may also see this error when you use a libvirt version that
contains the ESX driver but you or your distro disabled the ESX
driver during compilation. <span class="since">Since 0.8.3</span>
the error message has been improved in this case:
</p>
<pre>
$ virsh -c esx://example.com/
error: invalid argument in libvirt was built without the 'esx' driver
</pre>
</li>
</ul>
<h2><a id="questions">Questions blocking tasks</a></h2>
<p>
Some methods of the VI API start tasks, for example
<code>PowerOnVM_Task()</code>. Such tasks may be blocked by questions
if the ESX server detects an issue with the domain that requires user
interaction. The ESX driver cannot prompt the user to answer a
question, libvirt doesn't have an API for something like this.
</p>
<p>
The VI API provides the <code>AnswerVM()</code> method to
programmatically answer a questions. So the driver has two options
how to handle such a situation: either answer the questions with the
default answer or report the question as an error and cancel the
blocked task if possible. The
<a href="#uriformat"><code>auto_answer</code></a> query parameter
controls the answering behavior.
</p>
<h2><a id="xmlspecial">Specialities in the domain XML config</a></h2>
<p>
There are several specialities in the domain XML config for ESX domains.
</p>
<h3><a id="restrictions">Restrictions</a></h3>
<p>
There are some restrictions for some values of the domain XML config.
The driver will complain if this restrictions are violated.
</p>
<ul>
<li>
Memory size has to be a multiple of 4096
</li>
<li>
Number of virtual CPU has to be 1 or a multiple of 2.
<span class="since">Since 4.10.0</span> any number of vCPUs is
supported.
</li>
<li>
Valid MAC address prefixes are <code>00:0c:29</code> and
<code>00:50:56</code>. <span class="since">Since 0.7.6</span>
arbitrary <a href="#macaddresses">MAC addresses</a> are supported.
</li>
</ul>
<h3><a id="datastore">Datastore references</a></h3>
<p>
Storage is managed in datastores. VMware uses a special path format to
reference files in a datastore. Basically, the datastore name is put
into squared braces in front of the path.
</p>
<pre>
[datastore] directory/filename
</pre>
<p>
To define a new domain the driver converts the domain XML into a
VMware VMX file and uploads it to a datastore known to the ESX server.
Because multiple datastores may be known to an ESX server the driver
needs to decide to which datastore the VMX file should be uploaded.
The driver deduces this information from the path of the source of the
first file-based harddisk listed in the domain XML.
</p>
<h3><a id="macaddresses">MAC addresses</a></h3>
<p>
VMware has registered two MAC address prefixes for domains:
<code>00:0c:29</code> and <code>00:50:56</code>. These prefixes are
split into ranges for different purposes.
</p>
<table class="top_table">
<tr>
<th>Range</th>
<th>Purpose</th>
</tr>
<tr>
<td>
<code>00:0c:29:00:00:00</code> - <code>00:0c:29:ff:ff:ff</code>
</td>
<td>
An ESX server autogenerates MAC addresses from this range if
the VMX file doesn't contain a MAC address when trying to start
a domain.
</td>
</tr>
<tr>
<td>
<code>00:50:56:00:00:00</code> - <code>00:50:56:3f:ff:ff</code>
</td>
<td>
MAC addresses from this range can by manually assigned by the
user in the VI client.
</td>
</tr>
<tr>
<td>
<code>00:50:56:80:00:00</code> - <code>00:50:56:bf:ff:ff</code>
</td>
<td>
A VI client autogenerates MAC addresses from this range for
newly defined domains.
</td>
</tr>
</table>
<p>
The VMX files generated by the ESX driver always contain a MAC address,
because libvirt generates a random one if an interface element in the
domain XML file lacks a MAC address.
<span class="since">Since 0.7.6</span> the ESX driver sets the prefix
for generated MAC addresses to <code>00:0c:29</code>. Before 0.7.6
the <code>00:50:56</code> prefix was used. Sometimes this resulted in
the generation of out-of-range MAC address that were rejected by the
ESX server.
</p>
<p>
Also <span class="since">since 0.7.6</span> every MAC address outside
this ranges can be used. For such MAC addresses the ESX server-side
check is disabled in the VMX file to stop the ESX server from rejecting
out-of-predefined-range MAC addresses.
</p>
<pre>
ethernet0.checkMACAddress = "false"
</pre>
<p>
<span class="since">Since 6.6.0</span>, one can force libvirt to keep the
provided MAC address when it's in the reserved VMware range by adding a
<code>type="static"</code> attribute to the <code>&lt;mac/&gt;</code> element.
Note that this attribute is useless if the provided MAC address is outside of
the reserved VMWare ranges.
</p>
<h3><a id="hardware">Available hardware</a></h3>
<p>
VMware ESX supports different models of SCSI controllers and network
cards.
</p>
<h4>SCSI controller models</h4>
<dl>
<dt><code>auto</code></dt>
<dd>
This isn't an actual controller model. If specified the ESX driver
tries to detect the SCSI controller model referenced in the
<code>.vmdk</code> file and use it. Autodetection fails when a
SCSI controller has multiple disks attached and the SCSI controller
models referenced in the <code>.vmdk</code> files are inconsistent.
<span class="since">Since 0.8.3</span>
</dd>
<dt><code>buslogic</code></dt>
<dd>
BusLogic SCSI controller for older guests.
</dd>
<dt><code>lsilogic</code></dt>
<dd>
LSI Logic SCSI controller for recent guests.
</dd>
<dt><code>lsisas1068</code></dt>
<dd>
LSI Logic SAS 1068 controller. <span class="since">Since 0.8.0</span>
</dd>
<dt><code>vmpvscsi</code></dt>
<dd>
Special VMware Paravirtual SCSI controller, requires VMware tools inside
the guest. See <a href="https://kb.vmware.com/kb/1010398">VMware KB1010398</a>
for details. <span class="since">Since 0.8.3</span>
</dd>
</dl>
<p>
Here a domain XML snippet:
</p>
<pre>
...
&lt;disk type='file' device='disk'&gt;
&lt;source file='[local-storage] Fedora11/Fedora11.vmdk'/&gt;
&lt;target dev='sda' bus='scsi'/&gt;
&lt;address type='drive' controller='0' bus='0' unit='0'/&gt;
&lt;/disk&gt;
&lt;controller type='scsi' index='0' model='<strong>lsilogic</strong>'/&gt;
...
</pre>
<p>
The controller element is supported <span class="since">since 0.8.2</span>.
Prior to this <code>&lt;driver name='lsilogic'/&gt;</code> was abused to
specify the SCSI controller model. This attribute usage is deprecated now.
</p>
<pre>
...
&lt;disk type='file' device='disk'&gt;
&lt;driver name='<strong>lsilogic</strong>'/&gt;
&lt;source file='[local-storage] Fedora11/Fedora11.vmdk'/&gt;
&lt;target dev='sda' bus='scsi'/&gt;
&lt;/disk&gt;
...
</pre>
<h4>Network card models</h4>
<dl>
<dt><code>vlance</code></dt>
<dd>
AMD PCnet32 network card for older guests.
</dd>
<dt><code>vmxnet</code>, <code>vmxnet2</code>, <code>vmxnet3</code></dt>
<dd>
Special VMware VMXnet network card, requires VMware tools inside
the guest. See <a href="https://kb.vmware.com/kb/1001805">VMware KB1001805</a>
for details.
</dd>
<dt><code>e1000</code></dt>
<dd>
Intel E1000 network card for recent guests.
</dd>
</dl>
<p>
Here a domain XML snippet:
</p>
<pre>
...
&lt;interface type='bridge'&gt;
&lt;mac address='00:50:56:25:48:c7'/&gt;
&lt;source bridge='VM Network'/&gt;
&lt;model type='<strong>e1000</strong>'/&gt;
&lt;/interface&gt;
...
</pre>
<h2><a id="importexport">Import and export of domain XML configs</a></h2>
<p>
The ESX driver currently supports a native config format known as
<code>vmware-vmx</code> to handle VMware VMX configs.
</p>
<h3><a id="xmlimport">Converting from VMware VMX config to domain XML config</a></h3>
<p>
The <code>virsh domxml-from-native</code> provides a way to convert an
existing VMware VMX config into a domain XML config that can then be
used by libvirt.
</p>
<pre>
$ cat &gt; demo.vmx &lt;&lt; EOF
#!/usr/bin/vmware
config.version = "8"
virtualHW.version = "4"
floppy0.present = "false"
nvram = "Fedora11.nvram"
deploymentPlatform = "windows"
virtualHW.productCompatibility = "hosted"
tools.upgrade.policy = "useGlobal"
powerType.powerOff = "default"
powerType.powerOn = "default"
powerType.suspend = "default"
powerType.reset = "default"
displayName = "Fedora11"
extendedConfigFile = "Fedora11.vmxf"
scsi0.present = "true"
scsi0.sharedBus = "none"
scsi0.virtualDev = "lsilogic"
memsize = "1024"
scsi0:0.present = "true"
scsi0:0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Fedora11/Fedora11.vmdk"
scsi0:0.deviceType = "scsi-hardDisk"
ide0:0.present = "true"
ide0:0.clientDevice = "true"
ide0:0.deviceType = "cdrom-raw"
ide0:0.startConnected = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.addressType = "vpx"
ethernet0.generatedAddress = "00:50:56:91:48:c7"
chipset.onlineStandby = "false"
guestOSAltName = "Red Hat Enterprise Linux 5 (32-Bit)"
guestOS = "rhel5"
uuid.bios = "50 11 5e 16 9b dc 49 d7-f1 71 53 c4 d7 f9 17 10"
snapshot.action = "keep"
sched.cpu.min = "0"
sched.cpu.units = "mhz"
sched.cpu.shares = "normal"
sched.mem.minsize = "0"
sched.mem.shares = "normal"
toolScripts.afterPowerOn = "true"
toolScripts.afterResume = "true"
toolScripts.beforeSuspend = "true"
toolScripts.beforePowerOff = "true"
scsi0:0.redo = ""
tools.syncTime = "false"
uuid.location = "56 4d b5 06 a2 bd fb eb-ae 86 f7 d8 49 27 d0 c4"
sched.cpu.max = "unlimited"
sched.swap.derivedName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Fedora11/Fedora11-7de040d8.vswp"
tools.remindInstall = "TRUE"
EOF
$ virsh -c esx://example.com domxml-from-native vmware-vmx demo.vmx
Enter username for example.com [root]:
Enter root password for example.com:
&lt;domain type='vmware'&gt;
&lt;name&gt;Fedora11&lt;/name&gt;
&lt;uuid&gt;50115e16-9bdc-49d7-f171-53c4d7f91710&lt;/uuid&gt;
&lt;memory&gt;1048576&lt;/memory&gt;
&lt;currentMemory&gt;1048576&lt;/currentMemory&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;os&gt;
&lt;type arch='i686'&gt;hvm&lt;/type&gt;
&lt;/os&gt;
&lt;clock offset='utc'/&gt;
&lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
&lt;on_reboot&gt;restart&lt;/on_reboot&gt;
&lt;on_crash&gt;destroy&lt;/on_crash&gt;
&lt;devices&gt;
&lt;disk type='file' device='disk'&gt;
&lt;source file='[local-storage] Fedora11/Fedora11.vmdk'/&gt;
&lt;target dev='sda' bus='scsi'/&gt;
&lt;address type='drive' controller='0' bus='0' unit='0'/&gt;
&lt;/disk&gt;
&lt;controller type='scsi' index='0' model='lsilogic'/&gt;
&lt;interface type='bridge'&gt;
&lt;mac address='00:50:56:91:48:c7'/&gt;
&lt;source bridge='VM Network'/&gt;
&lt;/interface&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
<h3><a id="xmlexport">Converting from domain XML config to VMware VMX config</a></h3>
<p>
The <code>virsh domxml-to-native</code> provides a way to convert a
domain XML config into a VMware VMX config.
</p>
<pre>
$ cat &gt; demo.xml &lt;&lt; EOF
&lt;domain type='vmware'&gt;
&lt;name&gt;Fedora11&lt;/name&gt;
&lt;uuid&gt;50115e16-9bdc-49d7-f171-53c4d7f91710&lt;/uuid&gt;
&lt;memory&gt;1048576&lt;/memory&gt;
&lt;currentMemory&gt;1048576&lt;/currentMemory&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;os&gt;
&lt;type arch='x86_64'&gt;hvm&lt;/type&gt;
&lt;/os&gt;
&lt;devices&gt;
&lt;disk type='file' device='disk'&gt;
&lt;source file='[local-storage] Fedora11/Fedora11.vmdk'/&gt;
&lt;target dev='sda' bus='scsi'/&gt;
&lt;address type='drive' controller='0' bus='0' unit='0'/&gt;
&lt;/disk&gt;
&lt;controller type='scsi' index='0' model='lsilogic'/&gt;
&lt;interface type='bridge'&gt;
&lt;mac address='00:50:56:25:48:c7'/&gt;
&lt;source bridge='VM Network'/&gt;
&lt;/interface&gt;
&lt;/devices&gt;
&lt;/domain&gt;
EOF
$ virsh -c esx://example.com domxml-to-native vmware-vmx demo.xml
Enter username for example.com [root]:
Enter root password for example.com:
config.version = "8"
virtualHW.version = "4"
guestOS = "other-64"
uuid.bios = "50 11 5e 16 9b dc 49 d7-f1 71 53 c4 d7 f9 17 10"
displayName = "Fedora11"
memsize = "1024"
numvcpus = "1"
scsi0.present = "true"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "/vmfs/volumes/local-storage/Fedora11/Fedora11.vmdk"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
ethernet0.addressType = "static"
ethernet0.address = "00:50:56:25:48:C7"
</pre>
<h2><a id="xmlconfig">Example domain XML configs</a></h2>
<h3>Fedora11 on x86_64</h3>
<pre>
&lt;domain type='vmware'&gt;
&lt;name&gt;Fedora11&lt;/name&gt;
&lt;uuid&gt;50115e16-9bdc-49d7-f171-53c4d7f91710&lt;/uuid&gt;
&lt;memory&gt;1048576&lt;/memory&gt;
&lt;currentMemory&gt;1048576&lt;/currentMemory&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;os&gt;
&lt;type arch='x86_64'&gt;hvm&lt;/type&gt;
&lt;/os&gt;
&lt;devices&gt;
&lt;disk type='file' device='disk'&gt;
&lt;source file='[local-storage] Fedora11/Fedora11.vmdk'/&gt;
&lt;target dev='sda' bus='scsi'/&gt;
&lt;address type='drive' controller='0' bus='0' unit='0'/&gt;
&lt;/disk&gt;
&lt;controller type='scsi' index='0'/&gt;
&lt;interface type='bridge'&gt;
&lt;mac address='00:50:56:25:48:c7'/&gt;
&lt;source bridge='VM Network'/&gt;
&lt;/interface&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
<h2><a id="migration">Migration</a></h2>
<p>
A migration cannot be initiated on an ESX server directly, a VMware
vCenter is necessary for this. The <code>vcenter</code> query
parameter must be set either to the hostname or IP address of the
vCenter managing the ESX server or to <code>*</code>. Setting it
to <code>*</code> causes the driver to connect to the vCenter known to
the ESX server. If the ESX server is not managed by a vCenter an error
is reported.
</p>
<pre>
esx://example.com/?vcenter=example-vcenter.com
</pre>
<p>
Here's an example how to migrate the domain <code>Fedora11</code> from
ESX server <code>example-src.com</code> to ESX server
<code>example-dst.com</code> implicitly involving vCenter
<code>example-vcenter.com</code> using <code>virsh</code>.
</p>
<pre>
$ virsh -c esx://example-src.com/?vcenter=* migrate Fedora11 esx://example-dst.com/?vcenter=*
Enter username for example-src.com [root]:
Enter root password for example-src.com:
Enter username for example-vcenter.com [administrator]:
Enter administrator password for example-vcenter.com:
Enter username for example-dst.com [root]:
Enter root password for example-dst.com:
Enter username for example-vcenter.com [administrator]:
Enter administrator password for example-vcenter.com:
</pre>
<p>
<span class="since">Since 0.8.3</span> you can directly connect to a vCenter.
This simplifies migration a bit. Here's the same migration as above but
using <code>vpx://</code> connections and assuming both ESX server are in
datacenter <code>dc1</code> and aren't part of a cluster.
</p>
<pre>
$ virsh -c vpx://example-vcenter.com/dc1/example-src.com migrate Fedora11 vpx://example-vcenter.com/dc1/example-dst.com
Enter username for example-vcenter.com [administrator]:
Enter administrator password for example-vcenter.com:
Enter username for example-vcenter.com [administrator]:
Enter administrator password for example-vcenter.com:
</pre>
<h2><a id="scheduler">Scheduler configuration</a></h2>
<p>
The driver exposes the ESX CPU scheduler. The parameters listed below
are available to control the scheduler.
</p>
<dl>
<dt><code>reservation</code></dt>
<dd>
The amount of CPU resource in MHz that is guaranteed to be
available to the domain. Valid values are 0 and greater.
</dd>
<dt><code>limit</code></dt>
<dd>
The CPU utilization of the domain will be
limited to this value in MHz, even if more CPU resources are
available. If the limit is set to -1, the CPU utilization of the
domain is unlimited. If the limit is not set to -1, it must be
greater than or equal to the reservation.
</dd>
<dt><code>shares</code></dt>
<dd>
Shares are used to determine relative CPU
allocation between domains. In general, a domain with more shares
gets proportionally more of the CPU resource. Valid values are 0
and greater. The special values -1, -2 and -3 represent the
predefined shares level <code>low</code>, <code>normal</code> and
<code>high</code>.
</dd>
</dl>
<h2><a id="tools">VMware tools</a></h2>
<p>
Some actions require installed VMware tools. If the VMware tools are
not installed in the guest and one of the actions below is to be
performed the ESX server raises an error and the driver reports it.
</p>
<ul>
<li>
<code>virDomainGetHostname</code>
</li>
<li>
<code>virDomainInterfaceAddresses</code> (only for the
<code>VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT</code> source)
</li>
<li>
<code>virDomainReboot</code>
</li>
<li>
<code>virDomainShutdown</code>
</li>
</ul>
<h2><a id="links">Links</a></h2>
<ul>
<li>
<a href="https://www.vmware.com/support/developer/vc-sdk/">
VMware vSphere Web Services SDK Documentation
</a>
</li>
<li>
<a href="https://www.vmware.com/pdf/esx3_memory.pdf">
The Role of Memory in VMware ESX Server 3
</a>
</li>
<li>
<a href="https://www.sanbarrow.com/vmx.html">
VMware VMX config parameters
</a>
</li>
<li>
<a href="https://www.vmware.com/pdf/vsp_4_pvscsi_perf.pdf">
VMware ESX 4.0 PVSCSI Storage Performance
</a>
</li>
</ul>
</body></html>

679
docs/drvesx.rst Normal file
View File

@ -0,0 +1,679 @@
.. role:: since
============================
VMware ESX hypervisor driver
============================
.. contents::
The libvirt VMware ESX driver can manage VMware ESX/ESXi 3.5/4.x/5.x and VMware
GSX 2.0, also called VMware Server 2.0, and possibly later versions.
:since:`Since 0.8.3` the driver can also connect to a VMware vCenter 2.5/4.x/5.x
(VPX).
Project Links
-------------
- The `VMware ESX and GSX <https://www.vmware.com/>`__ hypervisors
Deployment pre-requisites
-------------------------
None. Any out-of-the-box installation of VPX/ESX(i)/GSX should work. No
preparations are required on the server side, no libvirtd must be installed on
the ESX server. The driver uses version 2.5 of the remote, SOAP based `VMware
Virtual Infrastructure
API <https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/>`__
(VI API) to communicate with the ESX server, like the VMware Virtual
Infrastructure Client (VI client) does. Since version 4.0 this API is called
`VMware vSphere
API <https://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/>`__.
Connections to the VMware ESX driver
------------------------------------
Some example remote connection URIs for the driver are:
::
vpx://example-vcenter.com/dc1/srv1 (VPX over HTTPS, select ESX server 'srv1' in datacenter 'dc1')
esx://example-esx.com (ESX over HTTPS)
gsx://example-gsx.com (GSX over HTTPS)
esx://example-esx.com/?transport=http (ESX over HTTP)
esx://example-esx.com/?no_verify=1 (ESX over HTTPS, but doesn't verify the server's SSL certificate)
**Note**: In contrast to other drivers, the ESX driver is a client-side-only
driver. It connects to the ESX server using HTTP(S). Therefore, the `remote
transport mechanism <remote.html>`__ provided by the remote driver and libvirtd
will not work, and you cannot use URIs like ``esx+ssh://example.com``.
URI Format
~~~~~~~~~~
URIs have this general form (``[...]`` marks an optional part).
::
type://[username@]hostname[:port]/[[folder/...]datacenter/[folder/...][cluster/]server][?extraparameters]
The ``type://`` is either ``esx://`` or ``gsx://`` or ``vpx://`` :since:`since
0.8.3` . The driver selects the default port depending on the ``type://``. For
``esx://`` and ``vpx://`` the default HTTPS port is 443, for ``gsx://`` it is
8333. If the port parameter is given, it overrides the default port.
A ``vpx://`` connection is currently restricted to a single ESX server. This
might be relaxed in the future. The path part of the URI is used to specify the
datacenter and the ESX server in it. If the ESX server is part of a cluster then
the cluster has to be specified too.
An example: ESX server ``example-esx.com`` is managed by vCenter
``example-vcenter.com`` and part of cluster ``cluster1``. This cluster is part
of datacenter ``dc1``.
::
vpx://example-vcenter.com/dc1/cluster1/example-esx.com
Datacenters and clusters can be organized in folders, those have to be specified
as well. The driver can handle folders :since:`since 0.9.7` .
::
vpx://example-vcenter.com/folder1/dc1/folder2/example-esx.com
Extra parameters
^^^^^^^^^^^^^^^^
Extra parameters can be added to a URI as part of the query string (the part
following ``?``). A single parameter is formed by a ``name=value`` pair.
Multiple parameters are separated by ``&``.
::
?no_verify=1&auto_answer=1&proxy=socks://example-proxy.com:23456
The driver understands the extra parameters shown below.
+-----------------+-----------------------------+-----------------------------+
| Name | Values | Meaning |
+=================+=============================+=============================+
| ``transport`` | ``http`` or ``https`` | Overrides the default HTTPS |
| | | transport. For ``esx://`` |
| | | and ``vpx://`` the default |
| | | HTTP port is 80, for |
| | | ``gsx://`` it is 8222. |
+-----------------+-----------------------------+-----------------------------+
| ``vcenter`` | Hostname of a VMware | In order to perform a |
| | vCenter or ``*`` | migration the driver needs |
| | | to know the VMware vCenter |
| | | for the ESX server. If set |
| | | to ``*``, the driver |
| | | connects to the vCenter |
| | | known to the ESX server. |
| | | This parameter in useful |
| | | when connecting to an ESX |
| | | server only. |
+-----------------+-----------------------------+-----------------------------+
| ``no_verify`` | ``0`` or ``1`` | If set to 1, this disables |
| | | libcurl client checks of |
| | | the server's SSL |
| | | certificate. The default |
| | | value is 0. See the |
| | | `Certificates for HTTPS`_ |
| | | section for details. |
+-----------------+-----------------------------+-----------------------------+
| ``auto_answer`` | ``0`` or ``1`` | If set to 1, the driver |
| | | answers all |
| | | `Questions blocking tasks`_ |
| | | with the default answer. If |
| | | set to 0, questions are |
| | | reported as errors. The |
| | | default value is 0. |
| | | :since:`Since 0.7.5` . |
+-----------------+-----------------------------+-----------------------------+
| ``proxy`` | ``[type://]host[:port]`` | Allows to specify a proxy |
| | | for HTTP and HTTPS |
| | | communication. |
| | | :since:`Since 0.8.2` . The |
| | | optional ``type`` part may |
| | | be one of: ``http``, |
| | | ``socks``, ``socks4``, |
| | | ``socks4a`` or ``socks5``. |
| | | The default is ``http`` and |
| | | ``socks`` is synonymous for |
| | | ``socks5``. The optional |
| | | ``port`` allows to override |
| | | the default port 1080. |
+-----------------+-----------------------------+-----------------------------+
Authentication
~~~~~~~~~~~~~~
In order to perform any useful operation the driver needs to log into the ESX
server. Therefore, only ``virConnectOpenAuth`` can be used to connect to an ESX
server, ``virConnectOpen`` and ``virConnectOpenReadOnly`` don't work. To log
into an ESX server or vCenter the driver will request credentials using the
callback passed to the ``virConnectOpenAuth`` function. The driver passes the
hostname as challenge parameter to the callback. This enables the callback to
distinguish between requests for ESX server and vCenter.
**Note**: During the ongoing driver development, testing is done using an
unrestricted ``root`` account. Problems may occur if you use a restricted
account. Detailed testing with restricted accounts has not been done yet.
Certificates for HTTPS
~~~~~~~~~~~~~~~~~~~~~~
By default the ESX driver uses HTTPS to communicate with an ESX server. Proper
HTTPS communication requires correctly configured SSL certificates. This
certificates are different from the ones libvirt uses for `secure communication
over TLS <remote.html>`__ to a libvirtd one a remote server.
By default the driver tries to verify the server's SSL certificate using the CA
certificate pool installed on your client computer. With an out-of-the-box
installed ESX server this won't work, because a newly installed ESX server uses
auto-generated self-signed certificates. Those are signed by a CA certificate
that is typically not known to your client computer and libvirt will report an
error like this one:
::
error: internal error curl_easy_perform() returned an error: Peer certificate cannot be authenticated with known CA certificates (60)
Where are two ways to solve this problem:
- Use the ``no_verify=1`` `Extra parameters`_ to disable server
certificate verification.
- Generate new SSL certificates signed by a CA known to your client computer
and replace the original ones on your ESX server. See the section *Replace a
Default Certificate with a CA-Signed Certificate* in the `ESX Configuration
Guide <https://www.vmware.com/pdf/vsphere4/r40/vsp_40_esx_server_config.pdf>`__
Connection problems
~~~~~~~~~~~~~~~~~~~
There are also other causes for connection problems than those related to
`Certificates for HTTPS`_ .
- As stated before the ESX driver doesn't need the `remote transport
mechanism <remote.html>`__ provided by the remote driver and libvirtd, nor
does the ESX driver support it. Therefore, using an URI including a transport
in the scheme won't work. Only URIs as described in `URI Format`_ are
supported by the ESX driver. Here's a collection of possible error messages:
::
$ virsh -c esx+tcp://example.com/
error: unable to connect to libvirtd at 'example.com': Connection refused
::
$ virsh -c esx+tls://example.com/
error: Cannot access CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
::
$ virsh -c esx+ssh://example.com/
error: cannot recv data: ssh: connect to host example.com port 22: Connection refused
::
$ virsh -c esx+ssh://example.com/
error: cannot recv data: Resource temporarily unavailable
- :since:`Since 0.7.0` libvirt contains the ESX driver. Earlier versions of
libvirt will report a misleading error about missing certificates when you
try to connect to an ESX server.
::
$ virsh -c esx://example.com/
error: Cannot access CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
Don't let this error message confuse you. Setting up certificates as
described on the `tls certificates <kbase/tlscerts.html>`__ page does not
help, as this is not a certificate related problem.
To fix this problem you need to update your libvirt to 0.7.0 or newer. You
may also see this error when you use a libvirt version that contains the ESX
driver but you or your distro disabled the ESX driver during compilation.
:since:`Since 0.8.3` the error message has been improved in this case:
::
$ virsh -c esx://example.com/
error: invalid argument in libvirt was built without the 'esx' driver
Questions blocking tasks
------------------------
Some methods of the VI API start tasks, for example ``PowerOnVM_Task()``. Such
tasks may be blocked by questions if the ESX server detects an issue with the
domain that requires user interaction. The ESX driver cannot prompt the user to
answer a question, libvirt doesn't have an API for something like this.
The VI API provides the ``AnswerVM()`` method to programmatically answer a
questions. So the driver has two options how to handle such a situation: either
answer the questions with the default answer or report the question as an error
and cancel the blocked task if possible. The ``auto_answer`` query
parameter (see `URI Format`_) controls the answering behavior.
Specialities in the domain XML config
-------------------------------------
There are several specialities in the domain XML config for ESX domains.
Restrictions
~~~~~~~~~~~~
There are some restrictions for some values of the domain XML config. The driver
will complain if this restrictions are violated.
- Memory size has to be a multiple of 4096
- Number of virtual CPU has to be 1 or a multiple of 2. :since:`Since 4.10.0`
any number of vCPUs is supported.
- Valid MAC address prefixes are ``00:0c:29`` and ``00:50:56``. :since:`Since
0.7.6` arbitrary `MAC addresses`_ are supported.
Datastore references
~~~~~~~~~~~~~~~~~~~~
Storage is managed in datastores. VMware uses a special path format to reference
files in a datastore. Basically, the datastore name is put into squared braces
in front of the path.
::
[datastore] directory/filename
To define a new domain the driver converts the domain XML into a VMware VMX file
and uploads it to a datastore known to the ESX server. Because multiple
datastores may be known to an ESX server the driver needs to decide to which
datastore the VMX file should be uploaded. The driver deduces this information
from the path of the source of the first file-based harddisk listed in the
domain XML.
MAC addresses
~~~~~~~~~~~~~
VMware has registered two MAC address prefixes for domains: ``00:0c:29`` and
``00:50:56``. These prefixes are split into ranges for different purposes.
+--------------------------------------+--------------------------------------+
| Range | Purpose |
+======================================+======================================+
| ``00:0c:29:00:00:00`` - | An ESX server autogenerates MAC |
| ``00:0c:29:ff:ff:ff`` | addresses from this range if the VMX |
| | file doesn't contain a MAC address |
| | when trying to start a domain. |
+--------------------------------------+--------------------------------------+
| ``00:50:56:00:00:00`` - | MAC addresses from this range can by |
| ``00:50:56:3f:ff:ff`` | manually assigned by the user in the |
| | VI client. |
+--------------------------------------+--------------------------------------+
| ``00:50:56:80:00:00`` - | A VI client autogenerates MAC |
| ``00:50:56:bf:ff:ff`` | addresses from this range for newly |
| | defined domains. |
+--------------------------------------+--------------------------------------+
The VMX files generated by the ESX driver always contain a MAC address, because
libvirt generates a random one if an interface element in the domain XML file
lacks a MAC address. :since:`Since 0.7.6` the ESX driver sets the prefix for
generated MAC addresses to ``00:0c:29``. Before 0.7.6 the ``00:50:56`` prefix
was used. Sometimes this resulted in the generation of out-of-range MAC address
that were rejected by the ESX server.
Also :since:`since 0.7.6` every MAC address outside this ranges can be used. For
such MAC addresses the ESX server-side check is disabled in the VMX file to stop
the ESX server from rejecting out-of-predefined-range MAC addresses.
::
ethernet0.checkMACAddress = "false"
:since:`Since 6.6.0` , one can force libvirt to keep the provided MAC address
when it's in the reserved VMware range by adding a ``type="static"`` attribute
to the ``<mac/>`` element. Note that this attribute is useless if the provided
MAC address is outside of the reserved VMWare ranges.
Available hardware
~~~~~~~~~~~~~~~~~~
VMware ESX supports different models of SCSI controllers and network cards.
SCSI controller models
^^^^^^^^^^^^^^^^^^^^^^
``auto``
This isn't an actual controller model. If specified the ESX driver tries to
detect the SCSI controller model referenced in the ``.vmdk`` file and use it.
Autodetection fails when a SCSI controller has multiple disks attached and
the SCSI controller models referenced in the ``.vmdk`` files are
inconsistent. :since:`Since 0.8.3`
``buslogic``
BusLogic SCSI controller for older guests.
``lsilogic``
LSI Logic SCSI controller for recent guests.
``lsisas1068``
LSI Logic SAS 1068 controller. :since:`Since 0.8.0`
``vmpvscsi``
Special VMware Paravirtual SCSI controller, requires VMware tools inside the
guest. See `VMware KB1010398 <https://kb.vmware.com/kb/1010398>`__ for
details. :since:`Since 0.8.3`
Here a domain XML snippet:
::
...
<disk type='file' device='disk'>
<source file='[local-storage] Fedora11/Fedora11.vmdk'/>
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='lsilogic'/>
...
The controller element is supported :since:`since 0.8.2` . Prior to this
``<driver name='lsilogic'/>`` was abused to specify the SCSI controller model.
This attribute usage is deprecated now.
::
...
<disk type='file' device='disk'>
<driver name='lsilogic'/>
<source file='[local-storage] Fedora11/Fedora11.vmdk'/>
<target dev='sda' bus='scsi'/>
</disk>
...
Network card models
^^^^^^^^^^^^^^^^^^^
``vlance``
AMD PCnet32 network card for older guests.
``vmxnet``, ``vmxnet2``, ``vmxnet3``
Special VMware VMXnet network card, requires VMware tools inside the guest.
See `VMware KB1001805 <https://kb.vmware.com/kb/1001805>`__ for details.
``e1000``
Intel E1000 network card for recent guests.
Here a domain XML snippet:
::
...
<interface type='bridge'>
<mac address='00:50:56:25:48:c7'/>
<source bridge='VM Network'/>
<model type='e1000'/>
</interface>
...
Import and export of domain XML configs
---------------------------------------
The ESX driver currently supports a native config format known as ``vmware-vmx``
to handle VMware VMX configs.
Converting from VMware VMX config to domain XML config
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh domxml-from-native`` provides a way to convert an existing VMware
VMX config into a domain XML config that can then be used by libvirt.
::
$ cat > demo.vmx << EOF
#!/usr/bin/vmware
config.version = "8"
virtualHW.version = "4"
floppy0.present = "false"
nvram = "Fedora11.nvram"
deploymentPlatform = "windows"
virtualHW.productCompatibility = "hosted"
tools.upgrade.policy = "useGlobal"
powerType.powerOff = "default"
powerType.powerOn = "default"
powerType.suspend = "default"
powerType.reset = "default"
displayName = "Fedora11"
extendedConfigFile = "Fedora11.vmxf"
scsi0.present = "true"
scsi0.sharedBus = "none"
scsi0.virtualDev = "lsilogic"
memsize = "1024"
scsi0:0.present = "true"
scsi0:0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Fedora11/Fedora11.vmdk"
scsi0:0.deviceType = "scsi-hardDisk"
ide0:0.present = "true"
ide0:0.clientDevice = "true"
ide0:0.deviceType = "cdrom-raw"
ide0:0.startConnected = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.addressType = "vpx"
ethernet0.generatedAddress = "00:50:56:91:48:c7"
chipset.onlineStandby = "false"
guestOSAltName = "Red Hat Enterprise Linux 5 (32-Bit)"
guestOS = "rhel5"
uuid.bios = "50 11 5e 16 9b dc 49 d7-f1 71 53 c4 d7 f9 17 10"
snapshot.action = "keep"
sched.cpu.min = "0"
sched.cpu.units = "mhz"
sched.cpu.shares = "normal"
sched.mem.minsize = "0"
sched.mem.shares = "normal"
toolScripts.afterPowerOn = "true"
toolScripts.afterResume = "true"
toolScripts.beforeSuspend = "true"
toolScripts.beforePowerOff = "true"
scsi0:0.redo = ""
tools.syncTime = "false"
uuid.location = "56 4d b5 06 a2 bd fb eb-ae 86 f7 d8 49 27 d0 c4"
sched.cpu.max = "unlimited"
sched.swap.derivedName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Fedora11/Fedora11-7de040d8.vswp"
tools.remindInstall = "TRUE"
EOF
$ virsh -c esx://example.com domxml-from-native vmware-vmx demo.vmx
Enter username for example.com [root]:
Enter root password for example.com:
<domain type='vmware'>
<name>Fedora11</name>
<uuid>50115e16-9bdc-49d7-f171-53c4d7f91710</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686'>hvm</type>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='[local-storage] Fedora11/Fedora11.vmdk'/>
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='lsilogic'/>
<interface type='bridge'>
<mac address='00:50:56:91:48:c7'/>
<source bridge='VM Network'/>
</interface>
</devices>
</domain>
Converting from domain XML config to VMware VMX config
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh domxml-to-native`` provides a way to convert a domain XML config
into a VMware VMX config.
::
$ cat > demo.xml << EOF
<domain type='vmware'>
<name>Fedora11</name>
<uuid>50115e16-9bdc-49d7-f171-53c4d7f91710</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
</os>
<devices>
<disk type='file' device='disk'>
<source file='[local-storage] Fedora11/Fedora11.vmdk'/>
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='lsilogic'/>
<interface type='bridge'>
<mac address='00:50:56:25:48:c7'/>
<source bridge='VM Network'/>
</interface>
</devices>
</domain>
EOF
$ virsh -c esx://example.com domxml-to-native vmware-vmx demo.xml
Enter username for example.com [root]:
Enter root password for example.com:
config.version = "8"
virtualHW.version = "4"
guestOS = "other-64"
uuid.bios = "50 11 5e 16 9b dc 49 d7-f1 71 53 c4 d7 f9 17 10"
displayName = "Fedora11"
memsize = "1024"
numvcpus = "1"
scsi0.present = "true"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "/vmfs/volumes/local-storage/Fedora11/Fedora11.vmdk"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
ethernet0.addressType = "static"
ethernet0.address = "00:50:56:25:48:C7"
Example domain XML configs
--------------------------
Fedora11 on x86_64
~~~~~~~~~~~~~~~~~~
::
<domain type='vmware'>
<name>Fedora11</name>
<uuid>50115e16-9bdc-49d7-f171-53c4d7f91710</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
</os>
<devices>
<disk type='file' device='disk'>
<source file='[local-storage] Fedora11/Fedora11.vmdk'/>
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='scsi' index='0'/>
<interface type='bridge'>
<mac address='00:50:56:25:48:c7'/>
<source bridge='VM Network'/>
</interface>
</devices>
</domain>
Migration
---------
A migration cannot be initiated on an ESX server directly, a VMware vCenter is
necessary for this. The ``vcenter`` query parameter must be set either to the
hostname or IP address of the vCenter managing the ESX server or to ``*``.
Setting it to ``*`` causes the driver to connect to the vCenter known to the ESX
server. If the ESX server is not managed by a vCenter an error is reported.
::
esx://example.com/?vcenter=example-vcenter.com
Here's an example how to migrate the domain ``Fedora11`` from ESX server
``example-src.com`` to ESX server ``example-dst.com`` implicitly involving
vCenter ``example-vcenter.com`` using ``virsh``.
::
$ virsh -c esx://example-src.com/?vcenter=* migrate Fedora11 esx://example-dst.com/?vcenter=*
Enter username for example-src.com [root]:
Enter root password for example-src.com:
Enter username for example-vcenter.com [administrator]:
Enter administrator password for example-vcenter.com:
Enter username for example-dst.com [root]:
Enter root password for example-dst.com:
Enter username for example-vcenter.com [administrator]:
Enter administrator password for example-vcenter.com:
:since:`Since 0.8.3` you can directly connect to a vCenter. This simplifies
migration a bit. Here's the same migration as above but using ``vpx://``
connections and assuming both ESX server are in datacenter ``dc1`` and aren't
part of a cluster.
::
$ virsh -c vpx://example-vcenter.com/dc1/example-src.com migrate Fedora11 vpx://example-vcenter.com/dc1/example-dst.com
Enter username for example-vcenter.com [administrator]:
Enter administrator password for example-vcenter.com:
Enter username for example-vcenter.com [administrator]:
Enter administrator password for example-vcenter.com:
Scheduler configuration
-----------------------
The driver exposes the ESX CPU scheduler. The parameters listed below are
available to control the scheduler.
``reservation``
The amount of CPU resource in MHz that is guaranteed to be available to the
domain. Valid values are 0 and greater.
``limit``
The CPU utilization of the domain will be limited to this value in MHz, even
if more CPU resources are available. If the limit is set to -1, the CPU
utilization of the domain is unlimited. If the limit is not set to -1, it
must be greater than or equal to the reservation.
``shares``
Shares are used to determine relative CPU allocation between domains. In
general, a domain with more shares gets proportionally more of the CPU
resource. Valid values are 0 and greater. The special values -1, -2 and -3
represent the predefined shares level ``low``, ``normal`` and ``high``.
VMware tools
------------
Some actions require installed VMware tools. If the VMware tools are not
installed in the guest and one of the actions below is to be performed the ESX
server raises an error and the driver reports it.
- ``virDomainGetHostname``
- ``virDomainInterfaceAddresses`` (only for the
``VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT`` source)
- ``virDomainReboot``
- ``virDomainShutdown``
Links
-----
- `VMware vSphere Web Services SDK
Documentation <https://www.vmware.com/support/developer/vc-sdk/>`__
- `The Role of Memory in VMware ESX Server
3 <https://www.vmware.com/pdf/esx3_memory.pdf>`__
- `VMware VMX config parameters <https://www.sanbarrow.com/vmx.html>`__
- `VMware ESX 4.0 PVSCSI Storage
Performance <https://www.vmware.com/pdf/vsp_4_pvscsi_perf.pdf>`__

View File

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Microsoft Hyper-V hypervisor driver</h1>
<ul id="toc"></ul>
<p>
The libvirt Microsoft Hyper-V driver can manage Hyper-V 2012 R2 and newer.
</p>
<h2><a id="project">Project Links</a></h2>
<ul>
<li>
The <a href="http://www.microsoft.com/hyper-v-server/">Microsoft Hyper-V</a>
hypervisor
</li>
</ul>
<h2><a id="uri">Connections to the Microsoft Hyper-V driver</a></h2>
<p>
Some example remote connection URIs for the driver are:
</p>
<pre>
hyperv://example-hyperv.com (over HTTPS)
hyperv://example-hyperv.com/?transport=http (over HTTP)
</pre>
<p>
<strong>Note</strong>: In contrast to other drivers, the Hyper-V driver
is a client-side-only driver. It connects to the Hyper-V server using
WS-Management over HTTP(S). Therefore, the
<a href="remote.html">remote transport mechanism</a> provided by the
remote driver and libvirtd will not work, and you cannot use URIs like
<code>hyperv+ssh://example.com</code>.
</p>
<h3><a id="uriformat">URI Format</a></h3>
<p>
URIs have this general form (<code>[...]</code> marks an optional part).
</p>
<pre>
hyperv://[username@]hostname[:port]/[?extraparameters]
</pre>
<p>
The default HTTPS ports is 5986. If the port parameter is given, it
overrides the default port.
</p>
<h4><a id="extraparams">Extra parameters</a></h4>
<p>
Extra parameters can be added to a URI as part of the query string
(the part following <code>?</code>). A single parameter is formed by a
<code>name=value</code> pair. Multiple parameters are separated by
<code>&amp;</code>.
</p>
<pre>
?transport=http
</pre>
<p>
The driver understands the extra parameters shown below.
</p>
<table class="top_table">
<tr>
<th>Name</th>
<th>Values</th>
<th>Meaning</th>
</tr>
<tr>
<td>
<code>transport</code>
</td>
<td>
<code>http</code> or <code>https</code>
</td>
<td>
Overrides the default HTTPS transport. The default HTTP port
is 5985.
</td>
</tr>
</table>
<h3><a id="auth">Authentication</a></h3>
<p>
In order to perform any useful operation the driver needs to log into
the Hyper-V server. Therefore, only <code>virConnectOpenAuth</code> can
be used to connect to an Hyper-V server, <code>virConnectOpen</code> and
<code>virConnectOpenReadOnly</code> don't work.
To log into an Hyper-V server the driver will request credentials using
the callback passed to the <code>virConnectOpenAuth</code> function.
The driver passes the hostname as challenge parameter to the callback.
</p>
<p>
<strong>Note</strong>: Currently only <code>Basic</code> authentication
is supported by libvirt. This method is disabled by default on the
Hyper-V server and can be enabled via the WinRM commandline tool.
</p>
<pre>
winrm set winrm/config/service/auth @{Basic="true"}
</pre>
<p>
To allow <code>Basic</code> authentication with HTTP transport WinRM
needs to allow unencrypted communication. This can be enabled via the
WinRM commandline tool. However, this is not the recommended
communication mode.
</p>
<pre>
winrm set winrm/config/service @{AllowUnencrypted="true"}
</pre>
<h2><a id="versions">Version Numbers</a></h2>
<p>
Since Microsoft's build numbers are almost always over 1000, this driver
needs to pack the value differently compared to the format defined by
<code>virConnectGetVersion</code>.
To preserve all of the digits, the following format is used:
</p>
<pre>major * 100000000 + minor * 1000000 + micro</pre>
<p>
This results in <code>virsh version</code> producing unexpected output.
</p>
<table class="top_table">
<thead>
<th>Windows Release</th>
<th>Kernel Version</th>
<th>libvirt Representation</th>
</thead>
<tr>
<td>Windows Server 2012 R2</td>
<td>6.3.9600</td>
<td>603.9.600</td>
</tr>
<tr>
<td>Windows Server 2016</td>
<td>10.0.14393</td>
<td>1000.14.393</td>
</tr>
<tr>
<td>Windows Server 2019</td>
<td>10.0.17763</td>
<td>1000.17.763</td>
</tr>
</table>
</body></html>

121
docs/drvhyperv.rst Normal file
View File

@ -0,0 +1,121 @@
===================================
Microsoft Hyper-V hypervisor driver
===================================
.. contents::
The libvirt Microsoft Hyper-V driver can manage Hyper-V 2012 R2 and newer.
Project Links
-------------
- The `Microsoft Hyper-V <http://www.microsoft.com/hyper-v-server/>`__
hypervisor
Connections to the Microsoft Hyper-V driver
-------------------------------------------
Some example remote connection URIs for the driver are:
::
hyperv://example-hyperv.com (over HTTPS)
hyperv://example-hyperv.com/?transport=http (over HTTP)
**Note**: In contrast to other drivers, the Hyper-V driver is a client-side-only
driver. It connects to the Hyper-V server using WS-Management over HTTP(S).
Therefore, the `remote transport mechanism <remote.html>`__ provided by the
remote driver and libvirtd will not work, and you cannot use URIs like
``hyperv+ssh://example.com``.
URI Format
~~~~~~~~~~
URIs have this general form (``[...]`` marks an optional part).
::
hyperv://[username@]hostname[:port]/[?extraparameters]
The default HTTPS ports is 5986. If the port parameter is given, it overrides
the default port.
Extra parameters
^^^^^^^^^^^^^^^^
Extra parameters can be added to a URI as part of the query string (the part
following ``?``). A single parameter is formed by a ``name=value`` pair.
Multiple parameters are separated by ``&``.
::
?transport=http
The driver understands the extra parameters shown below.
+---------------+-----------------------+-------------------------------------+
| Name | Values | Meaning |
+===============+=======================+=====================================+
| ``transport`` | ``http`` or ``https`` | Overrides the default HTTPS |
| | | transport. The default HTTP port is |
| | | 5985. |
+---------------+-----------------------+-------------------------------------+
Authentication
~~~~~~~~~~~~~~
In order to perform any useful operation the driver needs to log into the
Hyper-V server. Therefore, only ``virConnectOpenAuth`` can be used to connect to
an Hyper-V server, ``virConnectOpen`` and ``virConnectOpenReadOnly`` don't work.
To log into an Hyper-V server the driver will request credentials using the
callback passed to the ``virConnectOpenAuth`` function. The driver passes the
hostname as challenge parameter to the callback.
**Note**: Currently only ``Basic`` authentication is supported by libvirt. This
method is disabled by default on the Hyper-V server and can be enabled via the
WinRM commandline tool.
::
winrm set winrm/config/service/auth @{Basic="true"}
To allow ``Basic`` authentication with HTTP transport WinRM needs to allow
unencrypted communication. This can be enabled via the WinRM commandline tool.
However, this is not the recommended communication mode.
::
winrm set winrm/config/service @{AllowUnencrypted="true"}
Version Numbers
---------------
Since Microsoft's build numbers are almost always over 1000, this driver needs
to pack the value differently compared to the format defined by
``virConnectGetVersion``. To preserve all of the digits, the following format is
used:
::
major * 100000000 + minor * 1000000 + micro
This results in ``virsh version`` producing unexpected output.
.. list-table::
:header-rows: 1
* - Windows Release
- Kernel Version
- libvirt Representation
* - Windows Server 2012 R2
- 6.3.9600
- 603.9.600
* - Windows Server 2016
- 10.0.14393
- 1000.14.393
* - Windows Server 2019
- 10.0.17763
- 1000.17.763

View File

@ -1,822 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>LXC container driver</h1>
<ul id="toc"></ul>
<p>
The libvirt LXC driver manages "Linux Containers". At their simplest, containers
can just be thought of as a collection of processes, separated from the main
host processes via a set of resource namespaces and constrained via control
groups resource tunables. The libvirt LXC driver has no dependency on the LXC
userspace tools hosted on sourceforge.net. It directly utilizes the relevant
kernel features to build the container environment. This allows for sharing
of many libvirt technologies across both the QEMU/KVM and LXC drivers. In
particular sVirt for mandatory access control, auditing of operations,
integration with control groups and many other features.
</p>
<h2><a id="cgroups">Control groups Requirements</a></h2>
<p>
In order to control the resource usage of processes inside containers, the
libvirt LXC driver requires that certain cgroups controllers are mounted on
the host OS. The minimum required controllers are 'cpuacct', 'memory' and
'devices', while recommended extra controllers are 'cpu', 'freezer' and
'blkio'. Libvirt will not mount the cgroups filesystem itself, leaving
this up to the init system to take care of. Systemd will do the right thing
in this respect, while for other init systems the <code>cgconfig</code>
init service will be required. For further information, consult the general
libvirt <a href="cgroups.html">cgroups documentation</a>.
</p>
<h2><a id="namespaces">Namespace requirements</a></h2>
<p>
In order to separate processes inside a container from those in the
primary "host" OS environment, the libvirt LXC driver requires that
certain kernel namespaces are compiled in. Libvirt currently requires
the 'mount', 'ipc', 'pid', and 'uts' namespaces to be available. If
separate network interfaces are desired, then the 'net' namespace is
required. If the guest configuration declares a
<a href="formatdomain.html#elementsOSContainer">UID or GID mapping</a>,
the 'user' namespace will be enabled to apply these. <strong>A suitably
configured UID/GID mapping is a pre-requisite to making containers
secure, in the absence of sVirt confinement.</strong>
</p>
<h2><a id="init">Default container setup</a></h2>
<h3><a id="cliargs">Command line arguments</a></h3>
<p>
When the container "init" process is started, it will typically
not be given any command line arguments (eg the equivalent of
the bootloader args visible in <code>/proc/cmdline</code>). If
any arguments are desired, then must be explicitly set in the
container XML configuration via one or more <code>initarg</code>
elements. For example, to run <code>systemd --unit emergency.service</code>
would use the following XML
</p>
<pre>
&lt;os&gt;
&lt;type arch='x86_64'&gt;exe&lt;/type&gt;
&lt;init&gt;/bin/systemd&lt;/init&gt;
&lt;initarg&gt;--unit&lt;/initarg&gt;
&lt;initarg&gt;emergency.service&lt;/initarg&gt;
&lt;/os&gt;
</pre>
<h3><a id="envvars">Environment variables</a></h3>
<p>
When the container "init" process is started, it will be given several useful
environment variables. The following standard environment variables are mandated
by <a href="https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface">systemd container interface</a>
to be provided by all container technologies on Linux.
</p>
<dl>
<dt><code>container</code></dt>
<dd>The fixed string <code>libvirt-lxc</code> to identify libvirt as the creator</dd>
<dt><code>container_uuid</code></dt>
<dd>The UUID assigned to the container by libvirt</dd>
<dt><code>PATH</code></dt>
<dd>The fixed string <code>/bin:/usr/bin</code></dd>
<dt><code>TERM</code></dt>
<dd>The fixed string <code>linux</code></dd>
<dt><code>HOME</code></dt>
<dd>The fixed string <code>/</code></dd>
</dl>
<p>
In addition to the standard variables, the following libvirt specific
environment variables are also provided
</p>
<dl>
<dt><code>LIBVIRT_LXC_NAME</code></dt>
<dd>The name assigned to the container by libvirt</dd>
<dt><code>LIBVIRT_LXC_UUID</code></dt>
<dd>The UUID assigned to the container by libvirt</dd>
<dt><code>LIBVIRT_LXC_CMDLINE</code></dt>
<dd>The unparsed command line arguments specified in the container configuration.
Use of this is discouraged, in favour of passing arguments directly to the
container init process via the <code>initarg</code> config element.</dd>
</dl>
<h3><a id="fsmounts">Filesystem mounts</a></h3>
<p>
In the absence of any explicit configuration, the container will
inherit the host OS filesystem mounts. A number of mount points will
be made read only, or re-mounted with new instances to provide
container specific data. The following special mounts are setup
by libvirt
</p>
<ul>
<li><code>/dev</code> a new "tmpfs" pre-populated with authorized device nodes</li>
<li><code>/dev/pts</code> a new private "devpts" instance for console devices</li>
<li><code>/sys</code> the host "sysfs" instance remounted read-only</li>
<li><code>/proc</code> a new instance of the "proc" filesystem</li>
<li><code>/proc/sys</code> the host "/proc/sys" bind-mounted read-only</li>
<li><code>/sys/fs/selinux</code> the host "selinux" instance remounted read-only</li>
<li><code>/sys/fs/cgroup/NNNN</code> the host cgroups controllers bind-mounted to
only expose the sub-tree associated with the container</li>
<li><code>/proc/meminfo</code> a FUSE backed file reflecting memory limits of the container</li>
</ul>
<h3><a id="devnodes">Device nodes</a></h3>
<p>
The container init process will be started with <code>CAP_MKNOD</code>
capability removed and blocked from re-acquiring it. As such it will
not be able to create any device nodes in <code>/dev</code> or anywhere
else in its filesystems. Libvirt itself will take care of pre-populating
the <code>/dev</code> filesystem with any devices that the container
is authorized to use. The current devices that will be made available
to all containers are
</p>
<ul>
<li><code>/dev/zero</code></li>
<li><code>/dev/null</code></li>
<li><code>/dev/full</code></li>
<li><code>/dev/random</code></li>
<li><code>/dev/urandom</code></li>
<li><code>/dev/stdin</code> symlinked to <code>/proc/self/fd/0</code></li>
<li><code>/dev/stdout</code> symlinked to <code>/proc/self/fd/1</code></li>
<li><code>/dev/stderr</code> symlinked to <code>/proc/self/fd/2</code></li>
<li><code>/dev/fd</code> symlinked to <code>/proc/self/fd</code></li>
<li><code>/dev/ptmx</code> symlinked to <code>/dev/pts/ptmx</code></li>
<li><code>/dev/console</code> symlinked to <code>/dev/pts/0</code></li>
</ul>
<p>
In addition, for every console defined in the guest configuration,
a symlink will be created from <code>/dev/ttyN</code> symlinked to
the corresponding <code>/dev/pts/M</code> pseudo TTY device. The
first console will be <code>/dev/tty1</code>, with further consoles
numbered incrementally from there.
</p>
<p>
Since /dev/ttyN and /dev/console are linked to the pts devices. The
tty device of login program is pts device. The pam module securetty
may prevent root user from logging in container. If you want root
user to log in container successfully, add the pts device to the file
/etc/securetty of container.
</p>
<p>
Further block or character devices will be made available to containers
depending on their configuration.
</p>
<h2><a id="security">Security considerations</a></h2>
<p>
The libvirt LXC driver is fairly flexible in how it can be configured,
and as such does not enforce a requirement for strict security
separation between a container and the host. This allows it to be used
in scenarios where only resource control capabilities are important,
and resource sharing is desired. Applications wishing to ensure secure
isolation between a container and the host must ensure that they are
writing a suitable configuration.
</p>
<h3><a id="securenetworking">Network isolation</a></h3>
<p>
If the guest configuration does not list any network interfaces,
the <code>network</code> namespace will not be activated, and thus
the container will see all the host's network interfaces. This will
allow apps in the container to bind to/connect from TCP/UDP addresses
and ports from the host OS. It also allows applications to access
UNIX domain sockets associated with the host OS, which are in the
abstract namespace. If access to UNIX domains sockets in the abstract
namespace is not wanted, then applications should set the
<code>&lt;privnet/&gt;</code> flag in the
<code>&lt;features&gt;....&lt;/features&gt;</code> element.
</p>
<h3><a id="securefs">Filesystem isolation</a></h3>
<p>
If the guest configuration does not list any filesystems, then
the container will be set up with a root filesystem that matches
the host's root filesystem. As noted earlier, only a few locations
such as <code>/dev</code>, <code>/proc</code> and <code>/sys</code>
will be altered. This means that, in the absence of restrictions
from sVirt, a process running as user/group N:M inside the container
will be able to access almost exactly the same files as a process
running as user/group N:M in the host.
</p>
<p>
There are multiple options for restricting this. It is possible to
simply map the existing root filesystem through to the container in
read-only mode. Alternatively a completely separate root filesystem
can be configured for the guest. In both cases, further sub-mounts
can be applied to customize the content that is made visible. Note
that in the absence of sVirt controls, it is still possible for the
root user in a container to unmount any sub-mounts applied. The user
namespace feature can also be used to restrict access to files based
on the UID/GID mappings.
</p>
<p>
Sharing the host filesystem tree, also allows applications to access
UNIX domains sockets associated with the host OS, which are in the
filesystem namespaces. It should be noted that a number of init
systems including at least <code>systemd</code> and <code>upstart</code>
have UNIX domain socket which are used to control their operation.
Thus, if the directory/filesystem holding their UNIX domain socket is
exposed to the container, it will be possible for a user in the container
to invoke operations on the init service in the same way it could if
outside the container. This also applies to other applications in the
host which use UNIX domain sockets in the filesystem, such as DBus,
Libvirtd, and many more. If this is not desired, then applications
should either specify the UID/GID mapping in the configuration to
enable user namespaces and thus block access to the UNIX domain socket
based on permissions, or should ensure the relevant directories have
a bind mount to hide them. This is particularly important for the
<code>/run</code> or <code>/var/run</code> directories.
</p>
<h3><a id="secureusers">User and group isolation</a></h3>
<p>
If the guest configuration does not list any ID mapping, then the
user and group IDs used inside the container will match those used
outside the container. In addition, the capabilities associated with
a process in the container will infer the same privileges they would
for a process in the host. This has obvious implications for security,
since a root user inside the container will be able to access any
file owned by root that is visible to the container, and perform more
or less any privileged kernel operation. In the absence of additional
protection from sVirt, this means that the root user inside a container
is effectively as powerful as the root user in the host. There is no
security isolation of the root user.
</p>
<p>
The ID mapping facility was introduced to allow for stricter control
over the privileges of users inside the container. It allows apps to
define rules such as "user ID 0 in the container maps to user ID 1000
in the host". In addition the privileges associated with capabilities
are somewhat reduced so that they cannot be used to escape from the
container environment. A full description of user namespaces is outside
the scope of this document, however LWN has
<a href="https://lwn.net/Articles/532593/">a good write-up on the topic</a>.
From the libvirt point of view, the key thing to remember is that defining
an ID mapping for users and groups in the container XML configuration
causes libvirt to activate the user namespace feature.
</p>
<h2><a id="configFiles">Location of configuration files</a></h2>
<p>
The LXC driver comes with sane default values. However, during its
initialization it reads a configuration file which offers system
administrator to override some of that default. The file is located
under <code>/etc/libvirt/lxc.conf</code>
</p>
<h2><a id="activation">Systemd Socket Activation Integration</a></h2>
<p>
The libvirt LXC driver provides the ability to pass across pre-opened file
descriptors when starting LXC guests. This allows for libvirt LXC to support
systemd's <a href="http://0pointer.de/blog/projects/socket-activated-containers.html">socket
activation capability</a>, where an incoming client connection
in the host OS will trigger the startup of a container, which runs another
copy of systemd which gets passed the server socket, and then activates the
actual service handler in the container.
</p>
<p>
Let us assume that you already have a LXC guest created, running
a systemd instance as PID 1 inside the container, which has an
SSHD service configured. The goal is to automatically activate
the container when the first SSH connection is made. The first
step is to create a couple of unit files for the host OS systemd
instance. The <code>/etc/systemd/system/mycontainer.service</code>
unit file specifies how systemd will start the libvirt LXC container
</p>
<pre>
[Unit]
Description=My little container
[Service]
ExecStart=/usr/bin/virsh -c lxc:///system start --pass-fds 3 mycontainer
ExecStop=/usr/bin/virsh -c lxc:///system destroy mycontainer
Type=oneshot
RemainAfterExit=yes
KillMode=none
</pre>
<p>
The <code>--pass-fds 3</code> argument specifies that the file
descriptor number 3 that <code>virsh</code> inherits from systemd,
is to be passed into the container. Since <code>virsh</code> will
exit immediately after starting the container, the <code>RemainAfterExit</code>
and <code>KillMode</code> settings must be altered from their defaults.
</p>
<p>
Next, the <code>/etc/systemd/system/mycontainer.socket</code> unit
file is created to get the host systemd to listen on port 23 for
TCP connections. When this unit file is activated by the first
incoming connection, it will cause the <code>mycontainer.service</code>
unit to be activated with the FD corresponding to the listening TCP
socket passed in as FD 3.
</p>
<pre>
[Unit]
Description=The SSH socket of my little container
[Socket]
ListenStream=23
</pre>
<p>
Port 23 was picked here so that the container doesn't conflict
with the host's SSH which is on the normal port 22. That's it
in terms of host side configuration.
</p>
<p>
Inside the container, the <code>/etc/systemd/system/sshd.socket</code>
unit file must be created
</p>
<pre>
[Unit]
Description=SSH Socket for Per-Connection Servers
[Socket]
ListenStream=23
Accept=yes
</pre>
<p>
The <code>ListenStream</code> value listed in this unit file, must
match the value used in the host file. When systemd in the container
receives the pre-opened FD from libvirt during container startup, it
looks at the <code>ListenStream</code> values to figure out which
FD to give to which service. The actual service to start is defined
by a correspondingly named <code>/etc/systemd/system/sshd@.service</code>
</p>
<pre>
[Unit]
Description=SSH Per-Connection Server for %I
[Service]
ExecStart=-/usr/sbin/sshd -i
StandardInput=socket
</pre>
<p>
Finally, make sure this SSH service is set to start on boot of the container,
by running the following command inside the container:
</p>
<pre>
# mkdir -p /etc/systemd/system/sockets.target.wants/
# ln -s /etc/systemd/system/sshd.socket /etc/systemd/system/sockets.target.wants/
</pre>
<p>
This example shows how to activate the container based on an incoming
SSH connection. If the container was also configured to have an httpd
service, it may be desirable to activate it upon either an httpd or a
sshd connection attempt. In this case, the <code>mycontainer.socket</code>
file in the host would simply list multiple socket ports. Inside the
container a separate <code>xxxxx.socket</code> file would need to be
created for each service, with a corresponding <code>ListenStream</code>
value set.
</p>
<!--
<h2>Container configuration</h2>
<h3>Init process</h3>
<h3>Console devices</h3>
<h3>Filesystem devices</h3>
<h3>Disk devices</h3>
<h3>Block devices</h3>
<h3>USB devices</h3>
<h3>Character devices</h3>
<h3>Network devices</h3>
-->
<h2>Container security</h2>
<h3>sVirt SELinux</h3>
<p>
In the absence of the "user" namespace being used, containers cannot
be considered secure against exploits of the host OS. The sVirt SELinux
driver provides a way to secure containers even when the "user" namespace
is not used. The cost is that writing a policy to allow execution of
arbitrary OS is not practical. The SELinux sVirt policy is typically
tailored to work with a simpler application confinement use case,
as provided by the "libvirt-sandbox" project.
</p>
<h3>Auditing</h3>
<p>
The LXC driver is integrated with libvirt's auditing subsystem, which
causes audit messages to be logged whenever there is an operation
performed against a container which has impact on host resources.
So for example, start/stop, device hotplug will all log audit messages
providing details about what action occurred and any resources
associated with it. There are the following 3 types of audit messages
</p>
<ul>
<li><code>VIRT_MACHINE_ID</code> - details of the SELinux process and
image security labels assigned to the container.</li>
<li><code>VIRT_CONTROL</code> - details of an action / operation
performed against a container. There are the following types of
operation
<ul>
<li><code>op=start</code> - a container has been started. Provides
the machine name, uuid and PID of the <code>libvirt_lxc</code>
controller process</li>
<li><code>op=init</code> - the init PID of the container has been
started. Provides the machine name, uuid and PID of the
<code>libvirt_lxc</code> controller process and PID of the
init process (in the host PID namespace)</li>
<li><code>op=stop</code> - a container has been stopped. Provides
the machine name, uuid</li>
</ul>
</li>
<li><code>VIRT_RESOURCE</code> - details of a host resource
associated with a container action.</li>
</ul>
<h3>Device access</h3>
<p>
All containers are launched with the CAP_MKNOD capability cleared
and removed from the bounding set. Libvirt will ensure that the
/dev filesystem is pre-populated with all devices that a container
is allowed to use. In addition, the cgroup "device" controller is
configured to block read/write/mknod from all devices except those
that a container is authorized to use.
</p>
<h2><a id="exconfig">Example configurations</a></h2>
<h3>Example config version 1</h3>
<p></p>
<pre>
&lt;domain type='lxc'&gt;
&lt;name&gt;vm1&lt;/name&gt;
&lt;memory&gt;500000&lt;/memory&gt;
&lt;os&gt;
&lt;type&gt;exe&lt;/type&gt;
&lt;init&gt;/bin/sh&lt;/init&gt;
&lt;/os&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;clock offset='utc'/&gt;
&lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
&lt;on_reboot&gt;restart&lt;/on_reboot&gt;
&lt;on_crash&gt;destroy&lt;/on_crash&gt;
&lt;devices&gt;
&lt;emulator&gt;/usr/libexec/libvirt_lxc&lt;/emulator&gt;
&lt;interface type='network'&gt;
&lt;source network='default'/&gt;
&lt;/interface&gt;
&lt;console type='pty' /&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
<p>
In the &lt;emulator&gt; element, be sure you specify the correct path
to libvirt_lxc, if it does not live in /usr/libexec on your system.
</p>
<p>
The next example assumes there is a private root filesystem
(perhaps hand-crafted using busybox, or installed from media,
debootstrap, whatever) under /opt/vm-1-root:
</p>
<p></p>
<pre>
&lt;domain type='lxc'&gt;
&lt;name&gt;vm1&lt;/name&gt;
&lt;memory&gt;32768&lt;/memory&gt;
&lt;os&gt;
&lt;type&gt;exe&lt;/type&gt;
&lt;init&gt;/init&lt;/init&gt;
&lt;/os&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;clock offset='utc'/&gt;
&lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
&lt;on_reboot&gt;restart&lt;/on_reboot&gt;
&lt;on_crash&gt;destroy&lt;/on_crash&gt;
&lt;devices&gt;
&lt;emulator&gt;/usr/libexec/libvirt_lxc&lt;/emulator&gt;
&lt;filesystem type='mount'&gt;
&lt;source dir='/opt/vm-1-root'/&gt;
&lt;target dir='/'/&gt;
&lt;/filesystem&gt;
&lt;interface type='network'&gt;
&lt;source network='default'/&gt;
&lt;/interface&gt;
&lt;console type='pty' /&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
<h2><a id="capabilities">Altering the available capabilities</a></h2>
<p>
By default the libvirt LXC driver drops some capabilities among which CAP_MKNOD.
However <span class="since">since 1.2.6</span> libvirt can be told to keep or
drop some capabilities using a domain configuration like the following:
</p>
<pre>
...
&lt;features&gt;
&lt;capabilities policy='default'&gt;
&lt;mknod state='on'/&gt;
&lt;sys_chroot state='off'/&gt;
&lt;/capabilities&gt;
&lt;/features&gt;
...
</pre>
<p>
The capabilities children elements are named after the capabilities as defined in
<code>man 7 capabilities</code>. An <code>off</code> state tells libvirt to drop the
capability, while an <code>on</code> state will force to keep the capability even though
this one is dropped by default.
</p>
<p>
The <code>policy</code> attribute can be one of <code>default</code>, <code>allow</code>
or <code>deny</code>. It defines the default rules for capabilities: either keep the
default behavior that is dropping a few selected capabilities, or keep all capabilities
or drop all capabilities. The interest of <code>allow</code> and <code>deny</code> is that
they guarantee that all capabilities will be kept (or removed) even if new ones are added
later.
</p>
<p>
The following example, drops all capabilities but CAP_MKNOD:
</p>
<pre>
...
&lt;features&gt;
&lt;capabilities policy='deny'&gt;
&lt;mknod state='on'/&gt;
&lt;/capabilities&gt;
&lt;/features&gt;
...
</pre>
<p>
Note that allowing capabilities that are normally dropped by default can seriously
affect the security of the container and the host.
</p>
<h2><a id="share">Inherit namespaces</a></h2>
<p>
Libvirt allows you to inherit the namespace from container/process just like lxc tools
or docker provides to share the network namespace. The following can be used to share
required namespaces. If we want to share only one then the other namespaces can be ignored.
The netns option is specific to sharenet. It can be used in cases we want to use existing network namespace
rather than creating new network namespace for the container. In this case privnet option will be
ignored.
</p>
<pre>
&lt;domain type='lxc' xmlns:lxc='http://libvirt.org/schemas/domain/lxc/1.0'&gt;
...
&lt;lxc:namespace&gt;
&lt;lxc:sharenet type='netns' value='red'/&gt;
&lt;lxc:shareuts type='name' value='container1'/&gt;
&lt;lxc:shareipc type='pid' value='12345'/&gt;
&lt;/lxc:namespace&gt;
&lt;/domain&gt;
</pre>
<p>
The use of namespace passthrough requires libvirt >= 1.2.19
</p>
<h2><a id="usage">Container usage / management</a></h2>
<p>
As with any libvirt virtualization driver, LXC containers can be
managed via a wide variety of libvirt based tools. At the lowest
level the <code>virsh</code> command can be used to perform many
tasks, by passing the <code>-c lxc:///system</code> argument. As an
alternative to repeating the URI with every command, the <code>LIBVIRT_DEFAULT_URI</code>
environment variable can be set to <code>lxc:///system</code>. The
examples that follow outline some common operations with virsh
and LXC. For further details about usage of virsh consult its
manual page.
</p>
<h3><a id="usageSave">Defining (saving) container configuration</a></h3>
<p>
The <code>virsh define</code> command takes an XML configuration
document and loads it into libvirt, saving the configuration on disk
</p>
<pre>
# virsh -c lxc:///system define myguest.xml
</pre>
<h3><a id="usageView">Viewing container configuration</a></h3>
<p>
The <code>virsh dumpxml</code> command can be used to view the
current XML configuration of a container. By default the XML
output reflects the current state of the container. If the
container is running, it is possible to explicitly request the
persistent configuration, instead of the current live configuration
using the <code>--inactive</code> flag
</p>
<pre>
# virsh -c lxc:///system dumpxml myguest
</pre>
<h3><a id="usageStart">Starting containers</a></h3>
<p>
The <code>virsh start</code> command can be used to start a
container from a previously defined persistent configuration
</p>
<pre>
# virsh -c lxc:///system start myguest
</pre>
<p>
It is also possible to start so called "transient" containers,
which do not require a persistent configuration to be saved
by libvirt, using the <code>virsh create</code> command.
</p>
<pre>
# virsh -c lxc:///system create myguest.xml
</pre>
<h3><a id="usageStop">Stopping containers</a></h3>
<p>
The <code>virsh shutdown</code> command can be used
to request a graceful shutdown of the container. By default
this command will first attempt to send a message to the
init process via the <code>/dev/initctl</code> device node.
If no such device node exists, then it will send SIGTERM
to PID 1 inside the container.
</p>
<pre>
# virsh -c lxc:///system shutdown myguest
</pre>
<p>
If the container does not respond to the graceful shutdown
request, it can be forcibly stopped using the <code>virsh destroy</code>
</p>
<pre>
# virsh -c lxc:///system destroy myguest
</pre>
<h3><a id="usageReboot">Rebooting a container</a></h3>
<p>
The <code>virsh reboot</code> command can be used
to request a graceful shutdown of the container. By default
this command will first attempt to send a message to the
init process via the <code>/dev/initctl</code> device node.
If no such device node exists, then it will send SIGHUP
to PID 1 inside the container.
</p>
<pre>
# virsh -c lxc:///system reboot myguest
</pre>
<h3><a id="usageDelete">Undefining (deleting) a container configuration</a></h3>
<p>
The <code>virsh undefine</code> command can be used to delete the
persistent configuration of a container. If the guest is currently
running, this will turn it into a "transient" guest.
</p>
<pre>
# virsh -c lxc:///system undefine myguest
</pre>
<h3><a id="usageConnect">Connecting to a container console</a></h3>
<p>
The <code>virsh console</code> command can be used to connect
to the text console associated with a container.
</p>
<pre>
# virsh -c lxc:///system console myguest
</pre>
<p>
If the container has been configured with multiple console devices,
then the <code>--devname</code> argument can be used to choose the
console to connect to.
In LXC, multiple consoles will be named
as 'console0', 'console1', 'console2', etc.
</p>
<pre>
# virsh -c lxc:///system console myguest --devname console1
</pre>
<h3><a id="usageEnter">Running commands in a container</a></h3>
<p>
The <code>virsh lxc-enter-namespace</code> command can be used
to enter the namespaces and security context of a container
and then execute an arbitrary command.
</p>
<pre>
# virsh -c lxc:///system lxc-enter-namespace myguest -- /bin/ls -al /dev
</pre>
<h3><a id="usageTop">Monitoring container utilization</a></h3>
<p>
The <code>virt-top</code> command can be used to monitor the
activity and resource utilization of all containers on a
host
</p>
<pre>
# virt-top -c lxc:///system
</pre>
<h3><a id="usageConvert">Converting LXC container configuration</a></h3>
<p>
The <code>virsh domxml-from-native</code> command can be used to convert
most of the LXC container configuration into a domain XML fragment
</p>
<pre>
# virsh -c lxc:///system domxml-from-native lxc-tools /var/lib/lxc/myguest/config
</pre>
<p>
This conversion has some limitations due to the fact that the
domxml-from-native command output has to be independent of the host. Here
are a few things to take care of before converting:
</p>
<ul>
<li>
Replace the fstab file referenced by <tt>lxc.mount</tt> by the corresponding
lxc.mount.entry lines.
</li>
<li>
Replace all relative sizes of tmpfs mount entries to absolute sizes. Also
make sure that tmpfs entries all have a size option (default is 50%).
</li>
<li>
Define <tt>lxc.cgroup.memory.limit_in_bytes</tt> to properly limit the memory
available to the container. The conversion will use 64MiB as the default.
</li>
</ul>
</body>
</html>

670
docs/drvlxc.rst Normal file
View File

@ -0,0 +1,670 @@
.. role:: since
====================
LXC container driver
====================
.. contents::
The libvirt LXC driver manages "Linux Containers". At their simplest, containers
can just be thought of as a collection of processes, separated from the main
host processes via a set of resource namespaces and constrained via control
groups resource tunables. The libvirt LXC driver has no dependency on the LXC
userspace tools hosted on sourceforge.net. It directly utilizes the relevant
kernel features to build the container environment. This allows for sharing of
many libvirt technologies across both the QEMU/KVM and LXC drivers. In
particular sVirt for mandatory access control, auditing of operations,
integration with control groups and many other features.
Control groups Requirements
---------------------------
In order to control the resource usage of processes inside containers, the
libvirt LXC driver requires that certain cgroups controllers are mounted on the
host OS. The minimum required controllers are 'cpuacct', 'memory' and 'devices',
while recommended extra controllers are 'cpu', 'freezer' and 'blkio'. Libvirt
will not mount the cgroups filesystem itself, leaving this up to the init system
to take care of. Systemd will do the right thing in this respect, while for
other init systems the ``cgconfig`` init service will be required. For further
information, consult the general libvirt `cgroups
documentation <cgroups.html>`__.
Namespace requirements
----------------------
In order to separate processes inside a container from those in the primary
"host" OS environment, the libvirt LXC driver requires that certain kernel
namespaces are compiled in. Libvirt currently requires the 'mount', 'ipc',
'pid', and 'uts' namespaces to be available. If separate network interfaces are
desired, then the 'net' namespace is required. If the guest configuration
declares a `UID or GID mapping <formatdomain.html#elementsOSContainer>`__, the
'user' namespace will be enabled to apply these. **A suitably configured UID/GID
mapping is a pre-requisite to making containers secure, in the absence of sVirt
confinement.**
Default container setup
-----------------------
Command line arguments
~~~~~~~~~~~~~~~~~~~~~~
When the container "init" process is started, it will typically not be given any
command line arguments (eg the equivalent of the bootloader args visible in
``/proc/cmdline``). If any arguments are desired, then must be explicitly set in
the container XML configuration via one or more ``initarg`` elements. For
example, to run ``systemd --unit emergency.service`` would use the following XML
::
<os>
<type arch='x86_64'>exe</type>
<init>/bin/systemd</init>
<initarg>--unit</initarg>
<initarg>emergency.service</initarg>
</os>
Environment variables
~~~~~~~~~~~~~~~~~~~~~
When the container "init" process is started, it will be given several useful
environment variables. The following standard environment variables are mandated
by `systemd container
interface <https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface>`__
to be provided by all container technologies on Linux.
``container``
The fixed string ``libvirt-lxc`` to identify libvirt as the creator
``container_uuid``
The UUID assigned to the container by libvirt
``PATH``
The fixed string ``/bin:/usr/bin``
``TERM``
The fixed string ``linux``
``HOME``
The fixed string ``/``
In addition to the standard variables, the following libvirt specific
environment variables are also provided
``LIBVIRT_LXC_NAME``
The name assigned to the container by libvirt
``LIBVIRT_LXC_UUID``
The UUID assigned to the container by libvirt
``LIBVIRT_LXC_CMDLINE``
The unparsed command line arguments specified in the container configuration.
Use of this is discouraged, in favour of passing arguments directly to the
container init process via the ``initarg`` config element.
Filesystem mounts
~~~~~~~~~~~~~~~~~
In the absence of any explicit configuration, the container will inherit the
host OS filesystem mounts. A number of mount points will be made read only, or
re-mounted with new instances to provide container specific data. The following
special mounts are setup by libvirt
- ``/dev`` a new "tmpfs" pre-populated with authorized device nodes
- ``/dev/pts`` a new private "devpts" instance for console devices
- ``/sys`` the host "sysfs" instance remounted read-only
- ``/proc`` a new instance of the "proc" filesystem
- ``/proc/sys`` the host "/proc/sys" bind-mounted read-only
- ``/sys/fs/selinux`` the host "selinux" instance remounted read-only
- ``/sys/fs/cgroup/NNNN`` the host cgroups controllers bind-mounted to only
expose the sub-tree associated with the container
- ``/proc/meminfo`` a FUSE backed file reflecting memory limits of the
container
Device nodes
~~~~~~~~~~~~
The container init process will be started with ``CAP_MKNOD`` capability removed
and blocked from re-acquiring it. As such it will not be able to create any
device nodes in ``/dev`` or anywhere else in its filesystems. Libvirt itself
will take care of pre-populating the ``/dev`` filesystem with any devices that
the container is authorized to use. The current devices that will be made
available to all containers are
- ``/dev/zero``
- ``/dev/null``
- ``/dev/full``
- ``/dev/random``
- ``/dev/urandom``
- ``/dev/stdin`` symlinked to ``/proc/self/fd/0``
- ``/dev/stdout`` symlinked to ``/proc/self/fd/1``
- ``/dev/stderr`` symlinked to ``/proc/self/fd/2``
- ``/dev/fd`` symlinked to ``/proc/self/fd``
- ``/dev/ptmx`` symlinked to ``/dev/pts/ptmx``
- ``/dev/console`` symlinked to ``/dev/pts/0``
In addition, for every console defined in the guest configuration, a symlink
will be created from ``/dev/ttyN`` symlinked to the corresponding ``/dev/pts/M``
pseudo TTY device. The first console will be ``/dev/tty1``, with further
consoles numbered incrementally from there.
Since /dev/ttyN and /dev/console are linked to the pts devices. The tty device
of login program is pts device. The pam module securetty may prevent root user
from logging in container. If you want root user to log in container
successfully, add the pts device to the file /etc/securetty of container.
Further block or character devices will be made available to containers
depending on their configuration.
Security considerations
-----------------------
The libvirt LXC driver is fairly flexible in how it can be configured, and as
such does not enforce a requirement for strict security separation between a
container and the host. This allows it to be used in scenarios where only
resource control capabilities are important, and resource sharing is desired.
Applications wishing to ensure secure isolation between a container and the host
must ensure that they are writing a suitable configuration.
Network isolation
~~~~~~~~~~~~~~~~~
If the guest configuration does not list any network interfaces, the ``network``
namespace will not be activated, and thus the container will see all the host's
network interfaces. This will allow apps in the container to bind to/connect
from TCP/UDP addresses and ports from the host OS. It also allows applications
to access UNIX domain sockets associated with the host OS, which are in the
abstract namespace. If access to UNIX domains sockets in the abstract namespace
is not wanted, then applications should set the ``<privnet/>`` flag in the
``<features>....</features>`` element.
Filesystem isolation
~~~~~~~~~~~~~~~~~~~~
If the guest configuration does not list any filesystems, then the container
will be set up with a root filesystem that matches the host's root filesystem.
As noted earlier, only a few locations such as ``/dev``, ``/proc`` and ``/sys``
will be altered. This means that, in the absence of restrictions from sVirt, a
process running as user/group N:M inside the container will be able to access
almost exactly the same files as a process running as user/group N:M in the
host.
There are multiple options for restricting this. It is possible to simply map
the existing root filesystem through to the container in read-only mode.
Alternatively a completely separate root filesystem can be configured for the
guest. In both cases, further sub-mounts can be applied to customize the content
that is made visible. Note that in the absence of sVirt controls, it is still
possible for the root user in a container to unmount any sub-mounts applied. The
user namespace feature can also be used to restrict access to files based on the
UID/GID mappings.
Sharing the host filesystem tree, also allows applications to access UNIX
domains sockets associated with the host OS, which are in the filesystem
namespaces. It should be noted that a number of init systems including at least
``systemd`` and ``upstart`` have UNIX domain socket which are used to control
their operation. Thus, if the directory/filesystem holding their UNIX domain
socket is exposed to the container, it will be possible for a user in the
container to invoke operations on the init service in the same way it could if
outside the container. This also applies to other applications in the host which
use UNIX domain sockets in the filesystem, such as DBus, Libvirtd, and many
more. If this is not desired, then applications should either specify the
UID/GID mapping in the configuration to enable user namespaces and thus block
access to the UNIX domain socket based on permissions, or should ensure the
relevant directories have a bind mount to hide them. This is particularly
important for the ``/run`` or ``/var/run`` directories.
User and group isolation
~~~~~~~~~~~~~~~~~~~~~~~~
If the guest configuration does not list any ID mapping, then the user and group
IDs used inside the container will match those used outside the container. In
addition, the capabilities associated with a process in the container will infer
the same privileges they would for a process in the host. This has obvious
implications for security, since a root user inside the container will be able
to access any file owned by root that is visible to the container, and perform
more or less any privileged kernel operation. In the absence of additional
protection from sVirt, this means that the root user inside a container is
effectively as powerful as the root user in the host. There is no security
isolation of the root user.
The ID mapping facility was introduced to allow for stricter control over the
privileges of users inside the container. It allows apps to define rules such as
"user ID 0 in the container maps to user ID 1000 in the host". In addition the
privileges associated with capabilities are somewhat reduced so that they cannot
be used to escape from the container environment. A full description of user
namespaces is outside the scope of this document, however LWN has `a good
write-up on the topic <https://lwn.net/Articles/532593/>`__. From the libvirt
point of view, the key thing to remember is that defining an ID mapping for
users and groups in the container XML configuration causes libvirt to activate
the user namespace feature.
Location of configuration files
-------------------------------
The LXC driver comes with sane default values. However, during its
initialization it reads a configuration file which offers system administrator
to override some of that default. The file is located under
``/etc/libvirt/lxc.conf``
Systemd Socket Activation Integration
-------------------------------------
The libvirt LXC driver provides the ability to pass across pre-opened file
descriptors when starting LXC guests. This allows for libvirt LXC to support
systemd's `socket activation
capability <http://0pointer.de/blog/projects/socket-activated-containers.html>`__,
where an incoming client connection in the host OS will trigger the startup of a
container, which runs another copy of systemd which gets passed the server
socket, and then activates the actual service handler in the container.
Let us assume that you already have a LXC guest created, running a systemd
instance as PID 1 inside the container, which has an SSHD service configured.
The goal is to automatically activate the container when the first SSH
connection is made. The first step is to create a couple of unit files for the
host OS systemd instance. The ``/etc/systemd/system/mycontainer.service`` unit
file specifies how systemd will start the libvirt LXC container
::
[Unit]
Description=My little container
[Service]
ExecStart=/usr/bin/virsh -c lxc:///system start --pass-fds 3 mycontainer
ExecStop=/usr/bin/virsh -c lxc:///system destroy mycontainer
Type=oneshot
RemainAfterExit=yes
KillMode=none
The ``--pass-fds 3`` argument specifies that the file descriptor number 3 that
``virsh`` inherits from systemd, is to be passed into the container. Since
``virsh`` will exit immediately after starting the container, the
``RemainAfterExit`` and ``KillMode`` settings must be altered from their
defaults.
Next, the ``/etc/systemd/system/mycontainer.socket`` unit file is created to get
the host systemd to listen on port 23 for TCP connections. When this unit file
is activated by the first incoming connection, it will cause the
``mycontainer.service`` unit to be activated with the FD corresponding to the
listening TCP socket passed in as FD 3.
::
[Unit]
Description=The SSH socket of my little container
[Socket]
ListenStream=23
Port 23 was picked here so that the container doesn't conflict with the host's
SSH which is on the normal port 22. That's it in terms of host side
configuration.
Inside the container, the ``/etc/systemd/system/sshd.socket`` unit file must be
created
::
[Unit]
Description=SSH Socket for Per-Connection Servers
[Socket]
ListenStream=23
Accept=yes
The ``ListenStream`` value listed in this unit file, must match the value used
in the host file. When systemd in the container receives the pre-opened FD from
libvirt during container startup, it looks at the ``ListenStream`` values to
figure out which FD to give to which service. The actual service to start is
defined by a correspondingly named ``/etc/systemd/system/sshd@.service``
::
[Unit]
Description=SSH Per-Connection Server for %I
[Service]
ExecStart=-/usr/sbin/sshd -i
StandardInput=socket
Finally, make sure this SSH service is set to start on boot of the container, by
running the following command inside the container:
::
# mkdir -p /etc/systemd/system/sockets.target.wants/
# ln -s /etc/systemd/system/sshd.socket /etc/systemd/system/sockets.target.wants/
This example shows how to activate the container based on an incoming SSH
connection. If the container was also configured to have an httpd service, it
may be desirable to activate it upon either an httpd or a sshd connection
attempt. In this case, the ``mycontainer.socket`` file in the host would simply
list multiple socket ports. Inside the container a separate ``xxxxx.socket``
file would need to be created for each service, with a corresponding
``ListenStream`` value set.
Container security
------------------
sVirt SELinux
~~~~~~~~~~~~~
In the absence of the "user" namespace being used, containers cannot be
considered secure against exploits of the host OS. The sVirt SELinux driver
provides a way to secure containers even when the "user" namespace is not used.
The cost is that writing a policy to allow execution of arbitrary OS is not
practical. The SELinux sVirt policy is typically tailored to work with a simpler
application confinement use case, as provided by the "libvirt-sandbox" project.
Auditing
~~~~~~~~
The LXC driver is integrated with libvirt's auditing subsystem, which causes
audit messages to be logged whenever there is an operation performed against a
container which has impact on host resources. So for example, start/stop, device
hotplug will all log audit messages providing details about what action occurred
and any resources associated with it. There are the following 3 types of audit
messages
- ``VIRT_MACHINE_ID`` - details of the SELinux process and image security
labels assigned to the container.
- ``VIRT_CONTROL`` - details of an action / operation performed against a
container. There are the following types of operation
- ``op=start`` - a container has been started. Provides the machine name,
uuid and PID of the ``libvirt_lxc`` controller process
- ``op=init`` - the init PID of the container has been started. Provides the
machine name, uuid and PID of the ``libvirt_lxc`` controller process and
PID of the init process (in the host PID namespace)
- ``op=stop`` - a container has been stopped. Provides the machine name,
uuid
- ``VIRT_RESOURCE`` - details of a host resource associated with a container
action.
Device access
~~~~~~~~~~~~~
All containers are launched with the CAP_MKNOD capability cleared and removed
from the bounding set. Libvirt will ensure that the /dev filesystem is
pre-populated with all devices that a container is allowed to use. In addition,
the cgroup "device" controller is configured to block read/write/mknod from all
devices except those that a container is authorized to use.
Example configurations
----------------------
Example config version 1
~~~~~~~~~~~~~~~~~~~~~~~~
::
<domain type='lxc'>
<name>vm1</name>
<memory>500000</memory>
<os>
<type>exe</type>
<init>/bin/sh</init>
</os>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<interface type='network'>
<source network='default'/>
</interface>
<console type='pty' />
</devices>
</domain>
In the <emulator> element, be sure you specify the correct path to libvirt_lxc,
if it does not live in /usr/libexec on your system.
The next example assumes there is a private root filesystem (perhaps
hand-crafted using busybox, or installed from media, debootstrap, whatever)
under /opt/vm-1-root:
::
<domain type='lxc'>
<name>vm1</name>
<memory>32768</memory>
<os>
<type>exe</type>
<init>/init</init>
</os>
<vcpu>1</vcpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount'>
<source dir='/opt/vm-1-root'/>
<target dir='/'/>
</filesystem>
<interface type='network'>
<source network='default'/>
</interface>
<console type='pty' />
</devices>
</domain>
Altering the available capabilities
-----------------------------------
By default the libvirt LXC driver drops some capabilities among which CAP_MKNOD.
However :since:`since 1.2.6` libvirt can be told to keep or drop some
capabilities using a domain configuration like the following:
::
...
<features>
<capabilities policy='default'>
<mknod state='on'/>
<sys_chroot state='off'/>
</capabilities>
</features>
...
The capabilities children elements are named after the capabilities as defined
in ``man 7 capabilities``. An ``off`` state tells libvirt to drop the
capability, while an ``on`` state will force to keep the capability even though
this one is dropped by default.
The ``policy`` attribute can be one of ``default``, ``allow`` or ``deny``. It
defines the default rules for capabilities: either keep the default behavior
that is dropping a few selected capabilities, or keep all capabilities or drop
all capabilities. The interest of ``allow`` and ``deny`` is that they guarantee
that all capabilities will be kept (or removed) even if new ones are added
later.
The following example, drops all capabilities but CAP_MKNOD:
::
...
<features>
<capabilities policy='deny'>
<mknod state='on'/>
</capabilities>
</features>
...
Note that allowing capabilities that are normally dropped by default can
seriously affect the security of the container and the host.
Inherit namespaces
------------------
Libvirt allows you to inherit the namespace from container/process just like lxc
tools or docker provides to share the network namespace. The following can be
used to share required namespaces. If we want to share only one then the other
namespaces can be ignored. The netns option is specific to sharenet. It can be
used in cases we want to use existing network namespace rather than creating new
network namespace for the container. In this case privnet option will be
ignored.
::
<domain type='lxc' xmlns:lxc='http://libvirt.org/schemas/domain/lxc/1.0'>
...
<lxc:namespace>
<lxc:sharenet type='netns' value='red'/>
<lxc:shareuts type='name' value='container1'/>
<lxc:shareipc type='pid' value='12345'/>
</lxc:namespace>
</domain>
The use of namespace passthrough requires libvirt >= 1.2.19
Container usage / management
----------------------------
As with any libvirt virtualization driver, LXC containers can be managed via a
wide variety of libvirt based tools. At the lowest level the ``virsh`` command
can be used to perform many tasks, by passing the ``-c lxc:///system`` argument.
As an alternative to repeating the URI with every command, the
``LIBVIRT_DEFAULT_URI`` environment variable can be set to ``lxc:///system``.
The examples that follow outline some common operations with virsh and LXC. For
further details about usage of virsh consult its manual page.
Defining (saving) container configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh define`` command takes an XML configuration document and loads it
into libvirt, saving the configuration on disk
::
# virsh -c lxc:///system define myguest.xml
Viewing container configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh dumpxml`` command can be used to view the current XML configuration
of a container. By default the XML output reflects the current state of the
container. If the container is running, it is possible to explicitly request the
persistent configuration, instead of the current live configuration using the
``--inactive`` flag
::
# virsh -c lxc:///system dumpxml myguest
Starting containers
~~~~~~~~~~~~~~~~~~~
The ``virsh start`` command can be used to start a container from a previously
defined persistent configuration
::
# virsh -c lxc:///system start myguest
It is also possible to start so called "transient" containers, which do not
require a persistent configuration to be saved by libvirt, using the
``virsh create`` command.
::
# virsh -c lxc:///system create myguest.xml
Stopping containers
~~~~~~~~~~~~~~~~~~~
The ``virsh shutdown`` command can be used to request a graceful shutdown of the
container. By default this command will first attempt to send a message to the
init process via the ``/dev/initctl`` device node. If no such device node
exists, then it will send SIGTERM to PID 1 inside the container.
::
# virsh -c lxc:///system shutdown myguest
If the container does not respond to the graceful shutdown request, it can be
forcibly stopped using the ``virsh destroy``
::
# virsh -c lxc:///system destroy myguest
Rebooting a container
~~~~~~~~~~~~~~~~~~~~~
The ``virsh reboot`` command can be used to request a graceful shutdown of the
container. By default this command will first attempt to send a message to the
init process via the ``/dev/initctl`` device node. If no such device node
exists, then it will send SIGHUP to PID 1 inside the container.
::
# virsh -c lxc:///system reboot myguest
Undefining (deleting) a container configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh undefine`` command can be used to delete the persistent
configuration of a container. If the guest is currently running, this will turn
it into a "transient" guest.
::
# virsh -c lxc:///system undefine myguest
Connecting to a container console
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh console`` command can be used to connect to the text console
associated with a container.
::
# virsh -c lxc:///system console myguest
If the container has been configured with multiple console devices, then the
``--devname`` argument can be used to choose the console to connect to. In LXC,
multiple consoles will be named as 'console0', 'console1', 'console2', etc.
::
# virsh -c lxc:///system console myguest --devname console1
Running commands in a container
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh lxc-enter-namespace`` command can be used to enter the namespaces
and security context of a container and then execute an arbitrary command.
::
# virsh -c lxc:///system lxc-enter-namespace myguest -- /bin/ls -al /dev
Monitoring container utilization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virt-top`` command can be used to monitor the activity and resource
utilization of all containers on a host
::
# virt-top -c lxc:///system
Converting LXC container configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``virsh domxml-from-native`` command can be used to convert most of the LXC
container configuration into a domain XML fragment
::
# virsh -c lxc:///system domxml-from-native lxc-tools /var/lib/lxc/myguest/config
This conversion has some limitations due to the fact that the domxml-from-native
command output has to be independent of the host. Here are a few things to take
care of before converting:
- Replace the fstab file referenced by lxc.mount by the corresponding
lxc.mount.entry lines.
- Replace all relative sizes of tmpfs mount entries to absolute sizes. Also
make sure that tmpfs entries all have a size option (default is 50%).
- Define lxc.cgroup.memory.limit_in_bytes to properly limit the memory
available to the container. The conversion will use 64MiB as the default.

View File

@ -1,383 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Host device management</h1>
<p>
Libvirt provides management of both physical and virtual host devices
(historically also referred to as node devices) like USB, PCI, SCSI, and
network devices. This also includes various virtualization capabilities
which the aforementioned devices provide for utilization, for example
SR-IOV, NPIV, MDEV, DRM, etc.
</p>
<p>
The node device driver provides means to list and show details about host
devices (<code>virsh nodedev-list</code>, <code>virsh nodedev-info</code>,
and <code>virsh nodedev-dumpxml</code>), which are generic and can be used
with all devices. It also provides the means to manage virtual devices.
Persistently-defined virtual devices are only supported for mediated
devices, while transient devices are supported by both mediated devices
and NPIV (<a href="https://wiki.libvirt.org/page/NPIV_in_libvirt">more
info about NPIV)</a>).
</p>
<p>
Persistent virtual devices are managed with
<code>virsh nodedev-define</code> and <code>virsh nodedev-undefine</code>.
Persistent devices can be configured to start manually or automatically
using <code>virsh nodedev-autostart</code>. Inactive devices can be made
active with <code>virsh nodedev-start</code>.
</p>
<p>
Transient virtual devices are started and stopped with the commands
<code>virsh nodedev-create</code> and <code>virsh nodedev-destroy</code>.
</p>
<p>
Devices on the host system are arranged in a tree-like hierarchy, with
the root node being called <code>computer</code>. The node device driver
supports udev backend (HAL backend was removed in <code>6.8.0</code>).
</p>
<p>
Details of the XML format of a host device can be found <a
href="formatnode.html">here</a>. Of particular interest is the
<code>capability</code> element, which describes features supported by
the device. Some specific device types are addressed in more detail
below.
</p>
<h2>Basic structure of a node device</h2>
<pre>
&lt;device&gt;
&lt;name&gt;pci_0000_00_17_0&lt;/name&gt;
&lt;path&gt;/sys/devices/pci0000:00/0000:00:17.0&lt;/path&gt;
&lt;parent&gt;computer&lt;/parent&gt;
&lt;driver&gt;
&lt;name&gt;ahci&lt;/name&gt;
&lt;/driver&gt;
&lt;capability type='pci'&gt;
...
&lt;/capability&gt;
&lt;/device&gt;</pre>
<ul id="toc"/>
<h2><a id="PCI">PCI host devices</a></h2>
<dl>
<dt><code>capability</code></dt>
<dd>
When used as top level element, the supported values for the
<code>type</code> attribute are <code>pci</code> and
<code>phys_function</code> (see <a href="#SRIOVCap">SR-IOV below</a>).
</dd>
</dl>
<pre>
&lt;device&gt;
&lt;name&gt;pci_0000_04_00_1&lt;/name&gt;
&lt;path&gt;/sys/devices/pci0000:00/0000:00:06.0/0000:04:00.1&lt;/path&gt;
&lt;parent&gt;pci_0000_00_06_0&lt;/parent&gt;
&lt;driver&gt;
&lt;name&gt;igb&lt;/name&gt;
&lt;/driver&gt;
&lt;capability type='pci'&gt;
&lt;domain&gt;0&lt;/domain&gt;
&lt;bus&gt;4&lt;/bus&gt;
&lt;slot&gt;0&lt;/slot&gt;
&lt;function&gt;1&lt;/function&gt;
&lt;product id='0x10c9'&gt;82576 Gigabit Network Connection&lt;/product&gt;
&lt;vendor id='0x8086'&gt;Intel Corporation&lt;/vendor&gt;
&lt;iommuGroup number='15'&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x00' function='0x1'/&gt;
&lt;/iommuGroup&gt;
&lt;numa node='0'/&gt;
&lt;pci-express&gt;
&lt;link validity='cap' port='1' speed='2.5' width='2'/&gt;
&lt;link validity='sta' speed='2.5' width='2'/&gt;
&lt;/pci-express&gt;
&lt;/capability&gt;
&lt;/device&gt;</pre>
<p>
The XML format for a PCI device stays the same for any further
capabilities it supports, a single nested <code>&lt;capability&gt;</code>
element will be included for each capability the device supports.
</p>
<h3><a id="SRIOVCap">SR-IOV capability</a></h3>
<p>
Single root input/output virtualization (SR-IOV) allows sharing of the
PCIe resources by multiple virtual environments. That is achieved by
slicing up a single full-featured physical resource called physical
function (PF) into multiple devices called virtual functions (VFs) sharing
their configuration with the underlying PF. Despite the SR-IOV
specification, the amount of VFs that can be created on a PF varies among
manufacturers.
</p>
<p>
Suppose the NIC <a href="#PCI">above</a> was also SR-IOV capable, it would
also include a nested
<code>&lt;capability&gt;</code> element enumerating all virtual
functions available on the physical device (physical port) like in the
example below.
</p>
<pre>
&lt;capability type='pci'&gt;
...
&lt;capability type='virt_functions' maxCount='7'&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x10' function='0x1'/&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x10' function='0x3'/&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x10' function='0x5'/&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x10' function='0x7'/&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x11' function='0x1'/&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x11' function='0x3'/&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x11' function='0x5'/&gt;
&lt;/capability&gt;
...
&lt;/capability&gt;</pre>
<p>
A SR-IOV child device on the other hand, would then report its top level
capability type as a <code>phys_function</code> instead:
</p>
<pre>
&lt;device&gt;
...
&lt;capability type='phys_function'&gt;
&lt;address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/&gt;
&lt;/capability&gt;
...
&lt;/device&gt;</pre>
<h3><a id="MDEVCap">MDEV capability</a></h3>
<p>
A device capable of creating mediated devices will include a nested
capability <code>mdev_types</code> which enumerates all supported mdev
types on the physical device, along with the type attributes available
through sysfs. A detailed description of the XML format for the
<code>mdev_types</code> capability can be found
<a href="formatnode.html#MDEVTypesCap">here</a>.
</p>
<p>
The following example shows how we might represent an NVIDIA GPU device
that supports mediated devices. See below for <a href="#MDEV">more
information about mediated devices</a>.
</p>
<pre>
&lt;device&gt;
...
&lt;driver&gt;
&lt;name&gt;nvidia&lt;/name&gt;
&lt;/driver&gt;
&lt;capability type='pci'&gt;
...
&lt;capability type='mdev_types'&gt;
&lt;type id='nvidia-11'&gt;
&lt;name&gt;GRID M60-0B&lt;/name&gt;
&lt;deviceAPI&gt;vfio-pci&lt;/deviceAPI&gt;
&lt;availableInstances&gt;16&lt;/availableInstances&gt;
&lt;/type&gt;
&lt;!-- Here would come the rest of the available mdev types --&gt;
&lt;/capability&gt;
...
&lt;/capability&gt;
&lt;/device&gt;</pre>
<h3><a id="VPDCap">VPD capability</a></h3>
<p>
A device that exposes a PCI/PCIe VPD capability will include a nested
capability <code>vpd</code> which presents data stored in the Vital Product
Data (VPD). VPD provides a device name and a number of other standard-defined
read-only fields (change level, manufacture id, part number, serial number) and
vendor-specific read-only fields. Additionally, if a device supports it,
read-write fields (asset tag, vendor-specific fields or system fields) may
also be present. The VPD capability is optional for PCI/PCIe devices and the
set of exposed fields may vary depending on a device. The XML format follows
the binary format described in "I.3. VPD Definitions" in PCI Local Bus (2.2+)
and the identical format in PCIe 4.0+. At the time of writing, the support for
exposing this capability is only present on Linux-based systems (kernel version
v2.6.26 is the first one to expose VPD via sysfs which Libvirt relies on).
Reading the VPD contents requires root privileges, therefore,
<code>virsh nodedev-dumpxml</code> must be executed accordingly.
A description of the XML format for the <code>vpd</code> capability can
be found <a href="formatnode.html#VPDCap">here</a>.
</p>
<p>
The following example shows a VPD representation for a device that exposes the
VPD capability with read-only and read-write fields. Among other things,
the VPD of this particular device includes a unique board serial number.
</p>
<pre>
&lt;device&gt;
&lt;name&gt;pci_0000_42_00_0&lt;/name&gt;
&lt;capability type=&apos;pci&apos;&gt;
&lt;class&gt;0x020000&lt;/class&gt;
&lt;domain&gt;0&lt;/domain&gt;
&lt;bus&gt;66&lt;/bus&gt;
&lt;slot&gt;0&lt;/slot&gt;
&lt;function&gt;0&lt;/function&gt;
&lt;product id=&apos;0xa2d6&apos;&gt;MT42822 BlueField-2 integrated ConnectX-6 Dx network controller&lt;/product&gt;
&lt;vendor id=&apos;0x15b3&apos;&gt;Mellanox Technologies&lt;/vendor&gt;
&lt;capability type=&apos;virt_functions&apos; maxCount=&apos;16&apos;/&gt;
&lt;capability type=&apos;vpd&apos;&gt;
&lt;name&gt;BlueField-2 DPU 25GbE Dual-Port SFP56, Crypto Enabled, 16GB on-board DDR, 1GbE OOB management, Tall Bracket&lt;/name&gt;
&lt;fields access=&apos;readonly&apos;&gt;
&lt;change_level&gt;B1&lt;/change_level&gt;
&lt;manufacture_id&gt;foobar&lt;/manufacture_id&gt;
&lt;part_number&gt;MBF2H332A-AEEOT&lt;/part_number&gt;
&lt;serial_number&gt;MT2113X00000&lt;/serial_number&gt;
&lt;vendor_field index=&apos;0&apos;&gt;PCIeGen4 x8&lt;/vendor_field&gt;
&lt;vendor_field index=&apos;2&apos;&gt;MBF2H332A-AEEOT&lt;/vendor_field&gt;
&lt;vendor_field index=&apos;3&apos;&gt;3c53d07eec484d8aab34dabd24fe575aa&lt;/vendor_field&gt;
&lt;vendor_field index=&apos;A&apos;&gt;MLX:MN=MLNX:CSKU=V2:UUID=V3:PCI=V0:MODL=BF2H332A&lt;/vendor_field&gt;
&lt;/fields&gt;
&lt;fields access=&apos;readwrite&apos;&gt;
&lt;asset_tag&gt;fooasset&lt;/asset_tag&gt;
&lt;vendor_field index=&apos;0&apos;&gt;vendorfield0&lt;/vendor_field&gt;
&lt;vendor_field index=&apos;2&apos;&gt;vendorfield2&lt;/vendor_field&gt;
&lt;vendor_field index=&apos;A&apos;&gt;vendorfieldA&lt;/vendor_field&gt;
&lt;system_field index=&apos;B&apos;&gt;systemfieldB&lt;/system_field&gt;
&lt;system_field index=&apos;0&apos;&gt;systemfield0&lt;/system_field&gt;
&lt;/fields&gt;
&lt;/capability&gt;
&lt;iommuGroup number=&apos;65&apos;&gt;
&lt;address domain=&apos;0x0000&apos; bus=&apos;0x42&apos; slot=&apos;0x00&apos; function=&apos;0x0&apos;/&gt;
&lt;/iommuGroup&gt;
&lt;numa node=&apos;0&apos;/&gt;
&lt;pci-express&gt;
&lt;link validity=&apos;cap&apos; port=&apos;0&apos; speed=&apos;16&apos; width=&apos;8&apos;/&gt;
&lt;link validity=&apos;sta&apos; speed=&apos;8&apos; width=&apos;8&apos;/&gt;
&lt;/pci-express&gt;
&lt;/capability&gt;
&lt;/device&gt;
</pre>
<h2><a id="MDEV">Mediated devices (MDEVs)</a></h2>
<p>
Mediated devices (<span class="since">Since 3.2.0</span>) are software
devices defining resource allocation on the backing physical device which
in turn allows the parent physical device's resources to be divided into
several mediated devices, thus sharing the physical device's performance
among multiple guests. Unlike SR-IOV however, where a PCIe device appears
as multiple separate PCIe devices on the host's PCI bus, mediated devices
only appear on the mdev virtual bus. Therefore, no detach/reattach
procedure from/to the host driver procedure is involved even though
mediated devices are used in a direct device assignment manner. A
detailed description of the XML format for the <code>mdev</code>
capability can be found <a href="formatnode.html#mdev">here</a>.
</p>
<h3>Example of a mediated device</h3>
<pre>
&lt;device&gt;
&lt;name&gt;mdev_4b20d080_1b54_4048_85b3_a6a62d165c01&lt;/name&gt;
&lt;path&gt;/sys/devices/pci0000:00/0000:00:02.0/4b20d080-1b54-4048-85b3-a6a62d165c01&lt;/path&gt;
&lt;parent&gt;pci_0000_06_00_0&lt;/parent&gt;
&lt;driver&gt;
&lt;name&gt;vfio_mdev&lt;/name&gt;
&lt;/driver&gt;
&lt;capability type='mdev'&gt;
&lt;type id='nvidia-11'/&gt;
&lt;uuid&gt;4b20d080-1b54-4048-85b3-a6a62d165c01&lt;/uuid&gt;
&lt;iommuGroup number='12'/&gt;
&lt;/capability&gt;
&lt;/device&gt;</pre>
<p>
The support of mediated device's framework in libvirt's node device driver
covers the following features:
</p>
<ul>
<li>
list available mediated devices on the host
(<span class="since">Since 3.4.0</span>)
</li>
<li>
display device details
(<span class="since">Since 3.4.0</span>)
</li>
<li>
create transient mediated devices
(<span class="since">Since 6.5.0</span>)
</li>
<li>
define persistent mediated devices
(<span class="since">Since 7.3.0</span>)
</li>
</ul>
<p>
Because mediated devices are instantiated from vendor specific templates,
simply called 'types', information describing these types is contained
within the parent device's capabilities (see the example in <a
href="#PCI">PCI host devices</a>). To list all devices capable of
creating mediated devices, the following command can be used.
</p>
<pre>$ virsh nodedev-list --cap mdev_types</pre>
<p>
To see the supported mediated device types on a specific physical device
use the following:
</p>
<pre>$ virsh nodedev-dumpxml &lt;device&gt;</pre>
<p>
Before creating a mediated device, unbind the device from the respective
device driver, eg. subchannel I/O driver for a CCW device. Then bind the
device to the respective VFIO driver. For a CCW device, also unbind the
corresponding subchannel of the CCW device from the subchannel I/O driver
and then bind the subchannel (instead of the CCW device) to the vfio_ccw
driver. The below example shows the unbinding and binding steps for a CCW
device.
</p>
<pre>
device="0.0.1234"
subchannel="0.0.0123"
echo $device &gt; /sys/bus/ccw/devices/$device/driver/unbind
echo $subchannel &gt; /sys/bus/css/devices/$subchannel/driver/unbind
echo $subchannel &gt; /sys/bus/css/drivers/vfio_ccw/bind
</pre>
<p>
To instantiate a transient mediated device, create an XML file representing the
device. See above for information about the mediated device xml format.
</p>
<pre>$ virsh nodedev-create &lt;xml-file&gt;
Node device '&lt;device-name&gt;' created from '&lt;xml-file&gt;'</pre>
<p>
If you would like to persistently define the device so that it will be
maintained across host reboots, use <code>virsh nodedev-define</code>
instead of <code>nodedev-create</code>:
</p>
<pre>$ virsh nodedev-define &lt;xml-file&gt;
Node device '&lt;device-name&gt;' defined from '&lt;xml-file&gt;'</pre>
<p>
To start an instance of this device definition, use the following command:
</p>
<pre>$ virsh nodedev-start &lt;device-name&gt;</pre>
<p>
Active mediated device instances can be stopped using <code>virsh
nodedev-destroy</code>, and persistent device definitions can be removed
using <code>virsh nodedev-undefine</code>.
</p>
<p>
If a mediated device is defined persistently, it can also be set to be
automatically started whenever the host reboots or when the parent device
becomes available. In order to autostart a mediated device, use the
following command:
</p>
<pre>$ virsh nodedev-autostart &lt;device-name&gt;</pre>
</body>
</html>

348
docs/drvnodedev.rst Normal file
View File

@ -0,0 +1,348 @@
.. role:: since
======================
Host device management
======================
.. contents::
Libvirt provides management of both physical and virtual host devices
(historically also referred to as node devices) like USB, PCI, SCSI, and network
devices. This also includes various virtualization capabilities which the
aforementioned devices provide for utilization, for example SR-IOV, NPIV, MDEV,
DRM, etc.
The node device driver provides means to list and show details about host
devices (``virsh nodedev-list``, ``virsh nodedev-info``, and
``virsh nodedev-dumpxml``), which are generic and can be used with all devices.
It also provides the means to manage virtual devices. Persistently-defined
virtual devices are only supported for mediated devices, while transient devices
are supported by both mediated devices and NPIV (`more info about
NPIV) <https://wiki.libvirt.org/page/NPIV_in_libvirt>`__).
Persistent virtual devices are managed with ``virsh nodedev-define`` and
``virsh nodedev-undefine``. Persistent devices can be configured to start
manually or automatically using ``virsh nodedev-autostart``. Inactive devices
can be made active with ``virsh nodedev-start``.
Transient virtual devices are started and stopped with the commands
``virsh nodedev-create`` and ``virsh nodedev-destroy``.
Devices on the host system are arranged in a tree-like hierarchy, with the root
node being called ``computer``. The node device driver supports udev backend
(HAL backend was removed in ``6.8.0``).
Details of the XML format of a host device can be found
`here <formatnode.html>`__. Of particular interest is the ``capability``
element, which describes features supported by the device. Some specific device
types are addressed in more detail below.
Basic structure of a node device
--------------------------------
::
<device>
<name>pci_0000_00_17_0</name>
<path>/sys/devices/pci0000:00/0000:00:17.0</path>
<parent>computer</parent>
<driver>
<name>ahci</name>
</driver>
<capability type='pci'>
...
</capability>
</device>
PCI host devices
----------------
``capability``
When used as top level element, the supported values for the ``type``
attribute are ``pci`` and ``phys_function`` (see `SR-IOV capability`_ below).
::
<device>
<name>pci_0000_04_00_1</name>
<path>/sys/devices/pci0000:00/0000:00:06.0/0000:04:00.1</path>
<parent>pci_0000_00_06_0</parent>
<driver>
<name>igb</name>
</driver>
<capability type='pci'>
<domain>0</domain>
<bus>4</bus>
<slot>0</slot>
<function>1</function>
<product id='0x10c9'>82576 Gigabit Network Connection</product>
<vendor id='0x8086'>Intel Corporation</vendor>
<iommuGroup number='15'>
<address domain='0x0000' bus='0x04' slot='0x00' function='0x1'/>
</iommuGroup>
<numa node='0'/>
<pci-express>
<link validity='cap' port='1' speed='2.5' width='2'/>
<link validity='sta' speed='2.5' width='2'/>
</pci-express>
</capability>
</device>
The XML format for a PCI device stays the same for any further capabilities it
supports, a single nested ``<capability>`` element will be included for each
capability the device supports.
SR-IOV capability
~~~~~~~~~~~~~~~~~
Single root input/output virtualization (SR-IOV) allows sharing of the PCIe
resources by multiple virtual environments. That is achieved by slicing up a
single full-featured physical resource called physical function (PF) into
multiple devices called virtual functions (VFs) sharing their configuration with
the underlying PF. Despite the SR-IOV specification, the amount of VFs that can
be created on a PF varies among manufacturers.
Suppose the NIC above in `PCI host devices`_ was also SR-IOV capable, it would
also include a nested ``<capability>`` element enumerating all virtual
functions available on the physical device (physical port) like in the example
below.
::
<capability type='pci'>
...
<capability type='virt_functions' maxCount='7'>
<address domain='0x0000' bus='0x04' slot='0x10' function='0x1'/>
<address domain='0x0000' bus='0x04' slot='0x10' function='0x3'/>
<address domain='0x0000' bus='0x04' slot='0x10' function='0x5'/>
<address domain='0x0000' bus='0x04' slot='0x10' function='0x7'/>
<address domain='0x0000' bus='0x04' slot='0x11' function='0x1'/>
<address domain='0x0000' bus='0x04' slot='0x11' function='0x3'/>
<address domain='0x0000' bus='0x04' slot='0x11' function='0x5'/>
</capability>
...
</capability>
A SR-IOV child device on the other hand, would then report its top level
capability type as a ``phys_function`` instead:
::
<device>
...
<capability type='phys_function'>
<address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</capability>
...
</device>
MDEV capability
~~~~~~~~~~~~~~~
A device capable of creating mediated devices will include a nested capability
``mdev_types`` which enumerates all supported mdev types on the physical device,
along with the type attributes available through sysfs. A detailed description
of the XML format for the ``mdev_types`` capability can be found
`here <formatnode.html#mdev-types-capability>`__.
The following example shows how we might represent an NVIDIA GPU device that
supports mediated devices. See below for more info on
`Mediated devices (MDEVs)`_.
::
<device>
...
<driver>
<name>nvidia</name>
</driver>
<capability type='pci'>
...
<capability type='mdev_types'>
<type id='nvidia-11'>
<name>GRID M60-0B</name>
<deviceAPI>vfio-pci</deviceAPI>
<availableInstances>16</availableInstances>
</type>
<!-- Here would come the rest of the available mdev types -->
</capability>
...
</capability>
</device>
VPD capability
~~~~~~~~~~~~~~
A device that exposes a PCI/PCIe VPD capability will include a nested capability
``vpd`` which presents data stored in the Vital Product Data (VPD). VPD provides
a device name and a number of other standard-defined read-only fields (change
level, manufacture id, part number, serial number) and vendor-specific read-only
fields. Additionally, if a device supports it, read-write fields (asset tag,
vendor-specific fields or system fields) may also be present. The VPD capability
is optional for PCI/PCIe devices and the set of exposed fields may vary
depending on a device. The XML format follows the binary format described in
"I.3. VPD Definitions" in PCI Local Bus (2.2+) and the identical format in PCIe
4.0+. At the time of writing, the support for exposing this capability is only
present on Linux-based systems (kernel version v2.6.26 is the first one to
expose VPD via sysfs which Libvirt relies on). Reading the VPD contents requires
root privileges, therefore, ``virsh nodedev-dumpxml`` must be executed
accordingly. A description of the XML format for the ``vpd`` capability can be
found `here <formatnode.html#vpd-capability>`__.
The following example shows a VPD representation for a device that exposes the
VPD capability with read-only and read-write fields. Among other things, the VPD
of this particular device includes a unique board serial number.
::
<device>
<name>pci_0000_42_00_0</name>
<capability type='pci'>
<class>0x020000</class>
<domain>0</domain>
<bus>66</bus>
<slot>0</slot>
<function>0</function>
<product id='0xa2d6'>MT42822 BlueField-2 integrated ConnectX-6 Dx network controller</product>
<vendor id='0x15b3'>Mellanox Technologies</vendor>
<capability type='virt_functions' maxCount='16'/>
<capability type='vpd'>
<name>BlueField-2 DPU 25GbE Dual-Port SFP56, Crypto Enabled, 16GB on-board DDR, 1GbE OOB management, Tall Bracket</name>
<fields access='readonly'>
<change_level>B1</change_level>
<manufacture_id>foobar</manufacture_id>
<part_number>MBF2H332A-AEEOT</part_number>
<serial_number>MT2113X00000</serial_number>
<vendor_field index='0'>PCIeGen4 x8</vendor_field>
<vendor_field index='2'>MBF2H332A-AEEOT</vendor_field>
<vendor_field index='3'>3c53d07eec484d8aab34dabd24fe575aa</vendor_field>
<vendor_field index='A'>MLX:MN=MLNX:CSKU=V2:UUID=V3:PCI=V0:MODL=BF2H332A</vendor_field>
</fields>
<fields access='readwrite'>
<asset_tag>fooasset</asset_tag>
<vendor_field index='0'>vendorfield0</vendor_field>
<vendor_field index='2'>vendorfield2</vendor_field>
<vendor_field index='A'>vendorfieldA</vendor_field>
<system_field index='B'>systemfieldB</system_field>
<system_field index='0'>systemfield0</system_field>
</fields>
</capability>
<iommuGroup number='65'>
<address domain='0x0000' bus='0x42' slot='0x00' function='0x0'/>
</iommuGroup>
<numa node='0'/>
<pci-express>
<link validity='cap' port='0' speed='16' width='8'/>
<link validity='sta' speed='8' width='8'/>
</pci-express>
</capability>
</device>
Mediated devices (MDEVs)
------------------------
Mediated devices ( :since:`Since 3.2.0` ) are software devices defining resource
allocation on the backing physical device which in turn allows the parent
physical device's resources to be divided into several mediated devices, thus
sharing the physical device's performance among multiple guests. Unlike SR-IOV
however, where a PCIe device appears as multiple separate PCIe devices on the
host's PCI bus, mediated devices only appear on the mdev virtual bus. Therefore,
no detach/reattach procedure from/to the host driver procedure is involved even
though mediated devices are used in a direct device assignment manner. A
detailed description of the XML format for the ``mdev`` capability can be found
`here <formatnode.html#mdev>`__.
Example of a mediated device
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
<device>
<name>mdev_4b20d080_1b54_4048_85b3_a6a62d165c01</name>
<path>/sys/devices/pci0000:00/0000:00:02.0/4b20d080-1b54-4048-85b3-a6a62d165c01</path>
<parent>pci_0000_06_00_0</parent>
<driver>
<name>vfio_mdev</name>
</driver>
<capability type='mdev'>
<type id='nvidia-11'/>
<uuid>4b20d080-1b54-4048-85b3-a6a62d165c01</uuid>
<iommuGroup number='12'/>
</capability>
</device>
The support of mediated device's framework in libvirt's node device driver
covers the following features:
- list available mediated devices on the host ( :since:`Since 3.4.0` )
- display device details ( :since:`Since 3.4.0` )
- create transient mediated devices ( :since:`Since 6.5.0` )
- define persistent mediated devices ( :since:`Since 7.3.0` )
Because mediated devices are instantiated from vendor specific templates, simply
called 'types', information describing these types is contained within the
parent device's capabilities (see the example in `PCI host devices`_).
To list all devices capable of creating mediated devices, the following command
can be used.
::
$ virsh nodedev-list --cap mdev_types
To see the supported mediated device types on a specific physical device use the
following:
::
$ virsh nodedev-dumpxml <device>
Before creating a mediated device, unbind the device from the respective device
driver, eg. subchannel I/O driver for a CCW device. Then bind the device to the
respective VFIO driver. For a CCW device, also unbind the corresponding
subchannel of the CCW device from the subchannel I/O driver and then bind the
subchannel (instead of the CCW device) to the vfio_ccw driver. The below example
shows the unbinding and binding steps for a CCW device.
::
device="0.0.1234"
subchannel="0.0.0123"
echo $device > /sys/bus/ccw/devices/$device/driver/unbind
echo $subchannel > /sys/bus/css/devices/$subchannel/driver/unbind
echo $subchannel > /sys/bus/css/drivers/vfio_ccw/bind
To instantiate a transient mediated device, create an XML file representing the
device. See above for information about the mediated device xml format.
::
$ virsh nodedev-create <xml-file>
Node device '<device-name>' created from '<xml-file>'
If you would like to persistently define the device so that it will be
maintained across host reboots, use ``virsh nodedev-define`` instead of
``nodedev-create``:
::
$ virsh nodedev-define <xml-file>
Node device '<device-name>' defined from '<xml-file>'
To start an instance of this device definition, use the following command:
::
$ virsh nodedev-start <device-name>
Active mediated device instances can be stopped using
``virsh nodedev-destroy``, and persistent device definitions can be
removed using ``virsh nodedev-undefine``.
If a mediated device is defined persistently, it can also be set to be
automatically started whenever the host reboots or when the parent device
becomes available. In order to autostart a mediated device, use the following
command:
::
$ virsh nodedev-autostart <device-name>

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>OpenVZ container driver</h1>
<ul id="toc"></ul>
<p>
The OpenVZ driver for libvirt allows use and management of container
based virtualization on a Linux host OS. Prior to using the OpenVZ
driver, the OpenVZ enabled kernel must be installed &amp; booted, and the
OpenVZ userspace tools installed. The libvirt driver has been tested
with OpenVZ 3.0.22, but other 3.0.x versions should also work without
undue trouble.
</p>
<h2><a id="project">Project Links</a></h2>
<ul>
<li>
The <a href="https://openvz.org/">OpenVZ</a> Linux container
system
</li>
</ul>
<h2><a id="connections">Connections to OpenVZ driver</a></h2>
<p>
The libvirt OpenVZ driver is a single-instance privileged driver,
with a driver name of 'openvz'. Some example connection URIs for
the libvirt driver are:
</p>
<pre>
openvz:///system (local access)
openvz+unix:///system (local access)
openvz://example.com/system (remote access, TLS/x509)
openvz+tcp://example.com/system (remote access, SASl/Kerberos)
openvz+ssh://root@example.com/system (remote access, SSH tunnelled)
</pre>
<h2><a id="notes">Notes on bridged networking</a></h2>
<p>
Bridged networking enables a guest domain (ie container) to have its
network interface connected directly to the host's physical LAN. Before
this can be used there are a couple of configuration pre-requisites for
the host OS.
</p>
<h3><a id="host">Host network devices</a></h3>
<p>
One or more of the physical devices must be attached to a bridge. The
process for this varies according to the operating system in use, so
for up to date notes consult the <a href="https://wiki.libvirt.org">Wiki</a>
or your operating system's networking documentation. The basic idea is
that the host OS should end up with a bridge device "br0" containing a
physical device "eth0", or a bonding device "bond0".
</p>
<h3><a id="tools">OpenVZ tools configuration</a></h3>
<p>
OpenVZ releases later than 3.0.23 ship with a standard network device
setup script that is able to setup bridging, named
<code>/usr/sbin/vznetaddbr</code>. For releases prior to 3.0.23, this
script must be created manually by the host OS administrator. The
simplest way is to just download the latest version of this script
from a newer OpenVZ release, or upstream source repository. Then
a generic configuration file <code>/etc/vz/vznet.conf</code>
must be created containing
</p>
<pre>
#!/bin/bash
EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"
</pre>
<p>
The host OS is now ready to allow bridging of guest containers, which
will work whether the container is started with libvirt, or OpenVZ
tools.
</p>
<h2><a id="example">Example guest domain XML configuration</a></h2>
<p>
The current libvirt OpenVZ driver has a restriction that the
domain names must match the OpenVZ container VEID, which by
convention start at 100, and are incremented from there. The
choice of OS template to use inside the container is determined
by the <code>filesystem</code> tag, and the template source name
matches the templates known to OpenVZ tools.
</p>
<pre>
&lt;domain type='openvz' id='104'&gt;
&lt;name&gt;104&lt;/name&gt;
&lt;uuid&gt;86c12009-e591-a159-6e9f-91d18b85ef78&lt;/uuid&gt;
&lt;vcpu&gt;3&lt;/vcpu&gt;
&lt;os&gt;
&lt;type&gt;exe&lt;/type&gt;
&lt;init&gt;/sbin/init&lt;/init&gt;
&lt;/os&gt;
&lt;devices&gt;
&lt;filesystem type='template'&gt;
&lt;source name='fedora-9-i386-minimal'/&gt;
&lt;target dir='/'/&gt;
&lt;/filesystem&gt;
&lt;interface type='bridge'&gt;
&lt;mac address='00:18:51:5b:ea:bf'/&gt;
&lt;source bridge='br0'/&gt;
&lt;target dev='veth101.0'/&gt;
&lt;/interface&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
</body>
</html>

97
docs/drvopenvz.rst Normal file
View File

@ -0,0 +1,97 @@
=======================
OpenVZ container driver
=======================
.. contents::
The OpenVZ driver for libvirt allows use and management of container based
virtualization on a Linux host OS. Prior to using the OpenVZ driver, the OpenVZ
enabled kernel must be installed & booted, and the OpenVZ userspace tools
installed. The libvirt driver has been tested with OpenVZ 3.0.22, but other
3.0.x versions should also work without undue trouble.
Project Links
-------------
- The `OpenVZ <https://openvz.org/>`__ Linux container system
Connections to OpenVZ driver
----------------------------
The libvirt OpenVZ driver is a single-instance privileged driver, with a driver
name of 'openvz'. Some example connection URIs for the libvirt driver are:
::
openvz:///system (local access)
openvz+unix:///system (local access)
openvz://example.com/system (remote access, TLS/x509)
openvz+tcp://example.com/system (remote access, SASl/Kerberos)
openvz+ssh://root@example.com/system (remote access, SSH tunnelled)
Notes on bridged networking
---------------------------
Bridged networking enables a guest domain (ie container) to have its network
interface connected directly to the host's physical LAN. Before this can be used
there are a couple of configuration pre-requisites for the host OS.
Host network devices
~~~~~~~~~~~~~~~~~~~~
One or more of the physical devices must be attached to a bridge. The process
for this varies according to the operating system in use, so for up to date
notes consult the `Wiki <https://wiki.libvirt.org>`__ or your operating system's
networking documentation. The basic idea is that the host OS should end up with
a bridge device "br0" containing a physical device "eth0", or a bonding device
"bond0".
OpenVZ tools configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~
OpenVZ releases later than 3.0.23 ship with a standard network device setup
script that is able to setup bridging, named ``/usr/sbin/vznetaddbr``. For
releases prior to 3.0.23, this script must be created manually by the host OS
administrator. The simplest way is to just download the latest version of this
script from a newer OpenVZ release, or upstream source repository. Then a
generic configuration file ``/etc/vz/vznet.conf`` must be created containing
::
#!/bin/bash
EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"
The host OS is now ready to allow bridging of guest containers, which will work
whether the container is started with libvirt, or OpenVZ tools.
Example guest domain XML configuration
--------------------------------------
The current libvirt OpenVZ driver has a restriction that the domain names must
match the OpenVZ container VEID, which by convention start at 100, and are
incremented from there. The choice of OS template to use inside the container is
determined by the ``filesystem`` tag, and the template source name matches the
templates known to OpenVZ tools.
::
<domain type='openvz' id='104'>
<name>104</name>
<uuid>86c12009-e591-a159-6e9f-91d18b85ef78</uuid>
<vcpu>3</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
</os>
<devices>
<filesystem type='template'>
<source name='fedora-9-i386-minimal'/>
<target dir='/'/>
</filesystem>
<interface type='bridge'>
<mac address='00:18:51:5b:ea:bf'/>
<source bridge='br0'/>
<target dev='veth101.0'/>
</interface>
</devices>
</domain>

View File

@ -5,7 +5,7 @@
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 3.1.0 or
later.
It supports multiple QEMU accelerators: software
@ -34,8 +34,8 @@ Deployment pre-requisites
``qemu-kvm`` and ``/dev/kvm`` device node. If both are found, then KVM fully
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.
presence of ``Hypervisor.framework``. If it is found it will be possible to
create hardware accelerated guests.
Connections to QEMU driver
--------------------------
@ -580,6 +580,63 @@ reconfigure libvirtd.
*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
-------------------------

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Remote management driver</h1>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More