Skip to content

Commit 71bc6fc

Browse files
committed
add functional regression test for bug #1888395
This change adds a funcitonal regression test that assert the broken behavior when trying to live migrate with a neutron backend that does not support multiple port bindings. Change-Id: I470a016d35afe69809321bd67359f466c3feb90a Partial-Bug: #1888395
1 parent 835440e commit 71bc6fc

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

nova/network/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
MULTI_NET_EXT = 'Multi Provider Network'
2121
FIP_PORT_DETAILS = 'Floating IP Port Details Extension'
2222
SUBSTR_PORT_FILTERING = 'IP address substring filtering'
23+
PORT_BINDING = 'Port Binding'
2324
PORT_BINDING_EXTENDED = 'Port Bindings Extended'
2425
DEFAULT_SECGROUP = 'default'
2526
BINDING_PROFILE = 'binding:profile'
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
import fixtures
14+
15+
from nova import context
16+
from nova.network import constants as neutron_constants
17+
from nova.network import neutron
18+
from nova.tests.functional.libvirt import base as libvirt_base
19+
from nova.tests.unit.virt.libvirt import fake_os_brick_connector
20+
from nova.tests.unit.virt.libvirt import fakelibvirt
21+
22+
23+
class TestLiveMigrationWithoutMultiplePortBindings(
24+
libvirt_base.ServersTestBase):
25+
"""Regression test for bug 1888395.
26+
27+
This regression test asserts that Live migration works when
28+
neutron does not support the binding-extended api extension
29+
and the legacy single port binding workflow is used.
30+
"""
31+
32+
ADMIN_API = True
33+
microversion = 'latest'
34+
35+
def list_extensions(self, *args, **kwargs):
36+
return {
37+
'extensions': [
38+
{
39+
# Copied from neutron-lib portbindings.py
40+
"updated": "2014-02-03T10:00:00-00:00",
41+
"name": neutron_constants.PORT_BINDING,
42+
"links": [],
43+
"alias": "binding",
44+
"description": "Expose port bindings of a virtual port to "
45+
"external application"
46+
}
47+
]
48+
}
49+
50+
def setUp(self):
51+
super().setUp()
52+
self.neutron.list_extensions = self.list_extensions
53+
self.neutron_api = neutron.API()
54+
# TODO(sean-k-mooney): remove after
55+
# I275509eb0e0eb9eaf26fe607b7d9a67e1edc71f8
56+
# has merged.
57+
self.useFixture(fixtures.MonkeyPatch(
58+
'nova.virt.libvirt.driver.connector',
59+
fake_os_brick_connector))
60+
61+
self.start_computes({
62+
'start_host': fakelibvirt.HostInfo(
63+
cpu_nodes=1, cpu_sockets=1, cpu_cores=4, cpu_threads=2,
64+
kB_mem=10740000),
65+
'end_host': fakelibvirt.HostInfo(
66+
cpu_nodes=1, cpu_sockets=1, cpu_cores=4, cpu_threads=2,
67+
kB_mem=10740000)})
68+
69+
self.ctxt = context.get_admin_context()
70+
71+
def test_live_migrate(self):
72+
server = self._create_server(
73+
host='start_host',
74+
networks=[{'port': self.neutron.port_1['id']}])
75+
76+
self.assertFalse(
77+
self.neutron_api.supports_port_binding_extension(self.ctxt))
78+
# TODO(sean-k-mooney): extend _live_migrate to support passing a host
79+
self.api.post_server_action(
80+
server['id'],
81+
{
82+
'os-migrateLive': {
83+
'host': 'end_host',
84+
'block_migration': 'auto'
85+
}
86+
}
87+
)
88+
89+
# FIXME(sean-k-mooney): this should succeed but because of bug #188395
90+
# it will fail.
91+
# self._wait_for_server_parameter(
92+
# server, {'OS-EXT-SRV-ATTR:host': 'end_host', 'status': 'ACTIVE'})
93+
# because of the bug the migration will fail in pre_live_migrate so
94+
# the vm should still be active on the start_host
95+
self._wait_for_server_parameter(
96+
server, {'OS-EXT-SRV-ATTR:host': 'start_host', 'status': 'ACTIVE'})
97+
98+
msg = "NotImplementedError: Cannot load 'vif_type' in the base class"
99+
self.assertIn(msg, self.stdlog.logger.output)

0 commit comments

Comments
 (0)