Skip to content

Commit

Permalink
- omit asking for parallel formatting if only one DASD is formatted (…
Browse files Browse the repository at this point in the history
…see bnc#888090)
  • Loading branch information
aschnell committed Jul 23, 2014
1 parent 41eb9f4 commit 7e87ce6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 26 deletions.
7 changes: 7 additions & 0 deletions package/yast2-s390.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jul 23 11:51:53 CEST 2014 - aschnell@suse.de

- omit asking for parallel formatting if only one DASD is
formatted (see bnc#888090)
- 3.1.17

-------------------------------------------------------------------
Thu Jul 17 09:36:30 CEST 2014 - schubi@suse.de

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-s390.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-s390
Version: 3.1.16
Version: 3.1.17
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
61 changes: 36 additions & 25 deletions src/include/s390/dasd/dialogs.rb
Expand Up @@ -27,6 +27,7 @@
# $Id$
module Yast
module S390DasdDialogsInclude

def initialize_s390_dasd_dialogs(include_target)
Yast.import "UI"
textdomain "s390"
Expand Down Expand Up @@ -162,7 +163,6 @@ def GetDASDDiskItems
end



def PossibleActions
if !Mode.config
return [
Expand Down Expand Up @@ -192,6 +192,35 @@ def PossibleActions
end


def AskNumParallel(num_devices)

if num_devices == 1
return 1
end

UI.OpenDialog(
VBox(
IntField(
# integer field (count of disks formatted parallel)
Id(:num_parallel), _("&Parallel Formatted Disks"),
1, num_devices, num_devices
),
ButtonBox(
PushButton(Id(:ok), Label.OKButton),
PushButton(Id(:cancel), Label.CancelButton)
)
)
)

ret = UI.UserInput()
num_parallel = Convert.to_integer(UI.QueryWidget(Id(:num_parallel), :Value))

UI.CloseDialog()

return ret == :ok ? num_parallel : 0

end


def PerformAction(action)
selected = ListSelectedDASD()
Expand Down Expand Up @@ -254,6 +283,7 @@ def PerformAction(action)
DASDController.ProbeDisks

return true

when :diag_off, :diag_on
value = action == :diag_on

Expand All @@ -274,6 +304,7 @@ def PerformAction(action)
DASDController.ProbeDisks

return true

when :format
# check if disks are R/W and active
problem = ""
Expand Down Expand Up @@ -307,29 +338,8 @@ def PerformAction(action)
return false
end

par = Integer.Min([Builtins.size(selected), 8])

cancel = false
UI.OpenDialog(
VBox(
IntField(
Id(:par),
# integer field (count of disks formatted at parallely)
_("&Parallel Formatted Disks"),
1,
par,
par
),
ButtonBox(
PushButton(Id(:ok), Label.OKButton),
PushButton(Id(:cancel), Label.CancelButton)
)
)
)
ret = Convert.to_symbol(UI.UserInput)
par = Convert.to_integer(UI.QueryWidget(Id(:par), :Value))
UI.CloseDialog
return false if ret == :cancel
num_parallel = AskNumParallel(Integer.Min([Builtins.size(selected), 8]))
return false if num_parallel == 0

# final confirmation before formatting the discs
channels = Builtins.maplist(selected) do |id|
Expand Down Expand Up @@ -359,7 +369,7 @@ def PerformAction(action)
devices = Builtins.maplist(selected) do |id|
Ops.get_string(DASDController.devices, [id, "dev_name"], "")
end
DASDController.FormatDisks(devices, par)
DASDController.FormatDisks(devices, num_parallel)

channels.each do |channel|
diag = DASDController.diag.fetch(channel, false)
Expand Down Expand Up @@ -681,5 +691,6 @@ def DeleteDASDDiskDialog

:next
end

end
end

0 comments on commit 7e87ce6

Please sign in to comment.