Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Fehr committed Feb 6, 2014
1 parent b7923a0 commit 26d0a2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/modules/AutoinstRAID.rb
Expand Up @@ -204,7 +204,7 @@ def Write
end
Ops.set(md, "format", false) if !Builtins.haskey(md, "format")
if Ops.get_boolean(md, "format", false)
Ops.set(md, "used_fs", Ops.get_symbol(md, "filesystem", :ext3))
Ops.set(md, "used_fs", Ops.get_symbol(md, "filesystem", Partitions.DefaultFs))
end
md = AutoinstStorage.AddFilesysData(md, md)
Ops.set(md, "type", :sw_raid)
Expand Down
20 changes: 9 additions & 11 deletions src/modules/AutoinstStorage.rb
Expand Up @@ -81,15 +81,15 @@ def humanStringToByte(s, b)
Storage.ClassicStringToByte(s)
end

META_TYPES = [ :CT_DMRAID, :CT_MDPART, :CT_DMMULTIPATH ]
ALL_TYPES = META_TYPES.dup.push(:CT_DISK)

def find_next_disk( tm, after, ctype )
Builtins.y2milestone("find_next_disk after:\"%1\" ctype:%2", after, ctype);
used_disk = ""
meta_types = [ :CT_DMRAID, :CT_MDPART, :CT_DMMULTIPATH ]
all_types = meta_types.dup
all_types.push(:CT_DISK)
if after.empty? && !all_types.include?(ctype)
if after.empty? && !ALL_TYPES.include?(ctype)
tm.each do |device, disk|
if meta_types.include?(disk.fetch("type",:jo)) &&
if META_TYPES.include?(disk.fetch("type")) &&
!@tabooDevices.include?(device)
used_disk = device
end
Expand All @@ -106,8 +106,8 @@ def find_next_disk( tm, after, ctype )

# device guessing code enhanced
if used_disk.empty?
ctype = :CT_DISK if !all_types.include?(ctype)
disks = tm.select { |dev,disk| disk.fetch("type",:x)==ctype };
ctype = :CT_DISK unless ALL_TYPES.include?(ctype)
disks = tm.select { |dev,disk| disk["type"]==ctype };
found = !disks.keys.include?(after)
disks.each do |device, disk|
next if !found && device != after
Expand Down Expand Up @@ -232,8 +232,7 @@ def GetRaidDevices(dev, tm)
tm = deep_copy(tm)
ret = []
tm.each do |k, d|
if d.fetch("type",:CT_UNKNOWN) == :CT_DISK ||
d.fetch("type",:CT_UNKNOWN) == :CT_DMMULTIPATH
if [:CT_DISK,:CT_DMMULTIPATH].include?(d["type"])
tmp = d.fetch("partitions",[]).select do |p|
p["raid_name"]==dev
end
Expand Down Expand Up @@ -281,8 +280,7 @@ def SearchRaids(tm)
end
#raid2device = $[];
tm.each do |k, d2|
if d2.fetch("type",:CT_UNKNOWN) == :CT_DISK ||
d2.fetch("type",:CT_UNKNOWN) == :CT_DMMULTIPATH
if [:CT_DISK,:CT_DMMULTIPATH].include?(d2["type"])
tmp = d2.fetch("partitions",[]).select do |p|
!p.fetch("raid_name","").empty?
end
Expand Down

0 comments on commit 26d0a2a

Please sign in to comment.