mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
add cdrom to instance errors fixed. make cdrom readonly, disable cache.
This commit is contained in:
parent
9198615076
commit
57665c2ab9
3 changed files with 8 additions and 10 deletions
|
@ -767,15 +767,13 @@
|
||||||
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
||||||
<p style="font-weight:bold;">
|
<p style="font-weight:bold;">
|
||||||
{% trans "Instance Media" %}
|
{% trans "Instance Media" %}
|
||||||
{% if status == 5 %}
|
|
||||||
<button type="submit" name="add_cdrom" type="button" class="btn btn-success pull-right" title="Add CD-ROM">
|
<button type="submit" name="add_cdrom" type="button" class="btn btn-success pull-right"
|
||||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
title="Add CD-ROM"
|
||||||
</button>
|
{% if status != 5 %} disabled {% endif %} >
|
||||||
{% else %}
|
|
||||||
<button type="submit" type="button" class="btn btn-success disabled pull-right" title="Add CD-ROM" disabled>
|
|
||||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
{% for cd in media %}
|
{% for cd in media %}
|
||||||
|
|
|
@ -663,7 +663,7 @@ def instance(request, compute_id, vname):
|
||||||
if 'add_cdrom' in request.POST and allow_admin_or_not_template:
|
if 'add_cdrom' in request.POST and allow_admin_or_not_template:
|
||||||
bus = request.POST.get('bus', 'ide' if machine == 'pc' else 'sata')
|
bus = request.POST.get('bus', 'ide' if machine == 'pc' else 'sata')
|
||||||
target = get_new_disk_dev(media, disks, bus)
|
target = get_new_disk_dev(media, disks, bus)
|
||||||
conn.attach_disk("", target, device='cdrom', cache='none', targetbus=bus)
|
conn.attach_disk("", target, disk_device='cdrom', cache_mode='none', target_bus=bus, readonly=True)
|
||||||
msg = _('Add CD-ROM: ' + target)
|
msg = _('Add CD-ROM: ' + target)
|
||||||
addlogmsg(request.user.username, instance.name, msg)
|
addlogmsg(request.user.username, instance.name, msg)
|
||||||
return HttpResponseRedirect(request.get_full_path() + '#disks')
|
return HttpResponseRedirect(request.get_full_path() + '#disks')
|
||||||
|
|
|
@ -650,7 +650,7 @@ class wvmInstance(wvmConnect):
|
||||||
cache_mode=None, io_mode=None, discard_mode=None, detect_zeroes_mode=None):
|
cache_mode=None, io_mode=None, discard_mode=None, detect_zeroes_mode=None):
|
||||||
|
|
||||||
additionals = ''
|
additionals = ''
|
||||||
if cache_mode is not None and cache_mode != 'default':
|
if cache_mode is not None and cache_mode != 'default' and disk_device != 'cdrom':
|
||||||
additionals += "cache='%s' " % cache_mode
|
additionals += "cache='%s' " % cache_mode
|
||||||
if io_mode is not None and io_mode != 'default':
|
if io_mode is not None and io_mode != 'default':
|
||||||
additionals += "io='%s' " % io_mode
|
additionals += "io='%s' " % io_mode
|
||||||
|
@ -666,7 +666,7 @@ class wvmInstance(wvmConnect):
|
||||||
xml_disk += "<driver name='%s' type='%s' %s/>" % (driver_name, driver_type, additionals)
|
xml_disk += "<driver name='%s' type='%s' %s/>" % (driver_name, driver_type, additionals)
|
||||||
xml_disk += """<source file='%s'/>
|
xml_disk += """<source file='%s'/>
|
||||||
<target dev='%s' bus='%s'/>""" % (source, target_dev, target_bus)
|
<target dev='%s' bus='%s'/>""" % (source, target_dev, target_bus)
|
||||||
if readonly:
|
if readonly or disk_device == 'cdrom':
|
||||||
xml_disk += """<readonly/>"""
|
xml_disk += """<readonly/>"""
|
||||||
if shareable:
|
if shareable:
|
||||||
xml_disk += """<shareable/>"""
|
xml_disk += """<shareable/>"""
|
||||||
|
|
Loading…
Reference in a new issue