summaryrefslogtreecommitdiff
path: root/src/basic/virt.c
Commit message (Collapse)AuthorAge
* Prep v235: Apply upstream fixes (3/10) [src/basic]Sven Eden2017-08-14
|
* virt: enable detecting QEMU (TCG) via CPUID (#6399)Daniel Berrange2017-08-10
| | | | | | | | | | | | QEMU >= 2.10 will include a CPUID leaf with value "TCGTCGTCGTCG" on x86 when running with the TCG CPU emulator: https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg05231.html Existing methods of detecting QEMU are left unchanged for sake of backcompatibility. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* basic/path-util: allow flags for path_equal_or_files_sameZbigniew Jędrzejewski-Szmek2017-07-25
| | | | | No functional change, just a new parameters and the tests that AT_SYMLINK_NOFOLLOW works as expected.
* Revert "util: Fine tune running_in_chroot() a bit" (#5506)Lennart Poettering2017-07-17
| | | | | | | | | | | This reverts commit 295ee9845c801300298d01256eb5a9e3ff117ae0. Let'd revert this for now, see #5446 for discussions. We want elogind-detect-virt --chroot to return true for all chroot-like stuff, for example mock environments which have use a mount namespace. The downside of this revert that systemctl will not work from our own namespaced services, anything with RootDirectory=/RootImage= set.
* virt: Update cache if the detected vm is virtualbox (#5364)Benjamin Robin2017-07-17
|
* virt: swap order of cpuid and dmi again, but properly detect oracle (#5355)Christian Hesse2017-07-17
| | | | | | | This breaks again, this time for setups where Qemu is not reported via DMI for whatever reason. So swap order of cpuid and dmi again, but properly detect oracle. See issue #5318.
* virt: detect qemu/kvm as 'kvm'Christian Hesse2017-07-17
| | | | | | | | | | In commit 050e65a we swapped order of detect_vm_{cpuid,dmi}(). That fixed Virtualbox but broke qemu with kvm, which is expected to return 'kvm'. So check for qemu/kvm first, then DMI, CPUID last. This fixes #5318. Signed-off-by: Christian Hesse <mail@eworm.de>
* virt: update url to hypervisor top-level functional specification (#5149)Stefan Schweter2017-07-17
|
* util-lib: improve container detection logicLennart Poettering2017-07-17
| | | | | | | | | | | | | | | Previously, elogind-detect-virt was unable to detect "elogind-nspawn -a" container environments, i.e. where PID 1 is a stub process running in host context, as in that case /proc/1/environ was inherited from the host. Let's improve that, and add an additional check for container environments where /proc/1/environ is not cleaned up and does not contain the $container environment variable: The /proc/1/sched file shows the host PID in the first line. if this is not 1, we know we are running in a PID namespace (but not which implementation). With these changes we should be able to detect container environments that don't set $container at all.
* util: Fine tune running_in_chroot() a bitLennart Poettering2017-07-17
| | | | | | | | | | | | | Let's be a bit more careful when detecting chroot() environments, so that we can discern them from namespaced environments. Previously this would simply check if the root directory of PID 1 matches our own root directory. With this commit, we also check whether the namespaces of PID 1 and ourselves are the same. If not we assume we are running inside of a namespaced environment instead of a chroot() environment. This has the benefit that systemctl (which uses running_in_chroot()) will work as usual when invoked in a namespaced service.
* basic/virt: fix userns check on CONFIG_USER_NS=n kernel (#4651)Zbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | ENOENT should be treated as "false", but because of the broken errno check it was treated as an error. So ConditionVirtualization=user-namespaces probably returned the correct answer, but only by accident. Fixes #4608.
* Prep v232.2: Mask more unneeded functionsSven Eden2017-07-07
|
* Prep v232: Do not listen to SYSTEMD_* environment variables to override things.Sven Eden2017-07-05
|
* detect-virt: add --private-users switch to check if a userns is activeZbigniew Jędrzejewski-Szmek2017-07-05
| | | | | | | | | | | | | Various things don't work when we're running in a user namespace, but it's pretty hard to reliably detect if that is true. A function is added which looks at /proc/self/uid_map and returns false if the default "0 0 UINT32_MAX" is found, and true if it finds anything else. This misses the case where an 1:1 mapping with the full range was used, but I don't know how to distinguish this case. 'elogind-detect-virt --private-users' is very similar to 'elogind-detect-virt --chroot', but we check for a user namespace instead.
* virt: add possibility to skip the check for chroot (#4374)Lukáš Nykrýn2017-07-05
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1379852
* virt: detect bhyve (FreeBSD hypervisor) (#3840)Leonardo Brondani Schenkel2017-07-05
| | | | | The CPUID and DMI vendor strings do not seem to be documented. Values were found experimentally and by inspecting the source code.
* Prep v230: Apply missing upstream fixes and updates (2/8) src/basic.Sven Eden2017-06-16
|
* Prep v229: Add missing fixes from upstream [1/6] src/basicSven Eden2017-05-17
|
* virt: add comment about order in virtualization detectionChristian Hesse2017-05-17
|
* virt: detect dmi before cpuidChristian Hesse2017-05-17
| | | | | | | | | | | | | | Virtualbox should be detected as 'oracle'. This used to work but broke with commit: commit 75f86906c52735c98dc0aa7e24b773edb42ee814 Author: Lennart Poettering <lennart@poettering.net> Date: Mon Sep 7 13:42:47 2015 +0200 basic: rework virtualization detection API We swap detection for dmi and cpuid, this fixes Virtualbox with KVM. Hopefully it does not break anything else.
* Prep v228: Full diff to master revealed more functions that are unused.Sven Eden2017-04-26
|
* Prep v228: Condense elogind source masks (3/5)Sven Eden2017-04-26
|
* Prep v228: Add remaining updates from upstream (2/3)Sven Eden2017-04-26
| | | | | Apply remaining fixes and the performed move of utility functions into their own foo-util.[hc] files on libbasic.
* virt: make sure that we detect unknown container managers as ↵Lennart Poettering2017-04-26
| | | | | | | | VIRTUALIZATION_CONTAINER_OTHER If we don't know a container manager, we should consider it as "other" rather than as no container manager at all, to provide a somwhat useful upgrade path.
* detect-virt: detect in best-heuristic orderAndrew Jones2017-04-26
| | | | | | | | afaict, this will fix a regression caused by commit 75f86906c5. Where we used to report "kvm" before that patch, without this patch, we would only report "qemu". The reason is because cpuid detection must come before dmi detection. Also, both can safely come before other xen heuristics. Untested.
* detect-virt: dmi: look for KVMAndrew Jones2017-04-26
| | | | | | | | | | | | Some guests (ARM, AArch64, x86-RHEL) have 'KVM' in the product name. Look for that first in order to more precisely report "kvm" when detecting a QEMU/KVM guest. Without this patch we report "qemu", even if KVM acceleration is in use on ARM/AArch64 guests. I've only tested a backported version of this and the previous patch on an AArch64 guest (which worked). Of course it would be nice to get regression testing on all guest types that depend on dmi done.
* arm/aarch64: detect-virt: check dmiAndrew Jones2017-04-26
| | | | | | | | ARM/AArch64 guests now have SMBIOS tables populated (when boot with a late enough QEMU and a late enough AAVMF is used as the bootloader). Furthermore, when booting ARM/AArch64 guests with ACPI, the DT detection obviously no longer works, so we need dmi detection.
* [2/5] Apply missing fixes from upstreamSven Eden2017-03-29
|
* Prep v226: Apply missing fixes and changes to src/basicSven Eden2017-03-14
|
* Prep v225: Applying various fixes and changes to src/basic that got lost ↵Sven Eden2017-03-14
| | | | during git am transfer.
* Prep v224: Major cleanup of unneeded functions and some source files.Sven Eden2017-03-14
|
* Prep v221: Update and clean up build system to sync with upstreamSven Eden2017-03-14
This commit replays the moving around of source files that have been done between systemd-219 and systemd-221. Further the Makefile.am is synchronized with the upstream version and then "re-cleaned". A lot of functions, that are not used anywhere in elogind have been coated into #if 0/#endif directives to further shorten the list of dependencies. All unneeded files have been removed.