Commit ede013ee by Kálmán Viktor

dashboard: prevent vm operations when node is missing

closes #410
parent d6ea079f
...@@ -82,6 +82,17 @@ ...@@ -82,6 +82,17 @@
</h1> </h1>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
{% if instance.node and not instance.node.online %}
<div class="alert alert-warning">
{% if user.is_superuser %}
{% blocktrans with name=instance.node.name %}
The node <strong>{{ name }}</strong> is missing.
{% endblocktrans %}
{% else %}
{% trans "Currently you cannot execute any operations because the virtual machine's node is missing." %}
{% endif %}
</div>
{% endif %}
<div class="row"> <div class="row">
<div class="col-md-4" id="vm-info-pane"> <div class="col-md-4" id="vm-info-pane">
<div class="big"> <div class="big">
......
...@@ -133,6 +133,10 @@ class InstanceOperation(Operation): ...@@ -133,6 +133,10 @@ class InstanceOperation(Operation):
super(InstanceOperation, self).check_auth(user=user) super(InstanceOperation, self).check_auth(user=user)
if (self.instance.node and not self.instance.node.online
and not user.is_superuser):
raise self.instance.WrongStateError(self.instance)
def create_activity(self, parent, user, kwargs): def create_activity(self, parent, user, kwargs):
name = self.get_activity_name(kwargs) name = self.get_activity_name(kwargs)
if parent: if parent:
......
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