Revision f4d4e184 scripts/gnt-cluster
b/scripts/gnt-cluster | ||
---|---|---|
26 | 26 |
from ganeti.cli import * |
27 | 27 |
from ganeti import opcodes |
28 | 28 |
from ganeti import constants |
29 |
from ganeti import errors |
|
29 | 30 |
|
30 | 31 |
|
31 | 32 |
def InitCluster(opts, args): |
... | ... | |
181 | 182 |
return result |
182 | 183 |
|
183 | 184 |
|
185 |
def VerifyDisks(opts, args): |
|
186 |
"""Verify integrity of cluster disks. |
|
187 |
|
|
188 |
Args: |
|
189 |
opts - class with options as members |
|
190 |
|
|
191 |
""" |
|
192 |
op = opcodes.OpVerifyDisks() |
|
193 |
result = SubmitOpCode(op) |
|
194 |
if not isinstance(result, tuple) or len(result) != 2: |
|
195 |
raise errors.ProgrammerError("Unknown result type for OpVerifyDisks") |
|
196 |
|
|
197 |
nodes, instances = result |
|
198 |
if nodes: |
|
199 |
print "Nodes unreachable or with bad data:" |
|
200 |
for name in nodes: |
|
201 |
print "\t%s" % name |
|
202 |
retcode = constants.EXIT_SUCCESS |
|
203 |
if instances: |
|
204 |
for iname in instances: |
|
205 |
op = opcodes.OpActivateInstanceDisks(instance_name=iname) |
|
206 |
try: |
|
207 |
print "Activating disks for instance '%s'" % iname |
|
208 |
SubmitOpCode(op) |
|
209 |
except errors.GenericError, err: |
|
210 |
nret, msg = FormatError(err) |
|
211 |
retcode |= nret |
|
212 |
print >>sys.stderr, ("Error activating disks for instance %s: %s" % |
|
213 |
(iname, msg)) |
|
214 |
|
|
215 |
return retcode |
|
216 |
|
|
217 |
|
|
184 | 218 |
def MasterFailover(opts, args): |
185 | 219 |
"""Failover the master node. |
186 | 220 |
|
... | ... | |
263 | 297 |
"Renames the cluster"), |
264 | 298 |
'verify': (VerifyCluster, ARGS_NONE, [DEBUG_OPT], |
265 | 299 |
"", "Does a check on the cluster configuration"), |
300 |
'verify-disks': (VerifyDisks, ARGS_NONE, [DEBUG_OPT], |
|
301 |
"", "Does a check on the cluster disk status"), |
|
266 | 302 |
'masterfailover': (MasterFailover, ARGS_NONE, [DEBUG_OPT], |
267 | 303 |
"", "Makes the current node the master"), |
268 | 304 |
'version': (ShowClusterVersion, ARGS_NONE, [DEBUG_OPT], |
Also available in: Unified diff