support for Masakari VMoves
It supports for Masakari VMove API in microversion 1.3. Change-Id: Iafc9da3037c858a327b8805c137c6a074c56d7cc
This commit is contained in:
parent
91a51dfb12
commit
4197cf15fd
|
@ -183,6 +183,11 @@ def notification_list(request, filters=None, marker='', paginate=False):
|
||||||
return entities, has_more_data, has_prev_data
|
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):
|
def get_notification(request, notification_id):
|
||||||
"""return single notifications"""
|
"""return single notifications"""
|
||||||
return openstack_connection(request).get_notification(notification_id)
|
return openstack_connection(request).get_notification(notification_id)
|
||||||
|
|
|
@ -75,14 +75,13 @@ class VMoveTab(tabs.TableTab):
|
||||||
preload = False
|
preload = False
|
||||||
|
|
||||||
def get_vmove_data(self):
|
def get_vmove_data(self):
|
||||||
vmove_list = []
|
notification = self.tab_group.kwargs['notification']
|
||||||
notification_type = self.tab_group.kwargs['type']
|
if notification.type != "COMPUTE_HOST":
|
||||||
if notification_type != "COMPUTE_HOST":
|
return []
|
||||||
return vmove_list
|
|
||||||
|
|
||||||
notification_id = self.tab_group.kwargs['notification_uuid']
|
vmove_list = []
|
||||||
vmove_gen = api.get_vmoves_list(
|
vmove_gen = api.get_vmoves_list(
|
||||||
self.request, notification_id, filters={})
|
self.request, notification.notification_uuid, filters={})
|
||||||
|
|
||||||
for item in vmove_gen:
|
for item in vmove_gen:
|
||||||
vmove_list.append(item)
|
vmove_list.append(item)
|
||||||
|
|
|
@ -97,7 +97,11 @@ class DetailView(tabs.TabbedTableView):
|
||||||
@memoized.memoized_method
|
@memoized.memoized_method
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
try:
|
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)
|
notification = api.get_notification(self.request, notification_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = _('Unable to get notification "%s".') % notification_id
|
msg = _('Unable to get notification "%s".') % notification_id
|
||||||
|
|
|
@ -18,7 +18,7 @@ from horizon import tables
|
||||||
|
|
||||||
|
|
||||||
VMOVE_FILTER_CHOICES = (
|
VMOVE_FILTER_CHOICES = (
|
||||||
('notification_id', _("Notification UUId ="), True),
|
('notification_uuid', _("Notification UUId ="), True),
|
||||||
('type', _("Type ="), True),
|
('type', _("Type ="), True),
|
||||||
('status', _("Status ="), True),
|
('status', _("Status ="), True),
|
||||||
)
|
)
|
||||||
|
@ -53,7 +53,7 @@ class VMoveTable(tables.DataTable):
|
||||||
'status', verbose_name=_("Status"))
|
'status', verbose_name=_("Status"))
|
||||||
|
|
||||||
def get_object_id(self, datum):
|
def get_object_id(self, datum):
|
||||||
return datum.uuid + ',' + datum.notification_id
|
return datum.notification_id + ',' + datum.uuid
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
name = "vmove"
|
name = "vmove"
|
||||||
|
|
|
@ -21,5 +21,7 @@
|
||||||
<dd>{{ vmove.end_time }}</dd>
|
<dd>{{ vmove.end_time }}</dd>
|
||||||
<dt>{% trans "Status" %}</dt>
|
<dt>{% trans "Status" %}</dt>
|
||||||
<dd>{{ vmove.status }}</dd>
|
<dd>{{ vmove.status }}</dd>
|
||||||
|
<dt>{% trans "message" %}</dt>
|
||||||
|
<dd>{{ vmove.message }}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
|
@ -14,6 +14,8 @@
|
||||||
<dl class="dl-horizontal">
|
<dl class="dl-horizontal">
|
||||||
<dt>{% trans "UUID" %}</dt>
|
<dt>{% trans "UUID" %}</dt>
|
||||||
<dd>{{ vmove.uuid }}</dd>
|
<dd>{{ vmove.uuid }}</dd>
|
||||||
|
<dt>{% trans "Notification UUID" %}</dt>
|
||||||
|
<dd>{{ vmove.notification_uuid }}</dd>
|
||||||
<dt>{% trans "Server ID" %}</dt>
|
<dt>{% trans "Server ID" %}</dt>
|
||||||
<dd>{{ vmove.server_id }}</dd>
|
<dd>{{ vmove.server_id }}</dd>
|
||||||
<dt>{% trans "Server Name" %}</dt>
|
<dt>{% trans "Server Name" %}</dt>
|
||||||
|
|
|
@ -35,7 +35,7 @@ class IndexView(tables.DataTableView):
|
||||||
return self._needs_filter_first
|
return self._needs_filter_first
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
notifications = api.notification_list(self.request)
|
notifications = api.get_notification_list(self.request)
|
||||||
vmove_list = []
|
vmove_list = []
|
||||||
filters = self.get_filters()
|
filters = self.get_filters()
|
||||||
self._needs_filter_first = True
|
self._needs_filter_first = True
|
||||||
|
@ -48,6 +48,8 @@ class IndexView(tables.DataTableView):
|
||||||
return vmove_list
|
return vmove_list
|
||||||
|
|
||||||
for notification in notifications:
|
for notification in notifications:
|
||||||
|
if notification.type != "COMPUTE_HOST":
|
||||||
|
continue
|
||||||
vmove_gen = api.get_vmoves_list(
|
vmove_gen = api.get_vmoves_list(
|
||||||
self.request, notification.notification_uuid, filters)
|
self.request, notification.notification_uuid, filters)
|
||||||
for item in vmove_gen:
|
for item in vmove_gen:
|
||||||
|
|
Loading…
Reference in New Issue