Revision a97bcacf
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
1110 | 1110 |
" network configuration script output: %s" % |
1111 | 1111 |
(tap, result.fail_reason, result.output)) |
1112 | 1112 |
|
1113 |
@classmethod |
|
1114 |
def _UnconfigureNic(cls, instance_name, nic, only_local=True): |
|
1115 |
"""Run ifdown script for a specific NIC |
|
1116 |
|
|
1117 |
This is executed during instance cleanup and NIC hot-unplug |
|
1118 |
|
|
1119 |
@param instance: instance we're acting on |
|
1120 |
@type instance: instance object |
|
1121 |
@param nic: nic we're acting on |
|
1122 |
@type nic: nic object |
|
1123 |
@param localy: whether ifdown script should reset global conf (dns) or not |
|
1124 |
@type localy: boolean |
|
1125 |
|
|
1126 |
""" |
|
1127 |
tap = cls._GetInstanceNICTap(instance_name, nic) |
|
1128 |
env = cls._CreateNICEnv(instance_name, nic, tap) |
|
1129 |
arg2 = str(only_local).lower() |
|
1130 |
result = utils.RunCmd([pathutils.KVM_IFDOWN, tap, arg2], env=env) |
|
1131 |
if result.failed: |
|
1132 |
raise errors.HypervisorError("Failed to unconfigure interface %s: %s;" |
|
1133 |
" network configuration script output: %s" % |
|
1134 |
(tap, result.fail_reason, result.output)) |
|
1135 |
|
|
1113 | 1136 |
@staticmethod |
1114 | 1137 |
def _VerifyAffinityPackage(): |
1115 | 1138 |
if affinity is None: |
... | ... | |
2336 | 2359 |
else: |
2337 | 2360 |
self._CallMonitorCommand(name, "system_powerdown") |
2338 | 2361 |
|
2362 |
@classmethod |
|
2363 |
def _UnconfigureInstanceNICs(cls, instance_name, info=None): |
|
2364 |
"""Get runtime NICs of an instance and unconfigure them |
|
2365 |
|
|
2366 |
""" |
|
2367 |
_, kvm_nics, __, ___ = cls._LoadKVMRuntime(instance_name, info) |
|
2368 |
for nic in kvm_nics: |
|
2369 |
cls._UnconfigureNic(instance_name, nic) |
|
2370 |
|
|
2339 | 2371 |
def CleanupInstance(self, instance_name): |
2340 | 2372 |
"""Cleanup after a stopped instance |
2341 | 2373 |
|
Also available in: Unified diff