mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
changing video card model functionality added to options.
This commit is contained in:
parent
60684cc7b1
commit
74eb8004d7
5 changed files with 77 additions and 7 deletions
|
|
@ -1290,6 +1290,8 @@
|
|||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="options">
|
||||
<div class="well">
|
||||
<p>{% trans "To set instance template name description, shutdown the instance." %}</p>
|
||||
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Title" %}</label>
|
||||
|
|
@ -1309,14 +1311,44 @@
|
|||
<input type="checkbox" name="is_template" value="True" id="is_template" {% if instance.is_template %}checked{% endif %} {% if not request.user.is_superuser %}disabled{% endif %}>
|
||||
</div>
|
||||
</div>
|
||||
{% ifequal status 5 %}
|
||||
<button type="submit" class="btn btn-lg btn-success pull-right" name="change_options">{% trans "Change" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success pull-right disabled" name="change_options">{% trans "Change" %}</button>
|
||||
{% endifequal %}
|
||||
<div class="form-group ">
|
||||
<div class="col-sm-offset-3 col-sm-6">
|
||||
{% ifequal status 5 %}
|
||||
<button type="submit" class="btn btn-block btn-success" name="change_options">{% trans "Change" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-block btn-success disabled" name="change_options">{% trans "Change" %}</button>
|
||||
{% endifequal %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="well">
|
||||
<p>{% trans "To set instance video model, shutdown the instance." %}</p>
|
||||
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label for="video_model_select" class="col-sm-3 control-label">{% trans "Primary Video Model" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<select id="video_model_select" class="form-control" name="video_model">
|
||||
<option value="" style="font-weight: bold">{% trans "please choose" %}</option>
|
||||
{% for vmodel in videos_host %}
|
||||
<option value="{{ vmodel }}">{{ vmodel }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
{% ifequal status 5 %}
|
||||
<button type="submit" class="btn btn-success" name="set_video_model">{% trans "Set" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-success disabled" name="set_video_model">{% trans "Set" %}</button>
|
||||
{% endifequal %}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1597,6 +1629,13 @@
|
|||
$("#console_select_listen_address option[value='" + console_listen_address + "']").prop('selected', true);
|
||||
}
|
||||
});
|
||||
$(document).ready(function () {
|
||||
// get video model or fall back to default
|
||||
let video_model = "{{ video_model }}"
|
||||
if (video_model != '') {
|
||||
$("#video_model_select option[value='" + video_model + "']").prop('selected', true);
|
||||
}
|
||||
});
|
||||
$(document).ready(function () {
|
||||
// set vdi url
|
||||
$.get("{% url 'vdi_url' vname %}", function(data) {
|
||||
|
|
|
|||
|
|
@ -291,6 +291,7 @@ def instance(request, compute_id, vname):
|
|||
console_port = conn.get_console_port()
|
||||
console_keymap = conn.get_console_keymap()
|
||||
console_listen_address = conn.get_console_listen_addr()
|
||||
video_model = conn.get_video_model()
|
||||
snapshots = sorted(conn.get_snapshot(), reverse=True, key=lambda k: k['date'])
|
||||
inst_xml = conn._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||
has_managed_save_image = conn.get_managed_save_image()
|
||||
|
|
@ -328,6 +329,7 @@ def instance(request, compute_id, vname):
|
|||
vcpu_host = len(vcpu_range)
|
||||
memory_host = conn.get_max_memory()
|
||||
bus_host = conn.get_disk_bus_types()
|
||||
videos_host = conn.get_video_models()
|
||||
networks_host = sorted(conn.get_networks())
|
||||
interfaces_host = sorted(conn.get_ifaces())
|
||||
nwfilters_host = conn.get_nwfilters()
|
||||
|
|
@ -764,6 +766,13 @@ def instance(request, compute_id, vname):
|
|||
return HttpResponseRedirect(request.get_full_path() + '#vncsettings')
|
||||
|
||||
if request.user.is_superuser:
|
||||
if 'set_video_model' in request.POST:
|
||||
video_model = request.POST.get('video_model', 'vga')
|
||||
conn.set_video_model(video_model)
|
||||
msg = _("Set Video Model")
|
||||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#options')
|
||||
|
||||
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