Revision 5716d4ce lib/hypervisor/hv_kvm.py

b/lib/hypervisor/hv_kvm.py
1125 1125
                                   " network configuration script output: %s" %
1126 1126
                                   (tap, result.fail_reason, result.output))
1127 1127

  
1128
  @classmethod
1129
  def _UnconfigureNic(cls, instance_name, nic, only_local=True):
1130
    """Run ifdown script for a specific NIC
1131

  
1132
    This is executed during instance cleanup and NIC hot-unplug
1133

  
1134
    @param instance_name: instance we're acting on
1135
    @type instance_name: string
1136
    @param nic: nic we're acting on
1137
    @type nic: nic object
1138
    @param only_local: whether ifdown script should reset global conf (dns)
1139
    @type only_local: boolean
1140

  
1141
    """
1142
    tap = cls._GetInstanceNICTap(instance_name, nic)
1143
    env = cls._CreateNICEnv(instance_name, nic, tap)
1144
    arg2 = str(only_local).lower()
1145
    result = utils.RunCmd([pathutils.KVM_IFDOWN, tap, arg2], env=env)
1146
    if result.failed:
1147
      raise errors.HypervisorError("Failed to unconfigure interface %s: %s;"
1148
                                   " network configuration script output: %s" %
1149
                                   (tap, result.fail_reason, result.output))
1150

  
1128 1151
  @staticmethod
1129 1152
  def _VerifyAffinityPackage():
1130 1153
    if affinity is None:
......
2392 2415
      else:
2393 2416
        self._CallMonitorCommand(name, "system_powerdown", timeout)
2394 2417

  
2418
  @classmethod
2419
  def _UnconfigureInstanceNICs(cls, instance_name, info=None):
2420
    """Get runtime NICs of an instance and unconfigure them
2421

  
2422
    """
2423
    _, kvm_nics, __, ___ = cls._LoadKVMRuntime(instance_name, info)
2424
    for nic in kvm_nics:
2425
      cls._UnconfigureNic(instance_name, nic)
2426

  
2395 2427
  def CleanupInstance(self, instance_name):
2396 2428
    """Cleanup after a stopped instance
2397 2429

  

Also available in: Unified diff