diff --git a/kvirt/providers/kvm/__init__.py b/kvirt/providers/kvm/__init__.py index 7d1f7733a..8e0af6d44 100644 --- a/kvirt/providers/kvm/__init__.py +++ b/kvirt/providers/kvm/__init__.py @@ -2985,8 +2985,11 @@ def list_disks(self): def add_nic(self, name, network, model='virtio'): conn = self.conn networks = {} - for interface in conn.listInterfaces(): - networks[interface] = 'bridge' + try: + for interface in conn.listInterfaces(): + networks[interface] = 'bridge' + except: + pass for net in conn.listAllNetworks(): networks[net.name()] = 'network' try: @@ -3006,6 +3009,8 @@ def add_nic(self, name, network, model='virtio'): %s """ % (networktype, modelxml, source) if vm.isActive() == 1: + controllerxml = "" + vm.attachDeviceFlags(controllerxml, VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG) vm.attachDeviceFlags(nicxml, VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG) else: vm.attachDeviceFlags(nicxml, VIR_DOMAIN_AFFECT_CONFIG) @@ -3536,7 +3541,6 @@ def list_networks(self): try: interfaces = conn.listInterfaces() except: - warning("Issue parsing your interfaces. Check for weird characters in your ifcfg files") return networks for interface in interfaces: if interface == 'lo' or interface in networks: