Skip to content

Commit

Permalink
use udev device for ppc prep partition proposal(bsc#1041692)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jun 14, 2017
1 parent 8d0bcc8 commit a3e2a08
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/bootloader/stage1_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Yast.import "Storage"

require "bootloader/stage1_device"
require "bootloader/udev_mapping"

module Bootloader
# Represents object that can set passed stage1 to proposed values.
Expand Down Expand Up @@ -198,7 +199,9 @@ class PPC < Stage1Proposal
def propose
partition = proposed_prep_partition
if partition
assign_bootloader_device([:custom, partition])
# ensure that stage1 device is in udev (bsc#1041692)
udev_partition = UdevMapping.to_mountby_device(partition)
assign_bootloader_device([:custom, udev_partition])

stage1.activate = !on_gpt?(partition) # do not activate on gpt disks see (bnc#983194)
stage1.generic_mbr = false
Expand Down
12 changes: 12 additions & 0 deletions test/stage1_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@
expect(subject.devices).to eq(["/dev/sda1"])
end

it "sets udev link for device" do
expect(Yast::Storage).to receive(:GetPartition).with(anything, "/dev/sdc1")
.and_return("create" => true)

expect(Bootloader::UdevMapping).to receive(:to_mountby_device).with("/dev/sdc1")
.and_return("/dev/disk/by-id/partition1")

subject.propose

expect(subject.devices).to eq(["/dev/disk/by-id/partition1"])
end

it "activate partition if it is on DOS partition table" do
expect(Yast::Storage).to receive(:GetDisk).with(anything, "/dev/sdb1")
.and_return("label" => "dos")
Expand Down

0 comments on commit a3e2a08

Please sign in to comment.