{% extends "dashboard/mass-operate.html" %}
{% load i18n %}
{% load sizefieldtags %}
{% load crispy_forms_tags %}


{% block formfields %}
  <hr />
  <ul id="vm-migrate-node-list" class="list-unstyled">
    <li class="panel panel-default panel-primary mass-migrate-node">
      <div class="panel-body">
        <label for="migrate-to-none">
          <strong>{% trans "Reschedule" %}</strong>
        </label>
        <input id="migrate-to-none" type="radio" name="to_node" value="" style="float: right;" checked="checked">
        <span class="vm-migrate-node-property">
          {% trans "This option will reschedule each virtual machine to the optimal node." %}
        </span>
        <div style="clear: both;"></div>
      </div>
    </li>
    {% for n in form.fields.to_node.queryset.all %}
    <li class="panel panel-default mass-migrate-node">
      <div class="panel-body">
        <label for="migrate-to-{{n.pk}}">
          <strong>{{ n }}</strong>
        </label>
        <input id="migrate-to-{{n.pk}}" type="radio" name="to_node" value="{{ n.pk }}" style="float: right;"/>
        <span class="vm-migrate-node-property">{% trans "CPU load" %}: {{ n.cpu_usage }}</span>
        <span class="vm-migrate-node-property">{% trans "RAM usage" %}: {{ n.byte_ram_usage|filesize }}/{{ n.ram_size|filesize }}</span>
        <div style="clear: both;"></div>
      </div>
    </li>
    {% endfor %}
  </ul>
  {{ form.live_migration|as_crispy_field }}
  <hr />
{% endblock %}
