Revision 7e5a72a0 lib/cmdlib.py

b/lib/cmdlib.py
59 59
from ganeti import qlang
60 60
from ganeti import opcodes
61 61
from ganeti import ht
62
from ganeti import rpc
62 63

  
63 64
import ganeti.masterd.instance # pylint: disable=W0611
64 65

  
......
112 113
  HTYPE = None
113 114
  REQ_BGL = True
114 115

  
115
  def __init__(self, processor, op, context, rpc):
116
  def __init__(self, processor, op, context, rpc_runner):
116 117
    """Constructor for LogicalUnit.
117 118

  
118 119
    This needs to be overridden in derived classes in order to check op
......
126 127
    # readability alias
127 128
    self.owned_locks = context.glm.list_owned
128 129
    self.context = context
129
    self.rpc = rpc
130
    self.rpc = rpc_runner
130 131
    # Dicts used to declare locking needs to mcpu
131 132
    self.needed_locks = None
132 133
    self.share_locks = dict.fromkeys(locking.LEVELS, 0)
......
1208 1209
  return []
1209 1210

  
1210 1211

  
1211
def _FindFaultyInstanceDisks(cfg, rpc, instance, node_name, prereq):
1212
def _FindFaultyInstanceDisks(cfg, rpc_runner, instance, node_name, prereq):
1212 1213
  faulty = []
1213 1214

  
1214 1215
  for dev in instance.disks:
1215 1216
    cfg.SetDiskID(dev, node_name)
1216 1217

  
1217
  result = rpc.call_blockdev_getmirrorstatus(node_name, instance.disks)
1218
  result = rpc_runner.call_blockdev_getmirrorstatus(node_name, instance.disks)
1218 1219
  result.Raise("Failed to get disk status from node %s" % node_name,
1219 1220
               prereq=prereq, ecode=errors.ECODE_ENVIRON)
1220 1221

  
......
5374 5375

  
5375 5376
    if old_role == self._ROLE_OFFLINE and new_role != old_role:
5376 5377
      # Trying to transition out of offline status
5377
      result = self.rpc.call_version([node.name])[node.name]
5378
      # TODO: Use standard RPC runner, but make sure it works when the node is
5379
      # still marked offline
5380
      result = rpc.BootstrapRunner().call_version([node.name])[node.name]
5378 5381
      if result.fail_msg:
5379 5382
        raise errors.OpPrereqError("Node %s is being de-offlined but fails"
5380 5383
                                   " to report its version: %s" %
......
13038 13041
  # pylint: disable=R0902
13039 13042
  # lots of instance attributes
13040 13043

  
13041
  def __init__(self, cfg, rpc, mode, **kwargs):
13044
  def __init__(self, cfg, rpc_runner, mode, **kwargs):
13042 13045
    self.cfg = cfg
13043
    self.rpc = rpc
13046
    self.rpc = rpc_runner
13044 13047
    # init buffer variables
13045 13048
    self.in_text = self.out_text = self.in_data = self.out_data = None
13046 13049
    # init all input fields so that pylint is happy

Also available in: Unified diff