move os_vif.initialize() to nova-compute start
os_vif.initialize() was previously executed during module load. This means it was entirely possible that it was run before things like logging were actually set up in the expected way. Move this back into execution time instead of load time to ensure that logging is actually setup. Changes need to be made to tests which make assumptions about os_vif objects to manually initialize os_vif when it will be used. os_vif objects can't be created until it is initialized, so some delayed object creation is also done in test_vif.py. Closes-Bug: #1615676 Change-Id: I89fe5c5b3d762f3a3238b587685df85d15ee56c4
This commit is contained in:
parent
10ee85c725
commit
735f710ae0
|
@ -19,6 +19,7 @@
|
|||
import shlex
|
||||
import sys
|
||||
|
||||
import os_vif
|
||||
from oslo_log import log as logging
|
||||
from oslo_privsep import priv_context
|
||||
from oslo_reports import guru_meditation_report as gmr
|
||||
|
@ -44,6 +45,8 @@ def main():
|
|||
priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
|
||||
utils.monkey_patch()
|
||||
objects.register_all()
|
||||
# Ensure os-vif objects are registered and plugins loaded
|
||||
os_vif.initialize()
|
||||
|
||||
gmr.TextGuruMeditation.setup_autorun(version)
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ versioned object model os_vif.objects.*
|
|||
|
||||
import sys
|
||||
|
||||
import os_vif
|
||||
from os_vif import objects
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
@ -33,9 +32,6 @@ from nova.network import model
|
|||
LOG = logging.getLogger(__name__)
|
||||
CONF = cfg.CONF
|
||||
|
||||
# Ensure os-vif objects are registered and plugins loaded
|
||||
os_vif.initialize()
|
||||
|
||||
|
||||
def _get_vif_name(vif):
|
||||
"""Get a VIF device name
|
||||
|
|
|
@ -36,6 +36,7 @@ from lxml import etree
|
|||
import mock
|
||||
from mox3 import mox
|
||||
from os_brick.initiator import connector
|
||||
import os_vif
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
|
@ -694,6 +695,9 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
|||
|
||||
self.flags(sysinfo_serial="hardware", group="libvirt")
|
||||
|
||||
# normally loaded during nova-compute startup
|
||||
os_vif.initialize()
|
||||
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.virt.libvirt.imagebackend.libvirt_utils',
|
||||
fake_libvirt_utils))
|
||||
|
@ -15007,6 +15011,8 @@ class LibvirtDriverTestCase(test.NoDBTestCase):
|
|||
"""Test for nova.virt.libvirt.libvirt_driver.LibvirtDriver."""
|
||||
def setUp(self):
|
||||
super(LibvirtDriverTestCase, self).setUp()
|
||||
os_vif.initialize()
|
||||
|
||||
self.drvr = libvirt_driver.LibvirtDriver(
|
||||
fake.FakeVirtAPI(), read_only=True)
|
||||
self.context = context.get_admin_context()
|
||||
|
|
|
@ -389,52 +389,56 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
|||
'quota:vif_outbound_burst': '30'
|
||||
}
|
||||
|
||||
os_vif_network = osv_objects.network.Network(
|
||||
id="b82c1929-051e-481d-8110-4669916c7915",
|
||||
label="Demo Net",
|
||||
subnets=osv_objects.subnet.SubnetList(
|
||||
objects=[]))
|
||||
def setup_os_vif_objects(self):
|
||||
self.os_vif_network = osv_objects.network.Network(
|
||||
id="b82c1929-051e-481d-8110-4669916c7915",
|
||||
label="Demo Net",
|
||||
subnets=osv_objects.subnet.SubnetList(
|
||||
objects=[]))
|
||||
|
||||
os_vif_bridge = osv_objects.vif.VIFBridge(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
address="22:52:25:62:e2:aa",
|
||||
plugin="linux_bridge",
|
||||
vif_name="nicdc065497-3c",
|
||||
bridge_name="br100",
|
||||
has_traffic_filtering=False,
|
||||
network=os_vif_network)
|
||||
self.os_vif_bridge = osv_objects.vif.VIFBridge(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
address="22:52:25:62:e2:aa",
|
||||
plugin="linux_bridge",
|
||||
vif_name="nicdc065497-3c",
|
||||
bridge_name="br100",
|
||||
has_traffic_filtering=False,
|
||||
network=self.os_vif_network)
|
||||
|
||||
os_vif_ovs_prof = osv_objects.vif.VIFPortProfileOpenVSwitch(
|
||||
interface_id="07bd6cea-fb37-4594-b769-90fc51854ee9",
|
||||
profile_id="fishfood")
|
||||
self.os_vif_ovs_prof = osv_objects.vif.VIFPortProfileOpenVSwitch(
|
||||
interface_id="07bd6cea-fb37-4594-b769-90fc51854ee9",
|
||||
profile_id="fishfood")
|
||||
|
||||
os_vif_ovs = osv_objects.vif.VIFOpenVSwitch(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
address="22:52:25:62:e2:aa",
|
||||
unplugin="linux_bridge",
|
||||
vif_name="nicdc065497-3c",
|
||||
bridge_name="br0",
|
||||
port_profile=os_vif_ovs_prof,
|
||||
network=os_vif_network)
|
||||
self.os_vif_ovs = osv_objects.vif.VIFOpenVSwitch(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
address="22:52:25:62:e2:aa",
|
||||
unplugin="linux_bridge",
|
||||
vif_name="nicdc065497-3c",
|
||||
bridge_name="br0",
|
||||
port_profile=self.os_vif_ovs_prof,
|
||||
network=self.os_vif_network)
|
||||
|
||||
os_vif_ovs_hybrid = osv_objects.vif.VIFBridge(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
address="22:52:25:62:e2:aa",
|
||||
unplugin="linux_bridge",
|
||||
vif_name="nicdc065497-3c",
|
||||
bridge_name="br0",
|
||||
port_profile=os_vif_ovs_prof,
|
||||
has_traffic_filtering=False,
|
||||
network=os_vif_network)
|
||||
self.os_vif_ovs_hybrid = osv_objects.vif.VIFBridge(
|
||||
id="dc065497-3c8d-4f44-8fb4-e1d33c16a536",
|
||||
address="22:52:25:62:e2:aa",
|
||||
unplugin="linux_bridge",
|
||||
vif_name="nicdc065497-3c",
|
||||
bridge_name="br0",
|
||||
port_profile=self.os_vif_ovs_prof,
|
||||
has_traffic_filtering=False,
|
||||
network=self.os_vif_network)
|
||||
|
||||
os_vif_inst_info = osv_objects.instance_info.InstanceInfo(
|
||||
uuid="d5b1090c-9e00-4fa4-9504-4b1494857970",
|
||||
name="instance-000004da",
|
||||
project_id="2f37d7f6-e51a-4a1f-8b6e-b0917ffc8390")
|
||||
self.os_vif_inst_info = osv_objects.instance_info.InstanceInfo(
|
||||
uuid="d5b1090c-9e00-4fa4-9504-4b1494857970",
|
||||
name="instance-000004da",
|
||||
project_id="2f37d7f6-e51a-4a1f-8b6e-b0917ffc8390")
|
||||
|
||||
def setUp(self):
|
||||
super(LibvirtVifTestCase, self).setUp()
|
||||
self.flags(allow_same_net_traffic=True)
|
||||
# os_vif.initialize is typically done in nova-compute startup
|
||||
os_vif.initialize()
|
||||
self.setup_os_vif_objects()
|
||||
self.executes = []
|
||||
|
||||
def fake_execute(*cmd, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue