24
25
26
27
28
29
30
31
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
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
|
# File '../../src/include/drbd/startup_conf.rb', line 24
def ConfigureStartUpDialog
boot = Drbd.start_daemon
_Tbooting = Frame(
_("Booting"),
Left(
RadioButtonGroup(
Id("server_type"),
VBox(
Left(
RadioButton(
Id("on"),
_("On -- Start DRBD Server Now and when Booting")
)
),
Left(
RadioButton(Id("off"), _("Off -- Server Only Starts Manually"))
),
VSpacing(1)
)
)
)
)
_Tonoff = Frame(
_("Switch On and Off"),
Left(
HSquash(
VBox(
HBox(
Label(_("Current Status: ")),
ReplacePoint(Id("status_rp"), Empty()),
HStretch()
),
PushButton(
Id("start_now"),
Opt(:hstretch),
_("Start DRBD Server Now")
),
PushButton(
Id("stop_now"),
Opt(:hstretch),
_("Stop DRBD Server Now")
)
)
)
)
)
_Tpropagate = Frame(
_("Propagate Configuration"),
Left(
HSquash(
VBox(
VBox(
Left(
Label(
_(
"To propagate this configuration ,\ncopy the configuration file '/etc/drbd.conf' to the rest of nodes manually."
)
)
)
)
)
)
)
)
contents = Empty()
contents = VBox(
_Tbooting,
VSpacing(1),
_Tonoff,
VSpacing(1),
_Tpropagate,
VStretch()
)
my_SetContents("startup_conf", contents)
UI.ChangeWidget(Id("server_type"), :CurrentButton, boot ? "on" : "off")
ret = nil
while true
status = Service.Status("drbd")
UI.ChangeWidget(Id("start_now"), :Enabled, status != 0)
UI.ChangeWidget(Id("stop_now"), :Enabled, status == 0)
UI.ReplaceWidget(
Id("status_rp"),
Label(
status == 0 ?
_("DRBD server is running.") :
_("DRBD server is not running.")
)
)
ret = UI.UserInput
if ret == :abort || ret == :cancel
if ReallyAbort()
return deep_copy(ret)
else
next
end
end
break if ret == :next || ret == :back
if ret == "start_now"
if !Service.Start("drbd")
Report.Error(_("Start DRBD service failed"))
end
next
end
if ret == "stop_now"
if !Service.Stop("drbd")
Report.Error(_("Stop DRBD service failed"))
end
next
end
if ret == :help
myHelp("startup_conf")
next
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))
break
end
Builtins.y2error("unexpected retcode: %1", ret)
end
boot1 = Convert.to_string(
UI.QueryWidget(Id("server_type"), :CurrentButton)
)
if boot1 == "off" && boot || boot1 == "on" && !boot
Drbd.start_daemon = !boot
end
deep_copy(ret)
end
|