Skip to content

Commit 0b6ae37

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Functional tests for NUMA live migration"
2 parents 0682028 + 06aaa08 commit 0b6ae37

File tree

5 files changed

+659
-5
lines changed

5 files changed

+659
-5
lines changed

nova/tests/functional/integrated_helpers.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,20 @@
2424
import time
2525

2626
import os_traits
27+
from oslo_concurrency import lockutils
2728
from oslo_log import log as logging
29+
import oslo_messaging as messaging
2830

2931
from nova.compute import instance_actions
32+
from nova.compute import rpcapi as compute_rpcapi
3033
from nova.compute import utils as compute_utils
3134
import nova.conf
3235
from nova import context
3336
from nova.db import api as db
3437
import nova.image.glance
3538
from nova import objects
39+
from nova.objects import base as objects_base
40+
from nova import rpc
3641
from nova import test
3742
from nova.tests import fixtures as nova_fixtures
3843
from nova.tests.functional.api import client as api_client
@@ -72,6 +77,26 @@ def generate_new_element(items, prefix, numeric=False):
7277
LOG.debug("Random collision on %s", candidate)
7378

7479

80+
class StubComputeRPCAPI(compute_rpcapi.ComputeAPI):
81+
"""Stub ComputeAPI that allows us to pin the RPC version of a host. Used to
82+
simulate rolling upgrade situations where either source, dest or conductor
83+
are pinned.
84+
"""
85+
86+
def __init__(self, version):
87+
self.version = version
88+
89+
@property
90+
def router(self):
91+
with lockutils.lock('compute-rpcapi-router'):
92+
target = messaging.Target(topic='compute', version='5.0')
93+
version_cap = self.version
94+
serializer = objects_base.NovaObjectSerializer()
95+
rpc.get_client(target, version_cap, serializer)
96+
default_client = self.get_client(target, version_cap, serializer)
97+
return rpc.ClientRouter(default_client)
98+
99+
75100
class InstanceHelperMixin(object):
76101

77102
def _wait_for_server_parameter(

0 commit comments

Comments
 (0)