Merge "Fixing scoping of instances in admin volume view"
This commit is contained in:
commit
c1d26e6935
@ -31,9 +31,10 @@ class VolumeTests(test.BaseAdminViewTests):
|
||||
keystone: ('tenant_list',)})
|
||||
def test_index(self):
|
||||
cinder.volume_list(IsA(http.HttpRequest), search_opts={
|
||||
'all_tenants': 1}).AndReturn(self.volumes.list())
|
||||
api.nova.server_list(IsA(http.HttpRequest)).\
|
||||
AndReturn([self.servers.list(), False])
|
||||
'all_tenants': True}).AndReturn(self.volumes.list())
|
||||
api.nova.server_list(IsA(http.HttpRequest), search_opts={
|
||||
'all_tenants': True}) \
|
||||
.AndReturn([self.servers.list(), False])
|
||||
cinder.volume_type_list(IsA(http.HttpRequest)).\
|
||||
AndReturn(self.volume_types.list())
|
||||
keystone.tenant_list(IsA(http.HttpRequest)) \
|
||||
@ -73,9 +74,10 @@ class VolumeTests(test.BaseAdminViewTests):
|
||||
formData = {'action': 'volume_types__delete__%s' % volume_type.id}
|
||||
|
||||
cinder.volume_list(IsA(http.HttpRequest), search_opts={
|
||||
'all_tenants': 1}).AndReturn(self.volumes.list())
|
||||
api.nova.server_list(IsA(http.HttpRequest)).\
|
||||
AndReturn([self.servers.list(), False])
|
||||
'all_tenants': True}).AndReturn(self.volumes.list())
|
||||
api.nova.server_list(IsA(http.HttpRequest), search_opts={
|
||||
'all_tenants': True}) \
|
||||
.AndReturn([self.servers.list(), False])
|
||||
cinder.volume_type_list(IsA(http.HttpRequest)).\
|
||||
AndReturn(self.volume_types.list())
|
||||
cinder.volume_type_delete(IsA(http.HttpRequest),
|
||||
|
@ -44,8 +44,8 @@ class IndexView(tables.MultiTableView, VolumeTableMixIn):
|
||||
template_name = "admin/volumes/index.html"
|
||||
|
||||
def get_volumes_data(self):
|
||||
volumes = self._get_volumes(search_opts={'all_tenants': 1})
|
||||
instances = self._get_instances()
|
||||
volumes = self._get_volumes(search_opts={'all_tenants': True})
|
||||
instances = self._get_instances(search_opts={'all_tenants': True})
|
||||
self._set_id_if_nameless(volumes, instances)
|
||||
self._set_attachments_string(volumes, instances)
|
||||
|
||||
|
@ -630,11 +630,11 @@ class VolumeViewTests(test.TestCase):
|
||||
cinder.volume_list(IsA(http.HttpRequest), search_opts=None).\
|
||||
AndReturn(self.volumes.list())
|
||||
cinder.volume_delete(IsA(http.HttpRequest), volume.id)
|
||||
api.nova.server_list(IsA(http.HttpRequest)).\
|
||||
api.nova.server_list(IsA(http.HttpRequest), search_opts=None).\
|
||||
AndReturn([self.servers.list(), False])
|
||||
cinder.volume_list(IsA(http.HttpRequest), search_opts=None).\
|
||||
AndReturn(self.volumes.list())
|
||||
api.nova.server_list(IsA(http.HttpRequest)).\
|
||||
api.nova.server_list(IsA(http.HttpRequest), search_opts=None).\
|
||||
AndReturn([self.servers.list(), False])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -658,11 +658,11 @@ class VolumeViewTests(test.TestCase):
|
||||
AndReturn(self.volumes.list())
|
||||
cinder.volume_delete(IsA(http.HttpRequest), volume.id).\
|
||||
AndRaise(exc)
|
||||
api.nova.server_list(IsA(http.HttpRequest)).\
|
||||
api.nova.server_list(IsA(http.HttpRequest), search_opts=None).\
|
||||
AndReturn([self.servers.list(), False])
|
||||
cinder.volume_list(IsA(http.HttpRequest), search_opts=None).\
|
||||
AndReturn(self.volumes.list())
|
||||
api.nova.server_list(IsA(http.HttpRequest)).\
|
||||
api.nova.server_list(IsA(http.HttpRequest), search_opts=None).\
|
||||
AndReturn([self.servers.list(), False])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
@ -54,9 +54,10 @@ class VolumeTableMixIn(object):
|
||||
_('Unable to retrieve volume list.'))
|
||||
return []
|
||||
|
||||
def _get_instances(self):
|
||||
def _get_instances(self, search_opts=None):
|
||||
try:
|
||||
instances, has_more = api.nova.server_list(self.request)
|
||||
instances, has_more = api.nova.server_list(self.request,
|
||||
search_opts=search_opts)
|
||||
return instances
|
||||
except:
|
||||
exceptions.handle(self.request,
|
||||
|
Loading…
x
Reference in New Issue
Block a user