Commit Graph

44943 Commits

Author SHA1 Message Date
Peter Krempa
c6bb274693 virsh: cmdEvent: Rewrite questionable event registration
The code registering the event handlers in 'cmdEvent' had too many
blocks of code conditional on whether just one event is being listened
to or all events.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

gets expanded to give a per-VM NVRAM path.

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

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

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

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

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

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

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

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

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

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

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

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

  b0074eeca3

which makes the build fail with:

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

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

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

https://bugs.gentoo.org/833586

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

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

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

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

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

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

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

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:16 +01:00