{% load i18n %} {% load bootstrap_icons %}
{# each resource on its own tab: how much the VM has now within its maximum, and the form that changes it #}
{% if not can_change %}

{% trans "You don't have permission for resizing instance" %}

{% else %}
{# one cell per vCPU up to the maximum, filled when on; a running VM's hot-pluggable ones turn on and off here #} {% with toggles=request.user.is_superuser %}
{% for cell in instance.vcpu_cells %} {% if toggles and instance.status != 5 and instance.vcpus and not cell.fixed %}
{% csrf_token %} {% if cell.on %} {% else %} {% endif %}
{% else %} {{ cell.id }} {% if cell.on %}{% trans "on" %}{% else %}{% trans "off" %}{% endif %} {% endif %} {% endfor %}
{% blocktrans with cur=instance.cur_vcpu max=instance.vcpu %}{{ cur }} on, up to {{ max }}{% endblocktrans %} {% blocktrans with count=vcpu_host %}Host: {{ count }} logical CPUs{% endblocktrans %}
{% if toggles and instance.status != 5 and instance.vcpus %}

{% trans "Click a vCPU to turn it on or off now; the next start keeps it so." %}{% if instance.status == 3 %} {% trans "A paused VM cannot let one go: resume it to turn vCPUs off." %}{% endif %}

{% endif %} {% endwith %}
{% csrf_token %}

{% if instance.status == 5 %}{% trans "The VM gets these at its next start." %}{% else %}{% trans "Shut the VM down to change its vCPUs." %}{% endif %}

{% if request.user.is_superuser %}
{% csrf_token %}

{% trans "Lets vCPUs up to the maximum be turned on and off while the VM runs." %}{% if instance.status != 5 %} {% trans "Shut the VM down to change this." %}{% endif %}

{% endif %}
{% blocktrans with cur=instance.cur_memory max=instance.memory %}{{ cur }} MiB of {{ max }} MiB{% endblocktrans %} {% blocktrans with total=memory_host|filesizeformat %}Host: {{ total }}{% endblocktrans %}
{% csrf_token %}
{# a running VM keeps its maximum: only the current memory changes #}

{% if instance.status == 5 %}{% trans "The VM gets these at its next start." %}{% else %}{% trans "The current memory changes now, up to the maximum; shut the VM down to change the maximum." %}{% endif %}

{% trans "A new size in GiB, larger than the disk's; empty keeps a disk as it is. Disks grow while the VM runs; the guest then grows its partition and file system." %}

{% csrf_token %} {% for disk in instance.disks %}
{% if disk.storage is None %}
{% trans "Error getting disk info" %}
{% else %}
{% blocktrans with size=disk.size|filesizeformat %}Now {{ size }}{% endblocktrans %}
GiB
{% endif %}
{% endfor %}
{% if instance.status == 1 or instance.status == 3 or instance.status == 5 %} {% else %} {% endif %}
{% endif %}