Commit Graph

45517 Commits

Author SHA1 Message Date
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Moteen Shah
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
Ján Tomko
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
Tim Wiederhake
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
Tim Wiederhake
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
Tim Wiederhake
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
Tim Wiederhake
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
Tim Wiederhake
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
Jiri Denemark
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
Jiri Denemark
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
Peter Krempa
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
Peter Krempa
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
Peter Krempa
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
Andrea Bolognani
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
Peter Krempa
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
Peter Krempa
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
Erik Skultety
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
Peter Krempa
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
Peter Krempa
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
Pavel Hrdina
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
Peter Krempa
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
Pavel Hrdina
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
Pavel Hrdina
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
Pavel Hrdina
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
Michal Privoznik
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
Michal Privoznik
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
Michal Privoznik
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
Michal Privoznik
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
Michal Privoznik
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
Ján Tomko
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
Michal Privoznik
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
Nikolay Shirokovskiy
7940fe02d5 AUTHORS: change my (Nikolay Shirokovskiy) email
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
2022-04-06 11:00:53 +03:00
Nikolay Shirokovskiy
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
Nikolay Shirokovskiy
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
Nikolay Shirokovskiy
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
Michal Privoznik
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
Tim Wiederhake
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
Tim Wiederhake
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
Tim Wiederhake
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