Revision 93610b9e
b/lib/hypervisor/hv_kvm/__init__.py | ||
---|---|---|
711 | 711 |
""" |
712 | 712 |
hv_base.ConfigureNIC([pathutils.KVM_IFUP, tap], instance, seq, nic, tap) |
713 | 713 |
|
714 |
@classmethod |
|
715 |
def _UnconfigureNic(cls, instance_name, nic, only_local=True): |
|
716 |
"""Run ifdown script for a specific NIC |
|
717 |
|
|
718 |
This is executed during instance cleanup and NIC hot-unplug |
|
719 |
|
|
720 |
@param instance_name: instance we're acting on |
|
721 |
@type instance_name: string |
|
722 |
@param nic: nic we're acting on |
|
723 |
@type nic: nic object |
|
724 |
@param only_local: whether ifdown script should reset global conf (dns) |
|
725 |
@type only_local: boolean |
|
726 |
|
|
727 |
""" |
|
728 |
tap = cls._GetInstanceNICTap(instance_name, nic) |
|
729 |
env = hv_base.CreateNICEnv(instance_name, nic, tap) |
|
730 |
arg2 = str(only_local).lower() |
|
731 |
result = utils.RunCmd([pathutils.KVM_IFDOWN, tap, arg2], env=env) |
|
732 |
if result.failed: |
|
733 |
raise errors.HypervisorError("Failed to unconfigure interface %s: %s;" |
|
734 |
" network configuration script output: %s" % |
|
735 |
(tap, result.fail_reason, result.output)) |
|
736 |
|
|
714 | 737 |
@staticmethod |
715 | 738 |
def _VerifyAffinityPackage(): |
716 | 739 |
if affinity is None: |
... | ... | |
2008 | 2031 |
""" |
2009 | 2032 |
self._StopInstance(instance, force, name, timeout) |
2010 | 2033 |
|
2034 |
@classmethod |
|
2035 |
def _UnconfigureInstanceNICs(cls, instance_name, info=None): |
|
2036 |
"""Get runtime NICs of an instance and unconfigure them |
|
2037 |
|
|
2038 |
""" |
|
2039 |
_, kvm_nics, __, ___ = cls._LoadKVMRuntime(instance_name, info) |
|
2040 |
for nic in kvm_nics: |
|
2041 |
cls._UnconfigureNic(instance_name, nic) |
|
2042 |
|
|
2011 | 2043 |
def CleanupInstance(self, instance_name): |
2012 | 2044 |
"""Cleanup after a stopped instance |
2013 | 2045 |
|
Also available in: Unified diff