Revision 12eaf843

b/lib/hypervisor/hv_kvm.py
1737 1737
    except EnvironmentError, err:
1738 1738
      raise errors.HypervisorError("Failed to save KVM runtime file: %s" % err)
1739 1739

  
1740
  def _ReadKVMRuntime(self, instance_name):
1740
  @classmethod
1741
  def _ReadKVMRuntime(cls, instance_name):
1741 1742
    """Read an instance's KVM runtime
1742 1743

  
1743 1744
    """
1744 1745
    try:
1745
      file_content = utils.ReadFile(self._InstanceKVMRuntime(instance_name))
1746
      file_content = utils.ReadFile(cls._InstanceKVMRuntime(instance_name))
1746 1747
    except EnvironmentError, err:
1747 1748
      raise errors.HypervisorError("Failed to load KVM runtime file: %s" % err)
1748 1749
    return file_content
......
1761 1762

  
1762 1763
    self._WriteKVMRuntime(instance.name, serialized_form)
1763 1764

  
1764
  def _LoadKVMRuntime(self, instance, serialized_runtime=None):
1765
  @classmethod
1766
  def _LoadKVMRuntime(cls, instance_name, serialized_runtime=None):
1765 1767
    """Load an instance's KVM runtime
1766 1768

  
1767 1769
    """
1768 1770
    if not serialized_runtime:
1769
      serialized_runtime = self._ReadKVMRuntime(instance.name)
1771
      serialized_runtime = cls._ReadKVMRuntime(instance_name)
1770 1772

  
1771 1773
    return _AnalyzeSerializedRuntime(serialized_runtime)
1772 1774

  
......
2165 2167
    if device.pci is None:
2166 2168
      self._GetFreePCISlot(instance, device)
2167 2169
    kvm_devid = _GenerateDeviceKVMId(dev_type, device)
2168
    runtime = self._LoadKVMRuntime(instance)
2170
    runtime = self._LoadKVMRuntime(instance.name)
2169 2171
    if dev_type == constants.HOTPLUG_TARGET_DISK:
2170 2172
      cmds = ["drive_add dummy file=%s,if=none,id=%s,format=raw" %
2171 2173
                (extra, kvm_devid)]
......
2196 2198
    invokes the device specific method.
2197 2199

  
2198 2200
    """
2199
    runtime = self._LoadKVMRuntime(instance)
2201
    runtime = self._LoadKVMRuntime(instance.name)
2200 2202
    entry = _GetExistingDeviceInfo(dev_type, device, runtime)
2201 2203
    kvm_device = _RUNTIME_DEVICE[dev_type](entry)
2202 2204
    kvm_devid = _GenerateDeviceKVMId(dev_type, kvm_device)
......
2356 2358
                                   " not running" % instance.name)
2357 2359
    # StopInstance will delete the saved KVM runtime so:
2358 2360
    # ...first load it...
2359
    kvm_runtime = self._LoadKVMRuntime(instance)
2361
    kvm_runtime = self._LoadKVMRuntime(instance.name)
2360 2362
    # ...now we can safely call StopInstance...
2361 2363
    if not self.StopInstance(instance):
2362 2364
      self.StopInstance(instance, force=True)
......
2388 2390
    @param target: target host (usually ip), on this node
2389 2391

  
2390 2392
    """
2391
    kvm_runtime = self._LoadKVMRuntime(instance, serialized_runtime=info)
2393
    kvm_runtime = self._LoadKVMRuntime(instance.name, serialized_runtime=info)
2392 2394
    incoming_address = (target, instance.hvparams[constants.HV_MIGRATION_PORT])
2393 2395
    kvmpath = instance.hvparams[constants.HV_KVM_PATH]
2394 2396
    kvmhelp = self._GetKVMOutput(kvmpath, self._KVMOPT_HELP)
......
2405 2407

  
2406 2408
    """
2407 2409
    if success:
2408
      kvm_runtime = self._LoadKVMRuntime(instance, serialized_runtime=info)
2410
      kvm_runtime = self._LoadKVMRuntime(instance.name, serialized_runtime=info)
2409 2411
      kvm_nics = kvm_runtime[1]
2410 2412

  
2411 2413
      for nic_seq, nic in enumerate(kvm_nics):

Also available in: Unified diff