Commit d0c8c01d authored by Iustin Pop's avatar Iustin Pop

Most boring patch ever

s/'/"/ in (hopefully) the right places.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 0fa044e7
This diff is collapsed.
...@@ -600,7 +600,7 @@ class LogicalVolume(BlockDev): ...@@ -600,7 +600,7 @@ class LogicalVolume(BlockDev):
# one line for any non-empty string # one line for any non-empty string
logging.error("Can't parse LVS output, no lines? Got '%s'", str(out)) logging.error("Can't parse LVS output, no lines? Got '%s'", str(out))
return False return False
out = out[-1].strip().rstrip(',') out = out[-1].strip().rstrip(",")
out = out.split(",") out = out.split(",")
if len(out) != 5: if len(out) != 5:
logging.error("Can't parse LVS output, len(%s) != 5", str(out)) logging.error("Can't parse LVS output, len(%s) != 5", str(out))
...@@ -633,7 +633,7 @@ class LogicalVolume(BlockDev): ...@@ -633,7 +633,7 @@ class LogicalVolume(BlockDev):
self.minor = minor self.minor = minor
self.pe_size = pe_size self.pe_size = pe_size
self.stripe_count = stripes self.stripe_count = stripes
self._degraded = status[0] == 'v' # virtual volume, i.e. doesn't backing self._degraded = status[0] == "v" # virtual volume, i.e. doesn't backing
# storage # storage
self.attached = True self.attached = True
return True return True
...@@ -745,8 +745,8 @@ class LogicalVolume(BlockDev): ...@@ -745,8 +745,8 @@ class LogicalVolume(BlockDev):
BlockDev.SetInfo(self, text) BlockDev.SetInfo(self, text)
# Replace invalid characters # Replace invalid characters
text = re.sub('^[^A-Za-z0-9_+.]', '_', text) text = re.sub("^[^A-Za-z0-9_+.]", "_", text)
text = re.sub('[^-A-Za-z0-9_+.]', '_', text) text = re.sub("[^-A-Za-z0-9_+.]", "_", text)
# Only up to 128 characters are allowed # Only up to 128 characters are allowed
text = text[:128] text = text[:128]
...@@ -971,14 +971,14 @@ class BaseDRBD(BlockDev): # pylint: disable-msg=W0223 ...@@ -971,14 +971,14 @@ class BaseDRBD(BlockDev): # pylint: disable-msg=W0223
first_line) first_line)
values = version.groups() values = version.groups()
retval = {'k_major': int(values[0]), retval = {"k_major": int(values[0]),
'k_minor': int(values[1]), "k_minor": int(values[1]),
'k_point': int(values[2]), "k_point": int(values[2]),
'api': int(values[3]), "api": int(values[3]),
'proto': int(values[4]), "proto": int(values[4]),
} }
if values[5] is not None: if values[5] is not None:
retval['proto2'] = values[5] retval["proto2"] = values[5]
return retval return retval
...@@ -1113,10 +1113,10 @@ class DRBD8(BaseDRBD): ...@@ -1113,10 +1113,10 @@ class DRBD8(BaseDRBD):
super(DRBD8, self).__init__(unique_id, children, size) super(DRBD8, self).__init__(unique_id, children, size)
self.major = self._DRBD_MAJOR self.major = self._DRBD_MAJOR
version = self._GetVersion(self._GetProcData()) version = self._GetVersion(self._GetProcData())
if version['k_major'] != 8 : if version["k_major"] != 8 :
_ThrowError("Mismatch in DRBD kernel version and requested ganeti" _ThrowError("Mismatch in DRBD kernel version and requested ganeti"
" usage: kernel is %s.%s, ganeti wants 8.x", " usage: kernel is %s.%s, ganeti wants 8.x",
version['k_major'], version['k_minor']) version["k_major"], version["k_minor"])
if (self._lhost is not None and self._lhost == self._rhost and if (self._lhost is not None and self._lhost == self._rhost and
self._lport == self._rport): self._lport == self._rport):
...@@ -1210,7 +1210,7 @@ class DRBD8(BaseDRBD): ...@@ -1210,7 +1210,7 @@ class DRBD8(BaseDRBD):
pyp.Optional(pyp.restOfLine).suppress()) pyp.Optional(pyp.restOfLine).suppress())
# an entire section # an entire section
section_name = pyp.Word(pyp.alphas + '_') section_name = pyp.Word(pyp.alphas + "_")
section = section_name + lbrace + pyp.ZeroOrMore(pyp.Group(stmt)) + rbrace section = section_name + lbrace + pyp.ZeroOrMore(pyp.Group(stmt)) + rbrace
bnf = pyp.ZeroOrMore(pyp.Group(section ^ stmt)) bnf = pyp.ZeroOrMore(pyp.Group(section ^ stmt))
...@@ -1343,18 +1343,18 @@ class DRBD8(BaseDRBD): ...@@ -1343,18 +1343,18 @@ class DRBD8(BaseDRBD):
# what we aim here is to revert back to the 'drain' method of # what we aim here is to revert back to the 'drain' method of
# disk flushes and to disable metadata barriers, in effect going # disk flushes and to disable metadata barriers, in effect going
# back to pre-8.0.7 behaviour # back to pre-8.0.7 behaviour
vmaj = version['k_major'] vmaj = version["k_major"]
vmin = version['k_minor'] vmin = version["k_minor"]
vrel = version['k_point'] vrel = version["k_point"]
assert vmaj == 8 assert vmaj == 8
if vmin == 0: # 8.0.x if vmin == 0: # 8.0.x
if vrel >= 12: if vrel >= 12:
args.extend(['-i', '-m']) args.extend(["-i", "-m"])
elif vmin == 2: # 8.2.x elif vmin == 2: # 8.2.x
if vrel >= 7: if vrel >= 7:
args.extend(['-i', '-m']) args.extend(["-i", "-m"])
elif vmaj >= 3: # 8.3.x or newer elif vmaj >= 3: # 8.3.x or newer
args.extend(['-i', '-a', 'm']) args.extend(["-i", "-a", "m"])
result = utils.RunCmd(args) result = utils.RunCmd(args)
if result.failed: if result.failed:
_ThrowError("drbd%d: can't attach local disk: %s", minor, result.output) _ThrowError("drbd%d: can't attach local disk: %s", minor, result.output)
...@@ -2102,7 +2102,7 @@ class PersistentBlockDevice(BlockDev): ...@@ -2102,7 +2102,7 @@ class PersistentBlockDevice(BlockDev):
if not isinstance(unique_id, (tuple, list)) or len(unique_id) != 2: if not isinstance(unique_id, (tuple, list)) or len(unique_id) != 2:
raise ValueError("Invalid configuration data %s" % str(unique_id)) raise ValueError("Invalid configuration data %s" % str(unique_id))
self.dev_path = unique_id[1] self.dev_path = unique_id[1]
if not os.path.realpath(self.dev_path).startswith('/dev/'): if not os.path.realpath(self.dev_path).startswith("/dev/"):
raise ValueError("Full path '%s' lies outside /dev" % raise ValueError("Full path '%s' lies outside /dev" %
os.path.realpath(self.dev_path)) os.path.realpath(self.dev_path))
# TODO: this is just a safety guard checking that we only deal with devices # TODO: this is just a safety guard checking that we only deal with devices
......
...@@ -517,7 +517,7 @@ def check_ident_key_val(option, opt, value): # pylint: disable-msg=W0613 ...@@ -517,7 +517,7 @@ def check_ident_key_val(option, opt, value): # pylint: disable-msg=W0613
""" """
if ":" not in value: if ":" not in value:
ident, rest = value, '' ident, rest = value, ""
else: else:
ident, rest = value.split(":", 1) ident, rest = value.split(":", 1)
...@@ -621,7 +621,7 @@ SEP_OPT = cli_option("--separator", default=None, ...@@ -621,7 +621,7 @@ SEP_OPT = cli_option("--separator", default=None,
" (defaults to one space)")) " (defaults to one space)"))
USEUNITS_OPT = cli_option("--units", default=None, USEUNITS_OPT = cli_option("--units", default=None,
dest="units", choices=('h', 'm', 'g', 't'), dest="units", choices=("h", "m", "g", "t"),
help="Specify units for output (one of h/m/g/t)") help="Specify units for output (one of h/m/g/t)")
FIELDS_OPT = cli_option("-o", "--output", dest="output", action="store", FIELDS_OPT = cli_option("-o", "--output", dest="output", action="store",
...@@ -1417,8 +1417,8 @@ def SplitNodeOption(value): ...@@ -1417,8 +1417,8 @@ def SplitNodeOption(value):
"""Splits the value of a --node option. """Splits the value of a --node option.
""" """
if value and ':' in value: if value and ":" in value:
return value.split(':', 1) return value.split(":", 1)
else: else:
return (value, None) return (value, None)
...@@ -1435,7 +1435,7 @@ def CalculateOSNames(os_name, os_variants): ...@@ -1435,7 +1435,7 @@ def CalculateOSNames(os_name, os_variants):
""" """
if os_variants: if os_variants:
return ['%s+%s' % (os_name, v) for v in os_variants] return ["%s+%s" % (os_name, v) for v in os_variants]
else: else:
return [os_name] return [os_name]
...@@ -1477,12 +1477,12 @@ def AskUser(text, choices=None): ...@@ -1477,12 +1477,12 @@ def AskUser(text, choices=None):
""" """
if choices is None: if choices is None:
choices = [('y', True, 'Perform the operation'), choices = [("y", True, "Perform the operation"),
('n', False, 'Do not perform the operation')] ("n", False, "Do not perform the operation")]
if not choices or not isinstance(choices, list): if not choices or not isinstance(choices, list):
raise errors.ProgrammerError("Invalid choices argument to AskUser") raise errors.ProgrammerError("Invalid choices argument to AskUser")
for entry in choices: for entry in choices:
if not isinstance(entry, tuple) or len(entry) < 3 or entry[0] == '?': if not isinstance(entry, tuple) or len(entry) < 3 or entry[0] == "?":
raise errors.ProgrammerError("Invalid choices element to AskUser") raise errors.ProgrammerError("Invalid choices element to AskUser")
answer = choices[-1][1] answer = choices[-1][1]
...@@ -1497,18 +1497,18 @@ def AskUser(text, choices=None): ...@@ -1497,18 +1497,18 @@ def AskUser(text, choices=None):
try: try:
chars = [entry[0] for entry in choices] chars = [entry[0] for entry in choices]
chars[-1] = "[%s]" % chars[-1] chars[-1] = "[%s]" % chars[-1]
chars.append('?') chars.append("?")
maps = dict([(entry[0], entry[1]) for entry in choices]) maps = dict([(entry[0], entry[1]) for entry in choices])
while True: while True:
f.write(text) f.write(text)
f.write('\n') f.write("\n")
f.write("/".join(chars)) f.write("/".join(chars))
f.write(": ") f.write(": ")
line = f.readline(2).strip().lower() line = f.readline(2).strip().lower()
if line in maps: if line in maps:
answer = maps[line] answer = maps[line]
break break
elif line == '?': elif line == "?":
for entry in choices: for entry in choices:
f.write(" %s - %s\n" % (entry[0], entry[2])) f.write(" %s - %s\n" % (entry[0], entry[2]))
f.write("\n") f.write("\n")
...@@ -1965,7 +1965,7 @@ def FormatError(err): ...@@ -1965,7 +1965,7 @@ def FormatError(err):
retcode = 0 retcode = 0
else: else:
obuf.write("Unhandled exception: %s" % msg) obuf.write("Unhandled exception: %s" % msg)
return retcode, obuf.getvalue().rstrip('\n') return retcode, obuf.getvalue().rstrip("\n")
def GenericMain(commands, override=None, aliases=None): def GenericMain(commands, override=None, aliases=None):
...@@ -2381,7 +2381,7 @@ def GenerateTable(headers, fields, separator, data, ...@@ -2381,7 +2381,7 @@ def GenerateTable(headers, fields, separator, data,
if separator is None: if separator is None:
mlens = [0 for name in fields] mlens = [0 for name in fields]
format_str = ' '.join(format_fields) format_str = " ".join(format_fields)
else: else:
format_str = separator.replace("%", "%%").join(format_fields) format_str = separator.replace("%", "%%").join(format_fields)
...@@ -2420,7 +2420,7 @@ def GenerateTable(headers, fields, separator, data, ...@@ -2420,7 +2420,7 @@ def GenerateTable(headers, fields, separator, data,
for line in data: for line in data:
args = [] args = []
if line is None: if line is None:
line = ['-' for _ in fields] line = ["-" for _ in fields]
for idx in range(len(fields)): for idx in range(len(fields)):
if separator is None: if separator is None:
args.append(mlens[idx]) args.append(mlens[idx])
...@@ -2826,7 +2826,7 @@ def FormatTimestamp(ts): ...@@ -2826,7 +2826,7 @@ def FormatTimestamp(ts):
""" """
if not isinstance (ts, (tuple, list)) or len(ts) != 2: if not isinstance (ts, (tuple, list)) or len(ts) != 2:
return '?' return "?"
sec, usec = ts sec, usec = ts
return time.strftime("%F %T", time.localtime(sec)) + ".%06d" % usec return time.strftime("%F %T", time.localtime(sec)) + ".%06d" % usec
...@@ -2849,11 +2849,11 @@ def ParseTimespec(value): ...@@ -2849,11 +2849,11 @@ def ParseTimespec(value):
if not value: if not value:
raise errors.OpPrereqError("Empty time specification passed") raise errors.OpPrereqError("Empty time specification passed")
suffix_map = { suffix_map = {
's': 1, "s": 1,
'm': 60, "m": 60,
'h': 3600, "h": 3600,
'd': 86400, "d": 86400,
'w': 604800, "w": 604800,
} }
if value[-1] not in suffix_map: if value[-1] not in suffix_map:
try: try:
...@@ -2966,7 +2966,7 @@ def _ToStream(stream, txt, *args): ...@@ -2966,7 +2966,7 @@ def _ToStream(stream, txt, *args):
stream.write(txt % args) stream.write(txt % args)
else: else:
stream.write(txt) stream.write(txt)
stream.write('\n') stream.write("\n")
stream.flush() stream.flush()
except IOError, err: except IOError, err:
if err.errno == errno.EPIPE: if err.errno == errno.EPIPE:
......
...@@ -1242,7 +1242,7 @@ def Epo(opts, args): ...@@ -1242,7 +1242,7 @@ def Epo(opts, args):
commands = { commands = {
'init': ( "init": (
InitCluster, [ArgHost(min=1, max=1)], InitCluster, [ArgHost(min=1, max=1)],
[BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, GLOBAL_FILEDIR_OPT, [BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, GLOBAL_FILEDIR_OPT,
HVLIST_OPT, MAC_PREFIX_OPT, MASTER_NETDEV_OPT, NIC_PARAMS_OPT, HVLIST_OPT, MAC_PREFIX_OPT, MASTER_NETDEV_OPT, NIC_PARAMS_OPT,
...@@ -1252,75 +1252,75 @@ commands = { ...@@ -1252,75 +1252,75 @@ commands = {
DEFAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT, DEFAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT,
NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT], NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT],
"[opts...] <cluster_name>", "Initialises a new cluster configuration"), "[opts...] <cluster_name>", "Initialises a new cluster configuration"),
'destroy': ( "destroy": (
DestroyCluster, ARGS_NONE, [YES_DOIT_OPT], DestroyCluster, ARGS_NONE, [YES_DOIT_OPT],
"", "Destroy cluster"), "", "Destroy cluster"),
'rename': ( "rename": (
RenameCluster, [ArgHost(min=1, max=1)], RenameCluster, [ArgHost(min=1, max=1)],
[FORCE_OPT, DRY_RUN_OPT], [FORCE_OPT, DRY_RUN_OPT],
"<new_name>", "<new_name>",
"Renames the cluster"), "Renames the cluster"),
'redist-conf': ( "redist-conf": (
RedistributeConfig, ARGS_NONE, [SUBMIT_OPT, DRY_RUN_OPT, PRIORITY_OPT], RedistributeConfig, ARGS_NONE, [SUBMIT_OPT, DRY_RUN_OPT, PRIORITY_OPT],
"", "Forces a push of the configuration file and ssconf files" "", "Forces a push of the configuration file and ssconf files"
" to the nodes in the cluster"), " to the nodes in the cluster"),
'verify': ( "verify": (
VerifyCluster, ARGS_NONE, VerifyCluster, ARGS_NONE,
[VERBOSE_OPT, DEBUG_SIMERR_OPT, ERROR_CODES_OPT, NONPLUS1_OPT, [VERBOSE_OPT, DEBUG_SIMERR_OPT, ERROR_CODES_OPT, NONPLUS1_OPT,
DRY_RUN_OPT, PRIORITY_OPT, NODEGROUP_OPT], DRY_RUN_OPT, PRIORITY_OPT, NODEGROUP_OPT],
"", "Does a check on the cluster configuration"), "", "Does a check on the cluster configuration"),
'verify-disks': ( "verify-disks": (
VerifyDisks, ARGS_NONE, [PRIORITY_OPT], VerifyDisks, ARGS_NONE, [PRIORITY_OPT],
"", "Does a check on the cluster disk status"), "", "Does a check on the cluster disk status"),
'repair-disk-sizes': ( "repair-disk-sizes": (
RepairDiskSizes, ARGS_MANY_INSTANCES, [DRY_RUN_OPT, PRIORITY_OPT], RepairDiskSizes, ARGS_MANY_INSTANCES, [DRY_RUN_OPT, PRIORITY_OPT],
"", "Updates mismatches in recorded disk sizes"), "", "Updates mismatches in recorded disk sizes"),
'master-failover': ( "master-failover": (
MasterFailover, ARGS_NONE, [NOVOTING_OPT], MasterFailover, ARGS_NONE, [NOVOTING_OPT],
"", "Makes the current node the master"), "", "Makes the current node the master"),
'master-ping': ( "master-ping": (
MasterPing, ARGS_NONE, [], MasterPing, ARGS_NONE, [],
"", "Checks if the master is alive"), "", "Checks if the master is alive"),
'version': ( "version": (
ShowClusterVersion, ARGS_NONE, [], ShowClusterVersion, ARGS_NONE, [],
"", "Shows the cluster version"), "", "Shows the cluster version"),
'getmaster': ( "getmaster": (
ShowClusterMaster, ARGS_NONE, [], ShowClusterMaster, ARGS_NONE, [],
"", "Shows the cluster master"), "", "Shows the cluster master"),
'copyfile': ( "copyfile": (
ClusterCopyFile, [ArgFile(min=1, max=1)], ClusterCopyFile, [ArgFile(min=1, max=1)],
[NODE_LIST_OPT, USE_REPL_NET_OPT, NODEGROUP_OPT], [NODE_LIST_OPT, USE_REPL_NET_OPT, NODEGROUP_OPT],
"[-n node...] <filename>", "Copies a file to all (or only some) nodes"), "[-n node...] <filename>", "Copies a file to all (or only some) nodes"),
'command': ( "command": (
RunClusterCommand, [ArgCommand(min=1)], RunClusterCommand, [ArgCommand(min=1)],
[NODE_LIST_OPT, NODEGROUP_OPT], [NODE_LIST_OPT, NODEGROUP_OPT],
"[-n node...] <command>", "Runs a command on all (or only some) nodes"), "[-n node...] <command>", "Runs a command on all (or only some) nodes"),
'info': ( "info": (
ShowClusterConfig, ARGS_NONE, [ROMAN_OPT], ShowClusterConfig, ARGS_NONE, [ROMAN_OPT],
"[--roman]", "Show cluster configuration"), "[--roman]", "Show cluster configuration"),
'list-tags': ( "list-tags": (
ListTags, ARGS_NONE, [], "", "List the tags of the cluster"), ListTags, ARGS_NONE, [], "", "List the tags of the cluster"),
'add-tags': ( "add-tags": (
AddTags, [ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT], AddTags, [ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT],
"tag...", "Add tags to the cluster"), "tag...", "Add tags to the cluster"),
'remove-tags': ( "remove-tags": (
RemoveTags, [ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT], RemoveTags, [ArgUnknown()], [TAG_SRC_OPT, PRIORITY_OPT],
"tag...", "Remove tags from the cluster"), "tag...", "Remove tags from the cluster"),
'search-tags': ( "search-tags": (
SearchTags, [ArgUnknown(min=1, max=1)], [PRIORITY_OPT], "", SearchTags, [ArgUnknown(min=1, max=1)], [PRIORITY_OPT], "",
"Searches the tags on all objects on" "Searches the tags on all objects on"
" the cluster for a given pattern (regex)"), " the cluster for a given pattern (regex)"),
'queue': ( "queue": (
QueueOps, QueueOps,
[ArgChoice(min=1, max=1, choices=["drain", "undrain", "info"])], [ArgChoice(min=1, max=1, choices=["drain", "undrain", "info"])],
[], "drain|undrain|info", "Change queue properties"), [], "drain|undrain|info", "Change queue properties"),
'watcher': ( "watcher": (
WatcherOps, WatcherOps,
[ArgChoice(min=1, max=1, choices=["pause", "continue", "info"]), [ArgChoice(min=1, max=1, choices=["pause", "continue", "info"]),
ArgSuggest(min=0, max=1, choices=["30m", "1h", "4h"])], ArgSuggest(min=0, max=1, choices=["30m", "1h", "4h"])],
[], [],
"{pause <timespec>|continue|info}", "Change watcher properties"), "{pause <timespec>|continue|info}", "Change watcher properties"),
'modify': ( "modify": (
SetClusterParams, ARGS_NONE, SetClusterParams, ARGS_NONE,
[BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT, MASTER_NETDEV_OPT, [BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT, MASTER_NETDEV_OPT,
NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT, NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT,
...@@ -1347,7 +1347,7 @@ commands = { ...@@ -1347,7 +1347,7 @@ commands = {
#: dictionary with aliases for commands #: dictionary with aliases for commands
aliases = { aliases = {
'masterfailover': 'master-failover', "masterfailover": "master-failover",
} }
......
...@@ -143,7 +143,7 @@ def TestAllocator(opts, args): ...@@ -143,7 +143,7 @@ def TestAllocator(opts, args):
while len(row) < 3: while len(row) < 3:
row.append(None) row.append(None)
for i in range(3): for i in range(3):
if row[i] == '': if row[i] == "":
row[i] = None row[i] = None
nic_dict = [{ nic_dict = [{
constants.INIC_MAC: v[0], constants.INIC_MAC: v[0],
...@@ -616,7 +616,7 @@ def ListLocks(opts, args): # pylint: disable-msg=W0613 ...@@ -616,7 +616,7 @@ def ListLocks(opts, args): # pylint: disable-msg=W0613
commands = { commands = {
'delay': ( "delay": (
Delay, [ArgUnknown(min=1, max=1)], Delay, [ArgUnknown(min=1, max=1)],
[cli_option("--no-master", dest="on_master", default=True, [cli_option("--no-master", dest="on_master", default=True,
action="store_false", help="Do not sleep in the master code"), action="store_false", help="Do not sleep in the master code"),
...@@ -627,7 +627,7 @@ commands = { ...@@ -627,7 +627,7 @@ commands = {
DRY_RUN_OPT, PRIORITY_OPT, DRY_RUN_OPT, PRIORITY_OPT,
], ],
"[opts...] <duration>", "Executes a TestDelay OpCode"), "[opts...] <duration>", "Executes a TestDelay OpCode"),
'submit-job': ( "submit-job": (
GenericOpCodes, [ArgFile(min=1)], GenericOpCodes, [ArgFile(min=1)],
[VERBOSE_OPT, [VERBOSE_OPT,
cli_option("--op-repeat", type="int", default="1", dest="rep_op", cli_option("--op-repeat", type="int", default="1", dest="rep_op",
...@@ -642,7 +642,7 @@ commands = { ...@@ -642,7 +642,7 @@ commands = {
], ],
"<op_list_file...>", "Submits jobs built from json files" "<op_list_file...>", "Submits jobs built from json files"
" containing a list of serialized opcodes"), " containing a list of serialized opcodes"),
'iallocator': ( "iallocator": (
TestAllocator, [ArgUnknown(min=1)], TestAllocator, [ArgUnknown(min=1)],
[cli_option("--dir", dest="direction", default=constants.IALLOCATOR_DIR_IN, [cli_option("--dir", dest="direction", default=constants.IALLOCATOR_DIR_IN,
choices=list(constants.VALID_IALLOCATOR_DIRECTIONS), choices=list(constants.VALID_IALLOCATOR_DIRECTIONS),
......
This diff is collapsed.
...@@ -157,7 +157,7 @@ def AutoArchiveJobs(opts, args): ...@@ -157,7 +157,7 @@ def AutoArchiveJobs(opts, args):
age = args[0] age = args[0]
if age == 'all': if age == "all":
age = -1 age = -1
else: else:
age = ParseTimespec(age) age = ParseTimespec(age)
...@@ -357,7 +357,7 @@ def WatchJob(opts, args): ...@@ -357,7 +357,7 @@ def WatchJob(opts, args):
commands = { commands = {
'list': ( "list": (
ListJobs, [ArgJobId()], ListJobs, [ArgJobId()],
[NOHDR_OPT, SEP_OPT, FIELDS_OPT], [NOHDR_OPT, SEP_OPT, FIELDS_OPT],
"[job_id ...]", "[job_id ...]",
...@@ -366,22 +366,22 @@ commands = { ...@@ -366,22 +366,22 @@ commands = {
" op_status, op_result." " op_status, op_result."
" The default field" " The default field"
" list is (in order): %s." % utils.CommaJoin(_LIST_DEF_FIELDS)), " list is (in order): %s." % utils.CommaJoin(_LIST_DEF_FIELDS)),
'archive': ( "archive": (
ArchiveJobs, [ArgJobId(min=1)], [], ArchiveJobs, [ArgJobId(min=1)], [],
"<job-id> [<job-id> ...]", "Archive specified jobs"), "<job-id> [<job-id> ...]", "Archive specified jobs"),
'autoarchive': ( "autoarchive": (
AutoArchiveJobs, AutoArchiveJobs,
[ArgSuggest(min=1, max=1, choices=["1d", "1w", "4w", "all"])], [ArgSuggest(min=1, max=1, choices=["1d", "1w", "4w", "all"])],
[], [],
"<age>", "Auto archive jobs older than the given age"), "<age>", "Auto archive jobs older than the given age"),
'cancel': ( "cancel": (
CancelJobs, [ArgJobId(min=1)], [], CancelJobs, [ArgJobId(min=1)], [],
"<job-id> [<job-id> ...]", "Cancel specified jobs"), "<job-id> [<job-id> ...]", "Cancel specified jobs"),
'info': ( "info": (
ShowJobs, [ArgJobId(min=1)], [], ShowJobs, [ArgJobId(min=1)], [],
"<job-id> [<job-id> ...]", "<job-id> [<job-id> ...]",
"Show detailed information about the specified jobs"), "Show detailed information about the specified jobs"),
'watch': ( "watch": (
WatchJob, [ArgJobId(min=1, max=1)], [], WatchJob, [ArgJobId(min=1, max=1)], [],
"<job-id>", "Follows a job and prints its output as it arrives"), "<job-id>", "Follows a job and prints its output as it arrives"),
} }
......
...@@ -174,7 +174,7 @@ def AddNode(opts, args): ...@@ -174,7 +174,7 @@ def AddNode(opts, args):
readd = opts.readd readd = opts.readd
try: try:
output = cl.QueryNodes(names=[node], fields=['name', 'sip', 'master'], output = cl.QueryNodes(names=[node], fields=["name", "sip", "master"],
use_locking=False) use_locking=False)
node_exists, sip, is_master = output[0] node_exists, sip, is_master = output[0]
except (errors.OpPrereqError, errors.OpExecError): except (errors.OpPrereqError, errors.OpExecError):
...@@ -197,7 +197,7 @@ def AddNode(opts, args): ...@@ -197,7 +197,7 @@ def AddNode(opts, args):
sip = opts.secondary_ip sip = opts.secondary_ip
# read the cluster name from the master # read the cluster name from the master
output = cl.QueryConfigValues(['cluster_name']) output = cl.QueryConfigValues(["cluster_name"])
cluster_name = output[0] cluster_name = output[0]
if not readd and opts.node_setup: if not readd and opts.node_setup:
...@@ -851,7 +851,7 @@ def SetNodeParams(opts, args): ...@@ -851,7 +851,7 @@ def SetNodeParams(opts, args):
commands = { commands = {
'add': ( "add": (
AddNode, [ArgHost(min=1, max=1)], AddNode, [ArgHost(min=1, max=1)],
[SECONDARY_IP_OPT, READD_OPT, NOSSH_KEYCHECK_OPT, NODE_FORCE_JOIN_OPT, [SECONDARY_IP_OPT, READD_OPT, NOSSH_KEYCHECK_OPT, NODE_FORCE_JOIN_OPT,
NONODE_SETUP_OPT, VERBOSE_OPT, NODEGROUP_OPT, PRIORITY_OPT, NONODE_SETUP_OPT, VERBOSE_OPT, NODEGROUP_OPT, PRIORITY_OPT,
...@@ -867,23 +867,23 @@ commands = { ...@@ -867,23 +867,23 @@ commands = {
"[-f] {-I <iallocator> | -n <dst>} <node>", "[-f] {-I <iallocator> | -n <dst>} <node>",
"Relocate the secondary instances from a node" "Relocate the secondary instances from a node"
" to other nodes"), " to other nodes"),
'failover': ( "failover": (
FailoverNode, ARGS_ONE_NODE, [FORCE_OPT, IGNORE_CONSIST_OPT, FailoverNode, ARGS_ONE_NODE, [FORCE_OPT, IGNORE_CONSIST_OPT,
IALLOCATOR_OPT, PRIORITY_OPT], IALLOCATOR_OPT, PRIORITY_OPT],
"[-f] <node>", "[-f] <node>",
"Stops the primary instances on a node and start them on their" "Stops the primary instances on a node and start them on their"
" secondary node (only for instances with drbd disk template)"), " secondary node (only for instances with drbd disk template)"),
'migrate': ( "migrate": (
MigrateNode, ARGS_ONE_NODE, MigrateNode, ARGS_ONE_NODE,
[FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, DST_NODE_OPT, [FORCE_OPT, NONLIVE_OPT, MIGRATION_MODE_OPT, DST_NODE_OPT,
IALLOCATOR_OPT, PRIORITY_OPT], IALLOCATOR_OPT, PRIORITY_OPT],
"[-f] <node>", "[-f] <node>",
"Migrate all the primary instance on a node away from it"