_vm-migrate.html 2.45 KB
Newer Older
1
{% extends "dashboard/operate.html" %}
2 3
{% load i18n %}
{% load sizefieldtags %}
4
{% load crispy_forms_tags %}
5

6 7 8 9 10 11 12 13 14 15 16
{% block question %}
<p>
{% blocktrans with obj=object op=op.name %}
Choose a compute node to migrate {{obj}} to.
{% endblocktrans %}
</p>
<p class="text-info">{{op.name}}: {{op.description}}</p>
{% endblock %}

{% block formfields %}
  <ul id="vm-migrate-node-list" class="list-unstyled">
17
  {% with current=object.node.pk recommended=form.fields.to_node.initial.pk %}
18
    {% for n in form.fields.to_node.queryset.all %}
19 20 21
      <li class="panel panel-default"><div class="panel-body">
        <label for="migrate-to-{{n.pk}}">
          <strong>{{ n }}</strong>
22 23
          <div class="label label-primary">
            <i class="fa {{n.get_status_icon}}"></i> {{n.get_status_display}}</div>
24
          {% if current == n.pk %}<div class="label label-info">{% trans "current" %}</div>{% endif %}
25
          {% if recommended == n.pk %}<div class="label label-success">{% trans "recommended" %}</div>{% endif %}
26 27 28 29 30
          {% if n.pk not in nodes_w_traits %}
            <div class="label label-warning">
              <i class="fa fa-warning"></i>
              {% trans "missing traits" %}</div>
          {% endif %}
31
        </label>
32
        <input id="migrate-to-{{n.pk}}" type="radio" name="to_node" value="{{ n.pk }}" style="float: right;"
33
          {% if current == n.pk %}disabled="disabled"{% endif %}
34
          {% if recommended == n.pk and n.pk != current %}checked="checked"{% endif %}
35
        />
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
        {% if n.pk not in nodes_w_traits %}
          <span class="vm-migrate-node-property">
            {% trans "Node traits" %}:
            {% if n.traits.all %}
              {{ n.traits.all|join:", " }}
            {% else %}
              -
            {% endif %}
          </span>
          <span class="vm-migrate-node-property">
            {% trans "Required traits" %}:
            {% if object.req_traits.all %}
              {{ object.req_traits.all|join:", " }}
            {% else %}
              -
            {% endif %}
          </span>
          <hr />
        {% endif %}
55
        <span class="vm-migrate-node-property">{% trans "CPU load" %}: {{ n.cpu_usage }}</span>
56 57
        <span class="vm-migrate-node-property">
          {% trans "RAM usage" %}: {{ n.byte_ram_usage|filesize }}/{{ n.ram_size|filesize }}</span>
58
        <div style="clear: both;"></div>
59
      </li>
60 61
    {% endfor %}
  {% endwith %}
62
  </ul>
63
  {{ form.live_migration|as_crispy_field }}
64
{% endblock %}