libvirt/src/libxl
Jim Fehlig fa58f571ee libxl: Add lock process indicator to libxlDomainObjPrivate object
The libvirt libxl driver has no access to FDs associated with VM disks.
The disks are opened by libxl.so and any related FDs are not exposed to
applications. The prevents using virtlockd's auto-release feature to
release locks when the FD is closed. Acquiring and releasing locks is
explicitly handled by the libxl driver.

The current logic is structured such that locks are acquired in
libxlDomainStart and released in libxlDomainCleanup. This works well
except for migration, where the locks must be released on the source
host before the domain can be started on the destination host, but the
domain cannot be cleaned up until the migration confirmation stage.
When libxlDomainCleanup if finally called in the confirm stage, locks
are again released resulting in confusing errors from virtlockd and
libvirtd

virtlockd[8095]: resource busy: Lockspace resource 'xxxxxx' is not locked
libvirtd[8050]: resource busy: Lockspace resource 'xxxxxx' is not locked
libvirtd[8050]: Unable to release lease on testvm

The error is also encountered in some error cases, e.g. when
libxlDomainStart fails before acquiring locks and libxlDomainCleanup
is still used for cleanup.

In lieu of a mechanism to check if a lock has been acquired, this patch
takes an easy approach to fixing the unnecessary lock releases by adding
an indicator to the libxlDomainPrivate object that can be set when the
lock is acquired and cleared when the lock is released. libxlDomainCleanup
can then skip releasing the lock in cases where it was previously released
or never acquired in the first place.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-02-23 17:55:19 -07:00
..
libvirtd_libxl.aug libxl: do not enable nested HVM unless global nested_hvm option enabled 2018-04-17 21:15:27 -06:00
libxl_capabilities.c libxl: Use g_autofree for char* where easily possible 2021-02-17 10:25:53 -07:00
libxl_capabilities.h src: add G_GNUC_NO_INLINE annotations for mocked symbols 2020-08-04 17:58:08 +01:00
libxl_conf.c Replace virStringSplit with g_strsplit 2021-02-11 17:05:34 +01:00
libxl_conf.h Xen: Add support for qemu command-line passthrough 2020-08-25 10:11:08 -06:00
libxl_domain.c libxl: Add lock process indicator to libxlDomainObjPrivate object 2021-02-23 17:55:19 -07:00
libxl_domain.h libxl: Add lock process indicator to libxlDomainObjPrivate object 2021-02-23 17:55:19 -07:00
libxl_driver.c qemu, libxl, hypervisor: use virDomainDriverNodeDeviceDetachFlags() helper 2021-02-17 15:56:27 -03:00
libxl_driver.h src/libxl: use #pragma once in headers 2019-06-13 17:05:10 +02:00
libxl_logger.c libxl: Use g_autofree for char* where easily possible 2021-02-17 10:25:53 -07:00
libxl_logger.h src/libxl: use #pragma once in headers 2019-06-13 17:05:10 +02:00
libxl_migration.c libxl: Add lock process indicator to libxlDomainObjPrivate object 2021-02-23 17:55:19 -07:00
libxl_migration.h src/libxl: use #pragma once in headers 2019-06-13 17:05:10 +02:00
libxl.conf libxl: do not enable nested HVM unless global nested_hvm option enabled 2018-04-17 21:15:27 -06:00
meson.build build: Remove unused 'conflicts' key from virt_daemon_unit 2021-02-10 09:30:41 -07:00
test_libvirtd_libxl.aug.in build: use @CONFIG@ instead of ::CONFIG:: in augeas tests 2019-08-09 14:06:31 +01:00
virtxend.init.in configure: Provide OpenRC scripts for sub-daemons 2019-12-16 10:11:22 +01:00
virtxend.service.in systemd: Move timeout from service files to sysconf files 2020-04-03 11:50:50 +02:00
virtxend.sysconf systemd: Move timeout from service files to sysconf files 2020-04-03 11:50:50 +02:00
xen_common.c libxl: Use g_autofree for char* where easily possible 2021-02-17 10:25:53 -07:00
xen_common.h xenconfig: move contents to libxl driver and remove directory 2019-08-26 11:06:12 -06:00
xen_xl.c libxl: Use g_autofree for char* where easily possible 2021-02-17 10:25:53 -07:00
xen_xl.h xenconfig: move contents to libxl driver and remove directory 2019-08-26 11:06:12 -06:00
xen_xm.c domain_conf: make virDomainDiskSetDriver() void 2020-11-11 12:53:11 +01:00
xen_xm.h xenconfig: move contents to libxl driver and remove directory 2019-08-26 11:06:12 -06:00
xenxs_private.h xenconfig: move contents to libxl driver and remove directory 2019-08-26 11:06:12 -06:00