Commit 3c286190 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Iustin Pop

Fixes to pass pep8 (make lint)

Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent beb81ea5
......@@ -541,6 +541,7 @@ def main():
[socat_stderr_write_fd, dd_stderr_write_fd,
dd_pid_write_fd, exp_size_write_fd])
try:
def _ForwardSignal(signum, _):
"""Forwards signals to child process.
......
......@@ -373,6 +373,7 @@ class ArgNetwork(_Argument):
"""
class ArgGroup(_Argument):
"""Node group argument.
......
......@@ -495,7 +495,7 @@ def TestJobqueue(opts, _):
opcodes.OpTestJqueue(notify_waitlock=True,
notify_exec=True,
log_messages=test_messages,
fail=fail)
fail=fail),
]
expect_messages = [test_messages]
expect_resultlen = 1
......
......@@ -44,6 +44,7 @@ def _HandleReservedIPs(ips):
return utils.UnescapeAndSplit(ips, sep=",")
return None
def AddNetwork(opts, args):
"""Add a network to the cluster.
......@@ -61,16 +62,16 @@ def AddNetwork(opts, args):
else:
tags = []
op = opcodes.OpNetworkAdd(network_name=network_name,
gateway=opts.gateway,
network=opts.network,
gateway6=opts.gateway6,
network6=opts.network6,
mac_prefix=opts.mac_prefix,
network_type=opts.network_type,
add_reserved_ips=\
_HandleReservedIPs(opts.add_reserved_ips),
tags=tags)
op = opcodes.OpNetworkAdd(
network_name=network_name,
gateway=opts.gateway,
network=opts.network,
gateway6=opts.gateway6,
network6=opts.network6,
mac_prefix=opts.mac_prefix,
network_type=opts.network_type,
add_reserved_ips=_HandleReservedIPs(opts.add_reserved_ips),
tags=tags)
SubmitOpCode(op, opts=opts)
......@@ -202,7 +203,7 @@ def ShowNetworkConfig(_, args):
ToStdout(" type: %s", network_type)
ToStdout(" size: %d", size)
ToStdout(" free: %d (%.2f%%)", free_count,
100 * float(free_count)/float(size))
100 * float(free_count) / float(size))
ToStdout(" usage map:")
idx = 0
for line in wrap(mapping, width=64):
......@@ -229,7 +230,7 @@ def ShowNetworkConfig(_, args):
["nic.ips", "nic.networks"],
use_locking=False)
l = lambda value: ", ".join(str(idx)+":"+str(ip)
l = lambda value: ", ".join(str(idx) + ":" + str(ip)
for idx, (ip, net) in enumerate(value)
if net == name)
......
......@@ -2037,7 +2037,7 @@ class LUClusterVerify(NoHooksLU):
# Verify global configuration
jobs.append([
opcodes.OpClusterVerifyConfig(ignore_errors=self.op.ignore_errors)
opcodes.OpClusterVerifyConfig(ignore_errors=self.op.ignore_errors),
])
# Always depend on global verification
......@@ -3189,7 +3189,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
"""
env = {
"CLUSTER_TAGS": " ".join(self.cfg.GetClusterInfo().GetTags())
"CLUSTER_TAGS": " ".join(self.cfg.GetClusterInfo().GetTags()),
}
env.update(("NODE_TAGS_%s" % node.name, " ".join(node.GetTags()))
......@@ -8200,8 +8200,7 @@ class LUNodeMigrate(LogicalUnit):
target_node=self.op.target_node,
allow_runtime_changes=allow_runtime_changes,
ignore_ipolicy=self.op.ignore_ipolicy)]
for inst in _GetNodePrimaryInstances(self.cfg, self.op.node_name)
]
for inst in _GetNodePrimaryInstances(self.cfg, self.op.node_name)]
# TODO: Run iallocator in this opcode and pass correct placement options to
# OpInstanceMigrate. Since other jobs can modify the cluster between
......@@ -9115,9 +9114,11 @@ def _GenerateDiskTemplate(
for i in range(disk_count)])
if template_name == constants.DT_PLAIN:
def logical_id_fn(idx, _, disk):
vg = disk.get(constants.IDISK_VG, vgname)
return (vg, names[idx])
elif template_name in (constants.DT_FILE, constants.DT_SHARED_FILE):
logical_id_fn = \
lambda _, disk_index, disk: (file_driver,
......@@ -10292,7 +10293,6 @@ class LUInstanceCreate(LogicalUnit):
if self.op.conflicts_check:
_CheckForConflictingIp(self, nic.ip, self.pnode.name)
# mirror node verification
if self.op.disk_template in constants.DTS_INT_MIRROR:
if self.op.snode == pnode.name:
......@@ -12045,8 +12045,7 @@ class LUNodeEvacuate(NoHooksLU):
disks=[],
mode=constants.REPLACE_DISK_CHG,
early_release=self.op.early_release)]
for instance_name in self.instance_names
]
for instance_name in self.instance_names]
else:
raise errors.ProgrammerError("No iallocator or remote node")
......@@ -12957,6 +12956,7 @@ class LUInstanceSetParams(LogicalUnit):
" in cluster" % mac,
errors.ECODE_NOTUNIQUE)
elif new_net != old_net:
def get_net_prefix(net):
if net:
uuid = self.cfg.LookupNetwork(net)
......@@ -12964,6 +12964,7 @@ class LUInstanceSetParams(LogicalUnit):
nobj = self.cfg.GetNetwork(uuid)
return nobj.mac_prefix
return None
new_prefix = get_net_prefix(new_net)
old_prefix = get_net_prefix(old_net)
if old_prefix != new_prefix:
......@@ -15551,6 +15552,7 @@ class LUTestAllocator(NoHooksLU):
result = ial.out_text
return result
# Network LUs
class LUNetworkAdd(LogicalUnit):
"""Logical unit for creating networks.
......@@ -15590,13 +15592,12 @@ class LUNetworkAdd(LogicalUnit):
self.op.network, errors.ECODE_EXISTS)
if self.op.mac_prefix:
utils.NormalizeAndValidateMac(self.op.mac_prefix+":00:00:00")
utils.NormalizeAndValidateMac(self.op.mac_prefix + ":00:00:00")
# Check tag validity
for tag in self.op.tags:
objects.TaggableObject.ValidateTag(tag)
def BuildHooksEnv(self):
"""Build hooks env.
......@@ -15681,7 +15682,6 @@ class LUNetworkRemove(LogicalUnit):
locking.LEVEL_NETWORK: [self.network_uuid],
}
def CheckPrereq(self):
"""Check prerequisites.
......@@ -15744,7 +15744,6 @@ class LUNetworkSetParams(LogicalUnit):
raise errors.OpPrereqError("Cannot modify gateway and reserved ips"
" at once", errors.ECODE_INVAL)
def ExpandNames(self):
self.network_uuid = self.cfg.LookupNetwork(self.op.network_name)
self.network = self.cfg.GetNetwork(self.network_uuid)
......@@ -15788,7 +15787,7 @@ class LUNetworkSetParams(LogicalUnit):
if self.op.mac_prefix == constants.VALUE_NONE:
self.mac_prefix = None
else:
utils.NormalizeAndValidateMac(self.op.mac_prefix+":00:00:00")
utils.NormalizeAndValidateMac(self.op.mac_prefix + ":00:00:00")
self.mac_prefix = self.op.mac_prefix
if self.op.gateway6:
......@@ -15803,8 +15802,6 @@ class LUNetworkSetParams(LogicalUnit):
else:
self.network6 = self.op.network6
def BuildHooksEnv(self):
"""Build hooks env.
......@@ -15939,7 +15936,6 @@ class _NetworkQuery(_QueryBase):
all_nodes = lu.cfg.GetAllNodesInfo()
network_to_instances = dict((uuid, []) for uuid in self.wanted)
for group in all_groups.values():
if do_instances:
group_nodes = [node.name for node in all_nodes.values() if
......@@ -15998,7 +15994,6 @@ class LUNetworkQuery(NoHooksLU):
return self.nq.OldStyleQuery(self)
class LUNetworkConnect(LogicalUnit):
"""Connect a network to a nodegroup
......@@ -16052,7 +16047,6 @@ class LUNetworkConnect(LogicalUnit):
nodes = self.cfg.GetNodeGroup(self.group_uuid).members
return (nodes, nodes)
def CheckPrereq(self):
l = lambda value: ", ".join("%s: %s/%s" % (i[0], i[1], i[2])
for i in value)
......@@ -16147,7 +16141,6 @@ class LUNetworkDisconnect(LogicalUnit):
nodes = self.cfg.GetNodeGroup(self.group_uuid).members
return (nodes, nodes)
def CheckPrereq(self):
l = lambda value: ", ".join("%s: %s/%s" % (i[0], i[1], i[2])
for i in value)
......@@ -16213,6 +16206,7 @@ def _GetQueryImplementation(name):
raise errors.OpPrereqError("Unknown query resource '%s'" % name,
errors.ECODE_INVAL)
def _CheckForConflictingIp(lu, ip, node):
"""In case of conflicting ip raise error.
......
......@@ -115,7 +115,6 @@ class TemporaryReservationManager:
ec_reserved.update(self._ec_reserved[ec_id])
return ec_reserved
def Generate(self, existing, generate_one_fn, ec_id):
"""Generate a new resource of this type
......@@ -162,6 +161,7 @@ def _CheckInstanceDiskIvNames(disks):
return result
def _GenerateMACSuffix():
"""Generate one mac address
......@@ -241,7 +241,7 @@ class ConfigWriter:
if nobj.mac_prefix:
prefix = nobj.mac_prefix
suffix = view_func(*args, **kwargs)
return prefix+':'+suffix
return prefix + ':' + suffix
return wraps(view_func)(_decorator)
return _get_mac_prefix
......@@ -391,7 +391,6 @@ class ConfigWriter:
return self._temporary_ips.Reserve(ec_id, ('reserve', address, net_uuid))
@locking.ssynchronized(_config_lock, shared=1)
def ReserveIp(self, net, address, ec_id):
"""Reserve a given IPv4 address for use by an instance.
......@@ -1444,7 +1443,6 @@ class ConfigWriter:
# Return all IP addresses to the respective address pools
self._UnlockedCommitIp('release', net_uuid, nic.ip)
del self._config_data.instances[instance_name]
self._config_data.cluster.serial_no += 1
self._WriteConfig()
......@@ -2546,7 +2544,6 @@ class ConfigWriter:
"""
return self._UnlockedGetGroupNetParams(net, node)
@locking.ssynchronized(_config_lock, shared=1)
def CheckIPInNodeGroup(self, ip, node):
"""Check for conflictig IP.
......
......@@ -334,7 +334,7 @@ VALID_STORAGE_FIELDS = frozenset([
SF_SIZE,
SF_USED,
SF_FREE,
SF_ALLOCATABLE
SF_ALLOCATABLE,
])
VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
......@@ -500,7 +500,7 @@ DISK_TEMPLATES = frozenset([
DT_FILE,
DT_SHARED_FILE,
DT_BLOCK,
DT_RBD
DT_RBD,
])
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
......@@ -613,7 +613,7 @@ OS_SCRIPTS = frozenset([
OS_SCRIPT_IMPORT,
OS_SCRIPT_EXPORT,
OS_SCRIPT_RENAME,
OS_SCRIPT_VERIFY
OS_SCRIPT_VERIFY,
])
OS_API_FILE = "ganeti_api_version"
......@@ -635,7 +635,7 @@ INSTANCE_REBOOT_FULL = "full"
REBOOT_TYPES = frozenset([
INSTANCE_REBOOT_SOFT,
INSTANCE_REBOOT_HARD,
INSTANCE_REBOOT_FULL
INSTANCE_REBOOT_FULL,
])
# instance reboot behaviors
......@@ -644,7 +644,7 @@ INSTANCE_REBOOT_EXIT = "exit"
REBOOT_BEHAVIORS = frozenset([
INSTANCE_REBOOT_ALLOWED,
INSTANCE_REBOOT_EXIT
INSTANCE_REBOOT_EXIT,
])
VTYPE_STRING = "string"
......@@ -1039,7 +1039,7 @@ OOB_COMMANDS = frozenset([
OOB_POWER_OFF,
OOB_POWER_CYCLE,
OOB_POWER_STATUS,
OOB_HEALTH
OOB_HEALTH,
])
OOB_POWER_STATUS_POWERED = "powered"
......@@ -1152,7 +1152,7 @@ HT_HVM_VALID_NIC_TYPES = frozenset([
HT_NIC_NE2K_PCI,
HT_NIC_E1000,
HT_NIC_NE2K_ISA,
HT_NIC_PARAVIRTUAL
HT_NIC_PARAVIRTUAL,
])
HT_KVM_VALID_NIC_TYPES = frozenset([
HT_NIC_RTL8139,
......@@ -1163,7 +1163,7 @@ HT_KVM_VALID_NIC_TYPES = frozenset([
HT_NIC_I8259ER,
HT_NIC_PCNET,
HT_NIC_E1000,
HT_NIC_PARAVIRTUAL
HT_NIC_PARAVIRTUAL,
])
# Disk types
......@@ -1182,7 +1182,7 @@ HT_VALID_CACHE_TYPES = frozenset([
HT_CACHE_DEFAULT,
HT_CACHE_NONE,
HT_CACHE_WTHROUGH,
HT_CACHE_WBACK
HT_CACHE_WBACK,
])
HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
......@@ -1192,7 +1192,7 @@ HT_KVM_VALID_DISK_TYPES = frozenset([
HT_DISK_SCSI,
HT_DISK_SD,
HT_DISK_MTD,
HT_DISK_PFLASH
HT_DISK_PFLASH,
])
# Mouse types:
......@@ -1211,7 +1211,7 @@ HT_KVM_VALID_BO_TYPES = frozenset([
HT_BO_FLOPPY,
HT_BO_CDROM,
HT_BO_DISK,
HT_BO_NETWORK
HT_BO_NETWORK,
])
# SPICE lossless image compression options
......@@ -1553,7 +1553,7 @@ OP_STATUS_ERROR = "error"
OPS_FINALIZED = frozenset([
OP_STATUS_CANCELED,
OP_STATUS_SUCCESS,
OP_STATUS_ERROR
OP_STATUS_ERROR,
])
# OpCode priority
......
......@@ -494,7 +494,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
constants.HV_REBOOT_BEHAVIOR:
hv_base.ParamInSet(True, constants.REBOOT_BEHAVIORS),
constants.HV_CPU_MASK: hv_base.OPT_MULTI_CPU_MASK_CHECK,
constants.HV_CPU_TYPE: hv_base.NO_CHECK
constants.HV_CPU_TYPE: hv_base.NO_CHECK,
}
_MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)",
......@@ -796,7 +796,6 @@ class KVMHypervisor(hv_base.BaseHypervisor):
return env
if nic.network:
n = objects.Network.FromDict(nic.netinfo)
_BuildNetworkEnv(nic.network, n.network, n.gateway,
......
......@@ -137,6 +137,7 @@ class XenHypervisor(hv_base.BaseHypervisor):
# VM) to one physical CPU, using format 'cpu = "C"'
return "cpu = \"%s\"" % ",".join(map(str, all_cpu_mapping))
else:
def _GetCPUMap(vcpu):
if vcpu[0] == constants.CPU_PINNING_ALL_VAL:
cpu_map = constants.CPU_PINNING_ALL_XEN
......
......@@ -216,7 +216,7 @@ class CommandBuilder(object):
# second address is only used for writing
"-u",
",".join(addr1), ",".join(addr2)
",".join(addr1), ",".join(addr2),
]
def _GetMagicCommand(self):
......
......@@ -40,7 +40,7 @@ _JOB_LIST = ht.TListOf(ht.TListOf(ht.TStrictDict(True, False, {
# Class '...' has no 'OP_ID' member
"OP_ID": ht.TElemOf([opcodes.OpInstanceFailover.OP_ID,
opcodes.OpInstanceMigrate.OP_ID,
opcodes.OpInstanceReplaceDisks.OP_ID])
opcodes.OpInstanceReplaceDisks.OP_ID]),
})))
_NEVAC_MOVED = \
......@@ -208,7 +208,7 @@ class IAReqMultiInstanceAlloc(IARequestBase):
# pylint: disable=E1101
MODE = constants.IALLOCATOR_MODE_MULTI_ALLOC
REQ_PARAMS = [
("instances", ht.TListOf(ht.TInstanceOf(IAReqInstanceAlloc)))
("instances", ht.TListOf(ht.TInstanceOf(IAReqInstanceAlloc))),
]
_MASUCCESS = \
ht.TListOf(ht.TAnd(ht.TIsLength(2),
......@@ -221,7 +221,7 @@ class IAReqMultiInstanceAlloc(IARequestBase):
def GetRequest(self, cfg):
return {
"instances": [iareq.GetRequest(cfg) for iareq in self.instances]
"instances": [iareq.GetRequest(cfg) for iareq in self.instances],
}
......
......@@ -29,6 +29,7 @@ from bitarray import bitarray
from ganeti import errors
class AddressPool(object):
"""Address pool class, wrapping an objects.Network object
......@@ -107,7 +108,7 @@ class AddressPool(object):
self.Update()
def _GetSize(self):
return 2**(32 - self.network.prefixlen)
return 2 ** (32 - self.network.prefixlen)
@property
def all_reservations(self):
......
......@@ -420,7 +420,7 @@ class MasterNetworkParameters(ConfigObject):
"ip",
"netmask",
"netdev",
"ip_family"
"ip_family",
]
......@@ -905,7 +905,7 @@ class Disk(ConfigObject):
elif disk_template == constants.DT_RBD:
result.append(FillDict(constants.DISK_LD_DEFAULTS[constants.LD_RBD], {
constants.LDP_POOL: dt_params[constants.RBD_POOL]
constants.LDP_POOL: dt_params[constants.RBD_POOL],
}))
return result
......
......@@ -353,6 +353,7 @@ _CheckNetworkType = ht.TElemOf(constants.NETWORK_VALID_TYPES)
_PNetworkType = ("network_type", None, ht.TOr(ht.TNone, _CheckNetworkType),
"Network type")
def _CheckCIDRNetNotation(value):
"""Ensure a given cidr notation type is valid.
......@@ -363,6 +364,7 @@ def _CheckCIDRNetNotation(value):
return False
return True
def _CheckCIDRAddrNotation(value):
"""Ensure a given cidr notation type is valid.
......@@ -373,6 +375,7 @@ def _CheckCIDRAddrNotation(value):
return False
return True
def _CheckCIDR6AddrNotation(value):
"""Ensure a given cidr notation type is valid.
......@@ -383,6 +386,7 @@ def _CheckCIDR6AddrNotation(value):
return False
return True
def _CheckCIDR6NetNotation(value):
"""Ensure a given cidr notation type is valid.
......@@ -393,6 +397,7 @@ def _CheckCIDR6NetNotation(value):
return False
return True
class _AutoOpParamSlots(objectutils.AutoSlots):
"""Meta class for opcode definitions.
......@@ -719,7 +724,7 @@ class OpClusterVerify(OpCode):
_PSkipChecks,
_PIgnoreErrors,
_PVerbose,
("group_name", None, ht.TMaybeString, "Group to verify")
("group_name", None, ht.TMaybeString, "Group to verify"),
]
OP_RESULT = TJobIdListOnly
......@@ -824,7 +829,7 @@ class OpClusterRepairDiskSizes(OpCode):
class OpClusterConfigQuery(OpCode):
"""Query cluster configuration values."""
OP_PARAMS = [
_POutputFields
_POutputFields,
]
OP_RESULT = ht.TListOf(ht.TAny)
......@@ -1298,7 +1303,7 @@ class OpInstanceMultiAlloc(OpCode):
OP_RESULT = ht.TStrictDict(True, True, {
constants.JOB_IDS_KEY: _JOB_LIST,
ALLOCATABLE_KEY: ht.TListOf(ht.TNonEmptyString),
FAILED_KEY: ht.TListOf(ht.TNonEmptyString)
FAILED_KEY: ht.TListOf(ht.TNonEmptyString),
})
def __getstate__(self):
......@@ -1506,7 +1511,7 @@ class OpInstanceConsole(OpCode):
"""Connect to an instance's console."""
OP_DSC_FIELD = "instance_name"
OP_PARAMS = [
_PInstanceName
_PInstanceName,
]
OP_RESULT = ht.TDict
......@@ -2011,7 +2016,7 @@ class OpNetworkAdd(OpCode):
OP_PARAMS = [
_PNetworkName,
_PNetworkType,
("network", None, ht.TAnd(ht.TString ,_CheckCIDRNetNotation),
("network", None, ht.TAnd(ht.TString, _CheckCIDRNetNotation),
"IPv4 Subnet"),
("gateway", None, ht.TOr(ht.TNone, _CheckCIDRAddrNotation),
"IPv4 Gateway"),
......@@ -2028,6 +2033,7 @@ class OpNetworkAdd(OpCode):
]
OP_RESULT = ht.TNone
class OpNetworkRemove(OpCode):
"""Remove an existing network from the cluster.
Must not be connected to any nodegroup.
......@@ -2040,6 +2046,7 @@ class OpNetworkRemove(OpCode):
]
OP_RESULT = ht.TNone
class OpNetworkSetParams(OpCode):
"""Modify Network's parameters except for IPv4 subnet"""
OP_DSC_FIELD = "network_name"
......@@ -2063,6 +2070,7 @@ class OpNetworkSetParams(OpCode):
]
OP_RESULT = ht.TNone
class OpNetworkConnect(OpCode):
"""Connect a Network to a specific Nodegroup with the defined netparams
(mode, link). Nics in this Network will inherit those params.
......@@ -2081,6 +2089,7 @@ class OpNetworkConnect(OpCode):
]
OP_RESULT = ht.TNone
class OpNetworkDisconnect(OpCode):
"""Disconnect a Network from a Nodegroup. Produce errors if NICs are
present in the Network unless --no-conficts-check option is passed.
......@@ -2094,6 +2103,7 @@ class OpNetworkDisconnect(OpCode):
]
OP_RESULT = ht.TNone
class OpNetworkQuery(OpCode):
"""Compute the list of networks."""
OP_PARAMS = [
......
......@@ -1343,15 +1343,13 @@ def _BuildNodeFields():
# Add simple fields
fields.extend([
(_MakeField(name, title, kind, doc), NQ_CONFIG, flags, _GetItemAttr(name))
for (name, (title, kind, flags, doc)) in _NODE_SIMPLE_FIELDS.items()
])
for (name, (title, kind, flags, doc)) in _NODE_SIMPLE_FIELDS.items()])
# Add fields requiring live data
fields.extend([
(_MakeField(name, title, kind, doc), NQ_LIVE, 0,
compat.partial(_GetLiveNodeField, nfield, kind))
for (name, (title, kind, nfield, doc)) in _NODE_LIVE_FIELDS.items()
])
for (name, (title, kind, nfield, doc)) in _NODE_LIVE_FIELDS.items()])
# Add timestamps
fields.extend(_GetItemTimestampFields(NQ_CONFIG))
......@@ -1772,8 +1770,7 @@ def _GetInstanceDiskFields():
(_MakeField("disk.size/%s" % i, "Disk/%s" % i, QFT_UNIT,
"Disk size of %s disk" % utils.FormatOrdinal(i + 1)),
IQ_CONFIG, 0, _GetInstDiskSize(i))
for i in range(constants.MAX_DISKS)
])
for i in range(constants.MAX_DISKS)])
return fields
......@@ -1821,8 +1818,7 @@ def _GetInstanceParameterFields():
_VTToQFT[kind], "The \"%s\" hypervisor parameter" % name),
IQ_CONFIG, 0, _GetInstHvParam(name))
for name, kind in constants.HVS_PARAMETER_TYPES.items()
if name not in constants.HVC_GLOBALS
])
if name not in constants.HVC_GLOBALS])
# BE params
def _GetInstBeParam(name):
......@@ -1833,8 +1829,7 @@ def _GetInstanceParameterFields():
constants.BES_PARAMETER_TITLES.get(name, "be/%s" % name),
_VTToQFT[kind], "The \"%s\" backend parameter" % name),
IQ_CONFIG, 0, _GetInstBeParam(name))
for name, kind in constants.BES_PARAMETER_TYPES.items()
])
for name, kind in constants.BES_PARAMETER_TYPES.items()])
return fields
......@@ -1937,8 +1932,7 @@ def _BuildInstanceFields():
# Add simple fields
fields.extend([
(_MakeField(name, title, kind, doc), IQ_CONFIG, flags, _GetItemAttr(name))
for (name, (title, kind, flags, doc)) in _INST_SIMPLE_FIELDS.items()
])
for (name, (title, kind, flags, doc)) in _INST_SIMPLE_FIELDS.items()])
# Fields requiring talking to the node
fields.extend([
......@@ -2431,20 +2425,18 @@ def _BuildClusterFields():
fields.extend([
(_MakeField(name, title, kind, doc), CQ_CONFIG, flags, _GetItemAttr(name))
for (name, (title, kind, flags, doc)) in _CLUSTER_SIMPLE_FIELDS.items()
])
],)
# Version fields
fields.extend([
(_MakeField(name, title, kind, doc), None, 0, _StaticValue(value))
for (name, (title, kind, value, doc)) in _CLUSTER_VERSION_FIELDS.items()
])
for (name, (title, kind, value, doc)) in _CLUSTER_VERSION_FIELDS.items()])
# Add timestamps
fields.extend(_GetItemTimestampFields(CQ_CONFIG))
return _PrepareFieldList(fields, [
("name", "cluster_name"),
])
("name", "cluster_name")])
class NetworkQueryData:
......@@ -2501,6 +2493,7 @@ _NETWORK_STATS_FIELDS = {
"The external reservations"),
}
def _GetNetworkStatsField(field, kind, ctx):
"""Gets the value of a "stats" field from L{NetworkQueryData}.
......@@ -2542,8 +2535,7 @@ def _BuildNetworkFields():
fields.extend([
(_MakeField(name, title, kind, doc),
NETQ_CONFIG, 0, _GetItemAttr(name))
for (name, (title, kind, _, doc)) in _NETWORK_SIMPLE_FIELDS.items()
])
for (name, (title, kind, _, doc)) in _NETWORK_SIMPLE_FIELDS.items()])
def _GetLength(getter):
retur