Skip to content

Commit

Permalink
fix handling of default subvolumes for root fs when formatting but no…
Browse files Browse the repository at this point in the history
…t creating a partition
  • Loading branch information
Thomas Fehr committed Sep 12, 2013
1 parent 78c668c commit b90c7c3
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/modules/Storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2895,18 +2895,15 @@ def ChangeVolumeProperties(part)
Builtins.y2milestone("ChangeVolumeProperties sint ret:%1", ret)
end
end
if ret == 0 && !Builtins.isempty(Ops.get_list(part, "subvol", []))
d = Ops.get_string(part, "device", "")
rem = Builtins.filter(Ops.get_list(part, "subvol", [])) do |p|
Ops.get_boolean(p, "delete", false)
end
cre = Builtins.filter(Ops.get_list(part, "subvol", [])) do |p|
Ops.get_boolean(p, "create", false)
end
if ret == 0 && !part.fetch("subvol",[]).empty?
d = part.fetch("device","")
fmt = part.fetch("format",false)
rem = part["subvol"].select { |p| p.fetch("delete",false) }
cre = part["subvol"].select { |p| p.fetch("create",false)||fmt }
Builtins.y2milestone("ChangeVolumeProperties rem:%1", rem)
Builtins.y2milestone("ChangeVolumeProperties cre:%1", cre)
while ret == 0 && !Builtins.isempty(rem)
pth = Ops.get_string(rem, [0, "name"], "")
while ret == 0 && !rem.empty?
pth = rem.first.fetch("name","")
if @sint.existSubvolume(d, pth)
changed = true
ret = @sint.removeSubvolume(d, pth)
Expand All @@ -2916,10 +2913,10 @@ def ChangeVolumeProperties(part)
Builtins.y2milestone("ChangeVolumeProperties sint ret:%1", ret)
end
end
rem = Builtins.remove(rem, 0)
rem = rem.drop(1)
end
while ret == 0 && !Builtins.isempty(cre)
pth = Ops.get_string(cre, [0, "name"], "")
while ret == 0 && !cre.empty?
pth = cre.first.fetch("name","")
if ! @sint.existSubvolume(d, pth)
changed = true
ret = @sint.createSubvolume(d, pth)
Expand All @@ -2929,7 +2926,7 @@ def ChangeVolumeProperties(part)
Builtins.y2milestone("ChangeVolumeProperties sint ret:%1", ret)
end
end
cre = Builtins.remove(cre, 0)
cre = cre.drop(1)
end
end
UpdateTargetMapDev(dev) if changed
Expand Down

0 comments on commit b90c7c3

Please sign in to comment.