mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
Added log func and fix buttons on instance page
This commit is contained in:
parent
90d8dd5729
commit
1642100ef4
5 changed files with 247 additions and 159 deletions
|
@ -13,6 +13,7 @@ from vrtManager.instance import wvmInstance, wvmInstances
|
||||||
from vrtManager.connection import connection_manager
|
from vrtManager.connection import connection_manager
|
||||||
from libvirt import libvirtError, VIR_DOMAIN_XML_SECURE
|
from libvirt import libvirtError, VIR_DOMAIN_XML_SECURE
|
||||||
from webvirtcloud.settings import QEMU_KEYMAPS, QEMU_CONSOLE_TYPES
|
from webvirtcloud.settings import QEMU_KEYMAPS, QEMU_CONSOLE_TYPES
|
||||||
|
from logs.views import addlogmsg
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
|
@ -73,26 +74,42 @@ def instances(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
name = request.POST.get('name', '')
|
name = request.POST.get('name', '')
|
||||||
compute_id = request.POST.get('compute_id', '')
|
compute_id = request.POST.get('compute_id', '')
|
||||||
compute = Compute.objects.get(id=compute_id)
|
instance = Instance.objects.get(compute_id=compute_id, name=name)
|
||||||
try:
|
try:
|
||||||
conn = wvmInstances(compute.hostname,
|
conn = wvmInstances(instance.compute.hostname,
|
||||||
compute.login,
|
instance.compute.login,
|
||||||
compute.password,
|
instance.compute.password,
|
||||||
compute.type)
|
instance.compute.type)
|
||||||
if 'start' in request.POST:
|
if 'poweron' in request.POST:
|
||||||
|
msg = _("Power On")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.start(name)
|
conn.start(name)
|
||||||
return HttpResponseRedirect(request.get_full_path())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
if 'destroy' in request.POST:
|
if 'powercycle' in request.POST:
|
||||||
|
msg = _("Power Cycle")
|
||||||
conn.force_shutdown(name)
|
conn.force_shutdown(name)
|
||||||
|
conn.start()
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
return HttpResponseRedirect(request.get_full_path())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
|
if 'poweroff' in request.POST:
|
||||||
|
msg = _("Power Off")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
|
conn.shutdown(name)
|
||||||
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
|
if request.user.is_superuser:
|
||||||
if 'suspend' in request.POST:
|
if 'suspend' in request.POST:
|
||||||
|
msg = _("Suspend")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.suspend(name)
|
conn.suspend(name)
|
||||||
return HttpResponseRedirect(request.get_full_path())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
if 'resume' in request.POST:
|
if 'resume' in request.POST:
|
||||||
|
msg = _("Resume")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.resume(name)
|
conn.resume(name)
|
||||||
return HttpResponseRedirect(request.get_full_path())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
except libvirtError as lib_err:
|
except libvirtError as lib_err:
|
||||||
error_messages.append(lib_err)
|
error_messages.append(lib_err)
|
||||||
|
addlogmsg(request.user.id, instance.id, lib_err.message)
|
||||||
|
|
||||||
return render(request, 'instances.html', locals())
|
return render(request, 'instances.html', locals())
|
||||||
|
|
||||||
|
@ -186,27 +203,27 @@ def instance(request, compute_id, vname):
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if 'poweron' in request.POST:
|
if 'poweron' in request.POST:
|
||||||
|
msg = _("Power On")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.start()
|
conn.start()
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#poweron')
|
return HttpResponseRedirect(request.get_full_path() + '#poweron')
|
||||||
|
|
||||||
if 'powercycle' in request.POST:
|
if 'powercycle' in request.POST:
|
||||||
|
msg = _("Power Cycle")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.force_shutdown()
|
conn.force_shutdown()
|
||||||
conn.start()
|
conn.start()
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#powercycle')
|
return HttpResponseRedirect(request.get_full_path() + '#powercycle')
|
||||||
|
|
||||||
if 'poweroff' == request.POST.get('power', ''):
|
if 'poweroff' == request.POST.get('power', ''):
|
||||||
|
msg = _("Power Off")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.shutdown()
|
conn.shutdown()
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#poweroff')
|
return HttpResponseRedirect(request.get_full_path() + '#poweroff')
|
||||||
|
|
||||||
if 'suspend' in request.POST:
|
|
||||||
conn.suspend()
|
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#resume')
|
|
||||||
|
|
||||||
if 'resume' in request.POST:
|
|
||||||
conn.resume()
|
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#suspend')
|
|
||||||
|
|
||||||
if 'delete' in request.POST:
|
if 'delete' in request.POST:
|
||||||
|
msg = _("Destroy")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
if conn.get_status() == 1:
|
if conn.get_status() == 1:
|
||||||
conn.force_shutdown()
|
conn.force_shutdown()
|
||||||
try:
|
try:
|
||||||
|
@ -228,31 +245,72 @@ def instance(request, compute_id, vname):
|
||||||
return HttpResponseRedirect(reverse('instances'))
|
return HttpResponseRedirect(reverse('instances'))
|
||||||
|
|
||||||
if 'snapshot' in request.POST:
|
if 'snapshot' in request.POST:
|
||||||
|
msg = _("New snapshot")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
name = request.POST.get('name', '')
|
name = request.POST.get('name', '')
|
||||||
conn.create_snapshot(name)
|
conn.create_snapshot(name)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#istaceshapshosts')
|
return HttpResponseRedirect(request.get_full_path() + '#istaceshapshosts')
|
||||||
|
|
||||||
if 'umount_iso' in request.POST:
|
if 'umount_iso' in request.POST:
|
||||||
|
msg = _("Mount media")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
image = request.POST.get('path', '')
|
image = request.POST.get('path', '')
|
||||||
dev = request.POST.get('umount_iso', '')
|
dev = request.POST.get('umount_iso', '')
|
||||||
conn.umount_iso(dev, image)
|
conn.umount_iso(dev, image)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancemedia')
|
return HttpResponseRedirect(request.get_full_path() + '#instancemedia')
|
||||||
|
|
||||||
if 'mount_iso' in request.POST:
|
if 'mount_iso' in request.POST:
|
||||||
|
msg = _("Umount media")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
image = request.POST.get('media', '')
|
image = request.POST.get('media', '')
|
||||||
dev = request.POST.get('mount_iso', '')
|
dev = request.POST.get('mount_iso', '')
|
||||||
conn.mount_iso(dev, image)
|
conn.mount_iso(dev, image)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancemedia')
|
return HttpResponseRedirect(request.get_full_path() + '#instancemedia')
|
||||||
|
|
||||||
|
if 'delete_snapshot' in request.POST:
|
||||||
|
msg = _("Delete snapshot")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
|
snap_name = request.POST.get('name', '')
|
||||||
|
conn.snapshot_delete(snap_name)
|
||||||
|
return HttpResponseRedirect(request.get_full_path() + '#istaceshapshosts')
|
||||||
|
|
||||||
|
if 'revert_snapshot' in request.POST:
|
||||||
|
msg = _("Revert snapshot")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
|
snap_name = request.POST.get('name', '')
|
||||||
|
conn.snapshot_revert(snap_name)
|
||||||
|
msg = _("Successful revert snapshot: ")
|
||||||
|
msg += snap_name
|
||||||
|
messages.append(msg)
|
||||||
|
|
||||||
|
if request.user.is_superuser:
|
||||||
|
if 'suspend' in request.POST:
|
||||||
|
msg = _("Suspend")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
|
conn.suspend()
|
||||||
|
return HttpResponseRedirect(request.get_full_path() + '#resume')
|
||||||
|
|
||||||
|
if 'resume' in request.POST:
|
||||||
|
msg = _("Resume")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
|
conn.resume()
|
||||||
|
return HttpResponseRedirect(request.get_full_path() + '#suspend')
|
||||||
|
|
||||||
if 'set_autostart' in request.POST:
|
if 'set_autostart' in request.POST:
|
||||||
|
msg = _("Set autostart")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.set_autostart(1)
|
conn.set_autostart(1)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
||||||
|
|
||||||
if 'unset_autostart' in request.POST:
|
if 'unset_autostart' in request.POST:
|
||||||
|
msg = _("Unset autostart")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
conn.set_autostart(0)
|
conn.set_autostart(0)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
||||||
|
|
||||||
if 'resize' in request.POST:
|
if 'resize' in request.POST:
|
||||||
|
msg = _("Resize")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
description = request.POST.get('description', '')
|
description = request.POST.get('description', '')
|
||||||
vcpu = request.POST.get('vcpu', '')
|
vcpu = request.POST.get('vcpu', '')
|
||||||
cur_vcpu = request.POST.get('cur_vcpu', '')
|
cur_vcpu = request.POST.get('cur_vcpu', '')
|
||||||
|
@ -268,12 +326,16 @@ def instance(request, compute_id, vname):
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
return HttpResponseRedirect(request.get_full_path() + '#instancesettings')
|
||||||
|
|
||||||
if 'change_xml' in request.POST:
|
if 'change_xml' in request.POST:
|
||||||
|
msg = _("Edit XML")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
exit_xml = request.POST.get('inst_xml', '')
|
exit_xml = request.POST.get('inst_xml', '')
|
||||||
if exit_xml:
|
if exit_xml:
|
||||||
conn._defineXML(exit_xml)
|
conn._defineXML(exit_xml)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#instancexml')
|
return HttpResponseRedirect(request.get_full_path() + '#instancexml')
|
||||||
|
|
||||||
if 'set_console_passwd' in request.POST:
|
if 'set_console_passwd' in request.POST:
|
||||||
|
msg = _("Set VNC password")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
if request.POST.get('auto_pass', ''):
|
if request.POST.get('auto_pass', ''):
|
||||||
passwd = ''.join([choice(letters + digits) for i in xrange(12)])
|
passwd = ''.join([choice(letters + digits) for i in xrange(12)])
|
||||||
else:
|
else:
|
||||||
|
@ -292,6 +354,8 @@ def instance(request, compute_id, vname):
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#console_pass')
|
return HttpResponseRedirect(request.get_full_path() + '#console_pass')
|
||||||
|
|
||||||
if 'set_console_keymap' in request.POST:
|
if 'set_console_keymap' in request.POST:
|
||||||
|
msg = _("Set VNC keymap")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
keymap = request.POST.get('console_keymap', '')
|
keymap = request.POST.get('console_keymap', '')
|
||||||
clear = request.POST.get('clear_keymap', False)
|
clear = request.POST.get('clear_keymap', False)
|
||||||
if clear:
|
if clear:
|
||||||
|
@ -301,11 +365,15 @@ def instance(request, compute_id, vname):
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#console_keymap')
|
return HttpResponseRedirect(request.get_full_path() + '#console_keymap')
|
||||||
|
|
||||||
if 'set_console_type' in request.POST:
|
if 'set_console_type' in request.POST:
|
||||||
|
msg = _("Set VNC type")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
console_type = request.POST.get('console_type', '')
|
console_type = request.POST.get('console_type', '')
|
||||||
conn.set_console_type(console_type)
|
conn.set_console_type(console_type)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#console_type')
|
return HttpResponseRedirect(request.get_full_path() + '#console_type')
|
||||||
|
|
||||||
if 'migrate' in request.POST:
|
if 'migrate' in request.POST:
|
||||||
|
msg = _("Migrate")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
compute_id = request.POST.get('compute_id', '')
|
compute_id = request.POST.get('compute_id', '')
|
||||||
live = request.POST.get('live_migrate', False)
|
live = request.POST.get('live_migrate', False)
|
||||||
unsafe = request.POST.get('unsafe_migrate', False)
|
unsafe = request.POST.get('unsafe_migrate', False)
|
||||||
|
@ -320,19 +388,9 @@ def instance(request, compute_id, vname):
|
||||||
conn_migrate.close()
|
conn_migrate.close()
|
||||||
return HttpResponseRedirect(reverse('instance', args=[compute_id, vname]))
|
return HttpResponseRedirect(reverse('instance', args=[compute_id, vname]))
|
||||||
|
|
||||||
if 'delete_snapshot' in request.POST:
|
|
||||||
snap_name = request.POST.get('name', '')
|
|
||||||
conn.snapshot_delete(snap_name)
|
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#istaceshapshosts')
|
|
||||||
|
|
||||||
if 'revert_snapshot' in request.POST:
|
|
||||||
snap_name = request.POST.get('name', '')
|
|
||||||
conn.snapshot_revert(snap_name)
|
|
||||||
msg = _("Successful revert snapshot: ")
|
|
||||||
msg += snap_name
|
|
||||||
messages.append(msg)
|
|
||||||
|
|
||||||
if 'clone' in request.POST:
|
if 'clone' in request.POST:
|
||||||
|
msg = _("Clone")
|
||||||
|
addlogmsg(request.user.id, instance.id, msg)
|
||||||
clone_data = {}
|
clone_data = {}
|
||||||
clone_data['name'] = request.POST.get('name', '')
|
clone_data['name'] = request.POST.get('name', '')
|
||||||
|
|
||||||
|
@ -346,6 +404,7 @@ def instance(request, compute_id, vname):
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
except libvirtError as lib_err:
|
except libvirtError as lib_err:
|
||||||
error_messages.append(lib_err)
|
error_messages.append(lib_err.message)
|
||||||
|
addlogmsg(request.user.id, instance.id, lib_err.message)
|
||||||
|
|
||||||
return render(request, 'instance.html', locals())
|
return render(request, 'instance.html', locals())
|
|
@ -4,6 +4,15 @@ from django.core.urlresolvers import reverse
|
||||||
from logs.models import Logs
|
from logs.models import Logs
|
||||||
|
|
||||||
|
|
||||||
|
def addlogmsg(userid, instanceid, message):
|
||||||
|
"""
|
||||||
|
:param request:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
add_log_msg = Logs(user_id=userid, instance_id=instanceid, message=message)
|
||||||
|
add_log_msg.save()
|
||||||
|
|
||||||
|
|
||||||
def showlogs(request):
|
def showlogs(request):
|
||||||
"""
|
"""
|
||||||
:param request:
|
:param request:
|
||||||
|
|
|
@ -105,15 +105,21 @@
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
{% if request.user.is_superuser %}
|
|
||||||
{% ifequal status 3 %}
|
{% ifequal status 3 %}
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<li role="presentation" class="active">
|
||||||
|
<a href="#resume" aria-controls="resume" role="tab" data-toggle="tab">
|
||||||
|
{% trans "Resume" %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
<a href="#resume" aria-controls="resume" role="tab" data-toggle="tab">
|
<a href="#resume" aria-controls="resume" role="tab" data-toggle="tab">
|
||||||
{% trans "Resume" %}
|
{% trans "Resume" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endifequal %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endifequal %}
|
||||||
{% ifequal status 5 %}
|
{% ifequal status 5 %}
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
<a href="#boot" aria-controls="boot" role="tab" data-toggle="tab">
|
<a href="#boot" aria-controls="boot" role="tab" data-toggle="tab">
|
||||||
|
@ -149,8 +155,8 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
{% if request.user.is_superuser %}
|
|
||||||
{% ifequal status 3 %}
|
{% ifequal status 3 %}
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resume">
|
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resume">
|
||||||
<p>{% trans "This action restore the instance after suspend." %}</p>
|
<p>{% trans "This action restore the instance after suspend." %}</p>
|
||||||
<form action="" method="post" role="form">{% csrf_token %}
|
<form action="" method="post" role="form">{% csrf_token %}
|
||||||
|
@ -158,8 +164,16 @@
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endifequal %}
|
{% else %}
|
||||||
|
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resume">
|
||||||
|
<p>{% trans "Administrator blocked your instance." %}</p>
|
||||||
|
<form action="" method="post" role="form">{% csrf_token %}
|
||||||
|
<button class="btn btn-lg btn-success disabled pull-right">{% trans "Resume" %}</button>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endifequal %}
|
||||||
{% ifequal status 5 %}
|
{% ifequal status 5 %}
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="boot">
|
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="boot">
|
||||||
<p>{% trans "Click on Boot button to start this instance." %}</p>
|
<p>{% trans "Click on Boot button to start this instance." %}</p>
|
||||||
|
@ -186,10 +200,10 @@
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="vnconsole">
|
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="vnconsole">
|
||||||
<p>{% trans "This action opens a new window with a VNC connection to the console of the instance." %}</p>
|
<p>{% trans "This action opens a new window with a VNC connection to the console of the instance." %}</p>
|
||||||
{% ifequal status 5 %}
|
{% ifequal status 1 %}
|
||||||
<button class="btn btn-lg btn-success pull-right disabled">{% trans "Console" %}</button>
|
|
||||||
{% else %}
|
|
||||||
<a href="#" class="btn btn-lg btn-success pull-right" title="Console port: {{ console_port }}" onclick="open_console()">{% trans "Console" %}</a>
|
<a href="#" class="btn btn-lg btn-success pull-right" title="Console port: {{ console_port }}" onclick="open_console()">{% trans "Console" %}</a>
|
||||||
|
{% else %}
|
||||||
|
<button class="btn btn-lg btn-success pull-right disabled">{% trans "Console" %}</button>
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -703,6 +717,9 @@
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="destroy">
|
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="destroy">
|
||||||
<p>{% trans "Delete storage for instance?" %}</p>
|
<p>{% trans "Delete storage for instance?" %}</p>
|
||||||
{% if request.user.is_superuser or userinstace.is_delete %}
|
{% if request.user.is_superuser or userinstace.is_delete %}
|
||||||
|
{% ifequal status 3 %}
|
||||||
|
<button class="btn btn-lg btn-success disabled pull-right" name="delete">{% trans "Destroy" %}</button>
|
||||||
|
{% else %}
|
||||||
<form class="form-group" method="post" role="form">{% csrf_token %}
|
<form class="form-group" method="post" role="form">{% csrf_token %}
|
||||||
<div class="checkbox" style="margin-left: 8px;">
|
<div class="checkbox" style="margin-left: 8px;">
|
||||||
<label>
|
<label>
|
||||||
|
@ -712,6 +729,7 @@
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-lg btn-success pull-right" name="delete">{% trans "Destroy" %}</button>
|
<button type="submit" class="btn btn-lg btn-success pull-right" name="delete">{% trans "Destroy" %}</button>
|
||||||
</form>
|
</form>
|
||||||
|
{% endifequal %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<button class="btn btn-lg btn-success disabled pull-right" name="delete">{% trans "Destroy" %}</button>
|
<button class="btn btn-lg btn-success disabled pull-right" name="delete">{% trans "Destroy" %}</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>VCPU</th>
|
<th>VCPU</th>
|
||||||
<th>Memory</th>
|
<th>Memory</th>
|
||||||
<th data-sortable="false" style="width: 165px;">Actions</th>
|
<th data-sortable="false" style="width:205px;">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="searchable">
|
<tbody class="searchable">
|
||||||
|
@ -64,44 +64,50 @@
|
||||||
<input type="hidden" name="name" value="{{ vm }}"/>
|
<input type="hidden" name="name" value="{{ vm }}"/>
|
||||||
<input type="hidden" name="compute_id" value="{{ host.0 }}"/>
|
<input type="hidden" name="compute_id" value="{{ host.0 }}"/>
|
||||||
{% ifequal info.status 5 %}
|
{% ifequal info.status 5 %}
|
||||||
<button class="btn btn-sm btn-default" type="submit" name="start" title="Start">
|
<button class="btn btn-sm btn-default" type="submit" name="poweron" title="{% trans "Power On" %}">
|
||||||
<span class="glyphicon glyphicon-play"></span>
|
<span class="glyphicon glyphicon-play"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
|
||||||
<span class="glyphicon glyphicon-pause"></span>
|
<span class="glyphicon glyphicon-pause"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
|
||||||
|
<span class="glyphicon glyphicon-off"></span>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
||||||
<span class="glyphicon glyphicon-stop"></span>
|
<span class="glyphicon glyphicon-stop"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
||||||
<span class="glyphicon glyphicon-eye-open"></span>
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
</button>
|
</button>
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
{% ifequal info.status 3 %}
|
{% ifequal info.status 3 %}
|
||||||
<button class="btn btn-sm btn-default" type="submit" name="resume"
|
<button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}">
|
||||||
title="{% trans "Resume" %}">
|
|
||||||
<span class="glyphicon glyphicon-play"></span>
|
<span class="glyphicon glyphicon-play"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
|
||||||
<span class="glyphicon glyphicon-pause"></span>
|
<span class="glyphicon glyphicon-pause"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
|
||||||
|
<span class="glyphicon glyphicon-off"></span>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
||||||
<span class="glyphicon glyphicon-stop"></span>
|
<span class="glyphicon glyphicon-stop"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
||||||
<span class="glyphicon glyphicon-eye-open"></span>
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
</button>
|
</button>
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
{% ifequal info.status 1 %}
|
{% ifequal info.status 1 %}
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Start" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
|
||||||
<span class="glyphicon glyphicon-play"></span>
|
<span class="glyphicon glyphicon-play"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default" type="submit" name="suspend"
|
<button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}">
|
||||||
title="{% trans "Suspend" %}">
|
|
||||||
<span class="glyphicon glyphicon-pause"></span>
|
<span class="glyphicon glyphicon-pause"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default" type="submit" name="destroy"
|
<button class="btn btn-sm btn-default" type="submit" name="poweroff" title="{% trans "Power Off" %}" onclick="return confirm('Are you sure?')">
|
||||||
title="{% trans "Destroy" %}" onclick="return confirm('Are you sure?')">
|
<span class="glyphicon glyphicon-off"></span>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
|
||||||
<span class="glyphicon glyphicon-stop"></span>
|
<span class="glyphicon glyphicon-stop"></span>
|
||||||
</button>
|
</button>
|
||||||
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
|
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
|
||||||
|
@ -155,48 +161,44 @@
|
||||||
<input type="hidden" name="name" value="{{ vm.name }}"/>
|
<input type="hidden" name="name" value="{{ vm.name }}"/>
|
||||||
<input type="hidden" name="compute_id" value="{{ vm.compute_id }}"/>
|
<input type="hidden" name="compute_id" value="{{ vm.compute_id }}"/>
|
||||||
{% ifequal vm.status 5 %}
|
{% ifequal vm.status 5 %}
|
||||||
<button class="btn btn-sm btn-default" type="submit" name="start" title="Start">
|
<button class="btn btn-sm btn-default" type="submit" name="poweron" title="Power On">
|
||||||
<span class="glyphicon glyphicon-play"></span>
|
<span class="glyphicon glyphicon-play"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
|
||||||
<span class="glyphicon glyphicon-pause"></span>
|
<span class="glyphicon glyphicon-off"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
||||||
<span class="glyphicon glyphicon-stop"></span>
|
<span class="glyphicon glyphicon-stop"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
||||||
<span class="glyphicon glyphicon-eye-open"></span>
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
</button>
|
</button>
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
{% ifequal vm.status 3 %}
|
{% ifequal vm.status 3 %}
|
||||||
<button class="btn btn-sm btn-default" type="submit" name="resume"
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
|
||||||
title="{% trans "Resume" %}">
|
|
||||||
<span class="glyphicon glyphicon-play"></span>
|
<span class="glyphicon glyphicon-play"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
|
||||||
<span class="glyphicon glyphicon-pause"></span>
|
<span class="glyphicon glyphicon-off"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
||||||
<span class="glyphicon glyphicon-stop"></span>
|
<span class="glyphicon glyphicon-stop"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
||||||
<span class="glyphicon glyphicon-eye-open"></span>
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
</button>
|
</button>
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
{% ifequal vm.status 1 %}
|
{% ifequal vm.status 1 %}
|
||||||
<button class="btn btn-sm btn-default disabled" title="{% trans "Start" %}">
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
|
||||||
<span class="glyphicon glyphicon-play"></span>
|
<span class="glyphicon glyphicon-play"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default" type="submit" name="suspend"
|
<button class="btn btn-sm btn-default" type="submit" name="poweroff" title="{% trans "Power Off" %}">
|
||||||
title="{% trans "Suspend" %}">
|
<span class="glyphicon glyphicon-off"></span>
|
||||||
<span class="glyphicon glyphicon-pause"></span>
|
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-default" type="submit" name="destroy"
|
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
|
||||||
title="{% trans "Destroy" %}" onclick="return confirm('Are you sure?')">
|
|
||||||
<span class="glyphicon glyphicon-stop"></span>
|
<span class="glyphicon glyphicon-stop"></span>
|
||||||
</button>
|
</button>
|
||||||
<a href="#" class="btn btn-sm btn-default"
|
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ host.0 }}-{{ vm.uuid }}")' title="{% trans "Console" %}">
|
||||||
onclick='open_console("{{ host.0 }}-{{ vm.uuid }}")' title="{% trans "Console" %}">
|
|
||||||
<span class="glyphicon glyphicon-eye-open"></span>
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
</a>
|
</a>
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
|
|
|
@ -38,9 +38,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ forloop.counter }}</td>
|
<td>{{ forloop.counter }}</td>
|
||||||
<td><a href="#">{{ log.user }}</a></td>
|
<td><a href="#">{{ log.user }}</a></td>
|
||||||
<td><a href="#">{{ log.instance }}<a></td>
|
<td><a href="#">{{ log.instance }}</a></td>
|
||||||
<td>{{ log.message }}</td>
|
<td>{{ log.message }}</td>
|
||||||
<td>{{ log.date }}</td>
|
<td style="width:120px;">{{ log.date|date:"M d H:i:s" }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in a new issue