'Clear out the nwfilter rules.'

def unfilter_instance(self, instance, network_info):

    for vif in network_info:
        nic_id = vif['address'].replace(':', '')
        instance_filter_name = self._instance_filter_name(instance, nic_id)
        max_retry = CONF.live_migration_retry_count
        for cnt in range(max_retry):
            try:
                _nw = self._conn.nwfilterLookupByName(instance_filter_name)
                _nw.undefine()
                break
            except libvirt.libvirtError as e:
                if (cnt == (max_retry - 1)):
                    raise
                errcode = e.get_error_code()
                if (errcode == libvirt.VIR_ERR_OPERATION_INVALID):
                    LOG.info('Failed    to    undefine    network    filter    %(name)s.    Try    %(cnt)d    of    %(max_retry)d.', {'name': instance_filter_name, 'cnt': (cnt + 1), 'max_retry': max_retry}, instance=instance)
                    greenthread.sleep(1)
                else:
                    LOG.debug('The    nwfilter(%s)    is    not    found.', instance_filter_name, instance=instance)
                    break
