Commit b5078735 by Kálmán Viktor

dashboard: don't fail if datastore is missing

parent 9ee74088
...@@ -16,14 +16,16 @@ ...@@ -16,14 +16,16 @@
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>. # with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
from django.db.models import Q from django.contrib import messages
from django.views.generic import UpdateView
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic import UpdateView
from sizefield.utils import filesizeformat
from braces.views import SuperuserRequiredMixin from braces.views import SuperuserRequiredMixin
from sizefield.utils import filesizeformat
from common.models import WorkerNotFound
from storage.models import DataStore, Disk from storage.models import DataStore, Disk
from ..tables import DiskListTable from ..tables import DiskListTable
from ..forms import DataStoreForm, DiskForm from ..forms import DataStoreForm, DiskForm
...@@ -41,9 +43,13 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView): ...@@ -41,9 +43,13 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
context = super(StorageDetail, self).get_context_data(**kwargs) context = super(StorageDetail, self).get_context_data(**kwargs)
ds = self.get_object() ds = self.get_object()
try:
context['stats'] = self._get_stats() context['stats'] = self._get_stats()
context['missing_disks'] = ds.get_missing_disks() context['missing_disks'] = ds.get_missing_disks()
context['orphan_disks'] = ds.get_orphan_disks() context['orphan_disks'] = ds.get_orphan_disks()
except WorkerNotFound:
messages.error(self.request, _("The DataStore is offline."))
context['disk_table'] = DiskListTable( context['disk_table'] = DiskListTable(
self.get_table_data(), request=self.request, self.get_table_data(), request=self.request,
template="django_tables2/with_pagination.html") template="django_tables2/with_pagination.html")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment