From ba48bb55168f8e1a50dedea4246eae3c0f532ebf Mon Sep 17 00:00:00 2001 From: Jan Pokorny Date: Nov 06 2020 13:57:24 +0000 Subject: support for VM with NVME - added support for NVME into VM creation script --- diff --git a/inventory/standard-inventory-qcow2 b/inventory/standard-inventory-qcow2 index 522555d..ce82cae 100755 --- a/inventory/standard-inventory-qcow2 +++ b/inventory/standard-inventory-qcow2 @@ -99,17 +99,25 @@ class AdditionalDrives(object): """ result = [] drives = fmf_get(['qemu', 'drive'], list()) + dev_id = 0 for drive in drives: # create temporary sparse file size = int(drive.get('size', 2 * 1024 ** 3)) # default size: 2G path = drive.get('path', None) path = str(path) if path is not None else None + protocol = drive.get('protocol', None) drive_file = tempfile.NamedTemporaryFile(dir=path, delete=False) drive_file.truncate(size) cls._tempfiles.append(drive_file) logger.info("Created temporary sparse file '%s'.", drive_file.name) # translate data into qemu command options - result += ["-drive", "file=%s,media=disk,if=virtio" % drive_file.name] + + if protocol is None: + result += ["-drive", "file=%s,media=disk,if=virtio" % drive_file.name] + elif protocol.lower() == 'nvme': + result += ["-device", "nvme,drive=nvme%s,serial=def%s" % (dev_id, dev_id)] + result += ["-drive", "file=%s,media=disk,if=none,id=nvme%s" % (drive_file.name, dev_id)] + dev_id += 1 usb_drives = fmf_get(['qemu', 'usb_drive'], list()) if usb_drives: