diff options
-rw-r--r-- | src/main/java/org/openslx/util/vm/QemuMetaData.java | 32 | ||||
-rw-r--r-- | src/main/java/org/openslx/util/vm/VboxConfig.java | 122 | ||||
-rw-r--r-- | src/main/java/org/openslx/util/vm/VboxMetaData.java | 77 | ||||
-rw-r--r-- | src/main/java/org/openslx/util/vm/VmMetaData.java | 43 | ||||
-rw-r--r-- | src/main/java/org/openslx/util/vm/VmwareMetaData.java | 78 |
5 files changed, 279 insertions, 73 deletions
diff --git a/src/main/java/org/openslx/util/vm/QemuMetaData.java b/src/main/java/org/openslx/util/vm/QemuMetaData.java index dcb3b68..cd18abd 100644 --- a/src/main/java/org/openslx/util/vm/QemuMetaData.java +++ b/src/main/java/org/openslx/util/vm/QemuMetaData.java @@ -15,7 +15,7 @@ import org.openslx.thrifthelper.TConst; import org.openslx.util.vm.DiskImage.ImageFormat; import org.openslx.util.vm.DiskImage.UnknownImageFormatException; -public class QemuMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, VBoxHWVersionMeta, VBoxEthernetDevTypeMeta> +public class QemuMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, VBoxHWVersionMeta, VBoxEthernetDevTypeMeta, VBoxUsbSpeedMeta> { private final Map<String, String> arguments = new HashMap<String, String>(); @@ -37,7 +37,7 @@ public class QemuMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, if ( di == null || di.format != ImageFormat.QCOW2 ) { throw new UnsupportedVirtualizerFormatException( "This is not a qcow2 disk image" ); } - config = "qemu-system-i386 <args> <image> -enable-kvm \n\r qemu-system-x86_64 <args> <image> -enable-kvm"; + config = "qemu-system-i386 <args> <image> -enable-kvm\nqemu-system-x86_64 <args> <image> -enable-kvm"; displayName = file.getName().substring( 0, file.getName().indexOf( "." ) ); setOs( "anyOs" ); hdds.add( new HardDisk( "anychipset", DriveBusType.IDE, file.getAbsolutePath() ) ); @@ -201,25 +201,33 @@ public class QemuMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, } @Override - public void enableUsb( boolean enabled ) + public boolean disableSuspend() { - // TODO test this properly - if ( enabled ) { - arguments.put( "usb", "" ); - } else { - arguments.remove( "usb" ); - } + return false; } @Override - public boolean disableSuspend() + public void registerVirtualHW() { - return false; } @Override - public void registerVirtualHW() + public void setMaxUsbSpeed( VmMetaData.UsbSpeed speed ) + { + // TODO: Actual speed setting? + if ( speed == null || speed == VmMetaData.UsbSpeed.NONE ) { + arguments.remove( "usb" ); + } else { + arguments.put( "usb", "" ); + } + } + + @Override + public VmMetaData.UsbSpeed getMaxUsbSpeed() { + if ( arguments.containsKey( "usb" ) ) + return VmMetaData.UsbSpeed.USB2_0; // TODO + return VmMetaData.UsbSpeed.NONE; } } diff --git a/src/main/java/org/openslx/util/vm/VboxConfig.java b/src/main/java/org/openslx/util/vm/VboxConfig.java index 1eee0ed..5f2a21d 100644 --- a/src/main/java/org/openslx/util/vm/VboxConfig.java +++ b/src/main/java/org/openslx/util/vm/VboxConfig.java @@ -6,6 +6,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.List; import javax.xml.XMLConstants; import javax.xml.transform.stream.StreamSource; @@ -47,7 +48,6 @@ public class VboxConfig "/VirtualBox/Machine/Hardware/GuestProperties", "/VirtualBox/Machine/Hardware/VideoCapture", "/VirtualBox/Machine/Hardware/HID", - "/VirtualBox/Machine/Hardware/USB", "/VirtualBox/Machine/Hardware/LPT", "/VirtualBox/Machine/Hardware/SharedFolders", "/VirtualBox/Machine/Hardware/Network/Adapter[@enabled='true']/*", @@ -141,6 +141,7 @@ public class VboxConfig try { ensureHardwareUuid(); setOsType(); + fixUsb(); // Since we now support selecting specific speed if ( checkForPlaceholders() ) { return; } @@ -152,6 +153,33 @@ public class VboxConfig return; } } + + private void fixUsb() + { + NodeList list = findNodes( "/VirtualBox/Machine/Hardware/USB/Controllers/Controller" ); + if ( list != null && list.getLength() != 0 ) { + LOGGER.info( "USB present, not fixing anything" ); + return; + } + // If there's no USB section, this can mean two things: + // 1) Old config that would always default to USB 2.0 for "USB enabled" or nothing for disabled + // 2) New config with USB disabled + list = findNodes( "/VirtualBox/OpenSLX/USB[@disabled]" ); + if ( list != null && list.getLength() != 0 ) { + LOGGER.info( "USB explicitly disabled" ); + return; // Explicitly marked as disabled, do nothing + } + // We assume case 1) and add USB 2.0 + LOGGER.info( "Fixing USB: Adding USB 2.0" ); + Element controller; + Element node = createNodeRecursive( "/VirtualBox/Machine/Hardware/USB/Controllers" ); + controller = addNewNode( node, "Controller" ); + controller.setAttribute( "name", "OHCI" ); + controller.setAttribute( "type", "OHCI" ); + controller = addNewNode( node, "Controller" ); + controller.setAttribute( "name", "EHCI" ); + controller.setAttribute( "type", "EHCI" ); + } /** * Saves the machine's uuid as hardware uuid to prevent VMs from @@ -379,35 +407,6 @@ public class VboxConfig } /** - * Enable USB by adding the element /VirtualBox/Machine/Hardware/USB - * and adding controllers for OHCI and EHCI (thus enabling USB 2.0). - */ - public void enableUsb() - { - addNewNode( "/VirtualBox/Machine/Hardware", "USB" ); - addNewNode( "/VirtualBox/Machine/Hardware/USB", "Controllers" ); - // OHCI for USB 1.0 - Node ohci = addNewNode( "/VirtualBox/Machine/Hardware/USB/Controllers", "Controller" ); - addAttributeToNode( ohci, "name", "OHCI" ); - addAttributeToNode( ohci, "type", "OHCI" ); - // EHCI for USB 2.0 - Node ehci = addNewNode( "/VirtualBox/Machine/Hardware/USB/Controllers", "Controller" ); - addAttributeToNode( ehci, "name", "EHCI" ); - addAttributeToNode( ehci, "type", "EHCI" ); - } - - /** - * Removes all USB elements - */ - public void disableUsb() - { - NodeList usbList = findNodes( "/VirtualBox/Machine/Hardware/USB" ); - for ( int i = 0; i < usbList.getLength(); i++ ) { - removeNode( usbList.item( 0 ) ); - } - } - - /** * Detect if the vbox file has any machine snapshot by looking at * the existance of '/VirtualBox/Machine/Snapshot' elements. * @@ -502,6 +501,39 @@ public class VboxConfig return addNewNode( possibleParents.item( 0 ), childName ); } + public Element createNodeRecursive( String xPath ) + { + String[] nodeNames = xPath.split( "/" ); + Node parent = this.doc; + Element latest = null; + for ( int nodeIndex = 0; nodeIndex < nodeNames.length; ++nodeIndex ) { + if ( nodeNames[nodeIndex].length() == 0 ) + continue; + Node node = skipNonElementNodes( parent.getFirstChild() ); + while ( node != null ) { + if ( node.getNodeType() == Node.ELEMENT_NODE && nodeNames[nodeIndex].equals( node.getNodeName() ) ) + break; // Found existing + // Check next on same level + node = skipNonElementNodes( node.getNextSibling() ); + } + if ( node == null ) { + node = doc.createElement( nodeNames[nodeIndex] ); + parent.appendChild( node ); + } + parent = node; + latest = (Element)node; + } + return latest; + } + + private Element skipNonElementNodes( Node nn ) + { + while ( nn != null && nn.getNodeType() != Node.ELEMENT_NODE ) { + nn = nn.getNextSibling(); + } + return (Element)nn; + } + /** * Creates a new element to the given parent node. * @@ -509,12 +541,12 @@ public class VboxConfig * @param childName name of the new element to create * @return the newly created node */ - public Node addNewNode( Node parent, String childName ) + public Element addNewNode( Node parent, String childName ) { if ( parent == null || parent.getNodeType() != Node.ELEMENT_NODE ) { return null; } - Node newNode = null; + Element newNode = null; try { newNode = doc.createElement( childName ); parent.appendChild( newNode ); @@ -548,4 +580,30 @@ public class VboxConfig { return XmlHelper.getXmlFromDocument( doc, prettyPrint ); } + + /** + * Remove all nodes with name childName from parentPath + * @param parentPath XPath to parent node of where child nodes are to be deleted + * @param childName Name of nodes to delete + */ + public void removeNodes( String parentPath, String childName ) + { + NodeList parentNodes = findNodes( parentPath ); + // XPath might match multiple nodes + for ( int i = 0; i < parentNodes.getLength(); ++i ) { + Node parent = parentNodes.item( i ); + List<Node> delList = new ArrayList<>( 0 ); + // Iterate over child nodes + for ( Node child = parent.getFirstChild(); child != null; child = child.getNextSibling() ) { + if ( childName.equals( child.getNodeName() ) ) { + // Remember all to be deleted (don't delete while iterating) + delList.add( child ); + } + } + // Now delete them all + for ( Node child : delList ) { + parent.removeChild( child ); + } + } + } } diff --git a/src/main/java/org/openslx/util/vm/VboxMetaData.java b/src/main/java/org/openslx/util/vm/VboxMetaData.java index 00ca8ad..8fa530b 100644 --- a/src/main/java/org/openslx/util/vm/VboxMetaData.java +++ b/src/main/java/org/openslx/util/vm/VboxMetaData.java @@ -7,6 +7,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; +import java.util.Map.Entry; import java.util.UUID; import org.apache.log4j.Logger; @@ -14,6 +15,7 @@ import org.openslx.bwlp.thrift.iface.OperatingSystem; import org.openslx.bwlp.thrift.iface.Virtualizer; import org.openslx.thrifthelper.TConst; import org.openslx.util.vm.VboxConfig.PlaceHolder; +import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -62,7 +64,18 @@ class VBoxEthernetDevTypeMeta } } -public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, VBoxHWVersionMeta, VBoxEthernetDevTypeMeta> +class VBoxUsbSpeedMeta +{ + public final String value; + public final int speed; + public VBoxUsbSpeedMeta( String value, int speed ) + { + this.value = value; + this.speed = speed; + } +} + +public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, VBoxHWVersionMeta, VBoxEthernetDevTypeMeta, VBoxUsbSpeedMeta> { private static final Logger LOGGER = Logger.getLogger( VboxMetaData.class ); @@ -114,16 +127,6 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, } @Override - public void enableUsb( boolean enabled ) - { - if ( !enabled ) { - config.disableUsb(); - } else { - config.enableUsb(); - } - } - - @Override public void applySettingsForLocalEdit() { // TODO Auto-generated method stub @@ -415,6 +418,7 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, public void registerVirtualHW() { // none type needs to have a valid value; it takes the value of AC97; if value is left null or empty vm will not start because value is not valid + // TODO: Maybe just remove the entire section from the XML? Same for ethernet... soundCards.put( VmMetaData.SoundCardType.NONE, new VBoxSoundCardMeta( false, "AC97" ) ); soundCards.put( VmMetaData.SoundCardType.SOUND_BLASTER, new VBoxSoundCardMeta( true, "SB16" ) ); soundCards.put( VmMetaData.SoundCardType.HD_AUDIO, new VBoxSoundCardMeta( true, "HDA" ) ); @@ -433,6 +437,11 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, networkCards.put( VmMetaData.EthernetDevType.PRO1000TS, new VBoxEthernetDevTypeMeta( true, "82543GC" ) ); networkCards.put( VmMetaData.EthernetDevType.PRO1000MTS, new VBoxEthernetDevTypeMeta( true, "82545EM" ) ); networkCards.put( VmMetaData.EthernetDevType.PARAVIRT, new VBoxEthernetDevTypeMeta( true, "virtio" ) ); + + usbSpeeds.put( VmMetaData.UsbSpeed.NONE, new VBoxUsbSpeedMeta( null, 0 ) ); + usbSpeeds.put( VmMetaData.UsbSpeed.USB1_1, new VBoxUsbSpeedMeta( "OHCI", 1 ) ); + usbSpeeds.put( VmMetaData.UsbSpeed.USB2_0, new VBoxUsbSpeedMeta( "EHCI", 2 ) ); + usbSpeeds.put( VmMetaData.UsbSpeed.USB3_0, new VBoxUsbSpeedMeta( "XHCI", 3 ) ); } @Override @@ -455,4 +464,50 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, // https://forums.virtualbox.org/viewtopic.php?f=8&t=80338 return true; } + + @Override + public void setMaxUsbSpeed( VmMetaData.UsbSpeed speed ) + { + // Wipe existing ones + config.removeNodes( "/VirtualBox/Machine/Hardware", "USB" ); + if ( speed == null || speed == VmMetaData.UsbSpeed.NONE ) { + // Add marker so we know it's not an old config and we really want no USB + Element node = config.createNodeRecursive( "/VirtualBox/OpenSLX/USB" ); + if ( node != null ) { + node.setAttribute( "disabled", "true" ); + } + return; // NO USB + } + Element node = config.createNodeRecursive( "/VirtualBox/Machine/Hardware/USB/Controllers/Controller" ); + VBoxUsbSpeedMeta vboxSpeed = usbSpeeds.get( speed ); + node.setAttribute( "type", vboxSpeed.value ); + node.setAttribute( "name", vboxSpeed.value ); + if ( speed == UsbSpeed.USB2_0 ) { + // If EHCI (2.0) is selected, VBox adds an OHCI controller too... + node.setAttribute( "type", "OHCI" ); + node.setAttribute( "name", "OHCI" ); + } + } + + @Override + public VmMetaData.UsbSpeed getMaxUsbSpeed() + { + NodeList nodes = config.findNodes( "/VirtualBox/Machine/Hardware/USB/Controllers/Controller/@type" ); + int maxSpeed = 0; + VmMetaData.UsbSpeed maxItem = VmMetaData.UsbSpeed.NONE; + for ( int i = 0; i < nodes.getLength(); ++i ) { + if ( nodes.item( i ).getNodeType() != Node.ATTRIBUTE_NODE ) { + LOGGER.info( "Not ATTRIBUTE type" ); + continue; + } + String type = ((Attr)nodes.item( i )).getValue(); + for ( Entry<VmMetaData.UsbSpeed, VBoxUsbSpeedMeta> s : usbSpeeds.entrySet() ) { + if ( s.getValue().speed > maxSpeed && type.equals( s.getValue().value ) ) { + maxSpeed = s.getValue().speed; + maxItem = s.getKey(); + } + } + } + return maxItem; + } } diff --git a/src/main/java/org/openslx/util/vm/VmMetaData.java b/src/main/java/org/openslx/util/vm/VmMetaData.java index c750ecc..9cff9f5 100644 --- a/src/main/java/org/openslx/util/vm/VmMetaData.java +++ b/src/main/java/org/openslx/util/vm/VmMetaData.java @@ -18,7 +18,7 @@ import org.openslx.bwlp.thrift.iface.Virtualizer; * Describes a configured virtual machine. This class is parsed from a machine * description, like a *.vmx for VMware machines. */ -public abstract class VmMetaData<T, U, V, W> +public abstract class VmMetaData<T, U, V, W, X> { private static final Logger LOGGER = Logger.getLogger( VmMetaData.class ); @@ -29,6 +29,7 @@ public abstract class VmMetaData<T, U, V, W> protected Map<DDAcceleration, U> ddacc = new HashMap<>(); protected Map<HWVersion, V> hwversion = new HashMap<>(); protected Map<EthernetDevType, W> networkCards = new HashMap<>(); + protected Map<UsbSpeed, X> usbSpeeds = new HashMap<>(); /** * Virtual sound cards types @@ -103,6 +104,21 @@ public abstract class VmMetaData<T, U, V, W> this.displayName = dName; } } + + public static enum UsbSpeed + { + NONE( "None" ), + USB1_1( "USB 1.1" ), + USB2_0( "USB 2.0" ), + USB3_0( "USB 3.0" ); + + public final String displayName; + + private UsbSpeed( String dName ) + { + this.displayName = dName; + } + } public static enum DriveBusType { @@ -172,6 +188,13 @@ public abstract class VmMetaData<T, U, V, W> return availables; } + public List<UsbSpeed> getSupportedUsbSpeeds() + { + ArrayList<UsbSpeed> availables = new ArrayList<>( usbSpeeds.keySet() ); + Collections.sort( availables ); + return availables; + } + /** * Get operating system of this VM. */ @@ -270,7 +293,7 @@ public abstract class VmMetaData<T, U, V, W> * @param file VM's machine description file to get the metadata instance from * @return VmMetaData object representing the relevant parts of the given machine description */ - public static VmMetaData<?, ?, ?, ?> getInstance( List<OperatingSystem> osList, File file ) + public static VmMetaData<?, ?, ?, ?, ?> getInstance( List<OperatingSystem> osList, File file ) throws IOException { try { @@ -301,20 +324,24 @@ public abstract class VmMetaData<T, U, V, W> * @return VmMetaData object representing the relevant parts of the given machine description * @throws IOException */ - public static VmMetaData<?, ?, ?, ?> getInstance( List<OperatingSystem> osList, byte[] vmContent, int length ) throws IOException + public static VmMetaData<?, ?, ?, ?, ?> getInstance( List<OperatingSystem> osList, byte[] vmContent, int length ) throws IOException { + Map<String, Exception> exceptions = new HashMap<>(); try { return new VmwareMetaData( osList, vmContent, length ); } catch ( UnsupportedVirtualizerFormatException e ) { - LOGGER.info( "Not a VMware file", e ); + exceptions.put( "Not a VMware file", e ); } try { return new VboxMetaData( osList, vmContent, length ); } catch ( UnsupportedVirtualizerFormatException e ) { - LOGGER.info( "Not a VirtualBox file", e ); + exceptions.put( "Not a VirtualBox file", e ); } // TODO QEmu -- hack above expects qcow2 file, so we can't do anything here yet LOGGER.error( "Could not detect any known virtualizer format" ); + for ( Entry<String, Exception> e : exceptions.entrySet() ) { + LOGGER.error( e.getKey(), e.getValue() ); + } return null; } @@ -352,14 +379,16 @@ public abstract class VmMetaData<T, U, V, W> public abstract EthernetDevType getEthernetDevType( int cardIndex ); + public abstract void setMaxUsbSpeed( UsbSpeed speed ); + + public abstract UsbSpeed getMaxUsbSpeed(); + public abstract byte[] getDefinitionArray(); public abstract boolean addEthernet( EtherType type ); public abstract Virtualizer getVirtualizer(); - public abstract void enableUsb( boolean enabled ); - public abstract boolean disableSuspend(); /** diff --git a/src/main/java/org/openslx/util/vm/VmwareMetaData.java b/src/main/java/org/openslx/util/vm/VmwareMetaData.java index 4e154c3..1e87d72 100644 --- a/src/main/java/org/openslx/util/vm/VmwareMetaData.java +++ b/src/main/java/org/openslx/util/vm/VmwareMetaData.java @@ -59,7 +59,19 @@ class VmWareEthernetDevTypeMeta } } -public class VmwareMetaData extends VmMetaData<VmWareSoundCardMeta, VmWareDDAccelMeta, VmWareHWVersionMeta, VmWareEthernetDevTypeMeta> +class VmwareUsbSpeed +{ + public final String keyName; + public final int speedNumeric; + + public VmwareUsbSpeed( int speed, String key ) + { + this.keyName = key + ".present"; + this.speedNumeric = speed; + } +} + +public class VmwareMetaData extends VmMetaData<VmWareSoundCardMeta, VmWareDDAccelMeta, VmWareHWVersionMeta, VmWareEthernetDevTypeMeta, VmwareUsbSpeed> { private static final Logger LOGGER = Logger.getLogger( VmwareMetaData.class ); @@ -157,6 +169,11 @@ public class VmwareMetaData extends VmMetaData<VmWareSoundCardMeta, VmWareDDAcce addFiltered( "#SLX_HDD_CHIP", hdd.chipsetDriver ); } } + + // Fix accidentally filtered USB config if we see EHCI is present + if ( isSetAndTrue( "ehci.present" ) && !isSetAndTrue( "usb.present" ) ) { + addFiltered( "usb.present", "TRUE" ); + } } private void addFiltered( String key, String value ) @@ -449,13 +466,6 @@ public class VmwareMetaData extends VmMetaData<VmWareSoundCardMeta, VmWareDDAcce } @Override - public void enableUsb( boolean enabled ) - { - addFiltered( "usb.present", vmBoolean( enabled ) ); - addFiltered( "ehci.present", vmBoolean( enabled ) ); - } - - @Override public void applySettingsForLocalEdit() { addFiltered( "gui.applyHostDisplayScalingToGuest", "FALSE" ); @@ -544,12 +554,12 @@ public class VmwareMetaData extends VmMetaData<VmWareSoundCardMeta, VmWareDDAcce } } - public EthernetDevType getEthernetDevType( int cardIndex ) + public VmMetaData.EthernetDevType getEthernetDevType( int cardIndex ) { String temp = config.get( "ethernet" + cardIndex + ".virtualDev" ); if ( temp != null ) { VmWareEthernetDevTypeMeta ethernetDevTypeMeta = null; - for ( EthernetDevType type : VmMetaData.EthernetDevType.values() ) { + for ( VmMetaData.EthernetDevType type : VmMetaData.EthernetDevType.values() ) { ethernetDevTypeMeta = networkCards.get( type ); if ( ethernetDevTypeMeta == null ) { continue; @@ -559,7 +569,47 @@ public class VmwareMetaData extends VmMetaData<VmWareSoundCardMeta, VmWareDDAcce } } } - return EthernetDevType.AUTO; + return VmMetaData.EthernetDevType.AUTO; + } + + @Override + public void setMaxUsbSpeed( VmMetaData.UsbSpeed newSpeed ) + { + if ( newSpeed == null ) { + newSpeed = VmMetaData.UsbSpeed.NONE; + } + VmwareUsbSpeed newSpeedMeta = usbSpeeds.get( newSpeed ); + if ( newSpeedMeta == null ) { + throw new RuntimeException( "USB Speed " + newSpeed.name() + " not registered with VMware" ); + } + for ( VmwareUsbSpeed meta : usbSpeeds.values() ) { + if ( meta == null ) + continue; // Should not happen + if ( meta.keyName == null ) + continue; // "No USB" has no config entry, obviously + if ( meta.speedNumeric <= newSpeedMeta.speedNumeric ) { + // Enable desired speed class, plus all lower ones + addFiltered( meta.keyName, "TRUE" ); + } else { + // This one is higher – remove + config.remove( meta.keyName ); + } + } + } + + @Override + public VmMetaData.UsbSpeed getMaxUsbSpeed() + { + int max = 0; + VmMetaData.UsbSpeed maxEnum = VmMetaData.UsbSpeed.NONE; + for ( Entry<VmMetaData.UsbSpeed, VmwareUsbSpeed> entry : usbSpeeds.entrySet() ) { + VmwareUsbSpeed v = entry.getValue(); + if ( v.speedNumeric > max && isSetAndTrue( v.keyName ) ) { + max = v.speedNumeric; + maxEnum = entry.getKey(); + } + } + return maxEnum; } @Override @@ -599,5 +649,11 @@ public class VmwareMetaData extends VmMetaData<VmWareSoundCardMeta, VmWareDDAcce networkCards.put( VmMetaData.EthernetDevType.E1000E, new VmWareEthernetDevTypeMeta( "e1000e" ) ); networkCards.put( VmMetaData.EthernetDevType.VMXNET, new VmWareEthernetDevTypeMeta( "vmxnet" ) ); networkCards.put( VmMetaData.EthernetDevType.VMXNET3, new VmWareEthernetDevTypeMeta( "vmxnet3" ) ); + + usbSpeeds.put( VmMetaData.UsbSpeed.NONE, new VmwareUsbSpeed( 0, null )); + usbSpeeds.put( VmMetaData.UsbSpeed.USB1_1, new VmwareUsbSpeed( 1, "usb" ) ); + usbSpeeds.put( VmMetaData.UsbSpeed.USB2_0, new VmwareUsbSpeed( 2, "ehci" ) ); + usbSpeeds.put( VmMetaData.UsbSpeed.USB3_0, new VmwareUsbSpeed( 3, "usb_xhci" ) ); } + } |