Module: Yast::ClusterDialogsInclude
- Defined in:
- ../../src/include/cluster/dialogs.rb
Instance Method Summary (collapse)
- - (Object) addr_input_dialog(value, autoid, dual)
-
- (Object) calc_network_addr(ip, mask)
only work when IPv4.
- - (Object) CommunicationDialog
-
- (Object) CommunicationLayout
BNC#871970, change member address struct to memberaddr.
- - (Object) conntrack_layout
- - (Object) ConntrackDialog
- - (Object) csync2_layout
-
- (Object) csync2_status
return 1 if csync2 is not installed well return 2 if csync2 is OFF or csync2 is blocked by firewall return 3 if csync2 is ON.
- - (Object) csync2_turn_off
- - (Object) csync2_turn_on
- - (Object) Csync2Dialog
- - (Object) fill_conntrack_entries
- - (Object) fill_csync_entries
- - (Object) fill_memberaddr_entries
- - (Object) initialize_cluster_dialogs(include_target)
- - (Object) SaveCommunication
- - (Object) SaveCommunicationToConf
- - (Object) SaveSecurity
- - (Object) SaveSecurityToConf
- - (Object) SecurityDialog
- - (Object) ServiceDialog
-
- (Object) text_input_dialog(title, value)
return `cancel or a string.
-
- (Object) transport_switch
BNC#871970, change member address struct to memberaddr.
- - (Object) UpdateServiceStatus
-
- (Object) ValidateCommunication
BNC#871970, change member address struct.
- - (Object) ValidateSecurity
- - (Object) ValidateService
- - (Object) ValidNodeID
- - (Object) VerifyConntrackdConf
Instance Method Details
- (Object) addr_input_dialog(value, autoid, dual)
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 |
# File '../../src/include/cluster/dialogs.rb', line 101 def addr_input_dialog(value, autoid, dual) ret = nil value.default="" # BNC#871970, change member address struct UI.OpenDialog( MarginBox( 1, 1, VBox( HBox( MinWidth(40, InputField(Id(:addr1), _("IP Address"), value[:addr1])), HSpacing(1), MinWidth(40, InputField(Id(:addr2), _("Redundant IP Address"), value[:addr2])), HSpacing(1), MinWidth(20, InputField(Id(:mynodeid), _("Node ID") , value[:nodeid])) ), VSpacing(1), Right( HBox( PushButton(Id(:ok), _("OK")), PushButton(Id(:cancel), _("Cancel")) ) ) ) ) ) if (autoid) UI.ChangeWidget(:mynodeid, :Enabled, false) end if (!dual) UI.ChangeWidget(:addr2, :Enabled, false) end ret = UI.UserInput if ret == :ok if ( UI.QueryWidget(:mynodeid, :Value) != "" ) && ( UI.QueryWidget(:addr2, :Value) != "" ) ret = {:addr1 => UI.QueryWidget(:addr1, :Value), :addr2 => UI.QueryWidget(:addr2, :Value), :nodeid => UI.QueryWidget(:mynodeid, :Value)} elsif ( UI.QueryWidget(:mynodeid, :Value) == "" ) && ( UI.QueryWidget(:addr2, :Value) != "" ) ret = {:addr1 => UI.QueryWidget(:addr1, :Value), :addr2 => UI.QueryWidget(:addr2, :Value)} elsif ( UI.QueryWidget(:mynodeid, :Value) != "" ) && ( UI.QueryWidget(:addr2, :Value) == "" ) ret = {:addr1 => UI.QueryWidget(:addr1, :Value), :nodeid => UI.QueryWidget(:mynodeid, :Value)} else ret = {:addr1 => UI.QueryWidget(:addr1, :Value)} end end UI.CloseDialog deep_copy(ret) end |
- (Object) calc_network_addr(ip, mask)
only work when IPv4
376 377 378 379 380 381 382 383 |
# File '../../src/include/cluster/dialogs.rb', line 376 def calc_network_addr(ip, mask) IP.ToString( Ops.bitwise_and( IP.ToInteger(ip), Ops.shift_left(4294967295, Ops.subtract(32, mask.to_i)) ) ) end |
- (Object) CommunicationDialog
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 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
# File '../../src/include/cluster/dialogs.rb', line 577 def CommunicationDialog ret = nil CommunicationLayout() while true fill_memberaddr_entries transport_switch ret = UI.UserInput if ret == :bindnetaddr1 || ret == :bindnetaddr2 || ret == :mcastaddr1 || ret == :mcastaddr2 ip6 = false netaddr = Convert.to_string(UI.QueryWidget(Id(ret), :Value)) ip6 = IP.Check6(netaddr) if ip6 Cluster.ip_version = "ipv6" UI.ChangeWidget(Id(:autoid), :Value, false) UI.ChangeWidget(Id(:autoid), :Enabled, false) else Cluster.ip_version = "ipv4" UI.ChangeWidget(Id(:autoid), :Enabled, true) end next end if ret == :enable2 if UI.QueryWidget(Id(:enable2), :Value) # Changewidget items will change value to first one automatically rrpvalue = UI.QueryWidget(Id(:rrpmode), :Value) UI.ChangeWidget(Id(:rrpmode), :Items, ["passive","active"]) UI.ChangeWidget(Id(:rrpmode), :Enabled, true) UI.ChangeWidget(Id(:rrpmode), :Value, rrpvalue) if rrpvalue != "none" else UI.ChangeWidget(Id(:rrpmode), :Items, ["none"]) UI.ChangeWidget(Id(:rrpmode), :Value, "none") UI.ChangeWidget(Id(:rrpmode), :Enabled, false) end end if ret == :memberaddr_add ret = addr_input_dialog({}, UI.QueryWidget(Id(:autoid), :Value), UI.QueryWidget(Id(:enable2), :Value)) next if ret == :cancel Cluster.memberaddr.push(ret) end if ret == :memberaddr_edit current = 0 str = "" # The value will be nil if the list is empty, however nil.to_i is 0 current = UI.QueryWidget(:memberaddr, :CurrentItem).to_i ret = addr_input_dialog(Cluster.memberaddr[current] || {} ,UI.QueryWidget(Id(:autoid), :Value ), UI.QueryWidget(Id(:enable2), :Value)) next if ret == :cancel Cluster.memberaddr[current]= ret end if ret == :memberaddr_del current = 0 current = Convert.to_integer( UI.QueryWidget(:memberaddr, :CurrentItem) ) # Notice, current could be "nil" if the list is empty. Cluster.memberaddr = Builtins.remove(Cluster.memberaddr, current) end if ret == :next || ret == :back val = ValidateCommunication() if val == true SaveCommunication() break else ret = nil next end end if ret == :abort || ret == :cancel if ReallyAbort() return deep_copy(ret) else next end end if ret == :wizardTree ret = Convert.to_string(UI.QueryWidget(Id(:wizardTree), :CurrentItem)) end if Builtins.contains(@DIALOG, Convert.to_string(ret)) ret = Builtins.symbolof(Builtins.toterm(ret)) val = ValidateCommunication() if val == true SaveCommunication() break else ret = nil Wizard.SelectTreeItem("communication") next end end Builtins.y2error("unexpected retcode: %1", ret) end deep_copy(ret) end |
- (Object) CommunicationLayout
BNC#871970, change member address struct to memberaddr
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 |
# File '../../src/include/cluster/dialogs.rb', line 407 def CommunicationLayout result = {} result = Convert.to_map( SCR.Execute( path(".target.bash_output"), "/sbin/ip addr show scope global | grep inet | awk '{print $2}' | awk -F'/' '{print $1, $2}'" ) ) existing_ips = [] if Builtins.size(Ops.get_string(result, "stdout", "")) != 0 ip_masks = Builtins.splitstring( Ops.get_string(result, "stdout", ""), "\n" ) Builtins.foreach(ip_masks) do |s| ip_mask_list = Builtins.splitstring(s, " ") ip = Ops.get(ip_mask_list, 0, "") mask = Ops.get(ip_mask_list, 1, "") ip4 = false ip4 = IP.Check4(ip) if ip4 existing_ips = Builtins.add( existing_ips, calc_network_addr(ip, mask) ) end end end transport = ComboBox( Id(:transport), Opt(:hstretch, :notify), _("Transport:"), [ Item(Id("udp"),"Multicast"), Item(Id("udpu"),"Unicast") ] ) iface = Frame( _("Channel"), VBox( ComboBox( Id(:bindnetaddr1), Opt(:editable, :hstretch, :notify), _("Bind Network Address:"), Builtins.toset(existing_ips) ), InputField( Id(:mcastaddr1), Opt(:hstretch, :notify), _("Multicast Address:") ), InputField(Id(:mcastport1), Opt(:hstretch), _("Multicast Port:")), ) ) riface = CheckBoxFrame( Id(:enable2), Opt(:notify), _("Redundant Channel"), false, VBox( ComboBox( Id(:bindnetaddr2), Opt(:editable, :hstretch, :notify), _("Bind Network Address:"), existing_ips ), InputField(Id(:mcastaddr2), Opt(:hstretch), _("Multicast Address:")), InputField(Id(:mcastport2), Opt(:hstretch), _("Multicast Port:")), ) ) nid = VBox( HBox( Left(InputField(Id(:cluster_name),Opt(:hstretch), _("Cluster Name:"))), Left(InputField(Id(:expected_votes),Opt(:hstretch), _("Expected Votes:"),"")), ComboBox( Id(:rrpmode), Opt(:hstretch), _("rrp mode:"), ["none", "active", "passive"] ) ), Left( CheckBox(Id(:autoid), Opt(:notify), _("Auto Generate Node ID"), true) ) ) ip_table = VBox( Left(Label(_("Member Address:"))), Table(Id(:memberaddr), Header(_("IP"), _("Redundant IP"), _("Node ID")), []), Right(HBox( PushButton(Id(:memberaddr_add), "Add"), PushButton(Id(:memberaddr_del), "Del"), PushButton(Id(:memberaddr_edit), "Edit")) )) contents = VBox( transport, HBox(HWeight(1, VBox(iface)), HWeight(1, VBox(riface))), ip_table, HBox(nid), ) my_SetContents("communication", contents) UI.ChangeWidget(Id(:bindnetaddr1), :Value, Cluster.bindnetaddr1) UI.ChangeWidget(Id(:mcastaddr1), :Value, Cluster.mcastaddr1) UI.ChangeWidget(Id(:mcastport1), :Value, Cluster.mcastport1) UI.ChangeWidget(Id(:enable2), :Value, Cluster.enable2) UI.ChangeWidget(Id(:bindnetaddr2), :Value, Cluster.bindnetaddr2) UI.ChangeWidget(Id(:mcastaddr2), :Value, Cluster.mcastaddr2) UI.ChangeWidget(Id(:mcastport2), :Value, Cluster.mcastport2) UI.ChangeWidget(Id(:autoid), :Value, Cluster.autoid) UI.ChangeWidget(Id(:cluster_name), :Value, Cluster.cluster_name) UI.ChangeWidget(Id(:expected_votes), :Value, Cluster.expected_votes) UI.ChangeWidget(:expected_votes, :ValidChars, "0123456789" ); UI.ChangeWidget(Id(:transport), :Value, Cluster.transport) UI.ChangeWidget(Id(:rrpmode), :Value, Cluster.rrpmode) if "none" == Cluster.rrpmode UI.ChangeWidget(Id(:rrpmode), :Enabled, false) else UI.ChangeWidget(Id(:rrpmode), :Enabled, true) end # BNC#879596, check the corosync.conf format if Cluster.config_format == "old" Popup.Message(_(" NOTICE: Detected old corosync configuration.\n Please reconfigure the member list and confirm all other settings.")) Cluster.config_format = "showed" end transport_switch nil end |
- (Object) conntrack_layout
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 |
# File '../../src/include/cluster/dialogs.rb', line 1311 def conntrack_layout result = {} result = Convert.to_map( SCR.Execute( path(".target.bash_output"), "/sbin/ip a | grep MULTICAST | grep 'state UP' | awk '{print $2}' | awk -F: '{print $1}'" ) ) if Builtins.size(Ops.get_string(result, "stdout", "")) != 0 infs = Builtins.splitstring(Ops.get_string(result, "stdout", ""), "\n") Builtins.foreach(infs) do |inf| result = Convert.to_map( SCR.Execute( path(".target.bash_output"), Ops.add( Ops.add("/sbin/ip addr show scope global dev ", inf), " | grep inet | awk '{print $2}' | awk -F/ '{print $1}'" ) ) ) ip = Ops.get( Builtins.splitstring(Ops.get_string(result, "stdout", ""), "\n"), 0, "" ) if Builtins.size(ip) != 0 @usable_interface = Builtins.add(@usable_interface, inf) end end end VBox( Opt(:hvstretch), Label( Id(:conntrack_explain), Opt(:hstretch), _( "Conntrackd is a daemon which helps to duplicate firewall status between cluster nodes.\n" + "YaST can help to configure some basic aspects of conntrackd.\n" + "You need to start it with the ocf:heartbeat:conntrackd." ) ), HBox( Opt(), ComboBox( Id(:conntrack_bindinf), Opt(:hstretch, :notify), _("Dedicated Interface:"), Builtins.toset(@usable_interface) ), Label(Id(:conntrack_bindip), Opt(:hstretch), _("IP:")) ), InputField(Id(:conntrack_addr), Opt(:hstretch), _("Multicast Address:")), InputField(Id(:conntrack_group), Opt(:hstretch), _("Group Number:")), PushButton( Id(:conntrack_generate), Opt(:hstretch), _("Generate /etc/conntrackd/conntrackd.conf") ) ) end |
- (Object) ConntrackDialog
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 1470 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 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 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 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 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 |
# File '../../src/include/cluster/dialogs.rb', line 1444 def ConntrackDialog ret = nil my_SetContents("conntrack", conntrack_layout) fill_conntrack_entries while true ret = UI.UserInput if ret == :abort || ret == :cancel break if ReallyAbort() next end if ret == :next || ret == :back value = "" value = Convert.to_string(UI.QueryWidget(:conntrack_addr, :Value)) if value != "" SCR.Write(path(".sysconfig.conntrackd.CONNTRACK_ADDR"), value) end value = Convert.to_string(UI.QueryWidget(:conntrack_group, :Value)) if value != "" SCR.Write(path(".sysconfig.conntrackd.CONNTRACK_GROUP"), value) end value = Convert.to_string(UI.QueryWidget(:conntrack_bindinf, :Value)) if value != "" SCR.Write(path(".sysconfig.conntrackd.CONNTRACK_INTERFACE"), value) end break end if ret == :wizardTree ret = Convert.to_string(UI.QueryWidget(Id(:wizardTree), :CurrentItem)) end if ret == :conntrack_bindinf qr = Convert.to_string(UI.QueryWidget(:conntrack_bindinf, :Value)) ip = "" if qr != "" result = {} result = Convert.to_map( SCR.Execute( path(".target.bash_output"), Ops.add( Ops.add("/sbin/ip addr show scope global dev ", qr), " | grep inet | awk '{print $2}' | awk -F/ '{print $1}'" ) ) ) ip = Ops.get( Builtins.splitstring(Ops.get_string(result, "stdout", ""), "\n"), 0, "" ) end UI.ChangeWidget(:conntrack_bindip, :Label, Ops.add("IP: ", ip)) next end if ret == :conntrack_generate next if !VerifyConntrackdConf() addr = Convert.to_string(UI.QueryWidget(:conntrack_addr, :Value)) group = Convert.to_string(UI.QueryWidget(:conntrack_group, :Value)) inf = Convert.to_string(UI.QueryWidget(:conntrack_bindinf, :Value)) ip = "" if inf != "" result = {} result = Convert.to_map( SCR.Execute( path(".target.bash_output"), Ops.add( Ops.add("/sbin/ip addr show scope global dev ", inf), " | grep inet | awk '{print $2}' | awk -F/ '{print $1}'" ) ) ) ip = Ops.get( Builtins.splitstring(Ops.get_string(result, "stdout", ""), "\n"), 0, "" ) end fc_template = "Sync {\n" + "\tMode FTFW {\n" + "\t}\n" + "\tMulticast {\n" + "\t\tIPv4_address %1\n" + "\t\tGroup %2\n" + "\t\tIPv4_interface %3\n" + "\t\tInterface %4\n" + "\t\tSndSocketBuffer 1249280\n" + "\t\tRcvSocketBuffer 1249280\n" + "\t\tChecksum on\n" + "\t}\n" + "}\n" + "General {\n" + "\tNice -20\n" + "\tHashSize 32768\n" + "\tHashLimit 131072\n" + "\tLogFile on\n" + "\tLockFile /var/lock/conntrack.lock\n" + "\tUNIX {\n" + "\t\tPath /var/run/conntrackd.ctl\n" + "\t\tBacklog 20\n" + "\t}\n" + "\tNetlinkBufferSize 2097152\n" + "\tNetlinkBufferSizeMaxGrowth 8388608\n" + "\tFilter From Userspace {\n" + "\t\tProtocol Accept {\n" + "\t\t\tTCP\n" + "\t\t\tSCTP\n" + "\t\t\tDCCP\n" + "\t\t}\n" + "\t\tAddress Ignore {\n" + "\t\t\tIPv4_address 127.0.0.1\n" + "\t\t\tIPv4_address %5\n" + "\t\t}\n" + "\t}\n" + "}" fc = Builtins.sformat(fc_template, addr, group, ip, inf, ip) SCR.Execute(path(".target.bash_output"), "mkdir -p /etc/conntrackd") SCR.Execute( path(".target.bash_output"), "mv /etc/conntrackd/conntrackd.conf /etc/conntrackd/conntrackd.conf.YaST2bak" ) SCR.Execute( path(".target.bash_output"), Ops.add( Ops.add("echo \"", fc), "\" > /etc/conntrackd/conntrackd.conf.YaST2" ) ) SCR.Execute( path(".target.bash_output"), "mv /etc/conntrackd/conntrackd.conf.YaST2 /etc/conntrackd/conntrackd.conf" ) Popup.Message("Generated /etc/conntrackd/conntrackd.conf") next end if Builtins.contains(@DIALOG, Convert.to_string(ret)) ret = Builtins.symbolof(Builtins.toterm(ret)) break else Wizard.SelectTreeItem("conntrack") next end end deep_copy(ret) end |
- (Object) csync2_layout
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 |
# File '../../src/include/cluster/dialogs.rb', line 987 def csync2_layout VBox( Opt(:hvstretch), HBox( Frame( _("Sync Host"), VBox( SelectionBox(Id(:host_box), ""), HBox( PushButton(Id(:host_add), _("Add")), PushButton(Id(:host_del), _("Del")), PushButton(Id(:host_edit), _("Edit")) ) ) ), HSpacing(), Frame( _("Sync File"), VBox( SelectionBox(Id(:include_box), ""), HBox( PushButton(Id(:include_add), _("Add")), PushButton(Id(:include_del), _("Del")), PushButton(Id(:include_edit), _("Edit")), PushButton(Id(:include_suggest), _("Add Suggested Files")) ) ) ) ), HBox( PushButton( Id(:generate_key), Opt(:hstretch), _("Generate Pre-Shared-Keys") ), PushButton(Id(:csync2_switch), Opt(:hstretch), "") ) ) end |
- (Object) csync2_status
return 1 if csync2 is not installed well return 2 if csync2 is OFF or csync2 is blocked by firewall return 3 if csync2 is ON
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 |
# File '../../src/include/cluster/dialogs.rb', line 1031 def csync2_status csync2_socket = nil csync2_socket = SystemdSocket.find(@csync2_package) if !csync2_socket y2error("csync2.socket not found.") return 1 end if !csync2_socket.enabled? y2debug("csync2.socket is disabled.") return 2 end #check the firewall whether csync2 port was blocked. tcp_ports = [] tcp_ports = SuSEFirewallServices.GetNeededTCPPorts("service:cluster") pos = nil pos = Builtins.find(tcp_ports) { |s| s == @csync2_port } return 2 if pos == nil 3 end |
- (Object) csync2_turn_off
1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 |
# File '../../src/include/cluster/dialogs.rb', line 1054 def csync2_turn_off csync2_socket = nil csync2_socket = SystemdSocket.find(@csync2_package) if !csync2_socket y2error("csync2.socket is missing.") return nil end csync2_socket.stop csync2_socket.disable y2debug("Stop and disable csync2.socket.") tcp_ports = [] tcp_ports = SuSEFirewallServices.GetNeededTCPPorts("service:cluster") pos = nil pos = Builtins.find(tcp_ports) { |s| s == @csync2_port } if pos != nil tcp_ports = Builtins.remove(tcp_ports, Builtins.tointeger(pos)) end SuSEFirewallServices.SetNeededPortsAndProtocols( "service:cluster", { "tcp_ports" => tcp_ports } ) nil end |
- (Object) csync2_turn_on
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 |
# File '../../src/include/cluster/dialogs.rb', line 1082 def csync2_turn_on csync2_socket = nil csync2_socket = SystemdSocket.find(@csync2_package) if !csync2_socket y2error("csync2.socket is missing.") return nil end csync2_socket.start csync2_socket.enable y2debug("Start and enable csync2.socket.") tcp_ports = [] tcp_ports = SuSEFirewallServices.GetNeededTCPPorts("service:cluster") pos = nil pos = Builtins.find(tcp_ports) { |s| s == @csync2_port } tcp_ports = Builtins.add(tcp_ports, @csync2_port) if pos == nil SuSEFirewallServices.SetNeededPortsAndProtocols( "service:cluster", { "tcp_ports" => tcp_ports } ) nil end |
- (Object) Csync2Dialog
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 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 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 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 1275 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 1304 1305 1306 1307 1308 1309 |
# File '../../src/include/cluster/dialogs.rb', line 1158 def Csync2Dialog ret = nil my_SetContents("csync2", csync2_layout) while true fill_csync_entries ret = UI.UserInput if ret == :abort || ret == :cancel break if ReallyAbort() next end break if ret == :next || ret == :back if ret == :wizardTree ret = Convert.to_string(UI.QueryWidget(Id(:wizardTree), :CurrentItem)) end if ret == :host_add ret = text_input_dialog(_("Enter a hostname"), "") next if ret == :cancel Cluster.csync2_host = Builtins.add( Cluster.csync2_host, Convert.to_string(ret) ) end if ret == :host_edit current = 0 str = "" current = Convert.to_integer(UI.QueryWidget(:host_box, :CurrentItem)) ret = text_input_dialog( _("Edit the hostname"), Ops.get(Cluster.csync2_host, current, "") ) next if ret == :cancel Ops.set(Cluster.csync2_host, current, Convert.to_string(ret)) end if ret == :host_del current = 0 current = Convert.to_integer(UI.QueryWidget(:host_box, :CurrentItem)) Cluster.csync2_host = Builtins.remove(Cluster.csync2_host, current) end if ret == :include_add ret = text_input_dialog(_("Enter a filename to synchronize"), "") next if ret == :cancel Cluster.csync2_include = Builtins.add( Cluster.csync2_include, Convert.to_string(ret) ) end if ret == :include_edit current = 0 current = Convert.to_integer( UI.QueryWidget(:include_box, :CurrentItem) ) ret = text_input_dialog( _("Edit the filename"), Ops.get(Cluster.csync2_include, current, "") ) next if ret == :cancel Ops.set(Cluster.csync2_include, current, Convert.to_string(ret)) end if ret == :include_del current = 0 current = Convert.to_integer( UI.QueryWidget(:include_box, :CurrentItem) ) Cluster.csync2_include = Builtins.remove( Cluster.csync2_include, current ) end if ret == :include_suggest Cluster.csync2_include = Ops.add( Cluster.csync2_include, @csync2_suggest_files ) end if ret == :generate_key key_file = Cluster.csync2_key_file # key file exist if Ops.greater_than(SCR.Read(path(".target.size"), key_file), 0) if !Popup.YesNo( Builtins.sformat( _("Key file %1 already exist.\nDo you want to overwrite it?"), key_file ) ) next end # remove exist key file if SCR.Execute(path(".target.remove"), key_file) == false Popup.Message( Builtins.sformat(_("Delete key file %1 failed."), key_file) ) next end end # generate key file ret = SCR.Execute( path(".target.bash"), Builtins.sformat("csync2 -k %1", key_file) ) if ret == 0 Popup.Message( Builtins.sformat( _( "Key file %1 is generated.\nClicking \"Add Suggested Files\" button adds it to sync list." ), key_file ) ) else Popup.Message(_("Key generation failed.")) end end if ret == :csync2_switch label = "" label = Convert.to_string(UI.QueryWidget(:csync2_switch, :Label)) csync2_turn_off if Builtins.issubstring(label, "OFF") csync2_turn_on if Builtins.issubstring(label, "ON") end if Builtins.contains(@DIALOG, Convert.to_string(ret)) ret = Builtins.symbolof(Builtins.toterm(ret)) #SaveCsync2(); break else Wizard.SelectTreeItem("csync2") next end end deep_copy(ret) end |
- (Object) fill_conntrack_entries
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 |
# File '../../src/include/cluster/dialogs.rb', line 1375 def fill_conntrack_entries value = "" value = Convert.to_string(UI.QueryWidget(:conntrack_addr, :Value)) if value == "" value = Convert.to_string( SCR.Read(path(".sysconfig.conntrackd.CONNTRACK_ADDR")) ) value = "225.0.0.50" if Builtins.size(value) == 0 UI.ChangeWidget(:conntrack_addr, :Value, value) end value = Convert.to_string(UI.QueryWidget(:conntrack_group, :Value)) if value == "" value = Convert.to_string( SCR.Read(path(".sysconfig.conntrackd.CONNTRACK_GROUP")) ) value = "3780" if value == "" UI.ChangeWidget(:conntrack_group, :Value, value) end value = Convert.to_string( SCR.Read(path(".sysconfig.conntrackd.CONNTRACK_INTERFACE")) ) if value != "" if Builtins.contains(@usable_interface, value) UI.ChangeWidget(:conntrack_bindinf, :Value, value) end end qr = Convert.to_string(UI.QueryWidget(:conntrack_bindinf, :Value)) ip = "" if qr != "" result = {} result = Convert.to_map( SCR.Execute( path(".target.bash_output"), Ops.add( Ops.add("/sbin/ip addr show scope global dev ", qr), " | grep inet | awk '{print $2}' | awk -F/ '{print $1}'" ) ) ) ip = Ops.get( Builtins.splitstring(Ops.get_string(result, "stdout", ""), "\n"), 0, "" ) end UI.ChangeWidget(:conntrack_bindip, :Label, Ops.add("IP: ", ip)) nil end |
- (Object) fill_csync_entries
1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 |
# File '../../src/include/cluster/dialogs.rb', line 1108 def fill_csync_entries i = 0 ret = 0 current = 0 items = [] # remove duplicated elements Cluster.csync2_host = Ops.add(Cluster.csync2_host, []) Cluster.csync2_include = Ops.add(Cluster.csync2_include, []) i = 0 items = [] Builtins.foreach(Cluster.csync2_host) do |value| items = Builtins.add(items, Item(Id(i), value)) i = Ops.add(i, 1) end current = Convert.to_integer(UI.QueryWidget(:host_box, :CurrentItem)) current = 0 if current == nil current = Ops.subtract(i, 1) if Ops.greater_or_equal(current, i) UI.ChangeWidget(:host_box, :Items, items) UI.ChangeWidget(:host_box, :CurrentItem, current) i = 0 items = [] Builtins.foreach(Cluster.csync2_include) do |value| items = Builtins.add(items, Item(Id(i), value)) i = Ops.add(i, 1) end current = Convert.to_integer(UI.QueryWidget(:include_box, :CurrentItem)) current = 0 if current == nil current = Ops.subtract(i, 1) if Ops.greater_or_equal(current, i) UI.ChangeWidget(:include_box, :Items, items) UI.ChangeWidget(:include_box, :CurrentItem, current) ret = csync2_status UI.ChangeWidget(Id(:csync2_switch), :Enabled, ret != 1) if ret == 1 UI.ChangeWidget(Id(:csync2_switch), :Label, _("Csync2 Status Unknown")) end if ret == 2 UI.ChangeWidget(Id(:csync2_switch), :Label, _("Turn csync2 ON")) end if ret == 3 UI.ChangeWidget(Id(:csync2_switch), :Label, _("Turn csync2 OFF")) end nil end |
- (Object) fill_memberaddr_entries
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 |
# File '../../src/include/cluster/dialogs.rb', line 551 def fill_memberaddr_entries i = 0 ret = 0 current = 0 items = [] # BNC#871970,change structure # remove duplicated elements Cluster.memberaddr = Ops.add(Cluster.memberaddr, []) i = 0 items = [] Builtins.foreach(Cluster.memberaddr) do |value| items.push(Item(Id(i), value[:addr1],value[:addr2], value[:nodeid])) i += 1 end current = Convert.to_integer(UI.QueryWidget(:memberaddr, :CurrentItem)) current = 0 if current == nil current = Ops.subtract(i, 1) if Ops.greater_or_equal(current, i) UI.ChangeWidget(:memberaddr, :Items, items) UI.ChangeWidget(:memberaddr, :CurrentItem, current) nil end |
- (Object) initialize_cluster_dialogs(include_target)
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File '../../src/include/cluster/dialogs.rb', line 32 def initialize_cluster_dialogs(include_target) textdomain "cluster" Yast.import "Label" Yast.import "Wizard" Yast.import "Cluster" Yast.import "IP" Yast.import "Popup" Yast.import "Service" Yast.import "SystemdSocket" Yast.import "Report" Yast.import "CWMFirewallInterfaces" Yast.import "SuSEFirewall" Yast.import "SuSEFirewallServices" Yast.include include_target, "cluster/helps.rb" Yast.include include_target, "cluster/common.rb" @csync2_suggest_files = [ "/etc/corosync/corosync.conf", "/etc/corosync/authkey", "/etc/sysconfig/pacemaker", "/etc/drbd.d", "/etc/drbd.conf", "/etc/lvm/lvm.conf", "/etc/multipath.conf", "/etc/ha.d/ldirectord.cf", "/etc/ctdb/nodes", "/etc/samba/smb.conf", "/etc/booth", "/etc/sysconfig/sbd", "/etc/csync2/csync2.cfg", "/etc/csync2/key_hagroup" ] @csync2_port = "30865" @csync2_package = "csync2" # This is the list of usable interface for conntrackd @usable_interface = [] end |
- (Object) SaveCommunication
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 |
# File '../../src/include/cluster/dialogs.rb', line 335 def SaveCommunication Cluster.bindnetaddr1 = Convert.to_string( UI.QueryWidget(Id(:bindnetaddr1), :Value) ) Cluster.bindnetaddr2 = Convert.to_string( UI.QueryWidget(Id(:bindnetaddr2), :Value) ) Cluster.mcastaddr1 = Convert.to_string( UI.QueryWidget(Id(:mcastaddr1), :Value) ) Cluster.mcastaddr2 = Convert.to_string( UI.QueryWidget(Id(:mcastaddr2), :Value) ) Cluster.mcastport1 = Convert.to_string( UI.QueryWidget(Id(:mcastport1), :Value) ) Cluster.mcastport2 = Convert.to_string( UI.QueryWidget(Id(:mcastport2), :Value) ) Cluster.enable2 = Convert.to_boolean(UI.QueryWidget(Id(:enable2), :Value)) Cluster.autoid = Convert.to_boolean(UI.QueryWidget(Id(:autoid), :Value)) Cluster.rrpmode = Convert.to_string(UI.QueryWidget(Id(:rrpmode), :Value)) Cluster.cluster_name = UI.QueryWidget(Id(:cluster_name), :Value) Cluster.expected_votes = UI.QueryWidget(Id(:expected_votes), :Value).to_s Cluster.transport = Convert.to_string( UI.QueryWidget(Id(:transport), :Value) ) #BNC#871970, clear second IP when redundant channel is disabled if !UI.QueryWidget(Id(:enable2), :Value) Cluster.memberaddr.each { |member| member[:addr2] = "" } end if UI.QueryWidget(Id(:autoid), :Value) Cluster.memberaddr.each { |member| member[:nodeid] = "" } end nil end |
- (Object) SaveCommunicationToConf
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 |
# File '../../src/include/cluster/dialogs.rb', line 290 def SaveCommunicationToConf SCR.Write( path(".openais.totem.interface.interface0.bindnetaddr"), Convert.to_string(UI.QueryWidget(Id(:bindnetaddr1), :Value)) ) SCR.Write( path(".openais.totem.interface.interface0.mcastaddr"), Convert.to_string(UI.QueryWidget(Id(:mcastaddr1), :Value)) ) SCR.Write( path(".openais.totem.interface.interface0.mcastport"), Convert.to_string(UI.QueryWidget(Id(:mcastport1), :Value)) ) if !UI.QueryWidget(Id(:enable2), :Value) SCR.Write(path(".openais.totem.interface.interface1"), "") else SCR.Write( path(".openais.totem.interface.interface1.bindnetaddr"), Convert.to_string(UI.QueryWidget(Id(:bindnetaddr2), :Value)) ) SCR.Write( path(".openais.totem.interface.interface1.mcastaddr"), Convert.to_string(UI.QueryWidget(Id(:mcastaddr2), :Value)) ) SCR.Write( path(".openais.totem.interface.interface1.mcastport"), Convert.to_string(UI.QueryWidget(Id(:mcastport2), :Value)) ) end if UI.QueryWidget(Id(:autoid), :Value) SCR.Write(path(".openais.totem.autoid"), "yes") else SCR.Write(path(".openais.totem.autoid"), "no") end SCR.Write( path(".openais.totem.rrpmode"), Convert.to_string(UI.QueryWidget(Id(:rrpmode), :Value)) ) nil end |
- (Object) SaveSecurity
703 704 705 706 707 |
# File '../../src/include/cluster/dialogs.rb', line 703 def SaveSecurity Cluster.secauth = Convert.to_boolean(UI.QueryWidget(Id(:secauth), :Value)) nil end |
- (Object) SaveSecurityToConf
693 694 695 696 697 698 699 700 701 |
# File '../../src/include/cluster/dialogs.rb', line 693 def SaveSecurityToConf if UI.QueryWidget(Id(:secauth), :Value) == true SCR.Write(path(".openais.totem.secauth"), "on") else SCR.Write(path(".openais.totem.secauth"), "off") end nil end |
- (Object) SecurityDialog
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 |
# File '../../src/include/cluster/dialogs.rb', line 709 def SecurityDialog ret = nil contents = VBox( VSpacing(1), CheckBoxFrame( Id(:secauth), Opt(:hstretch, :notify), _("Enable Security Auth"), true, VBox( Label( _( "For a newly created cluster, push the button below to generate /etc/corosync/authkey." ) ), Label( _( "To join an existing cluster, please copy /etc/corosync/authkey from other nodes manually." ) ), PushButton(Id(:genf), Opt(:notify), "Generate Auth Key File") ) ), VStretch() ) my_SetContents("security", contents) UI.ChangeWidget(Id(:secauth), :Value, Cluster.secauth) while true ret = UI.UserInput if ret == :genf result = {} result = Convert.to_map( SCR.Execute( path(".target.bash_output"), "/usr/sbin/corosync-keygen -l" ) ) if Ops.get_integer(result, "exit", -1) != 0 Popup.Message(_("Failed to create /etc/corosync/authkey")) else Popup.Message(_("Create /etc/corosync/authkey succeeded")) end next end if ret == :secauth if UI.QueryWidget(Id(:secauth), :Value) == true next end end if ret == :next || ret == :back val = ValidateSecurity() if val == true SaveSecurity() break else ret = nil next end end if ret == :abort || ret == :cancel if ReallyAbort() return deep_copy(ret) else next end end if ret == :wizardTree ret = Convert.to_string(UI.QueryWidget(Id(:wizardTree), :CurrentItem)) end if Builtins.contains(@DIALOG, Convert.to_string(ret)) ret = Builtins.symbolof(Builtins.toterm(ret)) val = ValidateSecurity() if val == true SaveSecurity() break else ret = nil Wizard.SelectTreeItem("security") next end end Builtins.y2error("unexpected retcode: %1", ret) end deep_copy(ret) end |
- (Object) ServiceDialog
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 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 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 |
# File '../../src/include/cluster/dialogs.rb', line 833 def ServiceDialog ret = nil = CWMFirewallInterfaces.CreateOpenFirewallWidget( { #servie:cluster is the name of /etc/sysconfig/SuSEfirewall2.d/services/cluster "services" => [ "service:cluster" ], "display_details" => true } ) Builtins.y2milestone("%1", ) firewall_layout = Ops.get_term(, "custom_widget", VBox()) contents = VBox( VSpacing(1), Frame( _("Booting"), RadioButtonGroup( Id("bootcorosync"), HBox( HSpacing(1), VBox( Left( RadioButton( Id("on"), Opt(:notify), _("On -- Start pacemaker during boot") ) ), Left( RadioButton( Id("off"), Opt(:notify), _("Off -- Start pacemaker manually") ) ) ) ) ) ), VSpacing(1), Frame( _("Switch On and Off"), Left( VBox( Left( HBox( Label(_("Current Status: ")), Label(Id(:status), _("Running")), ReplacePoint(Id("status_rp"), Empty()) ) ), Left( HBox( HSpacing(1), HBox( PushButton(Id("start_now"), _("Start pacemaker Now")), PushButton(Id("stop_now"), _("Stop pacemaker Now")) ) ) ) ) ) ), VSpacing(1), firewall_layout, VStretch() ) my_SetContents("service", contents) event = {} errormsg = "See 'journalctl -xn' for details." CWMFirewallInterfaces.OpenFirewallInit(, "") while true UpdateServiceStatus() # add event event = UI.WaitForEvent ret = Ops.get(event, "ID") if ret == "on" Service.Enable("pacemaker") next end if ret == "off" Service.Disable("pacemaker") next end # pacemaker will start corosync automatically. # BNC#872651 is fixed, so stop pacemaker could stop corosync at the same time. if ret == "start_now" Cluster.save_csync2_conf Cluster.SaveClusterConfig # BNC#872651 , add more info about error message Report.Error(Service.Error + errormsg) if !Service.Start("pacemaker") next end if ret == "stop_now" # BNC#874563,stop pacemaker could stop corosync since BNC#872651 is fixed Report.Error(Service.Error + errormsg) if !Service.Stop("pacemaker") next end if ret == :next || ret == :back val = ValidateService() if val == true CWMFirewallInterfaces.OpenFirewallStore(, "", event) break else ret = nil next end end if ret == :abort || ret == :cancel if ReallyAbort() return deep_copy(ret) else next end end if ret == :wizardTree ret = Convert.to_string(UI.QueryWidget(Id(:wizardTree), :CurrentItem)) end if Builtins.contains(@DIALOG, Convert.to_string(ret)) ret = Builtins.symbolof(Builtins.toterm(ret)) val = ValidateService() if val == true break else ret = nil Wizard.SelectTreeItem("service") next end end CWMFirewallInterfaces.OpenFirewallHandle(, "", event) Builtins.y2error("unexpected retcode: %1", ret) end deep_copy(ret) end |
- (Object) text_input_dialog(title, value)
return `cancel or a string
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 |
# File '../../src/include/cluster/dialogs.rb', line 75 def text_input_dialog(title, value) ret = nil UI.OpenDialog( MarginBox( 1, 1, VBox( MinWidth(100, InputField(Id(:text), title, value)), VSpacing(1), Right( HBox( PushButton(Id(:ok), _("OK")), PushButton(Id(:cancel), _("Cancel")) ) ) ) ) ) ret = UI.UserInput ret = UI.QueryWidget(:text, :Value) if ret == :ok UI.CloseDialog deep_copy(ret) end |
- (Object) transport_switch
BNC#871970, change member address struct to memberaddr
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
# File '../../src/include/cluster/dialogs.rb', line 387 def transport_switch udp = UI.QueryWidget(Id(:transport), :Value) == "udp" enable2 = UI.QueryWidget(Id(:enable2), :Value) enable1 = udp enable2 = udp && enable2 UI.ChangeWidget(Id(:mcastaddr1), :Enabled, enable1) UI.ChangeWidget(Id(:memberaddr), :Enabled, !enable1) UI.ChangeWidget(Id(:memberaddr_add), :Enabled, !enable1) UI.ChangeWidget(Id(:memberaddr_del), :Enabled, !enable1) UI.ChangeWidget(Id(:memberaddr_edit), :Enabled, !enable1) UI.ChangeWidget(Id(:mcastaddr2), :Enabled, enable2) nil end |
- (Object) UpdateServiceStatus
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 |
# File '../../src/include/cluster/dialogs.rb', line 811 def UpdateServiceStatus ret = 0 ret = Service.Status("pacemaker") if ret == 0 UI.ChangeWidget(Id(:status), :Value, _("Running")) else UI.ChangeWidget(Id(:status), :Value, _("Not running")) end UI.ChangeWidget(Id("start_now"), :Enabled, ret != 0) UI.ChangeWidget(Id("stop_now"), :Enabled, ret == 0) if not Service.Enabled("pacemaker") UI.ChangeWidget(Id("off"), :Value, true) UI.ChangeWidget(Id("on"), :Value, false) else UI.ChangeWidget(Id("on"), :Value, true) UI.ChangeWidget(Id("off"), :Value, false) end nil end |
- (Object) ValidateCommunication
BNC#871970, change member address struct
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 |
# File '../../src/include/cluster/dialogs.rb', line 190 def ValidateCommunication i = 0 if IP.Check(Convert.to_string(UI.QueryWidget(Id(:bindnetaddr1), :Value))) == false Popup.Message(_("The Bind Network Address has to be fulfilled")) UI.SetFocus(:bindnetaddr1) return false end if UI.QueryWidget(Id(:cluster_name), :Value) == "" Popup.Message(_("The cluster name has to be fulfilled")) UI.SetFocus(:cluster_name) return false end if UI.QueryWidget(Id(:transport), :Value) == "udpu" i = 0 Builtins.foreach(Cluster.memberaddr) do |value| if !IP.Check(value[:addr1]) || ( UI.QueryWidget(Id(:enable2), :Value) && !IP.Check(value[:addr2]) ) UI.ChangeWidget(:memberaddr, :CurrentItem, i) i = 0 raise Break end i = Ops.add(i, 1) end if i == 0 UI.SetFocus(:memberaddr) Popup.Message(_("The Member Address has to be fulfilled")) return false end else #BNC#880242, expected_votes must have value when "udp" if UI.QueryWidget(Id(:expected_votes), :Value) == "" Popup.Message(_("The Expected Votes has to be fulfilled when multicast transport is configured")) UI.SetFocus(:expected_votes) return false end if !IP.Check(Convert.to_string(UI.QueryWidget(Id(:mcastaddr1), :Value))) Popup.Message(_("The Multicast Address has to be fulfilled")) UI.SetFocus(:mcastaddr1) return false end end if !Builtins.regexpmatch( Convert.to_string(UI.QueryWidget(Id(:mcastport1), :Value)), "^[0-9]+$" ) Popup.Message(_("The Multicast port must be a positive integer")) UI.SetFocus(Id(:mcastport1)) return false end if UI.QueryWidget(Id(:enable2), :Value) if IP.Check( Convert.to_string(UI.QueryWidget(Id(:bindnetaddr2), :Value)) ) == false Popup.Message(_("The Bind Network Address has to be fulfilled")) UI.SetFocus(:bindnetaddr2) return false end if UI.QueryWidget(Id(:transport), :Value) == "udp" if IP.Check( Convert.to_string(UI.QueryWidget(Id(:mcastaddr2), :Value)) ) == false Popup.Message(_("The Multicast Address has to be fulfilled")) UI.SetFocus(:mcastaddr2) return false end end if !Builtins.regexpmatch( Convert.to_string(UI.QueryWidget(Id(:mcastport2), :Value)), "^[0-9]+$" ) Popup.Message(_("The Multicast port must be a positive integer")) UI.SetFocus(Id(:mcastport2)) return false end if UI.QueryWidget(Id(:rrpmode), :Value) == "none" Popup.Message(_("Only passive or active can be chosen if multiple interface used. Set to passive.")) UI.ChangeWidget(Id(:rrpmode), :Value, "passive") UI.SetFocus(Id(:rrpmode)) return false end end if !UI.QueryWidget(Id(:autoid), :Value ) && ( UI.QueryWidget(Id(:transport), :Value) == "udpu" ) ret = ValidNodeID() if !ret UI.SetFocus(Id(:memberaddr)) return false end end true end |
- (Object) ValidateSecurity
688 689 690 691 |
# File '../../src/include/cluster/dialogs.rb', line 688 def ValidateSecurity ret = true ret end |
- (Object) ValidateService
806 807 808 |
# File '../../src/include/cluster/dialogs.rb', line 806 def ValidateService true end |
- (Object) ValidNodeID
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 |
# File '../../src/include/cluster/dialogs.rb', line 154 def ValidNodeID if Cluster.memberaddr.size <= 0 return true end i = 0 # Set need to require 'set' idset = Set[] Builtins.foreach(Cluster.memberaddr) do |value| if value[:nodeid].to_i <= 0 Popup.Message(_("Node ID has to be fulfilled with a positive integer")) UI.ChangeWidget(:memberaddr, :CurrentItem, i) i = 0 raise Break end if idset.include?(value[:nodeid].to_i) Popup.Message(_("Node ID must be unique")) UI.ChangeWidget(:memberaddr, :CurrentItem, i) i = 0 raise Break end idset << value[:nodeid].to_i i = Ops.add(i, 1) end if i == 0 return false end true end |
- (Object) VerifyConntrackdConf
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 |
# File '../../src/include/cluster/dialogs.rb', line 1425 def VerifyConntrackdConf if IP.Check( Convert.to_string(UI.QueryWidget(Id(:conntrack_addr), :Value)) ) == false Popup.Message(_("The Multicast Address has to be fulfilled")) UI.SetFocus(:conntrack_addr) return false end if !Builtins.regexpmatch( Convert.to_string(UI.QueryWidget(Id(:conntrack_group), :Value)), "^[0-9]+$" ) Popup.Message(_("The Group Number must be a positive integer")) UI.SetFocus(Id(:conntrack_group)) return false end true end |