Class: Yast::ReiplClass
- Inherits:
-
Module
- Object
- Module
- Yast::ReiplClass
- Defined in:
- ../../src/modules/Reipl.rb
Instance Method Summary (collapse)
-
- (Boolean) Abort
Abort function.
-
- (Hash) AutoPackages
Return packages needed to be installed and removed during Autoinstallation to insure module has all needed software installed.
-
- (Hash) Export
Dump the reipl settings to a single map (For use by autoinstallation.).
-
- (Boolean) Import(settings)
Get all reipl settings from the first parameter (For use by autoinstallation.).
-
- (Boolean) IPL_from_boot_zipl
Check to see if reipl is supported by the kernel.
- - (Object) main
-
- (Object) Modified
Data was modified?.
-
- (Object) Read
Read all reipl settings.
-
- (Hash{String => Object}) ReadState
Read all reipl settings.
-
- (Object) SetModified
Indicate that the data was modified.
-
- (Object) Summary
Create a textual summary and a list of unconfigured cards.
-
- (Object) Write
Write all reipl settings.
-
- (Object) WriteState(configuration)
Write all reipl setting to the firmware.
Instance Method Details
- (Boolean) Abort
Abort function
90 91 92 93 |
# File '../../src/modules/Reipl.rb', line 90 def Abort return @AbortFunction.call if @AbortFunction false end |
- (Hash) AutoPackages
Return packages needed to be installed and removed during Autoinstallation to insure module has all needed software installed.
368 369 370 |
# File '../../src/modules/Reipl.rb', line 368 def AutoPackages { "install" => [], "remove" => [] } end |
- (Hash) Export
Dump the reipl settings to a single map (For use by autoinstallation.)
318 319 320 |
# File '../../src/modules/Reipl.rb', line 318 def Export deep_copy(@reipl_configuration) end |
- (Boolean) Import(settings)
Get all reipl settings from the first parameter (For use by autoinstallation.)
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File '../../src/modules/Reipl.rb', line 259 def Import(settings) settings = deep_copy(settings) imported = {} if Ops.get(settings, "ccw") != nil ccwIn = Ops.get_map(settings, "ccw", {}) ccwOut = { "device" => "", "loadparm" => "", "parm" => "" } # SLES 11 and z/VM only if Ops.get(ccwIn, "device") != nil Ops.set(ccwOut, "device", Ops.get(ccwIn, "device")) end if Ops.get(ccwIn, "loadparm") != nil Ops.set(ccwOut, "loadparm", Ops.get(ccwIn, "loadparm")) end # SLES 11 and z/VM only if Ops.get(ccwIn, "parm") != nil Ops.set(ccwOut, "parm", Ops.get(ccwIn, "parm")) end Ops.set(imported, "ccw", ccwOut) end if Ops.get(settings, "fcp") != nil fcpIn = Ops.get_map(settings, "fcp", {}) fcpOut = { "device" => "", "wwpn" => "", "lun" => "", "bootprog" => "", "br_lba" => "" } if Ops.get(fcpIn, "device") != nil Ops.set(fcpOut, "device", Ops.get(fcpIn, "device")) end if Ops.get(fcpIn, "wwpn") != nil Ops.set(fcpOut, "wwpn", Ops.get(fcpIn, "wwpn")) end if Ops.get(fcpIn, "lun") != nil Ops.set(fcpOut, "lun", Ops.get(fcpIn, "lun")) end if Ops.get(fcpIn, "bootprog") != nil Ops.set(fcpOut, "bootprog", Ops.get(fcpIn, "bootprog")) end if Ops.get(fcpIn, "br_lba") != nil Ops.set(fcpOut, "br_lba", Ops.get(fcpIn, "br_lba")) end Ops.set(imported, "fcp", fcpOut) end @reipl_configuration = deep_copy(imported) true end |
- (Boolean) IPL_from_boot_zipl
Check to see if reipl is supported by the kernel. Returns the reipl configuration passed in with what it should be for the detected boot partition.
115 116 117 118 119 |
# File '../../src/modules/Reipl.rb', line 115 def IPL_from_boot_zipl # get target information result = Yast::SCR.Execute(path(".target.bash_output"), "chreipl node /boot/zipl") return result["exit"] == 0 end |
- (Object) main
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 |
# File '../../src/modules/Reipl.rb', line 35 def main textdomain "reipl" Yast.import "Progress" Yast.import "Report" Yast.import "Summary" Yast.import "Message" Yast.import "FileUtils" Yast.import "Confirm" Yast.import "Popup" Yast.import "Storage" # Data was modified? @modified = false @proposal_valid = false # Write only, used during autoinstallation. # Don't run services and SuSEconfig, it's all done at one place. @write_only = false # Abort function # return boolean return true if abort @AbortFunction = fun_ref(method(:Modified), "boolean ()") # Settings: Define all variables needed for configuration of reipl @reipl_configuration = {} # global map <string, any> reipl_configuration = $[ # "method": "ccw", # "ccw": $[ # "device": "0.0.4711", # "loadparm": "", # "parm": "" /* SLES 11 and z/VM only */ # ], # "fcp": $[ # "device": "0.0.4711", # "wwpn": "0x5005076303004711", # "lun": "0x4711000000000000", # "bootprog": "0", # "br_lba": "0" # ] #]; @reipl_directory = "/sys/firmware/reipl" @ccw_directory = @reipl_directory + "/ccw" @fcp_directory = @reipl_directory + "/fcp" @nss_directory = @reipl_directory + "/nss" @ccw_exists = FileUtils.IsDirectory(@ccw_directory) @fcp_exists = FileUtils.IsDirectory(@fcp_directory) @nss_exists = FileUtils.IsDirectory(@fcp_directory) end |
- (Object) Modified
Data was modified?
97 98 99 100 |
# File '../../src/modules/Reipl.rb', line 97 def Modified Builtins.y2debug("modified=%1", @modified) @modified end |
- (Object) Read
Read all reipl settings
160 161 162 163 164 165 166 167 168 |
# File '../../src/modules/Reipl.rb', line 160 def Read configuration = ReadState() @reipl_configuration = deep_copy(configuration) if configuration return false if Abort() @modified = false true end |
- (Hash{String => Object}) ReadState
Read all reipl settings
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 |
# File '../../src/modules/Reipl.rb', line 123 def ReadState configuration = {} Builtins.y2milestone("ReadState: The beginngn") Ops.set(configuration, "ccw", { "device" => "", "loadparm" => "", "parm" => "" }) Ops.set(configuration, "fcp", { "device" => "", "wwpn" => "", "lun" => "", "bootprog" => "", "br_lba" => "", "bootparms" => "" }) Ops.set(configuration, "nss", { "name" => "", "loadparm" => "", "parm" => "" }) result = Yast::SCR.Execute(path(".target.bash_output"), "lsreipl") raise "Calling lsreipl failed with #{result["stderr"]}" unless result["exit"].zero? lsreipl_lines = result["stdout"].split("\n") type = lsreipl_lines[0][/ccw$|fcp$|node$/] if type == "ccw" ccw_map = Ops.get_map(configuration, "ccw") Ops.set(ccw_map, "device", Builtins.deletechars(Convert.to_string(lsreipl_lines[1][/[0-3]\.[0-3]\.[\h.]*$/]), "\n ")) Ops.set(ccw_map, "loadparm", Builtins.deletechars(Convert.to_string(lsreipl_lines[2][/".*"$/]), "\n \"")) Ops.set(ccw_map, "parm", Builtins.deletechars(Convert.to_string(lsreipl_lines[3][/".*"$/]), "\n \"")) Ops.set(configuration, "ccw", ccw_map) end if type == "fcp" fcp_map = Ops.get_map(configuration, "fcp") Ops.set(ccw_map, "wwpm", Builtins.deletechars(Convert.to_string(lsreipl_lines[1][/[x\h]*$/]), "\n ")) Ops.set(ccw_map, "lun", Builtins.deletechars(Convert.to_string(lsreipl_lines[2][/[x\h]*$/]), "\n ")) Ops.set(ccw_map, "device", Builtins.deletechars(Convert.to_string(lsreipl_lines[3][/[0-3]\.[0-3]\.[\h.]*$/]), "\n ")) Ops.set(ccw_map, "bootprog", Builtins.deletechars(Convert.to_string(lsreipl_lines[4][/[0-9]*$/]), "\n ")) Ops.set(ccw_map, "br_lbr", Builtins.deletechars(Convert.to_string(lsreipl_lines[5][/[0-9]*$/]), "\n ")) Ops.set(ccw_map, "bootparms", Builtins.deletechars(Convert.to_string(lsreipl_lines[6][/".*"*$/]), "\n \"")) Ops.set(configuration, "fcp", fcp_map) end configuration["method"] = type deep_copy(configuration) end |
- (Object) SetModified
Indicate that the data was modified
103 104 105 106 107 |
# File '../../src/modules/Reipl.rb', line 103 def SetModified Builtins.y2debug("Reipl::SetModified") @modified = true nil end |
- (Object) Summary
Create a textual summary and a list of unconfigured cards
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File '../../src/modules/Reipl.rb', line 324 def Summary summary = "" status = nil found = nil summary = Summary.AddHeader(summary, _("Configured reipl methods")) summary = Summary.OpenList(summary) found = Ops.get_map(@reipl_configuration, "ccw") if found != nil if Ops.get(@reipl_configuration, "method") == "ccw" status = _("The method ccw is configured and being used.") else status = _("The method ccw is configured.") end else status = _("The method ccw is not supported.") end summary = Summary.AddListItem(summary, status) found = Ops.get_map(@reipl_configuration, "fcp") if found != nil if Ops.get(@reipl_configuration, "method") == "fcp" status = _("The method fcp is configured and being used.") else status = _("The method fcp is configured.") end else status = _("The method fcp is not supported.") end summary = Summary.AddListItem(summary, status) summary = Summary.CloseList(summary) [summary, []] end |
- (Object) Write
Write all reipl settings
247 248 249 250 251 252 253 |
# File '../../src/modules/Reipl.rb', line 247 def Write rc = WriteState(@reipl_configuration) return false if Abort() rc end |
- (Object) WriteState(configuration)
Write all reipl setting to the firmware
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File '../../src/modules/Reipl.rb', line 173 def WriteState(configuration) configuration = deep_copy(configuration) rc = true result = nil if Ops.get(configuration, "method") != nil && Ops.get_string(configuration, "method", "unknown_disk_type") != "unknown_disk_type" type = Ops.get_string(configuration, "method") Builtins.y2milestone("Reipl::WriteState: writing out method %1", type) end if type == "ccw" ccw_map = Ops.get_map(configuration, "ccw") if ccw_map != nil device = Ops.get_string(ccw_map, "device", "???") loadparm = Ops.get_string(ccw_map, "loadparm", "???") else Builtins.y2error("Reipl::WriteState: ccw_map is nil!") rc = false end end if type == "fcp" fcp_map = Ops.get_map(configuration, "fcp") if fcp_map != nil Builtins.y2milestone("Reipl::WriteState: fcp_map device is now \"%1\"", Ops.get_string(fcp_map, "device", "???")) Builtins.y2milestone("Reipl::WriteState: fcp_map wwpn is now \"%1\"", Ops.get_string(fcp_map, "wwpn", "???")) Builtins.y2milestone("Reipl::WriteState: fcp_map lun is now \"%1\"", Ops.get_string(fcp_map, "lun", "???")) Builtins.y2milestone("Reipl::WriteState: fcp_map bootprog is now \"%1\"", Ops.get_string(fcp_map, "bootprog", "???")) Builtins.y2milestone("Reipl::WriteState: fcp_map br_lba is now \"%1\"", Ops.get_string(fcp_map, "br_lba", "???")) device = Ops.get_string(fcp_map, "device") + " " + Ops.get_string(fcp_map, "wwpn") + " " + Ops.get_string(fcp_map, "lun") loadparm = Ops.get_string(fcp_map, "loadparm", "???") Builtins.y2milestone("FCP Device %1, loadparm %2 %1", device, loadparm) else Builtins.y2error("Reipl::Write: fcp_map is nil!") rc = false end end if type == "nss" nss_map = Ops.get_map(configuration, "nss") if nss_map != nil device = Ops.get_string(fcp_map, "name") loadparm = "" end end # now type, device, loadparm contain all what is needed to call chreipl chreiplCmd = "chreipl " + type + " " + device if loadparm != "" chreiplCmd << " -L " + loadparm end Builtins.y2milestone("Executing %1", chreiplCmd) result = Convert.to_map(SCR.Execute(path(".target.bash_output"), chreiplCmd)) if Ops.get_integer(result, "exit", -1) != 0 Builtins.y2error( "Error: Calling chreipl fails with code %1 and output %2", Ops.get_integer(result, "exit", -1), Ops.get_string(result, "stderr", "")) rc = false end rc end |