051-addhardware-Add-usb-as-a-recommended-sound-device.patch 055-virtinst-Add-serial-controller-option-to-cli.patch 056-virtinst-Add-NVMe-Controller.patch 057-virtinst-implement-NVMe-disk-target-generation.patch 057-virtinst-implement-NVMe-disk-target-generation.patch~ 058-virtManager-Add-NVMe-disk-type.patch 058-virtManager-Add-NVMe-disk-type.patch~ 059-ui-Show-NVMe-Controller-details.patch 060-virtinst-fix-locale-when-running-in-flatpak.patch 061-virtinst-add-support-for-iommufd.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=744
112 lines
4.2 KiB
Diff
112 lines
4.2 KiB
Diff
Subject: virtManager: Add NVMe disk type
|
|
From: 6543 6543@obermui.de Thu Dec 18 03:38:56 2025 +0100
|
|
Date: Sun Jan 11 18:36:09 2026 +0100:
|
|
Git: 08b547366fbc4037a737515ee0efab3c3e673a80
|
|
|
|
|
|
--- a/virtManager/addhardware.py
|
|
+++ b/virtManager/addhardware.py
|
|
@@ -472,6 +472,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|
def controller_recommended_types():
|
|
return [
|
|
DeviceController.TYPE_SCSI,
|
|
+ DeviceController.TYPE_NVME,
|
|
DeviceController.TYPE_USB,
|
|
DeviceController.TYPE_VIRTIOSERIAL,
|
|
DeviceController.TYPE_CCID,
|
|
@@ -482,6 +483,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|
labels = {
|
|
DeviceController.TYPE_IDE: _("IDE"),
|
|
DeviceController.TYPE_FDC: _("Floppy"),
|
|
+ DeviceController.TYPE_NVME: _("NVMe"),
|
|
DeviceController.TYPE_SCSI: _("SCSI"),
|
|
DeviceController.TYPE_SATA: _("SATA"),
|
|
DeviceController.TYPE_VIRTIOSERIAL: _("VirtIO Serial"),
|
|
@@ -510,6 +512,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|
ret.append("ide")
|
|
ret.append("sata")
|
|
ret.append("fdc")
|
|
+ ret.append("nvme")
|
|
ret.append("scsi")
|
|
ret.append("usb")
|
|
|
|
@@ -531,7 +534,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|
buses = vmmAddHardware.disk_old_recommended_buses(guest)
|
|
|
|
bus_map = {
|
|
- "disk": ["ide", "sata", "scsi", "sd", "usb", "virtio", "xen"],
|
|
+ "disk": ["ide", "nvme", "sata", "scsi", "sd", "usb", "virtio", "xen"],
|
|
"floppy": ["fdc"],
|
|
"cdrom": ["ide", "sata", "scsi", "usb"],
|
|
"lun": ["scsi"],
|
|
@@ -542,6 +545,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|
def disk_pretty_bus(bus):
|
|
bus_mappings = {
|
|
"ide": _("IDE"),
|
|
+ "nvme": _("NVMe"),
|
|
"sata": _("SATA"),
|
|
"scsi": _("SCSI"),
|
|
"sd": _("SD"),
|
|
@@ -1424,16 +1428,33 @@ class vmmAddHardware(vmmGObjectUI):
|
|
return dev
|
|
|
|
def _set_disk_controller(self, disk):
|
|
- # Add a SCSI controller with model virtio-scsi if needed
|
|
+ # Add a SCSI controller with model virtio-scsi if needed or
|
|
+ # add an NVMe controller if needed
|
|
disk.vmm_controller = None
|
|
- if not self.vm.xmlobj.can_default_virtioscsi():
|
|
- return
|
|
|
|
- controller = DeviceController(self.conn.get_backend())
|
|
- controller.type = "scsi"
|
|
- controller.model = "virtio-scsi"
|
|
- controller.index = 0
|
|
- disk.vmm_controller = controller
|
|
+ if disk.bus == "scsi":
|
|
+ if not self.vm.xmlobj.can_default_virtioscsi():
|
|
+ return
|
|
+
|
|
+ controller = DeviceController(self.conn.get_backend())
|
|
+ controller.type = "scsi"
|
|
+ controller.model = "virtio-scsi"
|
|
+ controller.index = 0
|
|
+ disk.vmm_controller = controller
|
|
+
|
|
+ elif disk.bus == "nvme":
|
|
+ nvme_controllers = [c for c in self.vm.xmlobj.devices.controller if c.type == "nvme"]
|
|
+ if len(nvme_controllers) > 0:
|
|
+ if not disk.serial:
|
|
+ disk.serial = nvme_controllers[0].serial
|
|
+ else:
|
|
+ if not disk.serial:
|
|
+ disk.serial = "0"
|
|
+ controller = DeviceController(self.conn.get_backend())
|
|
+ controller.type = "nvme"
|
|
+ controller.index = 0
|
|
+ controller.serial = disk.serial
|
|
+ disk.vmm_controller = controller
|
|
|
|
def _build_storage(self):
|
|
bus = uiutil.get_list_selection(self.widget("storage-bustype"))
|
|
@@ -1585,12 +1606,18 @@ class vmmAddHardware(vmmGObjectUI):
|
|
controller_num = [x for x in controllers if (x.type == controller_type)]
|
|
if len(controller_num) > 0:
|
|
index_new = max(int(x.index or 0) for x in controller_num) + 1
|
|
- dev.index = index_new
|
|
+ else:
|
|
+ index_new = 0
|
|
+ dev.index = index_new
|
|
|
|
dev.type = controller_type
|
|
|
|
if model and model != "none":
|
|
dev.model = model
|
|
+
|
|
+ if controller_type == DeviceController.TYPE_NVME:
|
|
+ dev.serial = str(dev.index)
|
|
+
|
|
return dev
|
|
|
|
def _build_rng(self):
|