Revision 3c286190

b/daemons/import-export
541 541
                           [socat_stderr_write_fd, dd_stderr_write_fd,
542 542
                            dd_pid_write_fd, exp_size_write_fd])
543 543
      try:
544

  
544 545
        def _ForwardSignal(signum, _):
545 546
          """Forwards signals to child process.
546 547

  
b/lib/cli.py
373 373

  
374 374
  """
375 375

  
376

  
376 377
class ArgGroup(_Argument):
377 378
  """Node group argument.
378 379

  
b/lib/client/gnt_debug.py
495 495
        opcodes.OpTestJqueue(notify_waitlock=True,
496 496
                             notify_exec=True,
497 497
                             log_messages=test_messages,
498
                             fail=fail)
498
                             fail=fail),
499 499
        ]
500 500
      expect_messages = [test_messages]
501 501
      expect_resultlen = 1
b/lib/client/gnt_network.py
44 44
      return utils.UnescapeAndSplit(ips, sep=",")
45 45
  return None
46 46

  
47

  
47 48
def AddNetwork(opts, args):
48 49
  """Add a network to the cluster.
49 50

  
......
61 62
  else:
62 63
    tags = []
63 64

  
64
  op = opcodes.OpNetworkAdd(network_name=network_name,
65
                            gateway=opts.gateway,
66
                            network=opts.network,
67
                            gateway6=opts.gateway6,
68
                            network6=opts.network6,
69
                            mac_prefix=opts.mac_prefix,
70
                            network_type=opts.network_type,
71
                            add_reserved_ips=\
72
                              _HandleReservedIPs(opts.add_reserved_ips),
73
                            tags=tags)
65
  op = opcodes.OpNetworkAdd(
66
                    network_name=network_name,
67
                    gateway=opts.gateway,
68
                    network=opts.network,
69
                    gateway6=opts.gateway6,
70
                    network6=opts.network6,
71
                    mac_prefix=opts.mac_prefix,
72
                    network_type=opts.network_type,
73
                    add_reserved_ips=_HandleReservedIPs(opts.add_reserved_ips),
74
                    tags=tags)
74 75
  SubmitOpCode(op, opts=opts)
75 76

  
76 77

  
......
202 203
    ToStdout("  type: %s", network_type)
203 204
    ToStdout("  size: %d", size)
204 205
    ToStdout("  free: %d (%.2f%%)", free_count,
205
             100 * float(free_count)/float(size))
206
             100 * float(free_count) / float(size))
206 207
    ToStdout("  usage map:")
207 208
    idx = 0
208 209
    for line in wrap(mapping, width=64):
......
229 230
                                                ["nic.ips", "nic.networks"],
230 231
                                                use_locking=False)
231 232

  
232
        l = lambda value: ", ".join(str(idx)+":"+str(ip)
233
        l = lambda value: ", ".join(str(idx) + ":" + str(ip)
233 234
                                    for idx, (ip, net) in enumerate(value)
234 235
                                      if net == name)
235 236

  
b/lib/cmdlib.py
2037 2037

  
2038 2038
      # Verify global configuration
2039 2039
      jobs.append([
2040
        opcodes.OpClusterVerifyConfig(ignore_errors=self.op.ignore_errors)
2040
        opcodes.OpClusterVerifyConfig(ignore_errors=self.op.ignore_errors),
2041 2041
        ])
2042 2042

  
2043 2043
      # Always depend on global verification
......
3189 3189

  
3190 3190
    """
3191 3191
    env = {
3192
      "CLUSTER_TAGS": " ".join(self.cfg.GetClusterInfo().GetTags())
3192
      "CLUSTER_TAGS": " ".join(self.cfg.GetClusterInfo().GetTags()),
3193 3193
      }
3194 3194

  
3195 3195
    env.update(("NODE_TAGS_%s" % node.name, " ".join(node.GetTags()))
......
8200 8200
                                 target_node=self.op.target_node,
8201 8201
                                 allow_runtime_changes=allow_runtime_changes,
8202 8202
                                 ignore_ipolicy=self.op.ignore_ipolicy)]
8203
      for inst in _GetNodePrimaryInstances(self.cfg, self.op.node_name)
8204
      ]
8203
      for inst in _GetNodePrimaryInstances(self.cfg, self.op.node_name)]
8205 8204

  
8206 8205
    # TODO: Run iallocator in this opcode and pass correct placement options to
8207 8206
    # OpInstanceMigrate. Since other jobs can modify the cluster between
......
9115 9114
                                        for i in range(disk_count)])
9116 9115

  
9117 9116
    if template_name == constants.DT_PLAIN:
9117

  
9118 9118
      def logical_id_fn(idx, _, disk):
9119 9119
        vg = disk.get(constants.IDISK_VG, vgname)
9120 9120
        return (vg, names[idx])
9121

  
9121 9122
    elif template_name in (constants.DT_FILE, constants.DT_SHARED_FILE):
9122 9123
      logical_id_fn = \
9123 9124
        lambda _, disk_index, disk: (file_driver,
......
10292 10293
        if self.op.conflicts_check:
10293 10294
          _CheckForConflictingIp(self, nic.ip, self.pnode.name)
10294 10295

  
10295

  
10296 10296
    # mirror node verification
10297 10297
    if self.op.disk_template in constants.DTS_INT_MIRROR:
10298 10298
      if self.op.snode == pnode.name:
......
12045 12045
                                        disks=[],
12046 12046
                                        mode=constants.REPLACE_DISK_CHG,
12047 12047
                                        early_release=self.op.early_release)]
12048
        for instance_name in self.instance_names
12049
        ]
12048
        for instance_name in self.instance_names]
12050 12049

  
12051 12050
    else:
12052 12051
      raise errors.ProgrammerError("No iallocator or remote node")
......
12957 12956
                                     " in cluster" % mac,
12958 12957
                                     errors.ECODE_NOTUNIQUE)
12959 12958
    elif new_net != old_net:
12959

  
12960 12960
      def get_net_prefix(net):
12961 12961
        if net:
12962 12962
          uuid = self.cfg.LookupNetwork(net)
......
12964 12964
            nobj = self.cfg.GetNetwork(uuid)
12965 12965
            return nobj.mac_prefix
12966 12966
        return None
12967

  
12967 12968
      new_prefix = get_net_prefix(new_net)
12968 12969
      old_prefix = get_net_prefix(old_net)
12969 12970
      if old_prefix != new_prefix:
......
15551 15552
      result = ial.out_text
15552 15553
    return result
15553 15554

  
15555

  
15554 15556
# Network LUs
15555 15557
class LUNetworkAdd(LogicalUnit):
15556 15558
  """Logical unit for creating networks.
......
15590 15592
                                 self.op.network, errors.ECODE_EXISTS)
15591 15593

  
15592 15594
    if self.op.mac_prefix:
15593
      utils.NormalizeAndValidateMac(self.op.mac_prefix+":00:00:00")
15595
      utils.NormalizeAndValidateMac(self.op.mac_prefix + ":00:00:00")
15594 15596

  
15595 15597
    # Check tag validity
15596 15598
    for tag in self.op.tags:
15597 15599
      objects.TaggableObject.ValidateTag(tag)
15598 15600

  
15599

  
15600 15601
  def BuildHooksEnv(self):
15601 15602
    """Build hooks env.
15602 15603

  
......
15681 15682
      locking.LEVEL_NETWORK: [self.network_uuid],
15682 15683
      }
15683 15684

  
15684

  
15685 15685
  def CheckPrereq(self):
15686 15686
    """Check prerequisites.
15687 15687

  
......
15744 15744
      raise errors.OpPrereqError("Cannot modify gateway and reserved ips"
15745 15745
                                 " at once", errors.ECODE_INVAL)
15746 15746

  
15747

  
15748 15747
  def ExpandNames(self):
15749 15748
    self.network_uuid = self.cfg.LookupNetwork(self.op.network_name)
15750 15749
    self.network = self.cfg.GetNetwork(self.network_uuid)
......
15788 15787
      if self.op.mac_prefix == constants.VALUE_NONE:
15789 15788
        self.mac_prefix = None
15790 15789
      else:
15791
        utils.NormalizeAndValidateMac(self.op.mac_prefix+":00:00:00")
15790
        utils.NormalizeAndValidateMac(self.op.mac_prefix + ":00:00:00")
15792 15791
        self.mac_prefix = self.op.mac_prefix
15793 15792

  
15794 15793
    if self.op.gateway6:
......
15803 15802
      else:
15804 15803
        self.network6 = self.op.network6
15805 15804

  
15806

  
15807

  
15808 15805
  def BuildHooksEnv(self):
15809 15806
    """Build hooks env.
15810 15807

  
......
15939 15936
        all_nodes = lu.cfg.GetAllNodesInfo()
15940 15937
        network_to_instances = dict((uuid, []) for uuid in self.wanted)
15941 15938

  
15942

  
15943 15939
      for group in all_groups.values():
15944 15940
        if do_instances:
15945 15941
          group_nodes = [node.name for node in all_nodes.values() if
......
15998 15994
    return self.nq.OldStyleQuery(self)
15999 15995

  
16000 15996

  
16001

  
16002 15997
class LUNetworkConnect(LogicalUnit):
16003 15998
  """Connect a network to a nodegroup
16004 15999

  
......
16052 16047
    nodes = self.cfg.GetNodeGroup(self.group_uuid).members
16053 16048
    return (nodes, nodes)
16054 16049

  
16055

  
16056 16050
  def CheckPrereq(self):
16057 16051
    l = lambda value: ", ".join("%s: %s/%s" % (i[0], i[1], i[2])
16058 16052
                                   for i in value)
......
16147 16141
    nodes = self.cfg.GetNodeGroup(self.group_uuid).members
16148 16142
    return (nodes, nodes)
16149 16143

  
16150

  
16151 16144
  def CheckPrereq(self):
16152 16145
    l = lambda value: ", ".join("%s: %s/%s" % (i[0], i[1], i[2])
16153 16146
                                   for i in value)
......
16213 16206
    raise errors.OpPrereqError("Unknown query resource '%s'" % name,
16214 16207
                               errors.ECODE_INVAL)
16215 16208

  
16209

  
16216 16210
def _CheckForConflictingIp(lu, ip, node):
16217 16211
  """In case of conflicting ip raise error.
16218 16212

  
b/lib/config.py
115 115
      ec_reserved.update(self._ec_reserved[ec_id])
116 116
    return ec_reserved
117 117

  
118

  
119 118
  def Generate(self, existing, generate_one_fn, ec_id):
120 119
    """Generate a new resource of this type
121 120

  
......
162 161

  
163 162
  return result
164 163

  
164

  
165 165
def _GenerateMACSuffix():
166 166
  """Generate one mac address
167 167

  
......
241 241
            if nobj.mac_prefix:
242 242
              prefix = nobj.mac_prefix
243 243
        suffix = view_func(*args, **kwargs)
244
        return prefix+':'+suffix
244
        return prefix + ':' + suffix
245 245
      return wraps(view_func)(_decorator)
246 246
    return _get_mac_prefix
247 247

  
......
391 391

  
392 392
    return self._temporary_ips.Reserve(ec_id, ('reserve', address, net_uuid))
393 393

  
394

  
395 394
  @locking.ssynchronized(_config_lock, shared=1)
396 395
  def ReserveIp(self, net, address, ec_id):
397 396
    """Reserve a given IPv4 address for use by an instance.
......
1444 1443
          # Return all IP addresses to the respective address pools
1445 1444
          self._UnlockedCommitIp('release', net_uuid, nic.ip)
1446 1445

  
1447

  
1448 1446
    del self._config_data.instances[instance_name]
1449 1447
    self._config_data.cluster.serial_no += 1
1450 1448
    self._WriteConfig()
......
2546 2544
    """
2547 2545
    return self._UnlockedGetGroupNetParams(net, node)
2548 2546

  
2549

  
2550 2547
  @locking.ssynchronized(_config_lock, shared=1)
2551 2548
  def CheckIPInNodeGroup(self, ip, node):
2552 2549
    """Check for conflictig IP.
b/lib/constants.py
334 334
  SF_SIZE,
335 335
  SF_USED,
336 336
  SF_FREE,
337
  SF_ALLOCATABLE
337
  SF_ALLOCATABLE,
338 338
  ])
339 339

  
340 340
VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
......
500 500
  DT_FILE,
501 501
  DT_SHARED_FILE,
502 502
  DT_BLOCK,
503
  DT_RBD
503
  DT_RBD,
504 504
  ])
505 505

  
506 506
FILE_DRIVER = frozenset([FD_LOOP, FD_BLKTAP])
......
613 613
  OS_SCRIPT_IMPORT,
614 614
  OS_SCRIPT_EXPORT,
615 615
  OS_SCRIPT_RENAME,
616
  OS_SCRIPT_VERIFY
616
  OS_SCRIPT_VERIFY,
617 617
  ])
618 618

  
619 619
OS_API_FILE = "ganeti_api_version"
......
635 635
REBOOT_TYPES = frozenset([
636 636
  INSTANCE_REBOOT_SOFT,
637 637
  INSTANCE_REBOOT_HARD,
638
  INSTANCE_REBOOT_FULL
638
  INSTANCE_REBOOT_FULL,
639 639
  ])
640 640

  
641 641
# instance reboot behaviors
......
644 644

  
645 645
REBOOT_BEHAVIORS = frozenset([
646 646
  INSTANCE_REBOOT_ALLOWED,
647
  INSTANCE_REBOOT_EXIT
647
  INSTANCE_REBOOT_EXIT,
648 648
  ])
649 649

  
650 650
VTYPE_STRING = "string"
......
1039 1039
  OOB_POWER_OFF,
1040 1040
  OOB_POWER_CYCLE,
1041 1041
  OOB_POWER_STATUS,
1042
  OOB_HEALTH
1042
  OOB_HEALTH,
1043 1043
  ])
1044 1044

  
1045 1045
OOB_POWER_STATUS_POWERED = "powered"
......
1152 1152
  HT_NIC_NE2K_PCI,
1153 1153
  HT_NIC_E1000,
1154 1154
  HT_NIC_NE2K_ISA,
1155
  HT_NIC_PARAVIRTUAL
1155
  HT_NIC_PARAVIRTUAL,
1156 1156
  ])
1157 1157
HT_KVM_VALID_NIC_TYPES = frozenset([
1158 1158
  HT_NIC_RTL8139,
......
1163 1163
  HT_NIC_I8259ER,
1164 1164
  HT_NIC_PCNET,
1165 1165
  HT_NIC_E1000,
1166
  HT_NIC_PARAVIRTUAL
1166
  HT_NIC_PARAVIRTUAL,
1167 1167
  ])
1168 1168

  
1169 1169
# Disk types
......
1182 1182
  HT_CACHE_DEFAULT,
1183 1183
  HT_CACHE_NONE,
1184 1184
  HT_CACHE_WTHROUGH,
1185
  HT_CACHE_WBACK
1185
  HT_CACHE_WBACK,
1186 1186
  ])
1187 1187

  
1188 1188
HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
......
1192 1192
  HT_DISK_SCSI,
1193 1193
  HT_DISK_SD,
1194 1194
  HT_DISK_MTD,
1195
  HT_DISK_PFLASH
1195
  HT_DISK_PFLASH,
1196 1196
  ])
1197 1197

  
1198 1198
# Mouse types:
......
1211 1211
  HT_BO_FLOPPY,
1212 1212
  HT_BO_CDROM,
1213 1213
  HT_BO_DISK,
1214
  HT_BO_NETWORK
1214
  HT_BO_NETWORK,
1215 1215
  ])
1216 1216

  
1217 1217
# SPICE lossless image compression options
......
1553 1553
OPS_FINALIZED = frozenset([
1554 1554
  OP_STATUS_CANCELED,
1555 1555
  OP_STATUS_SUCCESS,
1556
  OP_STATUS_ERROR
1556
  OP_STATUS_ERROR,
1557 1557
  ])
1558 1558

  
1559 1559
# OpCode priority
b/lib/hypervisor/hv_kvm.py
494 494
    constants.HV_REBOOT_BEHAVIOR:
495 495
      hv_base.ParamInSet(True, constants.REBOOT_BEHAVIORS),
496 496
    constants.HV_CPU_MASK: hv_base.OPT_MULTI_CPU_MASK_CHECK,
497
    constants.HV_CPU_TYPE: hv_base.NO_CHECK
497
    constants.HV_CPU_TYPE: hv_base.NO_CHECK,
498 498
    }
499 499

  
500 500
  _MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)",
......
796 796

  
797 797
      return env
798 798

  
799

  
800 799
    if nic.network:
801 800
      n = objects.Network.FromDict(nic.netinfo)
802 801
      _BuildNetworkEnv(nic.network, n.network, n.gateway,
b/lib/hypervisor/hv_xen.py
137 137
        # VM) to one physical CPU, using format 'cpu = "C"'
138 138
        return "cpu = \"%s\"" % ",".join(map(str, all_cpu_mapping))
139 139
    else:
140

  
140 141
      def _GetCPUMap(vcpu):
141 142
        if vcpu[0] == constants.CPU_PINNING_ALL_VAL:
142 143
          cpu_map = constants.CPU_PINNING_ALL_XEN
b/lib/impexpd/__init__.py
216 216
      # second address is only used for writing
217 217
      "-u",
218 218

  
219
      ",".join(addr1), ",".join(addr2)
219
      ",".join(addr1), ",".join(addr2),
220 220
      ]
221 221

  
222 222
  def _GetMagicCommand(self):
b/lib/masterd/iallocator.py
40 40
   # Class '...' has no 'OP_ID' member
41 41
   "OP_ID": ht.TElemOf([opcodes.OpInstanceFailover.OP_ID,
42 42
                        opcodes.OpInstanceMigrate.OP_ID,
43
                        opcodes.OpInstanceReplaceDisks.OP_ID])
43
                        opcodes.OpInstanceReplaceDisks.OP_ID]),
44 44
   })))
45 45

  
46 46
_NEVAC_MOVED = \
......
208 208
  # pylint: disable=E1101
209 209
  MODE = constants.IALLOCATOR_MODE_MULTI_ALLOC
210 210
  REQ_PARAMS = [
211
    ("instances", ht.TListOf(ht.TInstanceOf(IAReqInstanceAlloc)))
211
    ("instances", ht.TListOf(ht.TInstanceOf(IAReqInstanceAlloc))),
212 212
    ]
213 213
  _MASUCCESS = \
214 214
    ht.TListOf(ht.TAnd(ht.TIsLength(2),
......
221 221

  
222 222
  def GetRequest(self, cfg):
223 223
    return {
224
      "instances": [iareq.GetRequest(cfg) for iareq in self.instances]
224
      "instances": [iareq.GetRequest(cfg) for iareq in self.instances],
225 225
      }
226 226

  
227 227

  
b/lib/network.py
29 29

  
30 30
from ganeti import errors
31 31

  
32

  
32 33
class AddressPool(object):
33 34
  """Address pool class, wrapping an objects.Network object
34 35

  
......
107 108
    self.Update()
108 109

  
109 110
  def _GetSize(self):
110
    return 2**(32 - self.network.prefixlen)
111
    return 2 ** (32 - self.network.prefixlen)
111 112

  
112 113
  @property
113 114
  def all_reservations(self):
b/lib/objects.py
420 420
    "ip",
421 421
    "netmask",
422 422
    "netdev",
423
    "ip_family"
423
    "ip_family",
424 424
    ]
425 425

  
426 426

  
......
905 905

  
906 906
    elif disk_template == constants.DT_RBD:
907 907
      result.append(FillDict(constants.DISK_LD_DEFAULTS[constants.LD_RBD], {
908
        constants.LDP_POOL: dt_params[constants.RBD_POOL]
908
        constants.LDP_POOL: dt_params[constants.RBD_POOL],
909 909
        }))
910 910

  
911 911
    return result
b/lib/opcodes.py
353 353
_PNetworkType = ("network_type", None, ht.TOr(ht.TNone, _CheckNetworkType),
354 354
                 "Network type")
355 355

  
356

  
356 357
def _CheckCIDRNetNotation(value):
357 358
  """Ensure a given cidr notation type is valid.
358 359

  
......
363 364
    return False
364 365
  return True
365 366

  
367

  
366 368
def _CheckCIDRAddrNotation(value):
367 369
  """Ensure a given cidr notation type is valid.
368 370

  
......
373 375
    return False
374 376
  return True
375 377

  
378

  
376 379
def _CheckCIDR6AddrNotation(value):
377 380
  """Ensure a given cidr notation type is valid.
378 381

  
......
383 386
    return False
384 387
  return True
385 388

  
389

  
386 390
def _CheckCIDR6NetNotation(value):
387 391
  """Ensure a given cidr notation type is valid.
388 392

  
......
393 397
    return False
394 398
  return True
395 399

  
400

  
396 401
class _AutoOpParamSlots(objectutils.AutoSlots):
397 402
  """Meta class for opcode definitions.
398 403

  
......
719 724
    _PSkipChecks,
720 725
    _PIgnoreErrors,
721 726
    _PVerbose,
722
    ("group_name", None, ht.TMaybeString, "Group to verify")
727
    ("group_name", None, ht.TMaybeString, "Group to verify"),
723 728
    ]
724 729
  OP_RESULT = TJobIdListOnly
725 730

  
......
824 829
class OpClusterConfigQuery(OpCode):
825 830
  """Query cluster configuration values."""
826 831
  OP_PARAMS = [
827
    _POutputFields
832
    _POutputFields,
828 833
    ]
829 834
  OP_RESULT = ht.TListOf(ht.TAny)
830 835

  
......
1298 1303
  OP_RESULT = ht.TStrictDict(True, True, {
1299 1304
    constants.JOB_IDS_KEY: _JOB_LIST,
1300 1305
    ALLOCATABLE_KEY: ht.TListOf(ht.TNonEmptyString),
1301
    FAILED_KEY: ht.TListOf(ht.TNonEmptyString)
1306
    FAILED_KEY: ht.TListOf(ht.TNonEmptyString),
1302 1307
    })
1303 1308

  
1304 1309
  def __getstate__(self):
......
1506 1511
  """Connect to an instance's console."""
1507 1512
  OP_DSC_FIELD = "instance_name"
1508 1513
  OP_PARAMS = [
1509
    _PInstanceName
1514
    _PInstanceName,
1510 1515
    ]
1511 1516
  OP_RESULT = ht.TDict
1512 1517

  
......
2011 2016
  OP_PARAMS = [
2012 2017
    _PNetworkName,
2013 2018
    _PNetworkType,
2014
    ("network", None, ht.TAnd(ht.TString ,_CheckCIDRNetNotation),
2019
    ("network", None, ht.TAnd(ht.TString, _CheckCIDRNetNotation),
2015 2020
     "IPv4 Subnet"),
2016 2021
    ("gateway", None, ht.TOr(ht.TNone, _CheckCIDRAddrNotation),
2017 2022
     "IPv4 Gateway"),
......
2028 2033
    ]
2029 2034
  OP_RESULT = ht.TNone
2030 2035

  
2036

  
2031 2037
class OpNetworkRemove(OpCode):
2032 2038
  """Remove an existing network from the cluster.
2033 2039
     Must not be connected to any nodegroup.
......
2040 2046
    ]
2041 2047
  OP_RESULT = ht.TNone
2042 2048

  
2049

  
2043 2050
class OpNetworkSetParams(OpCode):
2044 2051
  """Modify Network's parameters except for IPv4 subnet"""
2045 2052
  OP_DSC_FIELD = "network_name"
......
2063 2070
    ]
2064 2071
  OP_RESULT = ht.TNone
2065 2072

  
2073

  
2066 2074
class OpNetworkConnect(OpCode):
2067 2075
  """Connect a Network to a specific Nodegroup with the defined netparams
2068 2076
     (mode, link). Nics in this Network will inherit those params.
......
2081 2089
    ]
2082 2090
  OP_RESULT = ht.TNone
2083 2091

  
2092

  
2084 2093
class OpNetworkDisconnect(OpCode):
2085 2094
  """Disconnect a Network from a Nodegroup. Produce errors if NICs are
2086 2095
     present in the Network unless --no-conficts-check option is passed.
......
2094 2103
    ]
2095 2104
  OP_RESULT = ht.TNone
2096 2105

  
2106

  
2097 2107
class OpNetworkQuery(OpCode):
2098 2108
  """Compute the list of networks."""
2099 2109
  OP_PARAMS = [
b/lib/query.py
1343 1343
  # Add simple fields
1344 1344
  fields.extend([
1345 1345
    (_MakeField(name, title, kind, doc), NQ_CONFIG, flags, _GetItemAttr(name))
1346
    for (name, (title, kind, flags, doc)) in _NODE_SIMPLE_FIELDS.items()
1347
    ])
1346
    for (name, (title, kind, flags, doc)) in _NODE_SIMPLE_FIELDS.items()])
1348 1347

  
1349 1348
  # Add fields requiring live data
1350 1349
  fields.extend([
1351 1350
    (_MakeField(name, title, kind, doc), NQ_LIVE, 0,
1352 1351
     compat.partial(_GetLiveNodeField, nfield, kind))
1353
    for (name, (title, kind, nfield, doc)) in _NODE_LIVE_FIELDS.items()
1354
    ])
1352
    for (name, (title, kind, nfield, doc)) in _NODE_LIVE_FIELDS.items()])
1355 1353

  
1356 1354
  # Add timestamps
1357 1355
  fields.extend(_GetItemTimestampFields(NQ_CONFIG))
......
1772 1770
    (_MakeField("disk.size/%s" % i, "Disk/%s" % i, QFT_UNIT,
1773 1771
                "Disk size of %s disk" % utils.FormatOrdinal(i + 1)),
1774 1772
     IQ_CONFIG, 0, _GetInstDiskSize(i))
1775
    for i in range(constants.MAX_DISKS)
1776
    ])
1773
    for i in range(constants.MAX_DISKS)])
1777 1774

  
1778 1775
  return fields
1779 1776

  
......
1821 1818
                _VTToQFT[kind], "The \"%s\" hypervisor parameter" % name),
1822 1819
     IQ_CONFIG, 0, _GetInstHvParam(name))
1823 1820
    for name, kind in constants.HVS_PARAMETER_TYPES.items()
1824
    if name not in constants.HVC_GLOBALS
1825
    ])
1821
    if name not in constants.HVC_GLOBALS])
1826 1822

  
1827 1823
  # BE params
1828 1824
  def _GetInstBeParam(name):
......
1833 1829
                constants.BES_PARAMETER_TITLES.get(name, "be/%s" % name),
1834 1830
                _VTToQFT[kind], "The \"%s\" backend parameter" % name),
1835 1831
     IQ_CONFIG, 0, _GetInstBeParam(name))
1836
    for name, kind in constants.BES_PARAMETER_TYPES.items()
1837
    ])
1832
    for name, kind in constants.BES_PARAMETER_TYPES.items()])
1838 1833

  
1839 1834
  return fields
1840 1835

  
......
1937 1932
  # Add simple fields
1938 1933
  fields.extend([
1939 1934
    (_MakeField(name, title, kind, doc), IQ_CONFIG, flags, _GetItemAttr(name))
1940
    for (name, (title, kind, flags, doc)) in _INST_SIMPLE_FIELDS.items()
1941
    ])
1935
    for (name, (title, kind, flags, doc)) in _INST_SIMPLE_FIELDS.items()])
1942 1936

  
1943 1937
  # Fields requiring talking to the node
1944 1938
  fields.extend([
......
2431 2425
  fields.extend([
2432 2426
    (_MakeField(name, title, kind, doc), CQ_CONFIG, flags, _GetItemAttr(name))
2433 2427
    for (name, (title, kind, flags, doc)) in _CLUSTER_SIMPLE_FIELDS.items()
2434
    ])
2428
    ],)
2435 2429

  
2436 2430
  # Version fields
2437 2431
  fields.extend([
2438 2432
    (_MakeField(name, title, kind, doc), None, 0, _StaticValue(value))
2439
    for (name, (title, kind, value, doc)) in _CLUSTER_VERSION_FIELDS.items()
2440
    ])
2433
    for (name, (title, kind, value, doc)) in _CLUSTER_VERSION_FIELDS.items()])
2441 2434

  
2442 2435
  # Add timestamps
2443 2436
  fields.extend(_GetItemTimestampFields(CQ_CONFIG))
2444 2437

  
2445 2438
  return _PrepareFieldList(fields, [
2446
    ("name", "cluster_name"),
2447
    ])
2439
    ("name", "cluster_name")])
2448 2440

  
2449 2441

  
2450 2442
class NetworkQueryData:
......
2501 2493
                            "The external reservations"),
2502 2494
  }
2503 2495

  
2496

  
2504 2497
def _GetNetworkStatsField(field, kind, ctx):
2505 2498
  """Gets the value of a "stats" field from L{NetworkQueryData}.
2506 2499

  
......
2542 2535
  fields.extend([
2543 2536
    (_MakeField(name, title, kind, doc),
2544 2537
     NETQ_CONFIG, 0, _GetItemAttr(name))
2545
     for (name, (title, kind, _, doc)) in _NETWORK_SIMPLE_FIELDS.items()
2546
    ])
2538
     for (name, (title, kind, _, doc)) in _NETWORK_SIMPLE_FIELDS.items()])
2547 2539

  
2548 2540
  def _GetLength(getter):
2549 2541
    return lambda ctx, network: len(getter(ctx)[network.uuid])
......
2558 2550
  fields.extend([
2559 2551
    (_MakeField("group_cnt", "NodeGroups", QFT_NUMBER, "Number of nodegroups"),
2560 2552
     NETQ_GROUP, 0, _GetLength(network_to_groups)),
2561
	(_MakeField("group_list", "GroupList", QFT_OTHER, "List of nodegroups"),
2553
    (_MakeField("group_list", "GroupList", QFT_OTHER, "List of nodegroups"),
2562 2554
     NETQ_GROUP, 0, _GetSortedList(network_to_groups)),
2563 2555
    ])
2564 2556

  
......
2574 2566
  fields.extend([
2575 2567
    (_MakeField(name, title, kind, doc), NETQ_STATS, 0,
2576 2568
    compat.partial(_GetNetworkStatsField, name, kind))
2577
    for (name, (title, kind, _, doc)) in _NETWORK_STATS_FIELDS.items()
2578
    ])
2569
    for (name, (title, kind, _, doc)) in _NETWORK_STATS_FIELDS.items()])
2579 2570

  
2580 2571
  return _PrepareFieldList(fields, [])
2581 2572

  
b/lib/rapi/client.py
1703 1703
    _AppendIf(query, bulk, ("bulk", 1))
1704 1704

  
1705 1705
    networks = self._SendRequest(HTTP_GET, "/%s/networks" % GANETI_RAPI_VERSION,
1706
                               query, None)
1706
                                 query, None)
1707 1707
    if bulk:
1708 1708
      return networks
1709 1709
    else:
......
1768 1768
    body = {
1769 1769
      "group_name": group_name,
1770 1770
      "network_mode": mode,
1771
      "network_link": link
1771
      "network_link": link,
1772 1772
      }
1773 1773

  
1774 1774
    query = []
......
1783 1783

  
1784 1784
    """
1785 1785
    body = {
1786
      "group_name": group_name
1786
      "group_name": group_name,
1787 1787
      }
1788 1788

  
1789 1789
    query = []
......
1793 1793
                             ("/%s/networks/%s/disconnect" %
1794 1794
                             (GANETI_RAPI_VERSION, network_name)), query, body)
1795 1795

  
1796

  
1797 1796
  def ModifyNetwork(self, network, **kwargs):
1798 1797
    """Modifies a network.
1799 1798

  
......
1883 1882
                             ("/%s/networks/%s/tags" %
1884 1883
                              (GANETI_RAPI_VERSION, network)), query, None)
1885 1884

  
1886

  
1887 1885
  def GetGroups(self, bulk=False):
1888 1886
    """Gets all node groups in the cluster.
1889 1887

  
......
1938 1936

  
1939 1937
    body = {
1940 1938
      "name": name,
1941
      "alloc_policy": alloc_policy
1939
      "alloc_policy": alloc_policy,
1942 1940
      }
1943 1941

  
1944 1942
    return self._SendRequest(HTTP_POST, "/%s/groups" % GANETI_RAPI_VERSION,
b/lib/rapi/rlib2.py
98 98
              "free_count", "reserved_count",
99 99
              "map", "group_list", "inst_list",
100 100
              "external_reservations", "tags",
101
             ] 
101
              ]
102 102

  
103 103
G_FIELDS = [
104 104
  "alloc_policy",
......
717 717
      "dry_run": self.dryRun(),
718 718
      })
719 719

  
720

  
720 721
class R_2_networks_name_connect(baserlib.OpcodeResource):
721 722
  """/2/networks/[network_name]/connect resource.
722 723

  
......
733 734
      "dry_run": self.dryRun(),
734 735
      })
735 736

  
737

  
736 738
class R_2_networks_name_disconnect(baserlib.OpcodeResource):
737 739
  """/2/networks/[network_name]/disconnect resource.
738 740

  
......
749 751
      "dry_run": self.dryRun(),
750 752
      })
751 753

  
754

  
752 755
class R_2_networks_name_modify(baserlib.OpcodeResource):
753 756
  """/2/networks/[network_name]/modify resource.
754 757

  
......
1564 1567
  """
1565 1568
  TAG_LEVEL = constants.TAG_NODEGROUP
1566 1569

  
1570

  
1567 1571
class R_2_networks_name_tags(_R_Tags):
1568 1572
  """ /2/networks/[network_name]/tags resource.
1569 1573

  
b/lib/utils/__init__.py
648 648
    _set_wakeup_fd_fn = signal.set_wakeup_fd
649 649
  except AttributeError:
650 650
    # Not supported
651

  
651 652
    def _SetWakeupFd(self, _): # pylint: disable=R0201
652 653
      return -1
653 654
  else:
655

  
654 656
    def _SetWakeupFd(self, fd):
655 657
      return self._set_wakeup_fd_fn(fd)
656 658

  
b/qa/qa_daemon.py
67 67
  """
68 68
  AssertCommand([
69 69
    "bash", "-c",
70
    "rm -vf %s" % (pathutils.WATCHER_GROUP_STATE_FILE % "*-*-*-*")
70
    "rm -vf %s" % (pathutils.WATCHER_GROUP_STATE_FILE % "*-*-*-*"),
71 71
    ])
72 72

  
73 73

  
b/tools/burnin
49 49
LOG_HEADERS = {
50 50
  0: "- ",
51 51
  1: "* ",
52
  2: ""
52
  2: "",
53 53
  }
54 54

  
55 55

  
b/tools/cfgupgrade
97 97
                  " the master node", ssconf_master_node, hostname)
98 98
  return False
99 99

  
100

  
100 101
def UpgradeNetworks(config_data):
101 102
  networks = config_data.get("networks", None)
102 103
  if not networks:
b/tools/confd-client
42 42
LOG_HEADERS = {
43 43
  0: "- ",
44 44
  1: "* ",
45
  2: ""
45
  2: "",
46 46
  }
47 47

  
48 48
OPTIONS = [
b/tools/lvmstrap
573 573
    "used": "Used",
574 574
    "mount": "Mount",
575 575
    "lvm": "LVM?",
576
    "info": "Info"
576
    "info": "Info",
577 577
    }
578 578
  fields = ["name", "size", "used", "mount", "lvm", "info"]
579 579

  

Also available in: Unified diff