Skip to content

Commit

Permalink
Merge pull request #1330 from ancorgs/like_a_master_boss
Browse files Browse the repository at this point in the history
Improve display of Dell BOSS
  • Loading branch information
ancorgs committed Apr 11, 2023
2 parents 5430b95 + e5046fc commit 3d2f72b
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 6 deletions.
7 changes: 7 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Apr 11 13:38:25 UTC 2023 - Ancor Gonzalez Sosa <ancor@suse.com>

- Adjusted detection of Dell BOSS devices (bsc#1200975).
- Partitioner: improved column Type for disks (bsc#1200975).
- 4.6.5

-------------------------------------------------------------------
Mon Apr 3 09:01:17 UTC 2023 - Ancor Gonzalez Sosa <ancor@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage-ng.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 4.6.4
Version: 4.6.5
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
6 changes: 4 additions & 2 deletions src/lib/y2partitioner/widgets/columns/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,11 @@ def part_of_label(ancestor_device)
#
# @return [String]
def default_unformatted_label(device)
data = [device.vendor, device.model].compact
# The "model" field from hwinfo is a combination of vendor + device with quite some added
# heuristics to make the result nice looking. See comment#66 at bsc#1200975.
model = device.model || ""

return data.join("-") unless data.empty?
return model unless model.empty?
return device.id.to_human_string if device.respond_to?(:id)

default_label(device)
Expand Down
10 changes: 7 additions & 3 deletions src/lib/y2storage/blk_device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -665,16 +665,20 @@ def hwinfo
# @return [Array<String>] empty if the driver is unknown

# @see #boss?
BOSS_REGEXP = Regexp.new("dell.*boss", Regexp::IGNORECASE).freeze
DELL_REGEXP = Regexp.new("dell", Regexp::IGNORECASE).freeze
BOSS_REGEXP = Regexp.new("BOSS").freeze
private_constant :DELL_REGEXP
private_constant :BOSS_REGEXP

# Whether this device is a Dell BOSS (Boot Optimized Storage Solution)
#
# See https://jira.suse.com/browse/SLE-17578
# See https://jira.suse.com/browse/SLE-17578 and bsc#1200975
#
# @return [Boolean]
def boss?
!!model&.match?(BOSS_REGEXP)
return false unless model

model.match?(BOSS_REGEXP) && model.match?(DELL_REGEXP)
end

# Size of the space that could be theoretically reclaimed by shrinking the
Expand Down
65 changes: 65 additions & 0 deletions test/y2storage/blk_device_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,71 @@
end
end

describe "#boss?" do
let(:device_name) { "/dev/sda" }

before { allow(device).to receive(:model).and_return model }

context "when no model information is available" do
let(:model) { nil }

it "returns false" do
expect(device.boss?).to eq false
end
end

context "when the model information is empty" do
let(:model) { "" }

it "returns false" do
expect(device.boss?).to eq false
end
end

# Original criteria provided by Dell at jsc#SLE-17578
context "when the model contains DELLBOSS" do
let(:model) { "A DELLBOSS device" }

it "returns true" do
expect(device.boss?).to eq true
end
end

# Used in some models like the one reported as bsc#1200975
context "when the model contains 'Dell BOSS'" do
let(:model) { "Dell BOSS-N1 Modular" }

it "returns true" do
expect(device.boss?).to eq true
end
end

# Hypothetical string based on the criteria exposed at comment#84 of bsc#1200975
context "when the model contains first 'BOSS' and then 'Dell'" do
let(:model) { "Cool BOSS device by Dell" }

it "returns true" do
expect(device.boss?).to eq true
end
end

context "when the model contains 'Dell' but not 'BOSS'" do
let(:model) { "Dell controller" }

it "returns false" do
expect(device.boss?).to eq false
end
end

context "when the model contains 'BOSS' but not 'Dell'" do
let(:model) { "BOSS as Back Office Support System" }

it "returns false" do
expect(device.boss?).to eq false
end
end
end

describe ".sorted_by_name" do
let(:scenario) { "sorting/disks_and_dasds1" }

Expand Down

0 comments on commit 3d2f72b

Please sign in to comment.