From 7deac91af348d53769e6371e46bcfa434b973dd5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 5 Mar 2021 14:16:16 +0100 Subject: [vm] Add support for NVMe --- src/main/java/org/openslx/util/vm/VboxConfig.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/main/java/org/openslx/util/vm/VboxConfig.java') diff --git a/src/main/java/org/openslx/util/vm/VboxConfig.java b/src/main/java/org/openslx/util/vm/VboxConfig.java index e9870a5..f405991 100644 --- a/src/main/java/org/openslx/util/vm/VboxConfig.java +++ b/src/main/java/org/openslx/util/vm/VboxConfig.java @@ -382,15 +382,18 @@ public class VboxConfig } String controllerMode = hddController.getAttribute( "type" ); String controllerType = hddController.getAttribute( "name" ); - DriveBusType busType = null; - if ( controllerType.equals( "IDE" ) ) { - busType = DriveBusType.IDE; - } else if ( controllerType.equals( "SCSI" ) ) { - busType = DriveBusType.SCSI; - } else if ( controllerType.equals( "SATA" ) ) { - busType = DriveBusType.SATA; - } else - continue; + DriveBusType busType; + if ( controllerType.equals( "NVMe" ) ) { + busType = DriveBusType.NVME; + } else { + try { + // This assumes the type in the xml matches our enum constants. + busType = DriveBusType.valueOf( controllerType ); + } catch (Exception e) { + LOGGER.warn( "Skipping unknown HDD controller type '" + controllerType + "'" ); + continue; + } + } LOGGER.info( "Adding hard disk with controller: " + busType + " (" + controllerMode + ") from file '" + fileName + "'." ); hddsArray.add( new HardDisk( controllerMode, busType, fileName ) ); } -- cgit v1.2.3-55-g7522