diff --git a/instances/models.py b/instances/models.py index ec80685..222f886 100644 --- a/instances/models.py +++ b/instances/models.py @@ -245,6 +245,7 @@ class CreateInstance(models.Model): mac = models.CharField(max_length=17, blank=True) console_pass = models.CharField(max_length=64, blank=True) add_cdrom = models.CharField(max_length=16) + add_input = models.CharField(max_length=16) graphics = models.CharField(max_length=16, error_messages={'required': _('Please select a graphics type')}) video = models.CharField(max_length=16, error_messages={'required': _('Please select a video driver')}) listener_addr = models.CharField(max_length=20, choices=QEMU_CONSOLE_LISTENER_ADDRESSES) diff --git a/instances/templates/create_instance_w2.html b/instances/templates/create_instance_w2.html index 4e98676..d26b2a6 100644 --- a/instances/templates/create_instance_w2.html +++ b/instances/templates/create_instance_w2.html @@ -261,6 +261,19 @@ +
+ +
+ +
+
@@ -504,6 +517,19 @@
+
+ +
+ +
+
@@ -733,6 +759,19 @@
+
+ +
+ +
+
diff --git a/instances/views.py b/instances/views.py index ce2db54..c308b39 100644 --- a/instances/views.py +++ b/instances/views.py @@ -1396,6 +1396,8 @@ def create_instance(request, compute_id, arch, machine): storages = sorted(conn.get_storages(only_actives=True)) default_graphics = app_settings.QEMU_CONSOLE_DEFAULT_TYPE default_cdrom = app_settings.INSTANCE_CDROM_ADD + input_device_buses = ['default', 'virtio', 'usb'] + default_input_device_bus = app_settings.INSTANCE_INPUT_DEFAULT_DEVICE dom_caps = conn.get_dom_capabilities(arch, machine) caps = conn.get_capabilities(arch) @@ -1554,7 +1556,8 @@ def create_instance(request, compute_id, arch, machine): console_pass=data["console_pass"], mac=data["mac"], qemu_ga=data["qemu_ga"], - add_cdrom=data["add_cdrom"] + add_cdrom=data["add_cdrom"], + add_input=data["add_input"], ) create_instance = Instance(compute_id=compute_id, name=data["name"], uuid=uuid) create_instance.save() diff --git a/vrtManager/create.py b/vrtManager/create.py index 6aaa1a9..e686efc 100644 --- a/vrtManager/create.py +++ b/vrtManager/create.py @@ -166,6 +166,7 @@ class wvmCreate(wvmConnect): mac=None, qemu_ga=True, add_cdrom="sata", + add_input="default" ): """ Create VM function @@ -324,14 +325,16 @@ class wvmCreate(wvmConnect): elif console_pass != "": console_pass = "passwd='" + console_pass + "'" - if "usb" in dom_caps["disk_bus"]: - xml += f"""""" - xml += f"""""" - xml += f"""""" - else: - xml += """""" - xml += """""" - xml += """""" + if add_input != "None": + xml += """""" + if add_input in dom_caps["disk_bus"]: + xml += f"""""" + xml += f"""""" + xml += f"""""" + else: + xml += """""" + xml += """""" + xml += """""" xml += f"""