Skip to content

Commit

Permalink
Merge pull request #73 from yast/fix-bsc1134927-sort
Browse files Browse the repository at this point in the history
Fix bsc1134927 sort
  • Loading branch information
aschnell committed Jul 17, 2019
2 parents 4c224e1 + 9709343 commit 8ec7d35
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 1 deletion.
7 changes: 7 additions & 0 deletions package/yast2-s390.changes
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
Tue Jul 16 11:27:09 CEST 2019 - aschnell@suse.com

- sort DASDs by channel ID (part of bsc#1134927)
- 4.2.1

-------------------------------------------------------------------

Fri Jun 7 23:45:18 UTC 2019 - Stasiek Michalski <hellcp@mailbox.org>

- Use new schema of desktop files (boo#1084864)
Expand Down
2 changes: 1 addition & 1 deletion package/yast2-s390.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-s390
Version: 4.2.0
Version: 4.2.1
Release: 0
Group: System/YaST
License: GPL-2.0-only
Expand Down
2 changes: 2 additions & 0 deletions src/modules/DASDController.rb
Expand Up @@ -390,6 +390,8 @@ def ProbeDisks
Builtins.tolower(Ops.get_string(d, "device", "")) == "dasd"
end

disks.sort_by! { |disk| FormatChannel(disk.fetch("sysfs_bus_id", "0.0.0000")) }

disks = Builtins.maplist(disks) do |d|
channel = Ops.get_string(d, "sysfs_bus_id", "")
Ops.set(d, "channel", channel)
Expand Down
26 changes: 26 additions & 0 deletions test/dasd_controller_test.rb
Expand Up @@ -114,6 +114,32 @@
end
end

describe "#GetDevices" do
it "returns DASDs" do
expect(Yast::SCR).to receive(:Read).with(Yast.path(".probe.disk")).once
.and_return(load_data("probe_disk_dasd.yml"))
expect(Yast::DASDController.ProbeDisks()).to eq(nil)
expect(Yast::DASDController.GetDevices()).to eq(
0 => { "detail" => { "cu_model" => 233, "dev_model" => 10, "lcss" => 0 },
"device_id" => 276880,
"resource" => { "io" => [{ "active" => false,
"length" => 1,
"mode" => "rw",
"start" => 352 }] },
"sub_device_id" => 275344,
"channel" => "0.0.0150" },
1 => { "detail" => { "cu_model" => 233, "dev_model" => 10, "lcss" => 0 },
"device_id" => 276880,
"resource" => { "io" => [{ "active" => false,
"length" => 1,
"mode" => "rw",
"start" => 352 }] },
"sub_device_id" => 275344,
"channel" => "0.0.0160" }
)
end
end

describe "#Write" do
let(:data) do
{ "devices" => [{ "channel" => "0.0.0100", "diag" => false,
Expand Down
31 changes: 31 additions & 0 deletions test/data/probe_disk_dasd.yml
Expand Up @@ -32,3 +32,34 @@
unique_key: 3VmV.ALFATSt_U8F
vendor: IBM
vendor_id: 286721
- bus: CCW
bus_hwcfg: ccw
class_id: 262
detail:
cu_model: 233
dev_model: 10
lcss: 0
device: DASD
device_id: 276880
drivers:
- active: true
modprobe: true
modules:
- - dasd_eckd_mod
- ''
model: |-
IBM
DASD
prog_if: 1
resource:
io:
- active: false
length: 1
mode: rw
start: 352
sub_class_id: 0
sub_device_id: 275344
sysfs_bus_id: 0.0.0150
sysfs_id: "/devices/css0/0.0.0001/0.0.0150"
vendor: IBM
vendor_id: 286721

0 comments on commit 8ec7d35

Please sign in to comment.