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