os_vif: register objects before loading plugins

It is conceivable that some part of the plugin loading process
may wish to use the os_vif object model. We should thus ensure
we register objects, before we load any of the plugins. It is
also incorrect to re-register the plugins if an app asks os_vif
to reinitialize itself, as it'll lead to duplicate object
registrations. So we now only register objects the first
time initialize() is called.

Change-Id: Ib5730135636acf37e3f9ed67fe1d4533a2df3474
This commit is contained in:
Daniel P. Berrange 2016-06-08 09:05:55 +00:00
parent ad13b337be
commit 8b72ece159
1 changed files with 3 additions and 2 deletions

View File

@ -34,6 +34,9 @@ def initialize(reset=False):
"""
global _EXT_MANAGER
if _EXT_MANAGER is None:
os_vif.objects.register_all()
if reset or (_EXT_MANAGER is None):
_EXT_MANAGER = extension.ExtensionManager(namespace='os_vif',
invoke_on_load=False)
@ -42,8 +45,6 @@ def initialize(reset=False):
obj = cls.load(plugin_name)
_EXT_MANAGER[plugin_name].obj = obj
os_vif.objects.register_all()
def plug(vif, instance_info):
"""