Fix oslo import issues

Change-Id: Ib21c85380795826656fd1c1fe3a3f959e32fab07
This commit is contained in:
Ildiko Vancsa 2015-09-29 09:25:54 +02:00
parent 96498a5343
commit cde2b3bbdf
10 changed files with 79 additions and 18 deletions

View File

@ -25,9 +25,9 @@ import json
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.openstack.common import log as logging
from nova import utils
from oslo.config import cfg
from oslo_config import cfg
from oslo_log import log as logging
from webob import exc
reservation_opts = [
@ -113,6 +113,8 @@ class Default_reservation(extensions.ExtensionDescriptor):
name = "DefaultReservation"
alias = "os-default-instance-reservation"
updated = "2015-09-29T00:00:00Z"
namespace = "blazarnova"
def get_controller_extensions(self):
controller = DefaultReservationController()

View File

@ -28,12 +28,13 @@ try:
except ImportError:
blazar_client = None
from blazarnova.i18n import _ # noqa
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
from nova.openstack.common.gettextutils import _ # noqa
from nova.openstack.common import log as logging
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
@ -176,6 +177,8 @@ class Reservation(extensions.ExtensionDescriptor):
name = "Reservation"
alias = "os-instance-reservation"
updated = "2015-09-29T00:00:00Z"
namespace = "blazarnova"
def get_controller_extensions(self):
controller = ReservationController()

44
blazarnova/i18n.py Normal file
View File

@ -0,0 +1,44 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""oslo.i18n integration module.
See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
import oslo_i18n
DOMAIN = 'blazarnova'
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical
def translate(value, user_locale):
return oslo_i18n.translate(value, user_locale)
def get_available_languages():
return oslo_i18n.get_available_languages(DOMAIN)

View File

@ -16,12 +16,12 @@
import six
from oslo.config import cfg
from blazarnova.i18n import _ # noqa
from nova import db
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.scheduler import filters
from oslo_config import cfg
from oslo_log import log as logging
LOG = logging.getLogger(__name__)

View File

@ -15,7 +15,7 @@
import datetime
from nova.tests.api.openstack import fakes
from nova.tests.unit.api.openstack import fakes
import mock
from nova.api.openstack import compute
@ -23,12 +23,13 @@ from nova.compute import api as compute_api
from nova import context
from nova import test
from nova import utils
from oslo.config import cfg
from oslo_config import cfg
UUID = fakes.FAKE_UUID
CONF = cfg.CONF
CONF.import_opt('osapi_compute_ext_list', 'nova.api.openstack.compute.contrib')
CONF.import_opt('osapi_compute_ext_list',
'nova.api.openstack.compute.legacy_v2.contrib')
CONF.import_opt('reservation_start_date',
'blazarnova.api.extensions.default_reservation')
CONF.import_opt('reservation_length_hours',
@ -60,7 +61,8 @@ class BaseExtensionTestCase(test.TestCase):
self.fake_instance = fakes.stub_instance(1, uuid=UUID)
self.flags(
osapi_compute_extension=[
'nova.api.openstack.compute.contrib.select_extensions',
'nova.api.openstack.compute.legacy_v2.contrib.'
'select_extensions',
'blazarnova.api.extensions.default_reservation.'
'Default_reservation',
'blazarnova.api.extensions.reservation.Reservation'

View File

@ -14,7 +14,7 @@
# limitations under the License.
import mock
from nova.openstack.common import jsonutils
from oslo_serialization import jsonutils
from blazarnova.tests.api import extensions

View File

@ -14,7 +14,7 @@
# limitations under the License.
import mock
from nova.openstack.common import jsonutils
from oslo_serialization import jsonutils
from blazarnova.tests.api import extensions
@ -32,7 +32,8 @@ class BlazarReservationTestCase(extensions.BaseExtensionTestCase):
super(BlazarReservationTestCase, self).setUp()
self.flags(
osapi_compute_extension=[
'nova.api.openstack.compute.contrib.select_extensions',
'nova.api.openstack.compute.legacy_v2.contrib.'
'select_extensions',
'blazarnova.api.extensions.reservation.Reservation'
],
osapi_compute_ext_list=['Scheduler_hints'])

View File

@ -16,10 +16,11 @@ import mock
from blazarnova.scheduler.filters import blazar_filter
from nova import context
from nova.openstack.common import log as logging
from nova import test
from nova.tests.scheduler import fakes
from oslo.config import cfg
from nova.tests.unit.scheduler import fakes
from nova.virt import fake
from oslo_config import cfg
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
@ -43,7 +44,7 @@ class BlazarFilterTestCase(test.TestCase):
self.fake_context = context.RequestContext('fake', 'fake')
#A fake instance (which has a reservation id 'r-fakeres')
fakes.FakeInstance(self.fake_context)
fake.FakeInstance('instance1', 'Running', '123')
#And a base filter properties
self.filter_properties = {

View File

@ -0,0 +1,3 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.

View File

@ -1,3 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=0.8.0,<0.9
nose
@ -13,3 +17,4 @@ testtools>=0.9.34
coverage>=3.6
http://tarballs.openstack.org/nova/nova-master.tar.gz#egg=nova
oslotest>=1.10.0 # Apache-2.0