Esempio n. 1
0
 def _host_pv_disk_get(self, pv):
     try:
         return sysinv.host_disk_get(self.request, pv.disk_or_part_uuid)
     except Exception:
         # Did not the find the disk so try to get the partition disk
         try:
             return sysinv.host_disk_partition_get(self.request,
                                                   pv.disk_or_part_uuid)
         except Exception:
             exceptions.handle(
                 self.request,
                 _("Unable to retrieve disk %(disk)s for PV %(pv)s.") % {
                     'disk': pv.disk_or_part_uuid,
                     'pv': pv.uuid
                 })
Esempio n. 2
0
    def _get_object(self, *args, **kwargs):
        if not hasattr(self, "_object"):
            partition_uuid = self.kwargs['partition_uuid']
            host_id = self.kwargs['host_id']
            LOG.debug("partition_id=%s kwargs=%s", partition_uuid, self.kwargs)
            try:
                self._object = sysinv.host_disk_partition_get(
                    self.request, partition_uuid)
                self._object.host_id = host_id
            except Exception:
                redirect = reverse("horizon:admin:inventory:detail",
                                   args=(self.kwargs['host_id'], ))
                msg = _('Unable to retrieve partition details')
                exceptions.handle(self.request, msg, redirect=redirect)

        return self._object