Ejemplo n.º 1
0
 def get_myhost_data(self):
     if not hasattr(self, "_host"):
         host_id = self.kwargs['host_id']
         try:
             host = sysinv.host_get(self.request, host_id)
             host.nodes = sysinv.host_node_list(self.request, host.uuid)
             host.cpus = sysinv.host_cpu_list(self.request, host.uuid)
             icpu_utils.restructure_host_cpu_data(host)
         except Exception:
             redirect = reverse('horizon:admin:inventory:index')
             exceptions.handle(self.request,
                               _('Unable to retrieve details for '
                                 'host "%s".') % host_id,
                               redirect=redirect)
         self._host = host
     return self._host
Ejemplo n.º 2
0
 def _get_object(self, *args, **kwargs):
     if not hasattr(self, "_object"):
         host_id = self.kwargs['host_id']
         try:
             host = sysinv.host_get(self.request, host_id)
             host.nodes = sysinv.host_node_list(self.request, host.uuid)
             host.cpus = sysinv.host_cpu_list(self.request, host.uuid)
             icpu_utils.restructure_host_cpu_data(host)
             self._object = host
             self._object.host_id = host_id
         except Exception as e:
             LOG.exception(e)
             redirect = reverse("horizon:project:networks:detail",
                                args=(host_id))
             msg = _('Unable to retrieve port details')
             exceptions.handle(self.request, msg, redirect=redirect)
     return self._object