[rally-jobs] Change import of base context
Rally team wants to change structure of context module[*] and doesn't want to break ec2 gates, so this patch adds try...except block to cover old structure and new one. try...except block should be removed, after patch in Rally will be merged. [*] - https://review.openstack.org/#/c/188518/ Also, this patch fixes wrong import of rally network wrapper Depends-On: I29c2dd5f85dc8b0a59d9b3f0ea86ff3edf0a7953 Change-Id: I4a012c994dbbc6320f6d3c6b1537b47c6f1579e5
This commit is contained in:
parent
dca51f09a0
commit
92b754e38b
|
@ -13,24 +13,28 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rally.benchmark.context import base
|
||||
from rally.benchmark.wrappers import network as network_wrapper
|
||||
from rally.common.i18n import _
|
||||
from rally.common import log as logging
|
||||
from rally.common import utils as rutils
|
||||
from rally import consts
|
||||
from rally import osclients
|
||||
from rally.plugins.openstack.wrappers import network as network_wrapper
|
||||
|
||||
try:
|
||||
from rally.benchmark.context import base as context
|
||||
except ImportError:
|
||||
from rally.benchmark import context
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@base.context(name="prepare_ec2_client", order=110)
|
||||
class PrepareEC2ClientContext(base.Context):
|
||||
@context.context(name="prepare_ec2_client", order=110)
|
||||
class PrepareEC2ClientContext(context.Context):
|
||||
|
||||
def __init__(self, context):
|
||||
super(PrepareEC2ClientContext, self).__init__(context)
|
||||
def __init__(self, ctx):
|
||||
super(PrepareEC2ClientContext, self).__init__(ctx)
|
||||
self.net_wrapper = network_wrapper.wrap(
|
||||
osclients.Clients(context["admin"]["endpoint"]),
|
||||
osclients.Clients(self.context["admin"]["endpoint"]),
|
||||
self.config)
|
||||
self.net_wrapper.start_cidr = '10.0.0.0/16'
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
import time
|
||||
|
||||
from rally.benchmark.context import base
|
||||
from rally.common.i18n import _
|
||||
from rally.common import log as logging
|
||||
from rally.common import utils as rutils
|
||||
|
@ -22,11 +21,16 @@ from rally import consts
|
|||
|
||||
from ec2api.tests.functional import botocoreclient
|
||||
|
||||
try:
|
||||
from rally.benchmark.context import base as context
|
||||
except ImportError:
|
||||
from rally.benchmark import context
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EC2Objects(base.Context):
|
||||
class EC2Objects(context.Context):
|
||||
|
||||
CIDR = "10.0.0.0/16"
|
||||
AWS_ZONE = "nova"
|
||||
|
@ -214,7 +218,7 @@ class EC2Objects(base.Context):
|
|||
LOG.exception('')
|
||||
|
||||
|
||||
@base.context(name="ec2_networks", order=451)
|
||||
@context.context(name="ec2_networks", order=451)
|
||||
class FakeNetworkGenerator(EC2Objects):
|
||||
"""Context class for adding temporary networks for benchmarks.
|
||||
|
||||
|
@ -269,7 +273,7 @@ class FakeNetworkGenerator(EC2Objects):
|
|||
self.cleanup_networks(tenant_id, client)
|
||||
|
||||
|
||||
@base.context(name="ec2_servers", order=450)
|
||||
@context.context(name="ec2_servers", order=450)
|
||||
class FakeServerGenerator(EC2Objects):
|
||||
"""Context class for adding temporary servers for benchmarks.
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rally.benchmark.context import base
|
||||
from rally.benchmark.scenarios import base as scenario_base
|
||||
from rally.common.i18n import _
|
||||
from rally.common import log as logging
|
||||
|
@ -20,12 +19,17 @@ from rally.common import utils as rutils
|
|||
from rally import consts
|
||||
from rally import osclients
|
||||
|
||||
try:
|
||||
from rally.benchmark.context import base as context
|
||||
except ImportError:
|
||||
from rally.benchmark import context
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@base.context(name="fake_images", order=411)
|
||||
class FakeImageGenerator(base.Context):
|
||||
@context.context(name="fake_images", order=411)
|
||||
class FakeImageGenerator(context.Context):
|
||||
"""Context class for adding images to each user for benchmarks."""
|
||||
|
||||
CONFIG_SCHEMA = {
|
||||
|
|
Loading…
Reference in New Issue