Base_VM.add_nic() doesn't add mac to address_cache,
so when we delete call BaseVM.del_nic(), it is like this:
    del self.address_cache[nic_mac]
This may lead to KeyError. But BaseVM.del_nic() only catch IndexError.
So we should catch KeyError too.

Signed-off-by: Tang Chen <[email protected]>
---
 client/virt/virt_vm.py |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/client/virt/virt_vm.py b/client/virt/virt_vm.py
index 534f8e3..4de5f14 100644
--- a/client/virt/virt_vm.py
+++ b/client/virt/virt_vm.py
@@ -541,6 +541,8 @@ class BaseVM(object):
             del self.virtnet[nic_index_or_name]
         except IndexError:
             pass # continue to not exist
+        except KeyError:
+            pass # continue to not exist


     def verify_kernel_crash(self):
-- 
1.7.10.2


-- 
Best Regards,
Tang chen
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to