Commit Graph

27819 Commits

Author SHA1 Message Date
Pavel Hrdina
da6d644ea7 meson: drop debug_logs configure argument
There is no point of having this option in libvirt because the debug
logs can be configured using log filters.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2020-08-03 09:26:28 +02:00
Pavel Hrdina
b63c979fc9 meson: remove automake specific directives
EXTRA_DIST is not relevant because meson makes a git copy when creating
dist archive so everything tracked by git is part of dist tarball.

The remaining ones are not converted to meson files as they are
automatically tracked by meson.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2020-08-03 09:26:25 +02:00
Ján Tomko
a64413e078 util: netdevip: remove unused VIR_NETDEV_FAMILY
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: cf0568b0af
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
a84e5a4979 util: vportprofile: remove unused constants
After the switch to libnl these are no longer used.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 77e7c13b2e
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
3056f44e72 util: remove unused VIR_MCAST_ADDR_LEN
Unused since its introduction.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: cc0e8c244d
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
d89edbfbfc test: remove unused NUM_CELLS
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 2bd7ed78a7
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
d50b399bf8 storage: scsi: remove unused LINUX_SYSFS_SCSI_HOST_POSTFIX
Unused since its introduction.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 81d0ffbc3b
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
c1945db104 storage: logical: drop unused PV_BLANK_SECTOR_SIZE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: d942bf6e9e
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
528f208102 locking: sanlock: drop unused LOCKSPACE_SLEEP
After dropping support for sanlock < 2.4,
this constant is no longer used.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: c495169478
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
a36b6c9a8a conf: scheduler parser: do not hardcode element name
When trying to parse an XML with overlapping iothread scheduler
settings, the error message was rather confusing:

   error: iothreadssched attributes 'vcpus' must not overlap

Pass the correct element name.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
a7d7c2a451 conf: pass elementName to virDomainThreadSchedParseHelper
Pass the scheduler element name instead of trying to reconstructing
it from the attribute name.

This has the benefit of not mixing '%s' with regular text in
translatable strings as well as preventing the confusion when
the 's' marking the plural in the element name ('vcpus') is taken
as a first letter of the 'sched' suffix.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 7ea55a481d
Fixes: 99c5fe0e7c
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-03 07:23:45 +02:00
Ján Tomko
dd44868423 conf: rename 'name' in scheduler parser
virDomainThreadSchedParseHelper is used for parsing both iothread
and vcpu scheduling settings. Rename its 'name' attribute to
make it obvious this refers to the attribute name, not the name of
the element (which is currently constructed from the attribute name).

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-03 07:23:45 +02:00
Peter Krempa
00bb850eb0 qemu: snapshot: Collect 'query-named-block-nodes' prior to memory migration
When doing an external snapshot we migrate memory to a file as a form of
taking the memory state. This creates a problem as qemu deactivates all
active bitmaps after a successful migration. This means that calling
'query-named-block-nodes' will return an empty list of bitmaps for
devices. We use the bitmap list to propagate the active bitmaps into the
overlay files being created which is required for backups to work after
a snapshot. Since we wouldn't propagate anything a subsequent backup
will fail with:

invalid argument: missing or broken bitmap 'testchck' for disk 'vda'

To fix this, we can simply collect the bitmap list prior to the
migration.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-08-03 07:17:38 +02:00
Hao Wang
f7f5b86be2 virNodeDevPCICapSRIOVVirtualParseXML: fix memleak of addr
virPCIDeviceAddressPtr 'addr' is forgotten to be freed in the branch
'VIR_APPEND_ELEMENT() < 0'. Use g_autoptr instead.

Signed-off-by: Hao Wang <wanghao232@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-07-30 17:52:47 +02:00
Zheng Chuan
ffa7fab440 qemu: fix memory leak in qemuDomainSaveInternal()
Use g_autoptr to free the temporary virDomainDef object created by
qemuDomainSaveInternal() when xmlin is non-NULL. Leak was added in
commit 0ea479f8f6, first appearing in libvirt 0.9.4 in August 2011.

Signed-off-by: Zheng Chuan <zhengchuan@huawei.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2020-07-29 15:47:24 -04:00
Nikolay Shirokovskiy
2c206f2006 src: add missing balloon stats docs
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-07-28 17:31:53 +02:00
Nikolay Shirokovskiy
188a71c8eb lib: clarify docs for hugetlb in virDomainMemoryStatTags
The term number is used for other stats and even for hugetlb
stats in virsh man page. The term number is also more clear.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-07-28 17:24:39 +02:00
Michal Privoznik
e450ebb4c6 virDevMapperGetTargets: Don't ignore EBADF
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-25 11:14:39 +02:00
Michal Privoznik
2249455654 virdevmapper: Don't use libdevmapper to obtain dependencies
CVE-2020-14339

When building domain's private /dev in a namespace, libdevmapper
is consulted for getting full dependency tree of domain's disks.
The reason is that for a multipath devices all dependent devices
must be created in the namespace and allowed in CGroups.

However, this approach is very fragile as building of namespace
happens in the forked off child process, after mass close of FDs
and just before dropping privileges and execing QEMU. And it so
happens that when calling libdevmapper APIs, one of them opens
/dev/mapper/control and saves the FD into a global variable. The
FD is kept open until the lib is unlinked or dm_lib_release() is
called explicitly. We are doing neither.

However, the virDevMapperGetTargets() function is called also
from libvirtd (when setting up CGroups) and thus has to be thread
safe. Unfortunately, libdevmapper APIs are not thread safe (nor
async signal safe) and thus we can't use them. Reimplement what
libdevmapper would do using plain C (ioctl()-s, /proc/devices
parsing, /dev/mapper dirwalking, and so on).

Fixes: a30078cb83
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1858260

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-25 11:14:39 +02:00
Michal Privoznik
b8ebbe0545 virDevMapperGetTargetsImpl: Use VIR_AUTOSTRINGLIST
Since we have VIR_AUTOSTRINGLIST we can use it to free string
lists used in the function automatically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-25 11:14:39 +02:00
Michal Privoznik
ae5752aabc virdevmapper.c: Join two WITH_DEVMAPPER sections together
There are two distinct WITH_DEVMAPPER sections in the file, for
different functions each. Rearrange the code to make some of
future commits smaller.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-25 11:14:39 +02:00
Daniel P. Berrangé
bb8ccb050d conf: add control over COW for storage pool directories
The storage pool code now attempts to disable COW by default on btrfs,
but management applications may wish to override this behaviour. Thus we
introduce a concept of storage pool features:

  <features>
    <cow state='yes|no'/>
  </features>

If the <cow> feature policy is set, it will be enforced. It will always
return an hard error if COW cannot be explicitly set or unset.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-23 16:18:09 +01:00
Daniel P. Berrangé
f12b283897 storage: attempt to disable COW by default
This calls virFileSetCOW when building a pool with a request to attempt,
but not require, COW to be disabled. The effect is that nothing changes
on non-btrfs filesystems, but btrfs will get COW disabled on the
directory. This setting is then inherited by all newly created files in
the pool, avoiding the need for mgmt app to set "nocow" on a per-volume
basis.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-23 16:18:09 +01:00
Daniel P. Berrangé
e944a71f09 storage: convert to use virFileSetCOW
When disabling COW on individual files, we now use the virFileSetCOW
method. Note that this change has a slight semantic difference to the
old implementation.

The original code reported errors but returned success when disabling
COW failed.

With this new code, we will always report an error if the user requested
disabling of COW and we could not honour it, either because btrfs
returned an error, or because the filesystem is not btrfs.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-23 16:18:08 +01:00
Daniel P. Berrangé
7230bc95aa util: add a helper method for controlling the COW flag on btrfs
btrfs defaults to performing copy-on-write for files. This is often
undesirable for VM images, so we need to be able to control whether this
behaviour is used.

The virFileSetCOW() will allow for this. We use a tristate, since out of
the box, we want the default behaviour attempt to disable cow, but only
on btrfs, silently do nothing on non-btrfs. If someone explicitly asks
to disable/enable cow, then we want to raise a hard error on non-btrfs.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-23 16:18:08 +01:00
Bastien Orivel
d3aa28925f Add a check attribute on the mac address element
This is only used in the ESX driver where, when set to "no", it will
ignore all the checks libvirt does about the origin of the MAC address
(whether or not it's in a VMWare OUI) and forward the original one to
the ESX server telling it not to check it either.

This allows keeping a deterministic MAC address which can be useful for
licensed software which might dislike changes.

Signed-off-by: Bastien Orivel <bastien.orivel@diateam.net>

VMX conversion parts rewritten to apply on top of previously merged
support for type='generated|static'

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-23 16:11:39 +01:00
Daniel P. Berrangé
80975c3c84 vmx: support outputing the type attribute for MAC addresses
When support for MAC addresses having a type='static|generated'
attribute was added in:

  commit 454e5961ab
  Author: Bastien Orivel <bastien.orivel@diateam.net>
  Date:   Mon Jul 13 16:28:53 2020 +0200

    Add a type attribute on the mac address element

the VMX -> XML parser was not updated. As a result while we
accept the 'type' attribute on input, we never show it again
on 'output', so we loose information during the roundtrip.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-23 16:11:35 +01:00
Daniel P. Berrangé
6d3cb071b4 vmx: fix logic handling mac address type
With the current formatter, the XML snippets:

    <interface type='bridge'>
      <mac address='00:0c:29:dd:ee:fe' type='static'/>
      <source bridge='br1'/>
    </interface>
    <interface type='bridge'>
      <mac address='aa:bb:cc:dd:ee:fd' type='generated'/>
      <source bridge='br2'/>
    </interface>

result in

 ethernet1.present = "true"
 ethernet1.networkName = "br1"
 ethernet1.connectionType = "bridged"
 ethernet1.addressType = "static"
 ethernet1.address = "00:0c:29:dd:ee:fe"
 ethernet1.checkMACAddress = "false"

 ethernet2.present = "true"
 ethernet2.networkName = "br2"
 ethernet2.connectionType = "bridged"
 ethernet2.addressType = "static"
 ethernet2.address = "aa:bb:cc:dd:ee:fd"
 ethernet2.checkMACAddress = "false"

which is flawed, as both type='static' and type='generated' in the XML
turn into 'static' in the VMX config.

The existence of the 'static' attribute is further overriding whether
the checkMACAddress config option is set as a side effect.

Both these pieces of flawed logic were introduced in

  commit 454e5961ab
  Author: Bastien Orivel <bastien.orivel@diateam.net>
  Date:   Mon Jul 13 16:28:53 2020 +0200

    Add a type attribute on the mac address element

which intentionally added the 'checkMACAddress' side effect based on
the 'type' attribute.

With this change, we're reverting the handling of checkMACAddress
to match what existed historically. The 'type' attribute now directly
maps to the addressType attribute, so the above config becomes:

 ethernet1.present = "true"
 ethernet1.networkName = "br1"
 ethernet1.connectionType = "bridged"
 ethernet1.addressType = "static"
 ethernet1.address = "00:0c:29:dd:ee:fe"

 ethernet2.present = "true"
 ethernet2.networkName = "br2"
 ethernet2.connectionType = "bridged"
 ethernet2.addressType = "generated"
 ethernet2.generatedAddress = "aa:bb:cc:dd:ee:fd"
 ethernet2.generatedAddressOffset = "0"

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-23 16:11:31 +01:00
Daniel P. Berrangé
9ee8c4e96a util: refactor code to workaround gcc 10.1.0 bug
gcc 10.1.0 on Debian sid has a bug where the bounds checking gets
confused beteen two branches:

In file included from /usr/include/string.h:495,
                 from ../../src/internal.h:28,
                 from ../../src/util/virsocket.h:21,
                 from ../../src/util/virsocketaddr.h:21,
                 from ../../src/util/virnetdevip.h:21,
                 from ../../src/util/virnetdevip.c:21:
In function 'memcpy',
    inlined from 'virNetDevGetifaddrsAddress' at ../../src/util/virnetdevip.c:914:13,
    inlined from 'virNetDevIPAddrGet' at ../../src/util/virnetdevip.c:962:16:
/usr/include/arm-linux-gnueabihf/bits/string_fortified.h:34:10: error: '__builtin_memcpy' offset [16, 27] from the object at 'addr' is out of the bounds of referenced subobject 'inet4' with type 'struct sockaddr_in' at offset 0 [-Werror=array-bounds]
   34 |   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../src/util/virnetdevip.h:21,
                 from ../../src/util/virnetdevip.c:21:
../../src/util/virnetdevip.c: In function 'virNetDevIPAddrGet':
../../src/util/virsocketaddr.h:29:28: note: subobject 'inet4' declared here
   29 |         struct sockaddr_in inet4;
      |                            ^~~~~
cc1: all warnings being treated as errors

Note the source location is pointing to the "inet6" / AF_INET6 branch of
the "if", but is complaining about bounds of the "inet4" field. Changing
the code into a switch() is sufficient to avoid triggering the bug and
is arguably better code too.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-23 14:57:54 +01:00
Ján Tomko
6c7ba7b496 qemu: Fix affinity typo
Fixes: 4c0398b528
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-07-22 15:51:26 +02:00
Bihong Yu
3ee423c363 qemu: pre-create the dbus directory in qemuStateInitialize
There are races condiction to make '/run/libvirt/qemu/dbus' directory in
virDirCreateNoFork() while concurrent start VMs, and get "failed to create
directory '/run/libvirt/qemu/dbus': File exists" error message. pre-create the
dbus directory in qemuStateInitialize.

Signed-off-by: Bihong Yu <yubihong@huawei.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-07-22 09:40:15 +02:00
Jiri Denemark
6f59749e4e qemu: Drop ret variable from qemuConnectCPUModelComparison
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-07-21 16:10:03 +02:00
Liao Pingfang
8df3d61604 security: Remove the superfluous break
Remove the superfuous break, as there is a 'return' before it.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-07-21 15:56:29 +02:00
Liao Pingfang
2868c20681 qemu: Remove superfluous breaks
Remove superfluous breaks, as there is a "return" before them.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-07-21 15:53:15 +02:00
Liao Pingfang
6e0d14202b conf: Remove superfluous breaks
Remove superfluous breaks, as there is a "return" before them.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-07-21 15:53:15 +02:00
Jiri Denemark
1031db3600 qemu: Properly set //cpu/@migratable default value for running domains
Since active domains which do not have the attribute already set were
not started by libvirt that probed for CPU migratable property, we need
to check this property on reconnect and update the domain definition
accordingly.

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

Reported-by: Mark Mielke <mark.mielke@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-21 15:40:01 +02:00
Jiri Denemark
4872ad27aa qemu: Do not set //cpu/@migratable for running domains in post-parse
Commit v6.4.0-61-g201bd5db63 started to fill the default value for
//cpu/@migratable attribute according to QEMU support. However, active
domains either have the migratable attribute already set or the
capabilities we use for checking the QEMU support were created by older
libvirt which didn't probe for this specific capability. Thus we should
leave active domains alone when parsing their XMLs.

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

Reported-by: Mark Mielke <mark.mielke@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-21 15:40:01 +02:00
Jiri Denemark
c7afaa69cd qemu_monitor: Add API for checking CPU migratable property
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-21 15:40:01 +02:00
Daniel Henrique Barboza
d32cde0ea2 qemu_capabilities.c: use g_autoptr() in virQEMUCapsInitQMPSingle()
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-6-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-07-21 15:34:36 +02:00
Daniel Henrique Barboza
494f72f786 qemu_driver.c: modernize qemuConnectCPUModelComparison()
Use g_auto* on pointers to avoid using the 'cleanup' label.

In theory the 'ret' variable can also be discarded if the flow
of the logic is reworked. Perhaps another time.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-5-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-07-21 15:34:36 +02:00
Daniel Henrique Barboza
661533fb67 qemu_driver.c: modernize qemuConnectCPUModelBaseline()
Use g_autoptr() on pointers and remove the unneeded 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-4-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-07-21 15:34:36 +02:00
Daniel Henrique Barboza
f187b2fb98 qemu_process.c: modernize qemuProcessQMPNew()
Use g_autoptr() and remove the 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-3-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-07-21 15:34:36 +02:00
Daniel Henrique Barboza
b677f0dbe0 qemu_process.h: register AUTOPTR_CLEANUP_FUNC for qemuProcessQMPPtr
Next patches will use g_autoptr() in qemuProcessQMPPtr pointers
for some cleanups in QMP code.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-2-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-07-21 15:34:36 +02:00
Ján Tomko
5c50d1dda5 network: split out networkSetIPv6Sysctl
Refactor networkSetIPv6Sysctls to remove repetition and reuse
of the 'field' variable.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-07-21 14:55:00 +02:00
Peter Krempa
66dc4992fa qemuDomainBlockPivot: Ignore failures of creating active layer bitmap
Ignore errors from creating "libvirt-tmp-activewrite" bitmap. This
prevents failures of finishing blockjobs if the bitmap already exists.

Note that if the bitmap exists, the worst case that can happen is that
more bits are marked as dirty in the resulting merge.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-21 09:52:59 +02:00
Peter Krempa
24ac1a7c04 qemuDomainBlockPivot: Rename 'actions' to 'bitmapactions'
There are two possible 'transaction' command arguments in the function.
Rename 'actions' as they deal with creating bitmaps only.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-21 09:52:59 +02:00
Peter Krempa
9d039863e2 qemu: block: Remove 'active-write' bitmap even if there are no bitmaps to merge
The 'libvirt-tmp-activewrite' bitmap is added during the 'pivot'
operation of block copy and active layer block commit operations
regardless of whether there are any bitmaps to merge, but was not
removed unless a bitmap was merged. This meant that subsequent attempts
to merge into the same image would fail.

Fix it by checking whether the 'libvirt-tmp-activewrite' would be used
by the code and don't skip the code which would delete it.

This is a regression introduced when we switched to the new code for
block commit in <20a7abc2d2d> and for block copy in <7bfff40fdfe5>. The
actual bug originates from <4fa8654ece>.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-21 09:52:59 +02:00
Peter Krempa
378e4fbc79 qemu: blockjob: Actually delete temporary bitmap on failed active commit
Commit 20a7abc2d2 tried to delete the possibly leftover bitmap but
neglected to call the actual monitor to do so.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-21 09:52:59 +02:00
Peter Krempa
d73f107469 qemu: blockjob: Don't base bitmap handling of active-layer block commit on QEMU_CAPS_BLOCKDEV_REOPEN
The handler finalizing the active layer block commit doesn't actually
reopen the file for active layer block commit, so the comment and check
are invalid.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-21 09:52:59 +02:00
Peter Krempa
52b90e31c6 virDomainSetBlockThreshold: Mention that the event can be registered for <mirror>
The infrastructure supports setting the threshold also for the <mirror>.
Mention it in the docs.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-21 09:52:46 +02:00