diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-01-30 20:27:20 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-01-30 20:27:20 +0000 |
commit | 23f28a8c20a8c7bdd7bece2d3ae6ea8036d95512 (patch) | |
tree | 238fece8be9b092b1af7309d00c1a897c7142230 /nova | |
parent | 75e6f03406de549bec30f6fa58dc1f2035a23ed7 (diff) | |
parent | 94e300273c6d0befc6d76d231e9b273d1444674f (diff) | |
download | nova-23f28a8c20a8c7bdd7bece2d3ae6ea8036d95512.tar.gz nova-23f28a8c20a8c7bdd7bece2d3ae6ea8036d95512.tar.xz nova-23f28a8c20a8c7bdd7bece2d3ae6ea8036d95512.zip |
Merge "Don't warn up front about libvirt loading issues in NWFilterFirewall"
Diffstat (limited to 'nova')
-rw-r--r-- | nova/virt/libvirt/firewall.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/nova/virt/libvirt/firewall.py b/nova/virt/libvirt/firewall.py index 3323b8f1d..5b712cf42 100644 --- a/nova/virt/libvirt/firewall.py +++ b/nova/virt/libvirt/firewall.py @@ -29,11 +29,7 @@ LOG = logging.getLogger(__name__) CONF = cfg.CONF CONF.import_opt('use_ipv6', 'nova.netconf') -try: - import libvirt -except ImportError: - LOG.warn(_("Libvirt module could not be loaded. NWFilterFirewall will " - "not work correctly.")) +libvirt = None class NWFilterFirewall(base_firewall.FirewallDriver): @@ -47,6 +43,13 @@ class NWFilterFirewall(base_firewall.FirewallDriver): def __init__(self, virtapi, get_connection, **kwargs): super(NWFilterFirewall, self).__init__(virtapi) + global libvirt + if libvirt is None: + try: + libvirt = __import__('libvirt') + except ImportError: + LOG.warn(_("Libvirt module could not be loaded. " + "NWFilterFirewall will not work correctly.")) self._libvirt_get_connection = get_connection self.static_filters_configured = False self.handle_security_groups = False |