{% load i18n %} {% load bootstrap_icons %}
{% if can_change %}
{% csrf_token %}

{% bs_icon 'cpu' %} {% trans "CPU allocation" %}

{% blocktrans with cur=instance.cur_vcpu max=instance.vcpu %}Now {{ cur }} of {{ max }} vCPUs.{% endblocktrans %}

{% trans "Host" %}: {% blocktrans with count=vcpu_host %}{{ count }} logical CPUs{% endblocktrans %}

{% if instance.status == 5 %}{% trans "The VM gets these at its next start." %} {% else %}{% trans "Shut the VM down to change its vCPUs." %}{% if instance.vcpus %} {% trans "While it runs, turn vCPUs on and off below." %}{% endif %}{% endif %}

{% if request.user.is_superuser and instance.vcpus and instance.status != 5 %}

{% trans "Live vCPUs" %}

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

{% for id, vcpu in instance.vcpus.items %}
{% csrf_token %} {% if vcpu.hotpluggable != "yes" %} {% elif vcpu.enabled == "yes" %} {% else %} {% endif %}
{% endfor %}
{% 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 %}
{% else %}

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

{% endif %}
{% if can_change %}
{% csrf_token %}

{% bs_icon 'memory' %} {% trans "Memory allocation" %}

{% blocktrans with cur=instance.cur_memory max=instance.memory %}Now {{ cur }} MiB of maximum {{ max }} MiB.{% endblocktrans %}

{% trans "Host" %}: {% blocktrans with total=memory_host|filesizeformat %}{{ total }} memory{% endblocktrans %}

{% 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 %}

{# a running VM keeps its maximum: only the current memory changes #}
{% else %}

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

{% endif %}
{% if can_change %}
{% csrf_token %}

{% bs_icon 'device-hdd' %} {% trans "Grow disks" %}

{% 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." %}

{% 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 %}
{% else %}

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

{% endif %}