yast / yast-yast2

YaST module yast2
http://en.opensuse.org/Portal:YaST
GNU General Public License v2.0
55 stars 44 forks source link

[Yast::Arch] Add support to know if running in a PV Xen guest #1120

Closed dgdavid closed 3 years ago

dgdavid commented 3 years ago

Problem

yast-kdump started warning the user when running on a Xen HVM guest.

https://bugzilla.suse.com/show_bug.cgi?id=1179197 https://trello.com/c/uqdMdM0n/2198-sles15-sp3-p2-1179197-build-20140-kdump-not-supported-in-xen-hvm

Real problem

According to https://bugzilla.suse.com/show_bug.cgi?id=952253#c8, yast-kdump must alert the user when running in a Xen PV guest

Kdump cannot work in DomU (unless it's fully virtualized, but then it behaves just like real hardware). There is no way to make kdump work in a para-virtualized DomU.

However, yast-kdump is relying in Yast::Arch, which was fixed a few months ago because a broken detection of both, dom0 and domU (see https://bugzilla.opensuse.org/show_bug.cgi?id=1172742). Looking at the former code base, it was using /proc/xen/xsd_port for determining if running in a host or guest, and wrongly returning host when executing the code in a XEN HVM domU.

Proposed solution

This PR proposes having a method to know if the code is running in a paravirtualized Xen guest, using the information available in /sys/hypervisor/guest_type.

Notes

Back in the times, @ancorgs implemented the requested check in https://bugzilla.suse.com/show_bug.cgi?id=952253#c8, but it was discarded in favor of Yast::Arch#is_xenU before merging it. I have been evaluating to bring back those lines of code but I think that reading /sys/hypervisor/guest_type is reliable and less complicated.

More information

For more information about the Xen detection, please read the description of https://github.com/yast/yast-yast2/pull/1062. Additionally, Martin Loviska's commented about xen-detect binary, which returns hypervisor type with version detected from the domain, but I'm not sure if it is available by default.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.001%) to 40.516% when pulling fa0b99512db9d7cfbc63b034c995fa84a157d583 on allow-asking-by-pv-xen-guest into 957ba22d325032a51bf0099bc2d87537b4e2a75f on master.

yast-bot commented 3 years ago

:heavy_check_mark: Public Jenkins job #269 successfully finished :heavy_check_mark: Created OBS submit request #852036

yast-bot commented 3 years ago

:heavy_check_mark: Internal Jenkins job #135 successfully finished :heavy_check_mark: Created IBS submit request #231767