Revision 099c52ad

b/lib/backend.py
1807 1807
  return payload
1808 1808

  
1809 1809

  
1810
def OSEnvironment(instance, os, debug=0):
1810
def OSEnvironment(instance, inst_os, debug=0):
1811 1811
  """Calculate the environment for an os script.
1812 1812

  
1813 1813
  @type instance: L{objects.Instance}
1814 1814
  @param instance: target instance for the os script run
1815
  @type os: L{objects.OS}
1816
  @param os: operating system for which the environment is being built
1815
  @type inst_os: L{objects.OS}
1816
  @param inst_os: operating system for which the environment is being built
1817 1817
  @type debug: integer
1818 1818
  @param debug: debug level (0 or 1, for OS Api 10)
1819 1819
  @rtype: dict
......
1823 1823

  
1824 1824
  """
1825 1825
  result = {}
1826
  api_version = max(constants.OS_API_VERSIONS.intersection(os.api_versions))
1826
  api_version = \
1827
    max(constants.OS_API_VERSIONS.intersection(inst_os.api_versions))
1827 1828
  result['OS_API_VERSION'] = '%d' % api_version
1828 1829
  result['INSTANCE_NAME'] = instance.name
1829 1830
  result['INSTANCE_OS'] = instance.os
......
1835 1836
    try:
1836 1837
      variant = instance.os.split('+', 1)[1]
1837 1838
    except IndexError:
1838
      variant = os.supported_variants[0]
1839
      variant = inst_os.supported_variants[0]
1839 1840
    result['OS_VARIANT'] = variant
1840 1841
  for idx, disk in enumerate(instance.disks):
1841 1842
    real_disk = _RecursiveFindBD(disk)
b/lib/bdev.py
48 48
    fn(*args, **kwargs)
49 49
    return True
50 50
  except errors.BlockDeviceError, err:
51
    logging.warning("Caught BlockDeviceError but ignoring: %s" % str(err))
51
    logging.warning("Caught BlockDeviceError but ignoring: %s", str(err))
52 52
    return False
53 53

  
54 54

  
b/lib/bootstrap.py
362 362
  result = rpc.RpcRunner.call_node_stop_master(master, True)
363 363
  msg = result.fail_msg
364 364
  if msg:
365
    logging.warning("Could not disable the master role: %s" % msg)
365
    logging.warning("Could not disable the master role: %s", msg)
366 366
  result = rpc.RpcRunner.call_node_leave_cluster(master, modify_ssh_setup)
367 367
  msg = result.fail_msg
368 368
  if msg:
b/lib/cmdlib.py
5092 5092
                                                    False)
5093 5093
    abort_msg = abort_result.fail_msg
5094 5094
    if abort_msg:
5095
      logging.error("Aborting migration failed on target node %s: %s" %
5096
                    (target_node, abort_msg))
5095
      logging.error("Aborting migration failed on target node %s: %s",
5096
                    target_node, abort_msg)
5097 5097
      # Don't raise an exception here, as we stil have to try to revert the
5098 5098
      # disk status, even if this step failed.
5099 5099

  
......
5178 5178
    msg = result.fail_msg
5179 5179
    if msg:
5180 5180
      logging.error("Instance migration succeeded, but finalization failed:"
5181
                    " %s" % msg)
5181
                    " %s", msg)
5182 5182
      raise errors.OpExecError("Could not finalize instance migration: %s" %
5183 5183
                               msg)
5184 5184

  
......
6886 6886
    minors = self.cfg.AllocateDRBDMinor([self.new_node
6887 6887
                                         for dev in self.instance.disks],
6888 6888
                                        self.instance.name)
6889
    logging.debug("Allocated minors %r" % (minors,))
6889
    logging.debug("Allocated minors %r", minors)
6890 6890

  
6891 6891
    iv_names = {}
6892 6892
    for idx, (dev, new_minor) in enumerate(zip(self.instance.disks, minors)):
b/lib/config.py
32 32
"""
33 33

  
34 34
import os
35
import tempfile
36 35
import random
37 36
import logging
38 37
import time
......
905 904
    @param node: a Node instance
906 905

  
907 906
    """
908
    logging.info("Adding node %s to configuration" % node.name)
907
    logging.info("Adding node %s to configuration", node.name)
909 908

  
910 909
    self._EnsureUUID(node)
911 910

  
......
920 919
    """Remove a node from the configuration.
921 920

  
922 921
    """
923
    logging.info("Removing node %s from configuration" % node_name)
922
    logging.info("Removing node %s from configuration", node_name)
924 923

  
925 924
    if node_name not in self._config_data.nodes:
926 925
      raise errors.ConfigurationError("Unknown node '%s'" % node_name)
b/lib/daemon.py
297 297
                       debug=options.debug,
298 298
                       stderr_logging=not options.fork,
299 299
                       multithreaded=multithread)
300
    logging.info("%s daemon startup" % daemon_name)
300
    logging.info("%s daemon startup", daemon_name)
301 301
    exec_fn(options, args)
302 302
  finally:
303 303
    utils.RemovePidFile(daemon_name)
b/lib/opcodes.py
372 372

  
373 373

  
374 374
class OpModifyNodeStorage(OpCode):
375
  """"""
375
  """Modifies the properies of a storage unit"""
376 376
  OP_ID = "OP_NODE_MODIFY_STORAGE"
377 377
  __slots__ = OpCode.__slots__ + [
378 378
    "node_name",
b/lib/ssconf.py
61 61
    self._config_data = None
62 62
    self._inst_ips_by_link = None
63 63
    self._ip_to_inst_by_link = None
64
    self._instances_ips = None
64 65
    self._mc_primary_ips = None
65 66
    self._nodes_primary_ips = None
66 67

  
......
470 471
    if debug:
471 472
      sys.stderr.write("Not master candidate, exiting.\n")
472 473
    sys.exit(constants.EXIT_NOTCANDIDATE)
473

  
b/lib/ssh.py
221 221
        msg += ": %s" % output
222 222
      else:
223 223
        msg += ": %s (no output)" % retval.fail_reason
224
      logging.error("Command %s failed: %s" % (retval.cmd, msg))
224
      logging.error("Command %s failed: %s", retval.cmd, msg)
225 225
      return False, msg
226 226

  
227 227
    remotehostname = retval.stdout.strip()
b/lib/utils.py
42 42
import resource
43 43
import logging
44 44
import signal
45
import string
46 45

  
47 46
from cStringIO import StringIO
48 47

  
......
519 518
  re_flags = 0
520 519
  if not case_sensitive:
521 520
    re_flags |= re.IGNORECASE
522
    key = string.upper(key)
521
    key = key.upper()
523 522
  mo = re.compile("^%s(\..*)?$" % re.escape(key), re_flags)
524 523
  names_filtered = []
525 524
  string_matches = []
526 525
  for name in name_list:
527 526
    if mo.match(name) is not None:
528 527
      names_filtered.append(name)
529
      if not case_sensitive and key == string.upper(name):
528
      if not case_sensitive and key == name.upper():
530 529
        string_matches.append(name)
531 530

  
532 531
  if len(string_matches) == 1:
......
1107 1106
    success = True
1108 1107
  except socket.timeout:
1109 1108
    success = False
1110
  except socket.error, (errcode, errstring):
1109
  except socket.error, (errcode, _):
1111 1110
    success = (not live_port_needed) and (errcode == errno.ECONNREFUSED)
1112 1111

  
1113 1112
  return success

Also available in: Unified diff