Merge "support for Masakari VMoves"
This commit is contained in:
commit
9698321920
|
@ -183,6 +183,11 @@ def notification_list(request, filters=None, marker='', paginate=False):
|
|||
return entities, has_more_data, has_prev_data
|
||||
|
||||
|
||||
def get_notification_list(request):
|
||||
"""return notifications list """
|
||||
return list(openstack_connection(request).notifications())
|
||||
|
||||
|
||||
def get_notification(request, notification_id):
|
||||
"""return single notifications"""
|
||||
return openstack_connection(request).get_notification(notification_id)
|
||||
|
|
|
@ -75,14 +75,13 @@ class VMoveTab(tabs.TableTab):
|
|||
preload = False
|
||||
|
||||
def get_vmove_data(self):
|
||||
vmove_list = []
|
||||
notification_type = self.tab_group.kwargs['type']
|
||||
if notification_type != "COMPUTE_HOST":
|
||||
return vmove_list
|
||||
notification = self.tab_group.kwargs['notification']
|
||||
if notification.type != "COMPUTE_HOST":
|
||||
return []
|
||||
|
||||
notification_id = self.tab_group.kwargs['notification_uuid']
|
||||
vmove_list = []
|
||||
vmove_gen = api.get_vmoves_list(
|
||||
self.request, notification_id, filters={})
|
||||
self.request, notification.notification_uuid, filters={})
|
||||
|
||||
for item in vmove_gen:
|
||||
vmove_list.append(item)
|
||||
|
|
|
@ -97,7 +97,11 @@ class DetailView(tabs.TabbedTableView):
|
|||
@memoized.memoized_method
|
||||
def get_data(self):
|
||||
try:
|
||||
notification_id = self.kwargs['notification_id']
|
||||
notification_data = self.kwargs['notification_id']
|
||||
if len(notification_data.split(',')) > 1:
|
||||
notification_id = notification_data.split(',')[0]
|
||||
else:
|
||||
notification_id = notification_data
|
||||
notification = api.get_notification(self.request, notification_id)
|
||||
except Exception:
|
||||
msg = _('Unable to get notification "%s".') % notification_id
|
||||
|
|
|
@ -18,7 +18,7 @@ from horizon import tables
|
|||
|
||||
|
||||
VMOVE_FILTER_CHOICES = (
|
||||
('notification_id', _("Notification UUId ="), True),
|
||||
('notification_uuid', _("Notification UUId ="), True),
|
||||
('type', _("Type ="), True),
|
||||
('status', _("Status ="), True),
|
||||
)
|
||||
|
@ -53,7 +53,7 @@ class VMoveTable(tables.DataTable):
|
|||
'status', verbose_name=_("Status"))
|
||||
|
||||
def get_object_id(self, datum):
|
||||
return datum.uuid + ',' + datum.notification_id
|
||||
return datum.notification_id + ',' + datum.uuid
|
||||
|
||||
class Meta(object):
|
||||
name = "vmove"
|
||||
|
|
|
@ -21,5 +21,7 @@
|
|||
<dd>{{ vmove.end_time }}</dd>
|
||||
<dt>{% trans "Status" %}</dt>
|
||||
<dd>{{ vmove.status }}</dd>
|
||||
<dt>{% trans "message" %}</dt>
|
||||
<dd>{{ vmove.message }}</dd>
|
||||
</dl>
|
||||
</div>
|
|
@ -14,6 +14,8 @@
|
|||
<dl class="dl-horizontal">
|
||||
<dt>{% trans "UUID" %}</dt>
|
||||
<dd>{{ vmove.uuid }}</dd>
|
||||
<dt>{% trans "Notification UUID" %}</dt>
|
||||
<dd>{{ vmove.notification_uuid }}</dd>
|
||||
<dt>{% trans "Server ID" %}</dt>
|
||||
<dd>{{ vmove.server_id }}</dd>
|
||||
<dt>{% trans "Server Name" %}</dt>
|
||||
|
|
|
@ -26,7 +26,7 @@ class VMoveTest(test.TestCase):
|
|||
def test_index(self):
|
||||
vmoves = self.masakari_vmove.list()
|
||||
notifications = self.masakari_notification.list()
|
||||
with mock.patch('masakaridashboard.api.api.notification_list',
|
||||
with mock.patch('masakaridashboard.api.api.get_notification_list',
|
||||
return_value=notifications), mock.patch(
|
||||
'masakaridashboard.api.api.get_notification',
|
||||
return_value=notifications[0]), mock.patch(
|
||||
|
|
|
@ -35,7 +35,7 @@ class IndexView(tables.DataTableView):
|
|||
return self._needs_filter_first
|
||||
|
||||
def get_data(self):
|
||||
notifications = api.notification_list(self.request)
|
||||
notifications = api.get_notification_list(self.request)
|
||||
vmove_list = []
|
||||
filters = self.get_filters()
|
||||
self._needs_filter_first = True
|
||||
|
@ -48,6 +48,8 @@ class IndexView(tables.DataTableView):
|
|||
return vmove_list
|
||||
|
||||
for notification in notifications:
|
||||
if notification.type != "COMPUTE_HOST":
|
||||
continue
|
||||
vmove_gen = api.get_vmoves_list(
|
||||
self.request, notification.notification_uuid, filters)
|
||||
for item in vmove_gen:
|
||||
|
|
Loading…
Reference in New Issue