Module: Yast::MultipathOptionsInclude

Defined in:
../../src/include/multipath/options.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_quotes(value)

add quotes to configuration value, no matter how many words. if the value has quotes pair, do not touch it. if more than 1 quote at the head or end, only keep one. if there are quote inside the value, ignore.



723
724
725
726
727
728
729
# File '../../src/include/multipath/options.rb', line 723

def add_quotes(value)
  result = rm_quotes(value)
  if Ops.greater_than(Builtins.size(result), 0)
    result = Ops.add(Ops.add("\"", result), "\"")
  end
  result
end

- (Object) alias_handler(item)



2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
# File '../../src/include/multipath/options.rb', line 2122

def alias_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:alias), :Value)
  if Ops.is_string?(ret) == true
    value = Convert.to_string(ret)
  else
    Popup.Message(Builtins.sformat("alias_handler: unexpected ret %1", ret))
  end
  Ops.set(item, "alias", value)
  deep_copy(item)
end

- (Object) build_alias_term(opt)



2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
# File '../../src/include/multipath/options.rb', line 2100

def build_alias_term(opt)
  entry = Ops.get_map(@alias_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("alias_opts[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_combobox_list(opts)



753
754
755
756
757
758
759
760
761
762
763
764
765
766
# File '../../src/include/multipath/options.rb', line 753

def build_combobox_list(opts)
  opts = deep_copy(opts)
  combobox_list = []
  Builtins.foreach(Ops.get_list(opts, "list", [])) do |e|
    opt_str = Ops.get_string(e, "optstr", "NA")
    id = Ops.get_symbol(e, "id", :id)
    item = Item(Id(id), opt_str)
    combobox_list = Builtins.add(combobox_list, item)
  end
  if combobox_list == []
    Popup.Message("build_combobox_list: nexpected empty combobox list.")
  end
  deep_copy(combobox_list)
end

- (Object) build_devnode_term(opt)



2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
# File '../../src/include/multipath/options.rb', line 2044

def build_devnode_term(opt)
  entry = Ops.get_map(@devnode_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("devnode_opts[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_failback_term(opt)



1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
# File '../../src/include/multipath/options.rb', line 1516

def build_failback_term(opt)
  ret = Empty()
  if opt == :editable_combobox_only
    ret = ComboBox(
      Id(:failback),
      Opt(:notify, :editable),
      Ops.get_string(@optlabel, "failback", "NA"),
      build_combobox_list(@failback_opts)
    )
  elsif opt == :combobox_only
    ret = ComboBox(
      Id(:failback),
      Opt(:notify),
      Ops.get_string(@optlabel, "failback", "NA"),
      build_combobox_list(@failback_opts)
    )
  elsif opt == :all
    ret = ReplacePoint(
      Id(:replace_failback),
      ComboBox(
        Id(:failback),
        Opt(:notify),
        Ops.get_string(@optlabel, "failback", "NA"),
        build_combobox_list(@failback_opts)
      )
    )
  else
    Popup.Message(
      Builtins.sformat("build_failback_term: unexpected opt %1", opt)
    )
  end

  deep_copy(ret)
end

- (Object) build_features_term(opt)



1353
1354
1355
1356
1357
1358
1359
1360
# File '../../src/include/multipath/options.rb', line 1353

def build_features_term(opt)
  ComboBox(
    Id(:features),
    Opt(:notify),
    Ops.get_string(@optlabel, "features", "NA"),
    build_combobox_list(@features_opts)
  )
end

- (Object) build_getuid_callout_term(opt)



1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
# File '../../src/include/multipath/options.rb', line 1135

def build_getuid_callout_term(opt)
  ret = Empty()
  if opt == :combobox_only
    ret = ComboBox(
      Id(:getuid_callout),
      Opt(:notify),
      Ops.get_string(@optlabel, "getuid_callout", "NA"),
      build_combobox_list(@getuid_callout_opts)
    )
  elsif opt == :editable_combobox_only
    ret = ComboBox(
      Id(:getuid_callout),
      Opt(:notify, :editable),
      Ops.get_string(@optlabel, "getuid_callout", "NA"),
      build_combobox_list(@getuid_callout_opts)
    )
  elsif opt == :all
    ret = ReplacePoint(
      Id(:replace_getuid_callout),
      ComboBox(
        Id(:getuid_callout),
        Opt(:notify),
        Ops.get_string(@optlabel, "getuid_callout", "NA"),
        build_combobox_list(@getuid_callout_opts)
      )
    )
  else
    Popup.Message(
      Builtins.sformat("build_getuid_callout_term: unexpected opt %1", opt)
    )
  end
  deep_copy(ret)
end

- (Object) build_hardware_handler_term(opt)



2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
# File '../../src/include/multipath/options.rb', line 2316

def build_hardware_handler_term(opt)
  entry = Ops.get_map(@hardware_handler_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("hardware_opt[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_no_path_retry_term(opt)



1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
# File '../../src/include/multipath/options.rb', line 1783

def build_no_path_retry_term(opt)
  ret = Empty()
  if opt == :combobox_only
    ret = ComboBox(
      Id(:no_path_retry),
      Opt(:notify),
      Ops.get_string(@optlabel, "no_path_retry", "NA"),
      build_combobox_list(@no_path_retry_opts)
    )
  elsif opt == :editable_combobox_only
    ret = ComboBox(
      Id(:no_path_retry),
      Opt(:notify, :editable),
      Ops.get_string(@optlabel, "no_path_retry", "NA"),
      build_combobox_list(@no_path_retry_opts)
    )
  elsif opt == :all
    ret = ReplacePoint(
      Id(:replace_no_path_retry),
      ComboBox(
        Id(:no_path_retry),
        Opt(:notify),
        Ops.get_string(@optlabel, "no_path_retry", "NA"),
        build_combobox_list(@no_path_retry_opts)
      )
    )
  else
    Popup.Message(
      Builtins.sformat("build_no_path_retry_term: unexpected opt %1", opt)
    )
  end
  deep_copy(ret)
end

- (Object) build_path_checker_term(opt)



1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
# File '../../src/include/multipath/options.rb', line 1415

def build_path_checker_term(opt)
  ret = Empty()
  if opt == :combobox_only
    ret = ComboBox(
      Id(:path_checker),
      Opt(:notify),
      Ops.get_string(@optlabel, "path_checker", "NA"),
      build_combobox_list(@path_checker_opts)
    )
  elsif opt == :all
    ret = ReplacePoint(
      Id(:replace_path_checker),
      ComboBox(
        Id(:path_checker),
        Opt(:notify),
        Ops.get_string(@optlabel, "path_checker", "NA"),
        build_combobox_list(@path_checker_opts)
      )
    )
  else
    Popup.Message(
      Builtins.sformat("build_path_checker_term: unexpected opt %1", opt)
    )
  end
  deep_copy(ret)
end

- (Object) build_path_gp_term(opt)



1057
1058
1059
1060
1061
1062
1063
1064
# File '../../src/include/multipath/options.rb', line 1057

def build_path_gp_term(opt)
  ComboBox(
    Id(:path_grouping_policy),
    Opt(:notify),
    Ops.get_string(@optlabel, "path_grouping_policy", "NA"),
    build_combobox_list(@path_gp_opts)
  )
end

- (Object) build_path_selector_term(opt)



980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
# File '../../src/include/multipath/options.rb', line 980

def build_path_selector_term(opt)
  ret = Empty()
  if opt == :combobox_only
    ret = ComboBox(
      Id(:path_selector),
      Opt(:notify),
      Ops.get_string(@optlabel, "path_selector", "NA"),
      build_combobox_list(@path_selector_opts)
    )
  elsif opt == :all
    ret = ReplacePoint(
      Id(:replace_path_selector),
      ComboBox(
        Id(:path_selector),
        Opt(:notify),
        Ops.get_string(@optlabel, "path_selector", "NA"),
        build_combobox_list(@path_selector_opts)
      )
    )
  else
    Popup.Message(
      Builtins.sformat("build_path_selector_term: unexpected opt %1", ret)
    )
  end
  deep_copy(ret)
end

- (Object) build_polling_interval_term(opt)



768
769
770
771
772
773
774
775
776
777
778
779
# File '../../src/include/multipath/options.rb', line 768

def build_polling_interval_term(opt)
  entry = Ops.get_map(@polling_interval_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("polling_interval_opts[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_prio_callout_term(opt)



1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
# File '../../src/include/multipath/options.rb', line 1249

def build_prio_callout_term(opt)
  ret = Empty()
  if opt == :combobox_only
    ret = ComboBox(
      Id(:prio_callout),
      Opt(:notify),
      Ops.get_string(@optlabel, "prio_callout", "NA"),
      build_combobox_list(@prio_callout_opts)
    )
  elsif opt == :all
    ret = ReplacePoint(
      Id(:replace_prio_callout),
      ComboBox(
        Id(:prio_callout),
        Opt(:notify),
        Ops.get_string(@optlabel, "prio_callout", "NA"),
        build_combobox_list(@prio_callout_opts)
      )
    )
  else
    Popup.Message(
      Builtins.sformat("build_prio_callout_term: unexpected opt %1", opt)
    )
  end
  deep_copy(ret)
end

- (Object) build_product_blacklist_term(opt)



2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
# File '../../src/include/multipath/options.rb', line 2260

def build_product_blacklist_term(opt)
  entry = Ops.get_map(@product_blacklist_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("product_blacklist_opts[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_product_term(opt)



2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
# File '../../src/include/multipath/options.rb', line 2205

def build_product_term(opt)
  entry = Ops.get_map(@product_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("product_opts[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_rr_min_io_term(opt)



1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
# File '../../src/include/multipath/options.rb', line 1659

def build_rr_min_io_term(opt)
  entry = Ops.get_map(@rr_min_io_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("rr_min_io_opts[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_rr_weight_term(opt)



1722
1723
1724
1725
1726
1727
1728
1729
# File '../../src/include/multipath/options.rb', line 1722

def build_rr_weight_term(opt)
  ComboBox(
    Id(:rr_weight),
    Opt(:notify),
    Ops.get_string(@optlabel, "rr_weight", "NA"),
    build_combobox_list(@rr_weight_opts)
  )
end

- (Object) build_selector_term(opt)



905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
# File '../../src/include/multipath/options.rb', line 905

def build_selector_term(opt)
  ret = Empty()
  if opt == :combobox_only
    ret = ComboBox(
      Id(:selector),
      Opt(:notify),
      Ops.get_string(@optlabel, "selector", "NA"),
      build_combobox_list(@selector_opts)
    )
  elsif opt == :all
    ret = ReplacePoint(
      Id(:replace_selector),
      ComboBox(
        Id(:selector),
        Opt(:notify),
        Ops.get_string(@optlabel, "selector", "NA"),
        build_combobox_list(@selector_opts)
      )
    )
  else
    Popup.Message(
      Builtins.sformat("build_selector_term: unexpected opt %1", opt)
    )
  end
  deep_copy(ret)
end

- (Object) build_udev_dir_term(opt)



852
853
854
855
856
857
858
859
860
861
862
863
# File '../../src/include/multipath/options.rb', line 852

def build_udev_dir_term(opt)
  entry = Ops.get_map(@udev_dir_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("udev_dir_opts[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_user_friendly_names_term(opt)



1928
1929
1930
1931
1932
1933
1934
1935
# File '../../src/include/multipath/options.rb', line 1928

def build_user_friendly_names_term(opt)
  ComboBox(
    Id(:user_friendly_names),
    Opt(:notify),
    Ops.get_string(@optlabel, "user_friendly_names", "NA"),
    build_combobox_list(@user_friendly_names_opts)
  )
end

- (Object) build_valid_chars(key)



733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
# File '../../src/include/multipath/options.rb', line 733

def build_valid_chars(key)
  valid_chars = {
    "path"              => " %./-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "wwid"              => ".-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "number"            => "0123456789",
    "devnode"           => " ^!\".*?()|[]/\\-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "vendor"            => " ^!\".*?()|[]/\\-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "product"           => " ^!\".*?()|[]/\\-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "product_blacklist" => " ^!\".*?()|[]/\\-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "hardware_handler"  => " ^!\".*?()|[]/\\-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "alias"             => ".-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  }
  if Builtins.haskey(valid_chars, key) == false
    Popup.Message(Builtins.sformat("can not find valid chars for %1", key))
    return ""
  else
    return Ops.get_string(valid_chars, key, "")
  end
end

- (Object) build_vendor_term(opt)



2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
# File '../../src/include/multipath/options.rb', line 2149

def build_vendor_term(opt)
  entry = Ops.get_map(@vendor_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("vendor_opts[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) build_wwid_term(opt)



1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
# File '../../src/include/multipath/options.rb', line 1995

def build_wwid_term(opt)
  entry = Ops.get_map(@wwid_opts, "entry", {})
  ret = Empty()
  if entry != {}
    id = Ops.get_symbol(entry, "id", :id)
    label_str = Ops.get_string(entry, "name", "NA")
    ret = TextEntry(Id(id), Opt(:notify), label_str, "")
  else
    Popup.Message("wwid_opt[\"entry\"] is not defined")
  end
  deep_copy(ret)
end

- (Object) check_alias(item)



2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
# File '../../src/include/multipath/options.rb', line 2135

def check_alias(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "alias", "")
  if value == Builtins.toascii(value)
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"alias\" " + _("illegal value") + "\n")
  end
  deep_copy(ret)
end

- (Object) check_devnode(item)



2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
# File '../../src/include/multipath/options.rb', line 2081

def check_devnode(item)
  item = deep_copy(item)
  header = "* \"devnode\" "
  ret = {}
  value = Ops.get_string(item, "devnode", "")
  if value == "" || Builtins.regexpmatch(value, "^[ \t]+$")
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      Ops.add(Ops.add(header, _("should not be empty")), "\n")
    )
  else
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  end
  deep_copy(ret)
end

- (Object) check_failback(item)



1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
# File '../../src/include/multipath/options.rb', line 1623

def check_failback(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "failback", "")
  if value == "" || value == "immediate" || value == "manual"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  elsif Builtins.substring(value, 0, 1) == "0"
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"failback\" " + _("should be a decimal integer") + "\n"
    )
  elsif Builtins.tointeger(value) == nil ||
      value != Builtins.tostring(Builtins.tointeger(value)) ||
      value == "0"
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"failback\" " + _("illegal value") + "\n")
  elsif Ops.less_or_equal(Builtins.tointeger(value), 0)
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"failback\" " + _("should be greater than 0") + "\n"
    )
  elsif value == Builtins.tostring(Builtins.tointeger(value))
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"failback\" " + _("illegal value") + "\n")
  end
  deep_copy(ret)
end

- (Object) check_features(item)



1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
# File '../../src/include/multipath/options.rb', line 1400

def check_features(item)
  item = deep_copy(item)
  header = "* \"features\" "
  ret = {}
  value = Ops.get_string(item, "features", "")
  if value == "" || value == "1 queue_if_no_path" || value == "0"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  end
  deep_copy(ret)
end

- (Object) check_getuid_callout(item)



1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
# File '../../src/include/multipath/options.rb', line 1230

def check_getuid_callout(item)
  item = deep_copy(item)
  header = "* \"getuid_callout\" "
  ret = {}
  value = Ops.get_string(item, "getuid_callout", "")

  if value == "" || value == "/sbin/scsi_id -g -u -s"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  elsif value == Builtins.toascii(value)
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  end
  deep_copy(ret)
end

- (Object) check_hardware_handler(item)



2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
# File '../../src/include/multipath/options.rb', line 2357

def check_hardware_handler(item)
  item = deep_copy(item)
  header = "* \"hardware_handler\" "
  ret = {}
  value = Ops.get_string(item, "hardware_handler", "")


  if value == "" || value == Builtins.toascii(value)
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  end
  deep_copy(ret)
end

- (Object) check_no_path_retry(item)



1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
# File '../../src/include/multipath/options.rb', line 1900

def check_no_path_retry(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "no_path_retry", "")
  if value == "" || value == "fail" || value == "queue"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  elsif value != "0" && Builtins.substring(value, 0, 1) == "0"
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"no_path_retry\" " + _("should be a decimal integer") + "\n"
    )
  elsif Builtins.tointeger(value) == nil ||
      value != Builtins.tostring(Builtins.tointeger(value))
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"no_path_retry\" " + _("illegal value") + "\n")
  elsif value == Builtins.tostring(Builtins.tointeger(value))
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"no_path_retry\" " + _("illegal value") + "\n")
  end
  deep_copy(ret)
end

- (Object) check_path_checker(item)



1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
# File '../../src/include/multipath/options.rb', line 1498

def check_path_checker(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "path_checker", "")
  if value == "" || value == "readsector0" || value == "tur" ||
      value == "emc_clariion" ||
      value == "hp_sw" ||
      value == "rdac" ||
      value == "directio"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"path_checker\" " + _("illegal value") + "\n")
  end
  deep_copy(ret)
end

- (Object) check_path_gp(item)



1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
# File '../../src/include/multipath/options.rb', line 1114

def check_path_gp(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "path_grouping_policy", "")
  if value == "" || value == "failover" || value == "multibus" ||
      value == "group_by_serial" ||
      value == "group_by_prio" ||
      value == "group_by_node_name"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"path_grouping_policy\" " + _("illegal value") + "\n"
    )
  end
  deep_copy(ret)
end

- (Object) check_path_selector(item)



1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
# File '../../src/include/multipath/options.rb', line 1043

def check_path_selector(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "path_selector", "")
  if value == "" || value == "round-robin 0"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"path_selector\" " + _("illegal value") + "\n")
  end
  deep_copy(ret)
end

- (Object) check_polling_interval(item)



809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
# File '../../src/include/multipath/options.rb', line 809

def check_polling_interval(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "polling_interval", "")
  if value == ""
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  elsif value != "0" && Builtins.substring(value, 0, 1) == "0"
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"polling_interval\" " + _("should be a decimal integer") + "\n"
    )
  elsif Builtins.tointeger(value) == nil ||
      value != Builtins.tostring(Builtins.tointeger(value))
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"polling_interval\" " + _("illegal value") + "\n"
    )
  elsif Ops.less_than(Builtins.tointeger(value), 0)
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"polling_interval\" " + _("should be greater than 0") + "\n"
    )
  elsif value == Builtins.tostring(Builtins.tointeger(value))
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"polling_interval\" " + _("illegal value") + "\n"
    )
  end
  deep_copy(ret)
end

- (Object) check_prio_callout(item)



1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
# File '../../src/include/multipath/options.rb', line 1332

def check_prio_callout(item)
  item = deep_copy(item)
  header = "* \"prio_callout\" "
  ret = {}
  value = Ops.get_string(item, "prio_callout", "")

  if value == "" || value == "mpath_prio_emc /dev/%n" ||
      value == "mpath_prio_alua /dev/%n" ||
      value == "mpath_prio_netapp /dev/%n" ||
      value == "mpath_prio_tpc /dev/%n" ||
      value == "mpath_prio_hp_sw /dev/%n" ||
      value == "mpath_prio_hds_modular %b"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  end
  deep_copy(ret)
end

- (Object) check_product(item)



2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
# File '../../src/include/multipath/options.rb', line 2241

def check_product(item)
  item = deep_copy(item)
  header = "* \"product\" "
  ret = {}
  value = Ops.get_string(item, "product", "")
  if value == "" || Builtins.regexpmatch(value, "^[ \t]+$")
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      Ops.add(Ops.add(header, _("should not be empty")), "\n")
    )
  else
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  end
  deep_copy(ret)
end

- (Object) check_product_blacklist(item)



2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
# File '../../src/include/multipath/options.rb', line 2301

def check_product_blacklist(item)
  item = deep_copy(item)
  header = "* \"product_blacklist\" "
  ret = {}
  value = Ops.get_string(item, "product_blacklist", "")
  if value != Builtins.toascii(value)
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  else
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  end
  deep_copy(ret)
end

- (Object) check_rr_min_io(item)



1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
# File '../../src/include/multipath/options.rb', line 1690

def check_rr_min_io(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "rr_min_io", "")
  if value != "0" && Builtins.substring(value, 0, 1) == "0"
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"rr_min_io\" " + _("should be a decimal integer") + "\n"
    )
  elsif value == ""
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  elsif Builtins.tointeger(value) == nil ||
      value != Builtins.tostring(Builtins.tointeger(value))
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      "* \"rr_min_io\" " + _("invalid decimal integer") + "\n"
    )
  elsif value == Builtins.tostring(Builtins.tointeger(value))
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"rr_min_io\" " + _("illegal value") + "\n")
  end
  deep_copy(ret)
end

- (Object) check_rr_weight(item)



1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
# File '../../src/include/multipath/options.rb', line 1768

def check_rr_weight(item)
  item = deep_copy(item)
  header = "* \"rr_weight\" "
  ret = {}
  value = Ops.get_string(item, "rr_weight", "")
  if value == "" || value == "priorities" || value == "uniform"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  end
  deep_copy(ret)
end

- (Object) check_selector(item)



965
966
967
968
969
970
971
972
973
974
975
976
977
978
# File '../../src/include/multipath/options.rb', line 965

def check_selector(item)
  item = deep_copy(item)
  header = "* \"selector\" "
  ret = {}
  value = Ops.get_string(item, "selector", "")
  if value == "" || value == "round-robin 0"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  end
  deep_copy(ret)
end

- (Object) check_udev_dir(item)



889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
# File '../../src/include/multipath/options.rb', line 889

def check_udev_dir(item)
  item = deep_copy(item)
  header = "* \"udev_dir\" "
  ret = {}
  value = Ops.get_string(item, "udev_dir", "")

  if value == "" || value == Builtins.toascii(value)
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  end
  deep_copy(ret)
end

- (Object) check_user_friendly_names(item)



1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
# File '../../src/include/multipath/options.rb', line 1980

def check_user_friendly_names(item)
  item = deep_copy(item)
  header = "* \"user_friendly_names\" "
  ret = {}
  value = Ops.get_string(item, "user_friendly_names", "")
  if value == "" || value == "yes" || value == "no"
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  else
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", Ops.add(Ops.add(header, _("illegal value")), "\n"))
  end
  deep_copy(ret)
end

- (Object) check_vendor(item)



2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
# File '../../src/include/multipath/options.rb', line 2186

def check_vendor(item)
  item = deep_copy(item)
  header = "* \"vendor\" "
  ret = {}
  value = Ops.get_string(item, "vendor", "")
  if value == "" || Builtins.regexpmatch(value, "^[ \t]+$")
    Ops.set(ret, "result", false)
    Ops.set(
      ret,
      "info",
      Ops.add(Ops.add(header, _("should not be empty")), "\n")
    )
  else
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  end
  deep_copy(ret)
end

- (Object) check_wwid(item)



2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
# File '../../src/include/multipath/options.rb', line 2030

def check_wwid(item)
  item = deep_copy(item)
  ret = {}
  value = Ops.get_string(item, "wwid", "")
  if value == "" || Builtins.regexpmatch(value, "^[ \t]+$")
    Ops.set(ret, "result", false)
    Ops.set(ret, "info", "* \"wwid\" " + _("should not be empty") + "\n")
  else
    Ops.set(ret, "result", true)
    Ops.set(ret, "info", "")
  end
  deep_copy(ret)
end

- (Object) devnode_handler(item)



2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
# File '../../src/include/multipath/options.rb', line 2066

def devnode_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:devnode), :Value)
  if Ops.is_string?(ret) == true
    value = Convert.to_string(ret)
  else
    Popup.Message(
      Builtins.sformat("devnode_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "devnode", value)
  deep_copy(item)
end

- (Object) failback_handler(item)



1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
# File '../../src/include/multipath/options.rb', line 1571

def failback_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:failback), :Value)
  if ret == :immediate
    UI.ReplaceWidget(
      Id(:replace_failback),
      build_failback_term(:combobox_only)
    )
    UI.ChangeWidget(Id(:failback), :Value, :immediate)
    value = "immediate"
  elsif ret == :manual
    UI.ReplaceWidget(
      Id(:replace_failback),
      build_failback_term(:combobox_only)
    )
    UI.ChangeWidget(Id(:failback), :Value, :manual)
    value = "manual"
  elsif ret == :customized_str
    value = Ops.get_string(@temp_string_values, "failback", "")
    UI.ReplaceWidget(
      Id(:replace_failback),
      build_failback_term(:editable_combobox_only)
    )
    UI.ChangeWidget(Id(:failback), :ValidChars, build_valid_chars("number"))
    UI.ChangeWidget(Id(:failback), :Value, value)
    UI.SetFocus(Id(:failback))
    @replacewidget_notify = true
  elsif ret == "0"
    value = ""
    UI.ReplaceWidget(
      Id(:replace_failback),
      build_failback_term(:editable_combobox_only)
    )
    UI.ChangeWidget(Id(:failback), :ValidChars, build_valid_chars("number"))
    UI.SetFocus(Id(:failback))
    UI.ChangeWidget(Id(:failback), :Value, " ")
    @replacewidget_notify = true
  elsif ret == ""
    value = ""
  elsif Builtins.tointeger(ret) != nil
    value = Convert.to_string(ret)
    Ops.set(@temp_string_values, "failback", value)
  else
    Popup.Message(
      Builtins.sformat("failback_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "failback", value)
  deep_copy(item)
end

- (Object) features_handler(item)



1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
# File '../../src/include/multipath/options.rb', line 1381

def features_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:features), :Value)
  if ret == :queue_if_no_path
    value = "1 queue_if_no_path"
  elsif ret == :zero
    value = "0"
  elsif ret == :none
    value = ""
  else
    Popup.Message(
      Builtins.sformat("features_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "features", value)
  deep_copy(item)
end

- (Object) get_newid(items)

get a new id for new item, this will help to make each item unique.



665
666
667
668
669
670
671
672
673
674
675
# File '../../src/include/multipath/options.rb', line 665

def get_newid(items)
  items = deep_copy(items)
  newid = 0
  Builtins.foreach(items) do |e|
    e_id = 0
    e_id = Builtins.tointeger(Ops.get_string(e, "id", "0"))
    newid = e_id if Ops.less_than(newid, e_id)
  end
  newid = Ops.add(newid, 1)
  Builtins.tostring(newid)
end

- (Object) getuid_callout_handler(item)



1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
# File '../../src/include/multipath/options.rb', line 1191

def getuid_callout_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:getuid_callout), :Value)
  if ret == :default
    UI.ReplaceWidget(
      Id(:replace_getuid_callout),
      build_getuid_callout_term(:combobox_only)
    )
    UI.ChangeWidget(Id(:getuid_callout), :Value, :default)
    value = "/sbin/scsi_id -g -u -s"
  elsif ret == :customized_str
    value = Ops.get_string(@temp_string_values, "getuid_callout", "")
    UI.ReplaceWidget(
      Id(:replace_getuid_callout),
      build_getuid_callout_term(:editable_combobox_only)
    )
    UI.ChangeWidget(
      Id(:getuid_callout),
      :ValidChars,
      build_valid_chars("path")
    )
    UI.ChangeWidget(Id(:getuid_callout), :Value, value)
    UI.SetFocus(Id(:getuid_callout)) 
    #	replacewidget_notify = true;
  elsif ret == ""
    value = ""
  elsif Convert.to_string(ret) == Builtins.toascii(Convert.to_string(ret))
    value = Convert.to_string(ret)
    Ops.set(@temp_string_values, "getuid_callout", value)
  else
    Popup.Message(
      Builtins.sformat("getuid_callout_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "getuid_callout", value)
  deep_copy(item)
end

- (Object) hardware_handler_handler(item)



2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
# File '../../src/include/multipath/options.rb', line 2342

def hardware_handler_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:hardware_handler), :Value)
  if Ops.is_string?(ret) == true
    value = Convert.to_string(ret)
  else
    Popup.Message(
      Builtins.sformat("hardware_handler_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "hardware_handler", value)
  deep_copy(item)
end

- (Object) initialize_multipath_options(include_target)



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
163
164
165
166
167
168
169
170
171
172
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
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
314
315
316
317
318
319
320
321
322
323
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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
# File '../../src/include/multipath/options.rb', line 34

def initialize_multipath_options(include_target)
  Yast.import "UI"

  Yast.import "Popup"

  textdomain "multipath"

  # hold temporary customized string value of combobox
  @temp_string_values = {}
  @replacewidget_notify = false

  @optlabel = {
    "polling_interval"     => "polling_interval",
    "udev_dir"             => "udev_dir",
    "selector"             => "selector",
    "path_selector"        => "path_selector",
    "path_grouping_policy" => "path_grouping_policy",
    "getuid_callout"       => "getuid_callout",
    "prio_callout"         => "prio_callout",
    "features"             => "features",
    "path_checker"         => "path_checker",
    "failback"             => "failback",
    "rr_min_io"            => "rr_min_io",
    "rr_weight"            => "rr_weight",
    "no_path_retry"        => "no_path_retry",
    "user_friendly_names"  => "user_friendly_names",
    "wwid"                 => "wwid",
    "devnode"              => "devnode",
    "alias"                => "alias",
    "vendor"               => "vendor",
    "product"              => "product",
    "product_blacklist"    => "product_blacklist",
    "hardware_handler"     => "hardware_handler"
  }



  @polling_interval_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "polling_interval", "NA"),
      "id"   => :polling_interval
    }
  }

  @udev_dir_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "udev_dir", "NA"),
      "id"   => :udev_dir
    }
  }

  @selector_opts = {
    "type" => "combobox",
    "list" => [
      {
        "name"   => "round_robin",
        "id"     => :round_robin,
        "optstr" => "\"round-robin 0\""
      },
      { "name" => "none", "id" => :none, "optstr" => "" }
    ]
  }

  @path_selector_opts = {
    "type" => "combobox",
    "list" => [
      {
        "name"   => "round_robin",
        "id"     => :round_robin,
        "optstr" => "\"round-robin 0\""
      },
      { "name" => "none", "id" => :none, "optstr" => "" }
    ]
  }

  @path_gp_opts = {
    "type" => "combobox",
    "list" => [
      { "name" => "failover", "id" => :failover, "optstr" => "failover" },
      { "name" => "multibus", "id" => :multibus, "optstr" => "multibus" },
      {
        "name"   => "group_by_serial",
        "id"     => :group_by_serial,
        "optstr" => "group_by_serial"
      },
      {
        "name"   => "group_by_prio",
        "id"     => :group_by_prio,
        "optstr" => "group_by_prio"
      },
      {
        "name"   => "group_by_node_name",
        "id"     => :group_by_node_name,
        "optstr" => "group_by_node_name"
      },
      { "name" => "none", "id" => :none, "optstr" => "" }
    ]
  }

  @getuid_callout_opts = {
    "type" => "combobox",
    "list" => [
      {
        "name"   => "default",
        "id"     => :default,
        "optstr" => "\"/sbin/scsi_id -g -u -s\""
      },
      {
        "name"   => "customized_str",
        "id"     => :customized_str,
        "optstr" => "(callout path string)"
      }
    ]
  }

  @prio_callout_opts = {
    "type" => "combobox",
    "list" => [
      {
        "name"   => "prio_emc",
        "id"     => :prio_emc,
        "optstr" => "\"mpath_prio_emc /dev/%n\""
      },
      {
        "name"   => "prio_alua",
        "id"     => :prio_alua,
        "optstr" => "\"mpath_prio_alua /dev/%n\""
      },
      {
        "name"   => "prio_netapp",
        "id"     => :prio_netapp,
        "optstr" => "\"mpath_prio_netapp /dev/%n\""
      },
      {
        "name"   => "prio_tpc",
        "id"     => :prio_tpc,
        "optstr" => "\"mpath_prio_tpc /dev/%n\""
      },
      {
        "name"   => "prio_hp_sw",
        "id"     => :prio_hp_sw,
        "optstr" => "\"mpath_prio_hp_sw /dev/%n\""
      },
      {
        "name"   => "prio_hds_mod",
        "id"     => :prio_hds_mod,
        "optstr" => "\"mpath_prio_hds_modular %b\""
      },
      { "name" => "none", "id" => :none, "optstr" => "" }
    ]
  }

  @features_opts = {
    "type" => "combobox",
    "list" => [
      { "name" => "0", "id" => :zero, "optstr" => "0" },
      {
        "name"   => "queue_if_no_path",
        "id"     => :queue_if_no_path,
        "optstr" => "\"1 queue_if_no_path\""
      },
      { "name" => "none", "id" => :none, "optstr" => "" }
    ]
  }

  @path_checker_opts = {
    "type" => "combobox",
    "list" => [
      {
        "name"   => "readsector0",
        "id"     => :readsector0,
        "optstr" => "readsector0"
      },
      { "name" => "tur", "id" => :tur, "optstr" => "tur" },
      {
        "name"   => "emc_clariion",
        "id"     => :emc_clariion,
        "optstr" => "emc_clariion"
      },
      { "name" => "hp_sw", "id" => :hp_sw, "optstr" => "hp_sw" },
      { "name" => "rdac", "id" => :rdac, "optstr" => "rdac" },
      { "name" => "directio", "id" => :directio, "optstr" => "directio" },
      { "name" => "none", "id" => :none, "optstr" => "" }
    ]
  }

  @failback_opts = {
    "type" => "combobox",
    "list" => [
      { "name" => "manual", "id" => :manual, "optstr" => "manual" },
      { "name" => "immediate", "id" => :immediate, "optstr" => "immediate" },
      {
        "name"   => "customized_str",
        "id"     => :customized_str,
        "optstr" => "(number > 0)"
      }
    ]
  }

  @rr_min_io_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "rr_min_io", "NA"),
      "id"   => :rr_min_io
    }
  }

  @rr_weight_opts = {
    "type" => "combobox",
    "list" => [
      {
        "name"   => "priorities",
        "id"     => :priorities,
        "optstr" => "priorities"
      },
      { "name" => "uniform", "id" => :uniform, "optstr" => "uniform" },
      { "name" => "none", "id" => :none, "optstr" => "" }
    ]
  }

  @no_path_retry_opts = {
    "type" => "combobox",
    "list" => [
      { "name" => "fail", "id" => :fail, "optstr" => "fail" },
      { "name" => "queue", "id" => :queue, "optstr" => "queue" },
      {
        "name"   => "customized_str",
        "id"     => :customized_str,
        "optstr" => "(number >= 0)"
      }
    ]
  }

  @user_friendly_names_opts = {
    "type" => "combobox",
    "list" => [
      { "name" => "yes", "id" => :yes, "optstr" => "yes" },
      { "name" => "no", "id" => :no, "optstr" => "no" },
      { "name" => "none", "id" => :none, "optstr" => "" }
    ]
  }

  @wwid_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "wwid", "NA"),
      "id"   => :wwid
    }
  }

  @devnode_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "devnode", "NA"),
      "id"   => :devnode
    }
  }

  @alias_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "alias", "NA"),
      "id"   => :alias
    }
  }

  @vendor_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "vendor", "NA"),
      "id"   => :vendor
    }
  }

  @product_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "product", "NA"),
      "id"   => :product
    }
  }

  @product_blacklist_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "product_blacklist", "NA"),
      "id"   => :product_blacklist
    }
  }

  @hardware_handler_opts = {
    "type"  => "textentry",
    "entry" => {
      "name" => Ops.get_string(@optlabel, "hardware_handler", "NA"),
      "id"   => :hardware_handler
    }
  }

  @build_term_handlers = {
    :polling_interval     => fun_ref(
      method(:build_polling_interval_term),
      "term (symbol)"
    ),
    :udev_dir             => fun_ref(
      method(:build_udev_dir_term),
      "term (symbol)"
    ),
    :selector             => fun_ref(
      method(:build_selector_term),
      "term (symbol)"
    ),
    :path_selector        => fun_ref(
      method(:build_path_selector_term),
      "term (symbol)"
    ),
    :path_grouping_policy => fun_ref(
      method(:build_path_gp_term),
      "term (symbol)"
    ),
    :getuid_callout       => fun_ref(
      method(:build_getuid_callout_term),
      "term (symbol)"
    ),
    :prio_callout         => fun_ref(
      method(:build_prio_callout_term),
      "term (symbol)"
    ),
    :features             => fun_ref(
      method(:build_features_term),
      "term (symbol)"
    ),
    :path_checker         => fun_ref(
      method(:build_path_checker_term),
      "term (symbol)"
    ),
    :failback             => fun_ref(
      method(:build_failback_term),
      "term (symbol)"
    ),
    :rr_min_io            => fun_ref(
      method(:build_rr_min_io_term),
      "term (symbol)"
    ),
    :rr_weight            => fun_ref(
      method(:build_rr_weight_term),
      "term (symbol)"
    ),
    :no_path_retry        => fun_ref(
      method(:build_no_path_retry_term),
      "term (symbol)"
    ),
    :user_friendly_names  => fun_ref(
      method(:build_user_friendly_names_term),
      "term (symbol)"
    ),
    :wwid                 => fun_ref(
      method(:build_wwid_term),
      "term (symbol)"
    ),
    :devnode              => fun_ref(
      method(:build_devnode_term),
      "term (symbol)"
    ),
    :alias                => fun_ref(
      method(:build_alias_term),
      "term (symbol)"
    ),
    :vendor               => fun_ref(
      method(:build_vendor_term),
      "term (symbol)"
    ),
    :product              => fun_ref(
      method(:build_product_term),
      "term (symbol)"
    ),
    :product_blacklist    => fun_ref(
      method(:build_product_blacklist_term),
      "term (symbol)"
    ),
    :hardware_handler     => fun_ref(
      method(:build_hardware_handler_term),
      "term (symbol)"
    )
  }

  @update_term_handlers = {
    :polling_interval     => fun_ref(
      method(:update_polling_interval_term),
      "void (map)"
    ),
    :udev_dir             => fun_ref(
      method(:update_udev_dir_term),
      "void (map)"
    ),
    :selector             => fun_ref(
      method(:update_selector_term),
      "void (map)"
    ),
    :path_selector        => fun_ref(
      method(:update_path_selector_term),
      "void (map)"
    ),
    :path_grouping_policy => fun_ref(
      method(:update_path_gp_term),
      "void (map)"
    ),
    :getuid_callout       => fun_ref(
      method(:update_getuid_callout_term),
      "void (map)"
    ),
    :prio_callout         => fun_ref(
      method(:update_prio_callout_term),
      "void (map)"
    ),
    :features             => fun_ref(
      method(:update_features_term),
      "void (map)"
    ),
    :path_checker         => fun_ref(
      method(:update_path_checker_term),
      "void (map)"
    ),
    :failback             => fun_ref(
      method(:update_failback_term),
      "void (map)"
    ),
    :rr_min_io            => fun_ref(
      method(:update_rr_min_io_term),
      "void (map)"
    ),
    :rr_weight            => fun_ref(
      method(:update_rr_weight_term),
      "void (map)"
    ),
    :no_path_retry        => fun_ref(
      method(:update_no_path_retry_term),
      "void (map)"
    ),
    :user_friendly_names  => fun_ref(
      method(:update_user_friendly_names_term),
      "void (map)"
    ),
    :wwid                 => fun_ref(
      method(:update_wwid_term),
      "void (map)"
    ),
    :devnode              => fun_ref(
      method(:update_devnode_term),
      "void (map)"
    ),
    :alias                => fun_ref(
      method(:update_alias_term),
      "void (map)"
    ),
    :vendor               => fun_ref(
      method(:update_vendor_term),
      "void (map)"
    ),
    :product              => fun_ref(
      method(:update_product_term),
      "void (map)"
    ),
    :product_blacklist    => fun_ref(
      method(:update_product_blacklist_term),
      "void (map)"
    ),
    :hardware_handler     => fun_ref(
      method(:update_hardware_handler_term),
      "void (map)"
    )
  }

  @default_item_handlers = {
    :polling_interval     => fun_ref(
      method(:polling_interval_handler),
      "map (map)"
    ),
    :udev_dir             => fun_ref(method(:udev_dir_handler), "map (map)"),
    :selector             => fun_ref(method(:selector_handler), "map (map)"),
    :path_selector        => fun_ref(
      method(:path_selector_handler),
      "map (map)"
    ),
    :path_grouping_policy => fun_ref(method(:path_gp_handler), "map (map)"),
    :getuid_callout       => fun_ref(
      method(:getuid_callout_handler),
      "map (map)"
    ),
    :prio_callout         => fun_ref(
      method(:prio_callout_handler),
      "map (map)"
    ),
    :features             => fun_ref(method(:features_handler), "map (map)"),
    :path_checker         => fun_ref(
      method(:path_checker_handler),
      "map (map)"
    ),
    :failback             => fun_ref(method(:failback_handler), "map (map)"),
    :rr_min_io            => fun_ref(
      method(:rr_min_io_handler),
      "map (map)"
    ),
    :rr_weight            => fun_ref(
      method(:rr_weight_handler),
      "map (map)"
    ),
    :no_path_retry        => fun_ref(
      method(:no_path_retry_handler),
      "map (map)"
    ),
    :user_friendly_names  => fun_ref(
      method(:user_friendly_names_handler),
      "map (map)"
    ),
    :wwid                 => fun_ref(method(:wwid_handler), "map (map)"),
    :devnode              => fun_ref(method(:devnode_handler), "map (map)"),
    :alias                => fun_ref(method(:alias_handler), "map (map)"),
    :vendor               => fun_ref(method(:vendor_handler), "map (map)"),
    :product              => fun_ref(method(:product_handler), "map (map)"),
    :product_blacklist    => fun_ref(
      method(:product_blacklist_handler),
      "map (map)"
    ),
    :hardware_handler     => fun_ref(
      method(:hardware_handler_handler),
      "map (map)"
    )
  }

  @check_handlers = {
    :polling_interval     => fun_ref(
      method(:check_polling_interval),
      "map (map)"
    ),
    :udev_dir             => fun_ref(method(:check_udev_dir), "map (map)"),
    :selector             => fun_ref(method(:check_selector), "map (map)"),
    :path_selector        => fun_ref(
      method(:check_path_selector),
      "map (map)"
    ),
    :path_grouping_policy => fun_ref(method(:check_path_gp), "map (map)"),
    :getuid_callout       => fun_ref(
      method(:check_getuid_callout),
      "map (map)"
    ),
    :prio_callout         => fun_ref(
      method(:check_prio_callout),
      "map (map)"
    ),
    :features             => fun_ref(method(:check_features), "map (map)"),
    :path_checker         => fun_ref(
      method(:check_path_checker),
      "map (map)"
    ),
    :failback             => fun_ref(method(:check_failback), "map (map)"),
    :rr_min_io            => fun_ref(method(:check_rr_min_io), "map (map)"),
    :rr_weight            => fun_ref(method(:check_rr_weight), "map (map)"),
    :no_path_retry        => fun_ref(
      method(:check_no_path_retry),
      "map (map)"
    ),
    :user_friendly_names  => fun_ref(
      method(:check_user_friendly_names),
      "map (map)"
    ),
    :wwid                 => fun_ref(method(:check_wwid), "map (map)"),
    :devnode              => fun_ref(method(:check_devnode), "map (map)"),
    :alias                => fun_ref(method(:check_alias), "map (map)"),
    :vendor               => fun_ref(method(:check_vendor), "map (map)"),
    :product              => fun_ref(method(:check_product), "map (map)"),
    :product_blacklist    => fun_ref(
      method(:check_product_blacklist),
      "map (map)"
    ),
    :hardware_handler     => fun_ref(
      method(:check_hardware_handler),
      "map (map)"
    )
  }


  @multipath_detail_items = [
    :path_grouping_policy,
    :path_checker,
    :path_selector,
    :failback,
    :no_path_retry,
    :rr_min_io
  ]

  @multipath_brief_items = [:wwid, :alias]


  @defaults_section_items = [
    :polling_interval,
    :udev_dir,
    :selector,
    :path_grouping_policy,
    :getuid_callout,
    :prio_callout,
    :features,
    :path_checker,
    :failback,
    :rr_min_io,
    :rr_weight,
    :no_path_retry,
    :user_friendly_names
  ]

  @device_detail_items = [
    :hardware_handler,
    :path_grouping_policy,
    :getuid_callout,
    :path_selector,
    :path_checker,
    :features,
    :prio_callout,
    :failback,
    :rr_weight,
    :no_path_retry,
    :rr_min_io
  ]

  @device_brief_items = [:vendor, :product, :product_blacklist]

  @blacklist_section_items = [:wwid, :devnode, :vendor, :product]
end

- (Object) no_path_retry_handler(item)



1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
# File '../../src/include/multipath/options.rb', line 1841

def no_path_retry_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:no_path_retry), :Value)
  if ret == :fail
    UI.ReplaceWidget(
      Id(:replace_no_path_retry),
      build_no_path_retry_term(:combobox_only)
    )
    UI.ChangeWidget(Id(:no_path_retry), :Value, :fail)
    value = "fail"
  elsif ret == :queue
    UI.ReplaceWidget(
      Id(:replace_no_path_retry),
      build_no_path_retry_term(:combobox_only)
    )
    UI.ChangeWidget(Id(:no_path_retry), :Value, :queue)
    value = "queue"
  elsif ret == :customized_str
    value = Ops.get_string(@temp_string_values, "no_path_retry", "")
    UI.ReplaceWidget(
      Id(:replace_no_path_retry),
      build_no_path_retry_term(:editable_combobox_only)
    )
    UI.ChangeWidget(
      Id(:no_path_retry),
      :ValidChars,
      build_valid_chars("number")
    )
    UI.ChangeWidget(Id(:no_path_retry), :Value, value)
    UI.SetFocus(Id(:no_path_retry))
    @replacewidget_notify = true
  elsif ret == ""
    UI.ReplaceWidget(
      Id(:replace_no_path_retry),
      build_no_path_retry_term(:editable_combobox_only)
    )
    UI.ChangeWidget(
      Id(:no_path_retry),
      :ValidChars,
      build_valid_chars("number")
    )
    UI.SetFocus(Id(:no_path_retry))
    UI.ChangeWidget(Id(:no_path_retry), :Value, "")
    value = ""
    Ops.set(@temp_string_values, "no_path_retry", value)
    @replacewidget_notify = true
  elsif Builtins.tointeger(ret) != nil
    value = Convert.to_string(ret)
    Ops.set(@temp_string_values, "no_path_retry", value)
  else
    Popup.Message(
      Builtins.sformat("no_path_retry_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "no_path_retry", value)
  deep_copy(item)
end

- (Object) path_checker_handler(item)



1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
# File '../../src/include/multipath/options.rb', line 1471

def path_checker_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:path_checker), :Value)
  if ret == :none
    value = ""
  elsif ret == :readsector0
    value = "readsector0"
  elsif ret == :tur
    value = "tur"
  elsif ret == :emc_clariion
    value = "emc_clariion"
  elsif ret == :hp_sw
    value = "hp_sw"
  elsif ret == :rdac
    value = "rdac"
  elsif ret == :directio
    value = "directio"
  else
    Popup.Message(
      Builtins.sformat("path_checker_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "path_checker", value)
  deep_copy(item)
end

- (Object) path_gp_handler(item)



1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
# File '../../src/include/multipath/options.rb', line 1089

def path_gp_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:path_grouping_policy), :Value)
  if ret == :none
    value = ""
  elsif ret == :failover
    value = "failover"
  elsif ret == :multibus
    value = "multibus"
  elsif ret == :group_by_serial
    value = "group_by_serial"
  elsif ret == :group_by_prio
    value = "group_by_prio"
  elsif ret == :group_by_node_name
    value = "group_by_node_name"
  else
    Popup.Message(
      Builtins.sformat("path_gp_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "path_grouping_policy", value)
  deep_copy(item)
end

- (Object) path_selector_handler(item)



1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
# File '../../src/include/multipath/options.rb', line 1026

def path_selector_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:path_selector), :Value)
  if ret == :round_robin
    value = "round-robin 0"
  elsif ret == :none
    value = ""
  else
    Popup.Message(
      Builtins.sformat("path_selector_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "path_selector", value)
  deep_copy(item)
end

- (Object) polling_interval_handler(item)



794
795
796
797
798
799
800
801
802
803
804
805
806
807
# File '../../src/include/multipath/options.rb', line 794

def polling_interval_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:polling_interval), :Value)
  if Ops.is_string?(ret) == true
    value = Convert.to_string(ret)
  else
    Popup.Message(
      Builtins.sformat("polling_interval_handler: unexpectd ret %1", ret)
    )
  end
  Ops.set(item, "polling_interval", value)
  deep_copy(item)
end

- (Object) prio_callout_handler(item)



1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
# File '../../src/include/multipath/options.rb', line 1305

def prio_callout_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:prio_callout), :Value)
  if ret == :prio_emc
    value = "mpath_prio_emc /dev/%n"
  elsif ret == :prio_alua
    value = "mpath_prio_alua /dev/%n"
  elsif ret == :prio_netapp
    value = "mpath_prio_netapp /dev/%n"
  elsif ret == :prio_tpc
    value = "mpath_prio_tpc /dev/%n"
  elsif ret == :prio_hp_sw
    value = "mpath_prio_hp_sw /dev/%n"
  elsif ret == :prio_hds_mod
    value = "mpath_prio_hds_modular %b"
  elsif ret == :none
    value = ""
  else
    Popup.Message(
      Builtins.sformat("prio_callout_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "prio_callout", value)
  deep_copy(item)
end

- (Object) product_blacklist_handler(item)



2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
# File '../../src/include/multipath/options.rb', line 2286

def product_blacklist_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:product_blacklist), :Value)
  if Ops.is_string?(ret) == true
    value = Convert.to_string(ret)
  else
    Popup.Message(
      Builtins.sformat("product_blacklist_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "product_blacklist", value)
  deep_copy(item)
end

- (Object) product_handler(item)



2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
# File '../../src/include/multipath/options.rb', line 2226

def product_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:product), :Value)
  if Ops.is_string?(ret) == true
    value = Convert.to_string(ret)
  else
    Popup.Message(
      Builtins.sformat("product_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "product", value)
  deep_copy(item)
end

- (Object) rm_quotes(value)

remove all the quotes at head and end. ignore quotes in the be middle of value



679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
# File '../../src/include/multipath/options.rb', line 679

def rm_quotes(value)
  str_len = 0
  str_start = 0
  str_end = 0

  str_len = Builtins.size(value)
  return "" if Ops.less_or_equal(str_len, 0)
  str_end = Ops.subtract(str_len, 1)
  while Ops.less_than(str_start, str_len)
    cur_char = Builtins.substring(value, str_start, 1)
    if cur_char == " " || cur_char == "\t" || cur_char == " " ||
        cur_char == "\n" ||
        cur_char == "\""
      str_start = Ops.add(str_start, 1)
      next
    end
    break
  end

  while Ops.greater_than(str_end, str_start)
    cur_char = Builtins.substring(value, str_end, 1)
    if cur_char == " " || cur_char == "\t" || cur_char == " " ||
        cur_char == "\n" ||
        cur_char == "\""
      str_end = Ops.subtract(str_end, 1)
      next
    end
    break
  end
  result = ""
  if Ops.greater_or_equal(str_end, str_start)
    result = Builtins.substring(
      value,
      str_start,
      Ops.add(Ops.subtract(str_end, str_start), 1)
    )
  end
  result
end

- (Object) rr_min_io_handler(item)



1681
1682
1683
1684
1685
1686
1687
1688
# File '../../src/include/multipath/options.rb', line 1681

def rr_min_io_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:rr_min_io), :Value)
  value = Convert.to_string(ret) if Builtins.tointeger(ret) != nil
  Ops.set(item, "rr_min_io", value)
  deep_copy(item)
end

- (Object) rr_weight_handler(item)



1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
# File '../../src/include/multipath/options.rb', line 1749

def rr_weight_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:rr_weight), :Value)
  if ret == :priorities
    value = "priorities"
  elsif ret == :uniform
    value = "uniform"
  elsif ret == :none
    value = ""
  else
    Popup.Message(
      Builtins.sformat("rr_weight_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "rr_weight", value)
  deep_copy(item)
end

- (Object) selector_handler(item)



948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
# File '../../src/include/multipath/options.rb', line 948

def selector_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:selector), :Value)
  if ret == :round_robin
    value = "round-robin 0"
  elsif ret == :none
    value = ""
  else
    Popup.Message(
      Builtins.sformat("selector_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "selector", value)
  deep_copy(item)
end

- (Object) udev_dir_handler(item)



874
875
876
877
878
879
880
881
882
883
884
885
886
887
# File '../../src/include/multipath/options.rb', line 874

def udev_dir_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:udev_dir), :Value)
  if Ops.is_string?(ret)
    value = Convert.to_string(ret)
  else
    Popup.Message(
      Builtins.sformat("udev_dir_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "udev_dir", value)
  deep_copy(item)
end

- (Object) update_alias_term(item)



2113
2114
2115
2116
2117
2118
2119
2120
# File '../../src/include/multipath/options.rb', line 2113

def update_alias_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "alias", "")
  UI.ChangeWidget(Id(:alias), :ValidChars, build_valid_chars("alias"))
  UI.ChangeWidget(Id(:alias), :Value, value)

  nil
end

- (Object) update_devnode_term(item)



2057
2058
2059
2060
2061
2062
2063
2064
# File '../../src/include/multipath/options.rb', line 2057

def update_devnode_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "devnode", "")
  UI.ChangeWidget(Id(:devnode), :ValidChars, build_valid_chars("devnode"))
  UI.ChangeWidget(Id(:devnode), :Value, value)

  nil
end

- (Object) update_failback_term(item)



1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
# File '../../src/include/multipath/options.rb', line 1551

def update_failback_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "failback", "")
  if value == "manual"
    UI.ChangeWidget(Id(:failback), :Value, :manual)
  elsif value == "immediate"
    UI.ChangeWidget(Id(:failback), :Value, :immediate)
  else
    UI.ReplaceWidget(
      Id(:replace_failback),
      build_failback_term(:editable_combobox_only)
    )
    UI.ChangeWidget(Id(:failback), :ValidChars, build_valid_chars("number"))
    UI.ChangeWidget(Id(:failback), :Value, value)
    Ops.set(@temp_string_values, "failback", value)
  end

  nil
end

- (Object) update_features_term(item)



1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
# File '../../src/include/multipath/options.rb', line 1362

def update_features_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "features", "")

  if value == "1 queue_if_no_path"
    UI.ChangeWidget(Id(:features), :Value, :queue_if_no_path)
  elsif value == "0"
    UI.ChangeWidget(Id(:features), :Value, :zero)
  elsif value == ""
    UI.ChangeWidget(Id(:features), :Value, :none)
  else
    Popup.Message(
      Builtins.sformat("update_features_term: unexpected value %1", value)
    )
  end

  nil
end

- (Object) update_getuid_callout_term(item)



1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
# File '../../src/include/multipath/options.rb', line 1169

def update_getuid_callout_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "getuid_callout", "")
  if value == "/sbin/scsi_id -g -u -s"
    UI.ChangeWidget(Id(:getuid_callout), :Value, :default)
  else
    UI.ReplaceWidget(
      Id(:replace_getuid_callout),
      build_getuid_callout_term(:editable_combobox_only)
    )
    UI.ChangeWidget(
      Id(:getuid_callout),
      :ValidChars,
      build_valid_chars("path")
    )
    UI.ChangeWidget(Id(:getuid_callout), :Value, value)
    UI.SetFocus(Id(:getuid_callout))
  end

  nil
end

- (Object) update_hardware_handler_term(item)



2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
# File '../../src/include/multipath/options.rb', line 2329

def update_hardware_handler_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "hardware_handler", "")
  UI.ChangeWidget(
    Id(:hardware_handler),
    :ValidChars,
    build_valid_chars("hardware_handler")
  )
  UI.ChangeWidget(Id(:hardware_handler), :Value, value)

  nil
end

- (Object) update_no_path_retry_term(item)



1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
# File '../../src/include/multipath/options.rb', line 1817

def update_no_path_retry_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "no_path_retry", "")
  if value == "fail"
    UI.ChangeWidget(Id(:no_path_retry), :Value, :fail)
  elsif value == "queue"
    UI.ChangeWidget(Id(:no_path_retry), :Value, :queue)
  else
    UI.ReplaceWidget(
      Id(:replace_no_path_retry),
      build_no_path_retry_term(:editable_combobox_only)
    )
    UI.ChangeWidget(
      Id(:no_path_retry),
      :ValidChars,
      build_valid_chars("number")
    )
    UI.ChangeWidget(Id(:no_path_retry), :Value, value)
    Ops.set(@temp_string_values, "no_path_retry", value)
  end

  nil
end

- (Object) update_path_checker_term(item)



1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
# File '../../src/include/multipath/options.rb', line 1442

def update_path_checker_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "path_checker", "")
  if value == "readsector0"
    UI.ChangeWidget(Id(:path_checker), :Value, :readsector0)
  elsif value == "tur"
    UI.ChangeWidget(Id(:path_checker), :Value, :tur)
  elsif value == "emc_clariion"
    UI.ChangeWidget(Id(:path_checker), :Value, :emc_clariion)
  elsif value == "hp_sw"
    UI.ChangeWidget(Id(:path_checker), :Value, :hp_sw)
  elsif value == "rdac"
    UI.ChangeWidget(Id(:path_checker), :Value, :rdac)
  elsif value == "directio"
    UI.ChangeWidget(Id(:path_checker), :Value, :directio)
  elsif value == ""
    UI.ChangeWidget(Id(:path_checker), :Value, :none)
  else
    Popup.Message(
      Builtins.sformat(
        "update_path_checker_term: unexpected value %1",
        value
      )
    )
  end

  nil
end

- (Object) update_path_gp_term(item)



1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
# File '../../src/include/multipath/options.rb', line 1066

def update_path_gp_term(item)
  item = deep_copy(item)
  value = ""
  id = ""

  value = Ops.get_string(item, "path_grouping_policy", "")
  if value == "failover"
    UI.ChangeWidget(Id(:path_grouping_policy), :Value, :failover)
  elsif value == "multibus"
    UI.ChangeWidget(Id(:path_grouping_policy), :Value, :multibus)
  elsif value == "group_by_serial"
    UI.ChangeWidget(Id(:path_grouping_policy), :Value, :group_by_serial)
  elsif value == "group_by_prio"
    UI.ChangeWidget(Id(:path_grouping_policy), :Value, :group_by_prio)
  elsif value == "group_by_node_name"
    UI.ChangeWidget(Id(:path_grouping_policy), :Value, :group_by_node_name)
  else
    UI.ChangeWidget(Id(:path_grouping_policy), :Value, :none)
  end

  nil
end

- (Object) update_path_selector_term(item)



1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
# File '../../src/include/multipath/options.rb', line 1007

def update_path_selector_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "path_selector", "")
  if value == "round-robin 0"
    UI.ChangeWidget(Id(:path_selector), :Value, :round_robin)
  elsif value == ""
    UI.ChangeWidget(Id(:path_selector), :Value, :none)
  else
    Popup.Message(
      Builtins.sformat(
        "update_path_selector_term: unexpected value %1",
        value
      )
    )
  end

  nil
end

- (Object) update_polling_interval_term(item)



781
782
783
784
785
786
787
788
789
790
791
792
# File '../../src/include/multipath/options.rb', line 781

def update_polling_interval_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "polling_interval", "")
  UI.ChangeWidget(
    Id(:polling_interval),
    :ValidChars,
    build_valid_chars("number")
  )
  UI.ChangeWidget(Id(:polling_interval), :Value, value)

  nil
end

- (Object) update_prio_callout_term(item)



1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
# File '../../src/include/multipath/options.rb', line 1276

def update_prio_callout_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "prio_callout", "")
  if value == "mpath_prio_emc /dev/%n"
    UI.ChangeWidget(Id(:prio_callout), :Value, :prio_emc)
  elsif value == "mpath_prio_alua /dev/%n"
    UI.ChangeWidget(Id(:prio_callout), :Value, :prio_alua)
  elsif value == "mpath_prio_netapp /dev/%n"
    UI.ChangeWidget(Id(:prio_callout), :Value, :prio_netapp)
  elsif value == "mpath_prio_tpc /dev/%n"
    UI.ChangeWidget(Id(:prio_callout), :Value, :prio_tpc)
  elsif value == "mpath_prio_hp_sw /dev/%n"
    UI.ChangeWidget(Id(:prio_callout), :Value, :prio_hp_sw)
  elsif value == "mpath_prio_hds_modular %b"
    UI.ChangeWidget(Id(:prio_callout), :Value, :prio_hds_mod)
  elsif value == ""
    UI.ChangeWidget(Id(:prio_callout), :Value, :none)
  else
    Popup.Message(
      Builtins.sformat(
        "update_prio_callout_term: unexpected value %1",
        value
      )
    )
  end

  nil
end

- (Object) update_product_blacklist_term(item)



2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
# File '../../src/include/multipath/options.rb', line 2273

def update_product_blacklist_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "product_blacklist", "")
  UI.ChangeWidget(
    Id(:product_blacklist),
    :ValidChars,
    build_valid_chars("product_blacklist")
  )
  UI.ChangeWidget(Id(:product_blacklist), :Value, value)

  nil
end

- (Object) update_product_term(item)



2218
2219
2220
2221
2222
2223
2224
# File '../../src/include/multipath/options.rb', line 2218

def update_product_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "product", "")
  UI.ChangeWidget(Id(:product), :ValidChars, build_valid_chars("product"))
  UI.ChangeWidget(Id(:product), :Value, value)
  nil
end

- (Object) update_rr_min_io_term(item)



1672
1673
1674
1675
1676
1677
1678
1679
# File '../../src/include/multipath/options.rb', line 1672

def update_rr_min_io_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "rr_min_io", "")
  UI.ChangeWidget(Id(:rr_min_io), :ValidChars, build_valid_chars("number"))
  UI.ChangeWidget(Id(:rr_min_io), :Value, value)

  nil
end

- (Object) update_rr_weight_term(item)



1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
# File '../../src/include/multipath/options.rb', line 1731

def update_rr_weight_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "rr_weight", "")
  if value == "priorities"
    UI.ChangeWidget(Id(:rr_weight), :Value, :priorities)
  elsif value == "uniform"
    UI.ChangeWidget(Id(:rr_weight), :Value, :uniform)
  elsif value == ""
    UI.ChangeWidget(Id(:rr_weight), :Value, :none)
  else
    Popup.Message(
      Builtins.sformat("update_rr_weight_term: unexpected value %1", value)
    )
  end

  nil
end

- (Object) update_selector_term(item)



932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File '../../src/include/multipath/options.rb', line 932

def update_selector_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "selector", "")
  if value == "round-robin 0"
    UI.ChangeWidget(Id(:selector), :Value, :round_robin)
  elsif value == ""
    UI.ChangeWidget(Id(:selector), :Value, :none)
  else
    Popup.Message(
      Builtins.sformat("update_selector_term: unexpected value %1", value)
    )
  end

  nil
end

- (Object) update_udev_dir_term(item)



865
866
867
868
869
870
871
872
# File '../../src/include/multipath/options.rb', line 865

def update_udev_dir_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "udev_dir", "")
  UI.ChangeWidget(Id(:udev_dir), :ValidChars, build_valid_chars("path"))
  UI.ChangeWidget(Id(:udev_dir), :Value, value)

  nil
end

- (Object) update_user_friendly_names_term(item)



1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
# File '../../src/include/multipath/options.rb', line 1937

def update_user_friendly_names_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "user_friendly_names", "")
  if value == "yes"
    UI.ChangeWidget(Id(:user_friendly_names), :Value, :yes)
  elsif value == "no"
    UI.ChangeWidget(Id(:user_friendly_names), :Value, :no)
  elsif value == ""
    UI.ChangeWidget(Id(:user_friendly_names), :Value, :none)
  else
    Popup.Message(
      Builtins.sformat(
        "update_user_friendly_names_term: unexpected value %1",
        value
      )
    )
  end

  nil
end

- (Object) update_vendor_term(item)



2162
2163
2164
2165
2166
2167
2168
2169
# File '../../src/include/multipath/options.rb', line 2162

def update_vendor_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "vendor", "")
  UI.ChangeWidget(Id(:vendor), :ValidChars, build_valid_chars("vendor"))
  UI.ChangeWidget(Id(:vendor), :Value, value)

  nil
end

- (Object) update_wwid_term(item)



2008
2009
2010
2011
2012
2013
2014
2015
# File '../../src/include/multipath/options.rb', line 2008

def update_wwid_term(item)
  item = deep_copy(item)
  value = Ops.get_string(item, "wwid", "")
  UI.ChangeWidget(Id(:wwid), :ValidChars, build_valid_chars("wwid"))
  UI.ChangeWidget(Id(:wwid), :Value, value)

  nil
end

- (Object) user_friendly_names_handler(item)



1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
# File '../../src/include/multipath/options.rb', line 1958

def user_friendly_names_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:user_friendly_names), :Value)
  if ret == :yes
    value = "yes"
  elsif ret == :no
    value = "no"
  elsif ret == :none
    value = ""
  else
    Popup.Message(
      Builtins.sformat(
        "user_friendly_names_handler: unexpected ret %1",
        ret
      )
    )
  end
  Ops.set(item, "user_friendly_names", value)
  deep_copy(item)
end

- (Object) vendor_handler(item)



2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
# File '../../src/include/multipath/options.rb', line 2171

def vendor_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:vendor), :Value)
  if Ops.is_string?(ret) == true
    value = Convert.to_string(ret)
  else
    Popup.Message(
      Builtins.sformat("vendor_handler: unexpected ret %1", ret)
    )
  end
  Ops.set(item, "vendor", value)
  deep_copy(item)
end

- (Object) wwid_handler(item)



2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
# File '../../src/include/multipath/options.rb', line 2017

def wwid_handler(item)
  item = deep_copy(item)
  value = ""
  ret = UI.QueryWidget(Id(:wwid), :Value)
  if Ops.is_string?(ret) == true
    value = Convert.to_string(ret)
  else
    Popup.Message(Builtins.sformat("wwid_handler: unexpected ret %1", ret))
  end
  Ops.set(item, "wwid", value)
  deep_copy(item)
end