Skip to content

Commit 06aaa08

Browse files
committed
Functional tests for NUMA live migration
This patch add a functional tests for NUMA live migration. It also adds all the previously missing scaffolding, specifically: * Make the fakelibvirt Domain support the vcpupin, memnode and emulatorpin XML elements. * To support testing RPC pinning, a new StubComputeRPCAPI is added to the integrated helpers. It replaces the real ComputeAPI's router() method with a stub that uses the RPC version set by the object's __init__. Tests can replace a real ComputeAPI object with the Stub to simulate compute services and/or conductors being pinned to different RPC versions. * In the fake_imagebackend, is_shared_block_storage() gets stubbed. It's called indirectly from the _check_can_live_migrate_(source|destination) checks. Implements blueprint numa-aware-live-migration Change-Id: Ia3d7351c1805d98bcb799ab0375673c7f1cb8848
1 parent 4ba00c8 commit 06aaa08

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)