Skip to content

Commit

Permalink
Use zvm and zkvm detection from Yast::Arch
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Jan 26, 2024
1 parent bd833ee commit 6a5c379
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 2 additions & 11 deletions src/lib/installation/cio_ignore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ def reset

private

def kvm?
File.exist?("/proc/sysinfo") &&
File.readlines("/proc/sysinfo").grep(/Control Program: KVM\/Linux/).any?
end

def zvm?
File.exist?("/proc/sysinfo") &&
File.readlines("/proc/sysinfo").grep(/Control Program: z\/VM/).any?
end

# Get current I/O device autoconf setting (rd.zdev kernel option)
#
# @return [Boolean]
Expand All @@ -53,11 +43,12 @@ def cio_setting
if Yast::Mode.autoinst
Yast::AutoinstConfig.cio_ignore
else
Yast.import "Arch"
# In case of given as a kernel parameter we should respect it,
# if not it will depend on the installation environment (bsc#1210525)
# cio_ignore does not make sense for KVM or z/VM (fate#317861)
# but for other cases return true as requested FATE#315586
cio_ignore_given? || !(kvm? || zvm?)
cio_ignore_given? || !(Yast::Arch.is_zkvm || Yast::Arch.is_zvm)
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/cio_ignore_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
let(:auto) { false }

before do
arch_mock = double("Yast::Arch", s390: false, is_zkvm: kvm, is_zvm: zvm)
stub_const("Yast::Arch", arch_mock)
allow(Yast::Bootloader).to receive(:kernel_param).with(:common, "rd.zdev")
allow(Yast::Bootloader).to receive(:kernel_param).with(:common, "cio_ignore").and_return(param)
allow_any_instance_of(described_class).to receive(:kvm?).and_return(kvm)
allow_any_instance_of(described_class).to receive(:zvm?).and_return(zvm)
allow(Yast::Mode).to receive(:autoinst).and_return(auto)
end

Expand Down

0 comments on commit 6a5c379

Please sign in to comment.