Class: Yast::InstDisksActivateClient

Inherits:
Client
  • Object
show all
Defined in:
src/lib/installation/clients/inst_disks_activate.rb

Instance Method Summary collapse

Instance Method Details

#mainObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'src/lib/installation/clients/inst_disks_activate.rb', line 33

def main
  Yast.import "UI"

  # **
  # <h3>Initialization of the disks</h3>

  textdomain "installation"

  # The main ()
  Builtins.y2milestone("----------------------------------------")
  Builtins.y2milestone("Disk activation module started")

  Yast.import "Arch"
  Yast.import "GetInstArgs"
  Yast.import "Label"
  Yast.import "Linuxrc"
  Yast.import "Popup"
  Yast.import "Wizard"

  # all the arguments
  @argmap = GetInstArgs.argmap

  @have_dasd = false
  @have_zfcp = false
  @want_fcoe = false

  if Arch.s390
    # popup label
    UI.OpenDialog(Label(_("Detecting Available Controllers")))

    # detect DASD disks
    disks = SCR.Read(path(".probe.disk"))
    @have_dasd = disks.any? { |d| d["device"] == "DASD" }

    # detect zFCP disks
    controllers = SCR.Read(path(".probe.storage"))
    @have_zfcp = controllers.any? { |c| c["device"] == "zFCP controller" }

    UI.CloseDialog
  end

  @want_fcoe = Linuxrc.InstallInf("WithFCoE") == "1"

  missing_part = [
    VSpacing(0),
    VSpacing(0)
  ]

  dasd_part = if @have_dasd
    button_with_spacing(:dasd, _("Configure &DASD Disks"))
  else
    missing_part
  end

  zfcp_part = if @have_zfcp
    button_with_spacing(:zfcp, _("Configure &ZFCP Disks"))
  else
    missing_part
  end

  fcoe_part = if @want_fcoe
    button_with_spacing(:fcoe, _("Configure &FCoE Interfaces"))
  else
    missing_part
  end

  @contents =
    VBox(
      network_button,
      VStretch(),
      HSquash(
        VBox(
          *dasd_part,
          *zfcp_part,
          *fcoe_part,
          *button_with_spacing(:iscsi, _("Configure &iSCSI Disks"))
        )
      ),
      VStretch()
    )

  @disks_changed = false

  while @ret.nil?
    show_base_dialog
    @ret = UI.UserInput

    case @ret
    when :dasd
      WFM.call("inst_dasd")
      @ret = :redraw
    when :zfcp
      WFM.call("inst_zfcp")
      @ret = :redraw
    when :iscsi
      WFM.call("inst_iscsi-client", [@argmap])
      @ret = :redraw
    when :fcoe
      WFM.call("inst_fcoe-client", [@argmap])
      @ret = :redraw
    when :network
      WFM.call(
        "inst_lan",
        [@argmap.merge("skip_detection" => true, "hide_abort_button" => true)]
      )
      @ret = :redraw
    when :abort
      @ret = nil unless Popup.ConfirmAbort(:painless)
    end

    if @ret == :redraw
      @disks_changed = true
      @ret = nil
    end
  end

  if @disks_changed
    storage = Y2Storage::StorageManager.instance
    storage.activate
    storage.probe
  end

  Builtins.y2debug("ret=%1", @ret)

  # Finish
  Builtins.y2milestone("Disk activation module finished")
  Builtins.y2milestone("----------------------------------------")

  @ret
end