[virt-manager PATCH] host: catch KeyError in interface_selected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We should catch KeyError in interface_selected,
for that error could happen when
singal on_interface_list_changed comes.

How to reproduce:
1. create 3 bridge by Edit->Connection Details->Network Interface
2. delete them
3. We would get a KeyError

Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
---
 virtManager/host.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/virtManager/host.py b/virtManager/host.py
index c8d7ee0..97a4f74 100644
--- a/virtManager/host.py
+++ b/virtManager/host.py
@@ -1098,6 +1098,15 @@ class vmmHost(vmmGObjectUI):
         name = model[treeiter][0]
 
         try:
+            self.conn.get_interface(name)
+        except KeyError:
+            self.widget("interface-apply").set_sensitive(False)
+            return
+        except Exception, e:
+            logging.exception(e)
+            self.set_interface_error_page(_("Error selecting interface: %s") %
+                    e)
+        try:
             self.populate_interface_state(name)
         except Exception, e:
             logging.exception(e)
-- 
1.8.5.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux