{% load i18n %} {% load vm_states %}
{% if not can_power %}

{% trans "Only the owners of this instance and administrators can change its power state." %}

{% else %} {# the three states a VM moves between, the current one marked; under each, the action that takes the VM there #} {% vm_state instance.status as state %}
{% if instance.status not in power_states %}

{% blocktrans with state=state.0 %}The VM's state: {{ state }}{% endblocktrans %}

{% endif %}
{% csrf_token %}
{% if instance.status == 1 or instance.status == 2 %} {% trans "Active" %}{% trans "now" %} {% else %} {% trans "Active" %} {% endif %}
{% if "poweron" in power_actions %}

{% trans "Starts the VM." %}

{% elif "resume" in power_actions %}

{% trans "Lets it run on." %}

{% endif %}
{% if instance.status == 3 or instance.status == 7 %} {% trans "Suspended" %}{% trans "now" %} {% else %} {% trans "Suspended" %} {% endif %}
{% if "suspend" in power_actions %}

{% trans "Pauses it; it stays in memory." %}

{% elif instance.status == 3 and not power_actions %}

{% trans "An administrator can resume it." %}

{% endif %}
{% if instance.status == 5 %} {% trans "Off" %}{% trans "now" %} {% else %} {% trans "Off" %} {% endif %}
{% if "poweroff" in power_actions %}

{% trans "Asks the guest to shut down." %}

{% elif instance.status == 5 and instance.is_template %}

{% trans "A template is not started: clone it to make a VM." %}

{% endif %}
{% if "force_off" in power_actions or "powercycle" in power_actions %}
{% csrf_token %} {% trans "A power cut: what the guest has not written to disk is lost." %} {% if "force_off" in power_actions %} {% endif %} {% if "powercycle" in power_actions %} {% endif %}
{% endif %}
{% endif %}