mirror of
https://github.com/retspen/webvirtcloud
synced 2024-10-31 19:44:16 +00:00
Qemu Guest Agent channel add option while creating instance
This commit is contained in:
parent
a67acc5d24
commit
62908f477c
4 changed files with 37 additions and 9 deletions
|
@ -46,6 +46,7 @@ class NewVMForm(forms.Form):
|
|||
hdd_size = forms.IntegerField(required=False)
|
||||
meta_prealloc = forms.BooleanField(required=False)
|
||||
virtio = forms.BooleanField(required=False)
|
||||
qemu_ga = forms.BooleanField(required=False)
|
||||
mac = forms.CharField(required=False)
|
||||
console_pass = forms.CharField(required=False,empty_value="", widget=forms.PasswordInput())
|
||||
video = forms.CharField(error_messages={'required': _('Please select a graphic display')})
|
||||
|
|
|
@ -203,6 +203,12 @@
|
|||
</div>
|
||||
<label class="col-lg-1 control-label">{% trans "CPU" %}</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Guest Agent" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox" name="qemu_ga" value="true" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "VirtIO" %}</label>
|
||||
<div class="col-sm-6">
|
||||
|
@ -375,6 +381,12 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Guest Agent" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox" name="qemu_ga" value="true" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "VirtIO" %}</label>
|
||||
<div class="col-sm-7">
|
||||
|
@ -515,6 +527,12 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Guest Agent" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox" name="qemu_ga" value="true" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "VirtIO" %}</label>
|
||||
<div class="col-sm-7">
|
||||
|
|
|
@ -53,7 +53,6 @@ def create_instance(request, compute_id):
|
|||
disk_devices = conn.get_disk_device_types()
|
||||
disk_buses = conn.get_disk_bus_types()
|
||||
default_bus = INSTANCE_VOLUME_DEFAULT_BUS
|
||||
#get_images = sorted(conn.get_storages_images())
|
||||
except libvirtError as lib_err:
|
||||
error_messages.append(lib_err)
|
||||
|
||||
|
@ -173,7 +172,7 @@ def create_instance(request, compute_id):
|
|||
conn.create_instance(data['name'], data['memory'], data['vcpu'], data['host_model'],
|
||||
uuid, volume_list, data['cache_mode'], data['networks'], data['virtio'],
|
||||
data["listener_addr"], data["nwfilter"], data["video"], data["console_pass"],
|
||||
data['mac'])
|
||||
data['mac'], data['qemu_ga'])
|
||||
create_instance = Instance(compute_id=compute_id, name=data['name'], uuid=uuid)
|
||||
create_instance.save()
|
||||
msg = _("Instance is created.")
|
||||
|
|
|
@ -154,7 +154,7 @@ class wvmCreate(wvmConnect):
|
|||
vol = self.get_volume_by_path(path)
|
||||
vol.delete()
|
||||
|
||||
def create_instance(self, name, memory, vcpu, host_model, uuid, images, cache_mode, networks, virtio, listen_addr, nwfilter=None, video="cirrus", console_pass="random", mac=None):
|
||||
def create_instance(self, name, memory, vcpu, host_model, uuid, images, cache_mode, networks, virtio, listen_addr, nwfilter=None, video="cirrus", console_pass="random", mac=None, qemu_ga=False):
|
||||
"""
|
||||
Create VM function
|
||||
"""
|
||||
|
@ -260,11 +260,21 @@ class wvmCreate(wvmConnect):
|
|||
xml += """ <input type='mouse' bus='ps2'/>
|
||||
<input type='tablet' bus='usb'/>
|
||||
<graphics type='%s' port='-1' autoport='yes' %s listen='%s'/>
|
||||
<console type='pty'/>
|
||||
<video>
|
||||
<console type='pty'/> """ % (QEMU_CONSOLE_DEFAULT_TYPE, console_pass, listen_addr)
|
||||
|
||||
if qemu_ga:
|
||||
xml += """ <channel type='unix'>
|
||||
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
||||
</channel>"""
|
||||
|
||||
xml += """ <video>
|
||||
<model type='%s'/>
|
||||
</video>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
</domain>""" % (QEMU_CONSOLE_DEFAULT_TYPE, console_pass, listen_addr, video)
|
||||
</video>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
</domain>""" % video
|
||||
|
||||
|
||||
|
||||
|
||||
self._defineXML(xml)
|
||||
|
|
Loading…
Reference in a new issue