Skip to content

Commit

Permalink
allow to recognize also mdraid partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Apr 20, 2016
1 parent 0ec8863 commit 4d1b623
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
3 changes: 3 additions & 0 deletions src/modules/BootStorage.rb
Expand Up @@ -247,6 +247,9 @@ def underlaying_devices(dev)
lvm_dev = Yast::Storage.GetDisk(tm, disk_data["disk"])
res = lvm_dev["devices"]
res = lvm_dev["devices_add"] if res.empty?
elsif part["type"] == :sw_raid
res = part["devices"]
res = part["devices_add"] if res.empty?
end
end

Expand Down
40 changes: 20 additions & 20 deletions test/stage1_test.rb
Expand Up @@ -31,7 +31,7 @@
.and_return("/dev/vda")
subject.propose

expect(subject.devices).to eq ["/dev/md1"]
expect(subject.devices).to eq ["/dev/vda"]
end

it "sets underlaying disks for md raid setup" do
Expand All @@ -50,24 +50,6 @@
expect(subject.mbr?).to eq true
end

it "sets underlaying partition for lvm partitions setup" do
allow(Yast::BootStorage).to receive(:underlaying_devices).and_call_original
target_map_stub("storage_lvm.yaml")

allow(Yast::BootStorage).to receive(:mbr_disk)
.and_return("/dev/system")
allow(Yast::BootStorage).to receive(:BootPartitionDevice)
.and_return("/dev/system/root")
allow(Yast::BootStorage).to receive(:RootPartitionDevice)
.and_return("/dev/system/root")

subject.propose

expect(subject.devices).to eq ["/dev/vda3"]

expect(subject.root_partition?).to eq true
end

it "sets to device first available prep partition for ppc64" do
allow(Yast::Arch).to receive(:architecture).and_return("ppc64")
object_double(
Expand All @@ -91,7 +73,7 @@
end

describe "#add_udev_device" do
it "adds underlayed lvm partition for lvm disk" do
it "adds underlayed disk device for lvm disk" do
allow(Yast::BootStorage).to receive(:underlaying_devices).and_call_original
target_map_stub("storage_lvm.yaml")

Expand All @@ -108,6 +90,24 @@

expect(subject.mbr?).to eq true
end

it "adds underlayed partition devices for lvm partition" do
allow(Yast::BootStorage).to receive(:underlaying_devices).and_call_original
target_map_stub("storage_lvm.yaml")

allow(Yast::BootStorage).to receive(:mbr_disk)
.and_return("/dev/system")
allow(Yast::BootStorage).to receive(:BootPartitionDevice)
.and_return("/dev/system/root")
allow(Yast::BootStorage).to receive(:RootPartitionDevice)
.and_return("/dev/system/root")

subject.add_udev_device("/dev/system/root")

expect(subject.devices).to eq(["/dev/vda3"])

expect(subject.boot_partition?).to eq true
end
end

describe "#can_use_boot?" do
Expand Down

0 comments on commit 4d1b623

Please sign in to comment.