Change in vdsm[ovirt-3.5]: revert: libvirt is happy with redefinition of an existing nw...

phoracek at redhat.com phoracek at redhat.com
Tue Sep 9 13:34:07 UTC 2014


Hello Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/32696

to review the following change.

Change subject: revert: libvirt is happy with redefinition of an existing nwfilter
......................................................................

revert: libvirt is happy with redefinition of an existing nwfilter

Change-Id: If7ab71951ae4edef750be9a4f944e3180d568c91
Bug-Url: https://bugzilla.redhat.com/1138807
Signed-off-by: Petr Horáček <phoracek at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/32691
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M lib/vdsm/tool/nwfilter.py
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/32696/1

diff --git a/lib/vdsm/tool/nwfilter.py b/lib/vdsm/tool/nwfilter.py
index 85f6303..19c95f6 100755
--- a/lib/vdsm/tool/nwfilter.py
+++ b/lib/vdsm/tool/nwfilter.py
@@ -21,6 +21,8 @@
 
 import logging
 
+import libvirt
+
 from .. import libvirtconnection
 from . import expose, ExtraArgsError
 
@@ -57,6 +59,14 @@
         define vdsm network filter on libvirt to control VM traffic
         """
 
+        try:
+            conn.nwfilterLookupByName(self.filterName).undefine()
+        except libvirt.libvirtError:
+            # Ignore failure if filter isn't exists or if failed to remove.
+            # Failure might occur when attempting to remove a filter which
+            # is being used by running VMs
+            pass
+
         nwFilter = conn.nwfilterDefineXML(self.buildFilterXml())
         logging.debug("Filter %s was defined", nwFilter.name())
 


-- 
To view, visit http://gerrit.ovirt.org/32696
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If7ab71951ae4edef750be9a4f944e3180d568c91
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list