virt: use /proc/xen as indicator for a Xen domain (#6442, #6662) (#7555)
authorOlaf Hering <olaf@aepfle.de>
Wed, 6 Dec 2017 18:59:30 +0000 (19:59 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 6 Dec 2017 18:59:30 +0000 (19:59 +0100)
commit87dc723ae00fae30c25013402e6296c1641416da
treef085b027a9b3a0ac8c3620fdcc03a872d918f0f0
parentc7a54cd67bb786c07b461787b7289ca1e554158d
virt: use /proc/xen as indicator for a Xen domain (#6442, #6662) (#7555)

The file /proc/xen/capabilities is only available if xenfs is mounted.

With a classic xenlinux based kernel that file is available
unconditionally. But with a modern pvops based kernel, xenfs must be
mounted before the "capabilities" may appear. xenfs is mounted very late
via .services files provided by the Xen toolstack. Other units may be
scheduled before xenfs is mounted, which will confuse the detection of
VIRTUALIZATION_XEN.

In all Xen enabled kernels, and if that kernel is actually running on
the Xen hypervisor, the "/proc/xen" directory is the reliable indicator
that this instance runs in a "Xen guest".

Adjust the code to check for /proc/xen instead of
/proc/xen/capabilities.

Fixes commit 3f61278b5 ("basic: Bugfix Detect XEN Dom0 as no virtualization")
src/basic/virt.c