Merge "Delete some deprecated codes"
This commit is contained in:
commit
d1c6ad8829
@ -22,18 +22,6 @@ from horizon.utils.memoized import memoized # noqa
|
||||
|
||||
from openstack_dashboard.api import base
|
||||
from openstack_dashboard.api import keystone
|
||||
from openstack_dashboard.api import nova
|
||||
|
||||
|
||||
def get_flavor_names(request):
|
||||
# TODO(lsmola) The flavors can be set per project,
|
||||
# so it should show only valid ones.
|
||||
try:
|
||||
flavors = nova.flavor_list(request, None)
|
||||
return [f.name for f in flavors]
|
||||
except Exception:
|
||||
return ['m1.tiny', 'm1.small', 'm1.medium',
|
||||
'm1.large', 'm1.xlarge']
|
||||
|
||||
|
||||
def is_iterable(var):
|
||||
@ -1097,16 +1085,6 @@ class Meters(object):
|
||||
"packets on a VM network interface"),
|
||||
}),
|
||||
])
|
||||
# Adding flavor based meters into meters_info dict
|
||||
# TODO(lsmola) this kind of meter will be probably deprecated
|
||||
# https://bugs.launchpad.net/ceilometer/+bug/1208365 . Delete it then.
|
||||
for flavor in get_flavor_names(self._request):
|
||||
name = 'instance:%s' % flavor
|
||||
meters_info[name] = dict(meters_info["instance:<type>"])
|
||||
|
||||
meters_info[name]['description'] = (
|
||||
_('Duration of instance type %s (openstack flavor)') %
|
||||
flavor)
|
||||
|
||||
# TODO(lsmola) allow to set specific in local_settings. For all meters
|
||||
# because users can have their own agents and meters.
|
||||
|
@ -125,14 +125,9 @@ class CeilometerApiTests(test.APITestCase):
|
||||
for s in ret_list:
|
||||
self.assertIsInstance(s, api.ceilometer.Statistic)
|
||||
|
||||
@test.create_stubs({api.nova: ('flavor_list',),
|
||||
})
|
||||
def test_meters_list_all(self):
|
||||
meters = self.meters.list()
|
||||
|
||||
request = self.mox.CreateMock(http.HttpRequest)
|
||||
api.nova.flavor_list(request, None).AndReturn([])
|
||||
|
||||
ceilometerclient = self.stub_ceilometerclient()
|
||||
ceilometerclient.meters = self.mox.CreateMockAnything()
|
||||
ceilometerclient.meters.list(None).AndReturn(meters)
|
||||
@ -153,8 +148,6 @@ class CeilometerApiTests(test.APITestCase):
|
||||
self.assertIn(ret.name, names)
|
||||
names.remove(ret.name)
|
||||
|
||||
@test.create_stubs({api.nova: ('flavor_list',),
|
||||
})
|
||||
def test_meters_list_all_only(self):
|
||||
meters = self.meters.list()
|
||||
|
||||
@ -162,8 +155,6 @@ class CeilometerApiTests(test.APITestCase):
|
||||
ceilometerclient.meters = self.mox.CreateMockAnything()
|
||||
ceilometerclient.meters.list(None).AndReturn(meters)
|
||||
|
||||
request = self.mox.CreateMock(http.HttpRequest)
|
||||
api.nova.flavor_list(request, None).AndReturn([])
|
||||
self.mox.ReplayAll()
|
||||
|
||||
meters_object = api.ceilometer.Meters(self.request)
|
||||
@ -179,8 +170,6 @@ class CeilometerApiTests(test.APITestCase):
|
||||
self.assertEqual("disk.read.bytes", ret_list[0].name)
|
||||
self.assertEqual("instance", ret_list[1].name)
|
||||
|
||||
@test.create_stubs({api.nova: ('flavor_list',),
|
||||
})
|
||||
def test_meters_list_all_except(self):
|
||||
meters = self.meters.list()
|
||||
|
||||
@ -188,8 +177,6 @@ class CeilometerApiTests(test.APITestCase):
|
||||
ceilometerclient.meters = self.mox.CreateMockAnything()
|
||||
ceilometerclient.meters.list(None).AndReturn(meters)
|
||||
|
||||
request = self.mox.CreateMock(http.HttpRequest)
|
||||
api.nova.flavor_list(request, None).AndReturn([])
|
||||
self.mox.ReplayAll()
|
||||
|
||||
meters_object = api.ceilometer.Meters(self.request)
|
||||
|
@ -70,7 +70,7 @@ def create_stubs(stubs_to_create=None):
|
||||
|
||||
api.nova
|
||||
|
||||
The values are either a tuple of list of methods to mock in the module
|
||||
The values are either a tuple or list of methods to mock in the module
|
||||
indicated by the key.
|
||||
|
||||
For example::
|
||||
|
Loading…
Reference in New Issue
Block a user