Commit 7dbb9c7e by Kálmán Viktor

dashboard: mass op smart migrate

parent e64d3033
...@@ -2,28 +2,34 @@ ...@@ -2,28 +2,34 @@
{% load i18n %} {% load i18n %}
{% load sizefieldtags %} {% load sizefieldtags %}
{% block question %}
<p>
{% blocktrans with op=op.name %}
Choose a compute node to migrate the selected VMs to.
{% endblocktrans %}
</p>
<p class="text-info">{{op.name}}: {{op.description}}</p>
{% endblock %}
{% block formfields %} {% block formfields %}
<hr />
<ul id="vm-migrate-node-list" class="list-unstyled"> <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="node" value="" style="float: right;" checked="checked">
<span class="vm-migrate-node-property">
{% trans "This option will reschedule each virtual machine to the most optimal node." %}
</span>
<div style="clear: both;"></div>
</div>
</li>
{% for n in nodes %} {% for n in nodes %}
<li class="panel panel-default mass-migrate-node"> <li class="panel panel-default mass-migrate-node">
<div class="panel-body"> <div class="panel-body">
<label for="migrate-to-{{n.pk}}"> <label for="migrate-to-{{n.pk}}">
<strong>{{ n }}</strong> <strong>{{ n }}</strong>
</label> </label>
<input id="migrate-to-{{n.pk}}" type="radio" name="node" value="{{ n.pk }}" style="float: right;" checked="checked"> <input id="migrate-to-{{n.pk}}" type="radio" name="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 "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> <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 style="clear: both;"></div>
</div></li> </div>
</li>
{% endfor %} {% endfor %}
</ul> </ul>
<hr /> <hr />
......
...@@ -1124,7 +1124,9 @@ class MassMigrationView(MassOperationView): ...@@ -1124,7 +1124,9 @@ class MassMigrationView(MassOperationView):
node = self.request.POST.get("node") node = self.request.POST.get("node")
if node: if node:
node = get_object_or_404(Node, pk=node) node = get_object_or_404(Node, pk=node)
extra["to_node"] = node else:
node = None
extra["to_node"] = node
return super(MassMigrationView, self).post(request, extra, *args, return super(MassMigrationView, self).post(request, extra, *args,
**kwargs) **kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment