mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Merge remote-tracking branch 'qdaniel/master'
This commit is contained in:
commit
ed4cb864ad
9 changed files with 56 additions and 8 deletions
|
|
@ -498,11 +498,15 @@
|
|||
{% trans "Autostart" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser or userinstace.is_vnc %}
|
||||
<li role="presentation">
|
||||
<a href="#vncsettings" aria-controls="vncsettings" role="tab" data-toggle="tab">
|
||||
{% trans "VNC" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<li role="presentation">
|
||||
<a href="#network" aria-controls="network" role="tab" data-toggle="tab">
|
||||
{% trans "Network" %}
|
||||
|
|
@ -591,6 +595,8 @@
|
|||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser or userinstace.is_vnc %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="vncsettings">
|
||||
<p>{% trans "To set console's type, shutdown the instance." %}</p>
|
||||
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||
|
|
@ -683,6 +689,8 @@
|
|||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="network">
|
||||
<p>{% trans "Assign network device to bridge" %}</p>
|
||||
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ from accounts.models import UserInstance, UserSSHKey
|
|||
from vrtManager.hostdetails import wvmHostDetails
|
||||
from vrtManager.instance import wvmInstance, wvmInstances
|
||||
from vrtManager.connection import connection_manager
|
||||
from vrtManager.util import randomPasswd
|
||||
from libvirt import libvirtError, VIR_DOMAIN_XML_SECURE
|
||||
from webvirtcloud.settings import QEMU_KEYMAPS, QEMU_CONSOLE_TYPES
|
||||
from logs.views import addlogmsg
|
||||
|
|
@ -342,7 +343,7 @@ def instance(request, compute_id, vname):
|
|||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#powerforce')
|
||||
|
||||
if 'delete' in request.POST:
|
||||
if 'delete' in request.POST and (request.user.is_superuser or userinstace.is_delete):
|
||||
if conn.get_status() == 1:
|
||||
conn.force_shutdown()
|
||||
if request.POST.get('delete_disk', ''):
|
||||
|
|
@ -408,7 +409,7 @@ def instance(request, compute_id, vname):
|
|||
msg = _("Please shutdow down your instance and then try again")
|
||||
error_messages.append(msg)
|
||||
|
||||
if 'resize' in request.POST:
|
||||
if 'resize' in request.POST and (request.user.is_superuser or userinstace.is_change):
|
||||
new_vcpu = request.POST.get('vcpu', '')
|
||||
new_cur_vcpu = request.POST.get('cur_vcpu', '')
|
||||
new_memory = request.POST.get('memory', '')
|
||||
|
|
@ -513,9 +514,10 @@ def instance(request, compute_id, vname):
|
|||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#xmledit')
|
||||
|
||||
if request.user.is_superuser or userinstace.is_vnc:
|
||||
if 'set_console_passwd' in request.POST:
|
||||
if request.POST.get('auto_pass', ''):
|
||||
passwd = ''.join([choice(letters + digits) for i in xrange(12)])
|
||||
passwd = randomPasswd()
|
||||
else:
|
||||
passwd = request.POST.get('console_passwd', '')
|
||||
clear = request.POST.get('clear_pass', False)
|
||||
|
|
@ -551,6 +553,7 @@ def instance(request, compute_id, vname):
|
|||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#vncsettings')
|
||||
|
||||
if request.user.is_superuser:
|
||||
if 'migrate' in request.POST:
|
||||
compute_id = request.POST.get('compute_id', '')
|
||||
live = request.POST.get('live_migrate', False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue