Commit f750837b by Bach Dániel

Merge remote-tracking branch 'origin/master' into feature-offline-migration

Conflicts:
	circle/dashboard/templates/dashboard/_vm-migrate.html
parents 513ce25a f2b2ede4
......@@ -1012,3 +1012,7 @@ textarea[name="new_members"] {
.disk-resize-btn {
margin-right: 5px;
}
#vm-migrate-node-list li {
cursor: pointer;
}
......@@ -411,6 +411,17 @@ $(function () {
$(this).removeClass("btn-default").addClass("btn-primary");
return false;
});
// vm migrate select for node
$(document).on("click", "#vm-migrate-node-list li", function(e) {
var li = $(this).closest('li');
if (li.find('input').attr('disabled'))
return true;
$('#vm-migrate-node-list li').removeClass('panel-primary');
li.addClass('panel-primary').find('input').prop("checked", true);
return true;
});
});
function generateVmHTML(pk, name, host, icon, _status, fav, is_last) {
......
......@@ -16,15 +16,6 @@ $(function() {
$('#confirmation-modal').on('hidden.bs.modal', function() {
$('#confirmation-modal').remove();
});
$('#vm-migrate-node-list li').click(function(e) {
var li = $(this).closest('li');
if (li.find('input').attr('disabled'))
return true;
$('#vm-migrate-node-list li').removeClass('panel-primary');
li.addClass('panel-primary').find('input').attr('checked', true);
return false;
});
$('#vm-migrate-node-list li input:checked').closest('li').addClass('panel-primary');
}
});
......
......@@ -2,7 +2,7 @@
{% load sizefieldtags %}
<i class="fa fa-file"></i>
{{ d.name }} (#{{ d.id }})
{{ d.name }} (#{{ d.id }}) - {{ d.size|filesize }}
{% if op.remove_disk %}
<span class="operation-wrapper">
......@@ -22,5 +22,8 @@
</a>
</span>
{% endif %}
<div style="clear: both;"></div>
{% if request.user.is_superuser %}
<small>{% trans "File name" %}: {{ d.filename }}</small>
{% endif %}
......@@ -19,18 +19,20 @@ Choose a compute node to migrate {{obj}} to.
<li class="panel panel-default"><div class="panel-body">
<label for="migrate-to-{{n.pk}}">
<strong>{{ n }}</strong>
<div class="label label-primary"><i class="fa {{n.get_status_icon}}"></i>
{{n.get_status_display}}</div>
<div class="label label-primary">
<i class="fa {{n.get_status_icon}}"></i> {{n.get_status_display}}</div>
{% if current == n.pk %}<div class="label label-info">{% trans "current" %}</div>{% endif %}
{% if recommended == n.pk %}<div class="label label-success">{% trans "recommended" %}</div>{% endif %}
</label>
<input id="migrate-to-{{n.pk}}" type="radio" name="to_node" value="{{ n.pk }}" style="float: right;"
{% if current == n.pk %}disabled="disabled"{% endif %}
{% if recommended == n.pk %}checked="checked"{% endif %} />
{% if recommended == n.pk %}checked="checked"{% endif %}
/>
<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></li>
</li>
{% endfor %}
{% endwith %}
</ul>
......
......@@ -490,6 +490,9 @@ class Disk(TimeStampedModel):
disk.destroy()
raise humanize_exception(ugettext_noop(
"Operation aborted by user."), e)
except:
disk.destroy()
raise
disk.is_ready = True
disk.save()
return disk
......@@ -324,7 +324,7 @@ class DeployOperation(InstanceOperation):
"deployed to node: %(node)s"),
node=self.instance.node)
def _operation(self, activity, timeout=15):
def _operation(self, activity):
# Allocate VNC port and host node
self.instance.allocate_vnc_port()
self.instance.allocate_node()
......@@ -405,7 +405,7 @@ class DestroyOperation(InstanceOperation):
required_perms = ()
resultant_state = 'DESTROYED'
def _operation(self, activity):
def _operation(self, activity, system):
# Destroy networks
with activity.sub_activity(
'destroying_net',
......@@ -415,7 +415,7 @@ class DestroyOperation(InstanceOperation):
self.instance.destroy_net()
if self.instance.node:
self.instance._delete_vm(parent_activity=activity)
self.instance._delete_vm(parent_activity=activity, system=system)
# Destroy disks
with activity.sub_activity(
......@@ -425,7 +425,8 @@ class DestroyOperation(InstanceOperation):
# Delete mem. dump if exists
try:
self.instance._delete_mem_dump(parent_activity=activity)
self.instance._delete_mem_dump(parent_activity=activity,
system=system)
except:
pass
......@@ -470,7 +471,7 @@ class MigrateOperation(RemoteInstanceOperation):
async_queue = "localhost.man.slow"
task = vm_tasks.migrate
remote_queue = ("vm", "slow")
timeout = 600
remote_timeout = 1000
def _get_remote_args(self, to_node, live_migration, **kwargs):
return (super(MigrateOperation, self)._get_remote_args(**kwargs)
......@@ -632,7 +633,7 @@ class SaveAsTemplateOperation(InstanceOperation):
for disk in self.disks:
disk.destroy()
def _operation(self, activity, user, system, timeout=300, name=None,
def _operation(self, activity, user, system, name=None,
with_shutdown=True, task=None, **kwargs):
if with_shutdown:
try:
......@@ -710,7 +711,7 @@ class ShutdownOperation(AbortableRemoteOperationMixin,
resultant_state = 'STOPPED'
task = vm_tasks.shutdown
remote_queue = ("vm", "slow")
timeout = 120
remote_timeout = 120
def _operation(self, task):
super(ShutdownOperation, self)._operation(task=task)
......@@ -779,12 +780,12 @@ class SleepOperation(InstanceOperation):
else:
activity.resultant_state = 'ERROR'
def _operation(self, activity):
def _operation(self, activity, system):
with activity.sub_activity('shutdown_net',
readable_name=ugettext_noop(
"shutdown network")):
self.instance.shutdown_net()
self.instance._suspend_vm(parent_activity=activity)
self.instance._suspend_vm(parent_activity=activity, system=system)
self.instance.yield_node()
@register_operation
......@@ -793,7 +794,7 @@ class SleepOperation(InstanceOperation):
name = _("suspend virtual machine")
task = vm_tasks.sleep
remote_queue = ("vm", "slow")
timeout = 600
remote_timeout = 1000
def _get_remote_args(self, **kwargs):
return (super(SleepOperation.SuspendVmOperation, self)
......@@ -846,7 +847,7 @@ class WakeUpOperation(InstanceOperation):
name = _("resume virtual machine")
task = vm_tasks.wake_up
remote_queue = ("vm", "slow")
timeout = 600
remote_timeout = 1000
def _get_remote_args(self, **kwargs):
return (super(WakeUpOperation.WakeUpVmOperation, self)
......
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