summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java')
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java557
1 files changed, 223 insertions, 334 deletions
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java
index b4bc0ba..19ad406 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemu.java
@@ -5,7 +5,6 @@ import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map.Entry;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.libvirt.domain.Domain;
@@ -13,8 +12,6 @@ import org.openslx.libvirt.domain.DomainUtils;
import org.openslx.libvirt.domain.device.ControllerUsb;
import org.openslx.libvirt.domain.device.Disk.BusType;
import org.openslx.libvirt.domain.device.Disk.StorageType;
-import org.openslx.libvirt.libosinfo.LibOsInfo;
-import org.openslx.libvirt.libosinfo.os.Os;
import org.openslx.libvirt.domain.device.DiskCdrom;
import org.openslx.libvirt.domain.device.DiskFloppy;
import org.openslx.libvirt.domain.device.DiskStorage;
@@ -23,174 +20,28 @@ import org.openslx.libvirt.domain.device.GraphicsSpice;
import org.openslx.libvirt.domain.device.Interface;
import org.openslx.libvirt.domain.device.Sound;
import org.openslx.libvirt.domain.device.Video;
+import org.openslx.libvirt.libosinfo.LibOsInfo;
+import org.openslx.libvirt.libosinfo.os.Os;
import org.openslx.libvirt.xml.LibvirtXmlDocumentException;
import org.openslx.libvirt.xml.LibvirtXmlSerializationException;
import org.openslx.libvirt.xml.LibvirtXmlValidationException;
import org.openslx.util.LevenshteinDistance;
+import org.openslx.util.Util;
import org.openslx.virtualization.Version;
+import org.openslx.virtualization.hardware.AbstractConfigurableOption;
+import org.openslx.virtualization.hardware.ConfigurationGroups;
+import org.openslx.virtualization.hardware.Ethernet;
+import org.openslx.virtualization.hardware.SoundCard;
+import org.openslx.virtualization.hardware.Usb;
import org.openslx.virtualization.virtualizer.VirtualizerQemu;
/**
- * Metadata to describe the hardware type of a QEMU sound card.
- *
- * @author Manuel Bentele
- * @version 1.0
- */
-class QemuSoundCardMeta
-{
- /**
- * Stores the hardware model of the QEMU sound card.
- */
- private final Sound.Model model;
-
- /**
- * Creates metadata to describe the hardware model of a QEMU sound card.
- *
- * @param model hardware model of the QEMU sound card.
- */
- public QemuSoundCardMeta( Sound.Model model )
- {
- this.model = model;
- }
-
- /**
- * Returns hardware model of the QEMU sound card.
- *
- * @return hardware model of the QEMU sound card.
- */
- public Sound.Model getModel()
- {
- return this.model;
- }
-}
-
-/**
- * Metadata to describe the hardware acceleration state of QEMU virtual graphics.
- *
- * @author Manuel Bentele
- * @version 1.0
- */
-class QemuDDAccelMeta
-{
- /**
- * Stores state of the hardware acceleration for QEMU virtual graphics.
- */
- private final boolean enabled;
-
- /**
- * Creates metadata to describe the hardware acceleration state of QEMU virtual graphics.
- *
- * @param enabled state of the hardware acceleration for QEMU virtual graphics.
- */
- public QemuDDAccelMeta( boolean enabled )
- {
- this.enabled = enabled;
- }
-
- /**
- * Returns state of the hardware acceleration of QEMU virtual graphics.
- *
- * @return state of the hardware acceleration for QEMU virtual graphics.
- */
- public boolean isEnabled()
- {
- return this.enabled;
- }
-}
-
-/**
- * Metadata to describe the hardware type of a QEMU ethernet device.
- *
- * @author Manuel Bentele
- * @version 1.0
- */
-class QemuEthernetDevTypeMeta
-{
- /**
- * Stores the hardware model of the QEMU ethernet device.
- */
- private final Interface.Model model;
-
- /**
- * Creates metadata to describe the hardware type of a QEMU ethernet device.
- *
- * @param model hardware type of the QEMU ethernet device.
- */
- public QemuEthernetDevTypeMeta( Interface.Model model )
- {
- this.model = model;
- }
-
- /**
- * Returns the hardware type of a QEMU ethernet device.
- *
- * @return hardware type of the QEMU ethernet device.
- */
- public Interface.Model getModel()
- {
- return this.model;
- }
-}
-
-/**
- * Metadata to describe a QEMU USB controller.
- *
- * @author Manuel Bentele
- * @version 1.0
- */
-class QemuUsbSpeedMeta
-{
- /**
- * Stores the USB speed of the QEMU USB controller.
- */
- private final int speed;
-
- /**
- * Stores the QEMU hardware model of the USB controller.
- */
- private final ControllerUsb.Model model;
-
- /**
- * Creates metadata to describe a QEMU USB controller.
- *
- * @param speed USB speed of the QEMU USB controller.
- * @param model QEMU hardware model of the USB controller.
- */
- public QemuUsbSpeedMeta( int speed, ControllerUsb.Model model )
- {
- this.speed = speed;
- this.model = model;
- }
-
- /**
- * Returns the speed of the QEMU USB controller.
- *
- * @return speed of the QEMU USB controller.
- */
- public int getSpeed()
- {
- return this.speed;
- }
-
- /**
- * Returns QEMU hardware model of the USB controller.
- *
- * @return hardware model of the QEMU USB controller.
- */
- public ControllerUsb.Model getModel()
- {
- return this.model;
- }
-}
-
-/**
* Virtual machine configuration (managed by Libvirt) for the QEMU hypervisor.
*
* @author Manuel Bentele
* @version 1.0
*/
-public class VirtualizationConfigurationQemu extends
- VirtualizationConfiguration<QemuSoundCardMeta, QemuDDAccelMeta, QemuEthernetDevTypeMeta, QemuUsbSpeedMeta>
+public class VirtualizationConfigurationQemu extends VirtualizationConfiguration
{
/**
* Name of the network bridge for the LAN.
@@ -558,129 +409,98 @@ public class VirtualizationConfigurationQemu extends
return isVCpuSet;
}
-
- @Override
- public void setSoundCard( SoundCardType type )
+
+ class QemuGfxType extends AbstractConfigurableOption
{
- QemuSoundCardMeta soundDeviceConfig = this.soundCards.get( type );
- ArrayList<Sound> soundDevices = this.vmConfig.getSoundDevices();
- Sound.Model soundDeviceModel = soundDeviceConfig.getModel();
- if ( soundDevices.isEmpty() ) {
- // create new sound device with 'soundDeviceModel' hardware
- Sound soundDevice = this.vmConfig.addSoundDevice();
- soundDevice.setModel( soundDeviceModel );
- } else {
- // update sound device model type of existing sound devices
- for ( Sound soundDevice : soundDevices ) {
- soundDevice.setModel( soundDeviceModel );
- }
+ public QemuGfxType( String id, String displayName )
+ {
+ super( id, displayName );
}
- }
-
- @Override
- public SoundCardType getSoundCard()
- {
- ArrayList<Sound> soundDevices = this.vmConfig.getSoundDevices();
- SoundCardType soundDeviceType = SoundCardType.DEFAULT;
-
- if ( soundDevices.isEmpty() ) {
- // the VM configuration does not contain a sound card device
- soundDeviceType = SoundCardType.NONE;
- } else {
- // the VM configuration at least one sound card device, so return the type of the first one
- Sound.Model soundDeviceModel = soundDevices.get( 0 ).getModel();
- soundDeviceType = VirtualizationConfigurationQemuUtils.convertSoundDeviceModel( soundDeviceModel );
- }
-
- return soundDeviceType;
- }
- @Override
- public void setDDAcceleration( DDAcceleration type )
- {
- QemuDDAccelMeta accelerationConfig = this.ddacc.get( type );
- ArrayList<Graphics> graphicDevices = this.vmConfig.getGraphicDevices();
- ArrayList<Video> videoDevices = this.vmConfig.getVideoDevices();
- final boolean accelerationEnabled = accelerationConfig.isEnabled();
+ @Override
+ public void apply()
+ {
+ ArrayList<Graphics> graphicDevices = vmConfig.getGraphicDevices();
+ ArrayList<Video> videoDevices = vmConfig.getVideoDevices();
+ final boolean accelerationEnabled = this.id.equals( "true" );
- boolean acceleratedGraphicsAvailable = false;
+ boolean acceleratedGraphicsAvailable = false;
- if ( graphicDevices.isEmpty() ) {
- // add new graphics device with enabled acceleration to VM configuration
- GraphicsSpice graphicSpiceDevice = this.vmConfig.addGraphicsSpiceDevice();
- graphicSpiceDevice.setOpenGl( true );
- acceleratedGraphicsAvailable = true;
- } else {
- // enable graphic acceleration of existing graphics devices
- for ( Graphics graphicDevice : graphicDevices ) {
- // set hardware acceleration for SPICE based graphics output
- // other graphic devices do not support hardware acceleration
- if ( graphicDevice instanceof GraphicsSpice ) {
- GraphicsSpice.class.cast( graphicDevice ).setOpenGl( true );
- acceleratedGraphicsAvailable = true;
+ if ( graphicDevices.isEmpty() ) {
+ // add new graphics device with enabled acceleration to VM configuration
+ GraphicsSpice graphicSpiceDevice = vmConfig.addGraphicsSpiceDevice();
+ graphicSpiceDevice.setOpenGl( true );
+ acceleratedGraphicsAvailable = true;
+ } else {
+ // enable graphic acceleration of existing graphics devices
+ for ( Graphics graphicDevice : graphicDevices ) {
+ // set hardware acceleration for SPICE based graphics output
+ // other graphic devices do not support hardware acceleration
+ if ( graphicDevice instanceof GraphicsSpice ) {
+ GraphicsSpice.class.cast( graphicDevice ).setOpenGl( true );
+ acceleratedGraphicsAvailable = true;
+ }
}
}
- }
- // only configure hardware acceleration of video card(s) if graphics with hardware acceleration is available
- if ( acceleratedGraphicsAvailable ) {
- if ( videoDevices.isEmpty() ) {
- // add new video device with enabled acceleration to VM configuration
- Video videoDevice = this.vmConfig.addVideoDevice();
- videoDevice.setModel( Video.Model.VIRTIO );
- videoDevice.set2DAcceleration( true );
- videoDevice.set3DAcceleration( true );
- } else {
- // enable graphic acceleration of existing graphics and video devices
- for ( Video videoDevice : videoDevices ) {
- // set hardware acceleration for Virtio GPUs
- // other GPUs do not support hardware acceleration
- if ( videoDevice.getModel() == Video.Model.VIRTIO ) {
- videoDevice.set2DAcceleration( accelerationEnabled );
- videoDevice.set3DAcceleration( accelerationEnabled );
+ // only configure hardware acceleration of video card(s) if graphics with hardware acceleration is available
+ if ( acceleratedGraphicsAvailable ) {
+ if ( videoDevices.isEmpty() ) {
+ // add new video device with enabled acceleration to VM configuration
+ Video videoDevice = vmConfig.addVideoDevice();
+ videoDevice.setModel( Video.Model.VIRTIO );
+ videoDevice.set2DAcceleration( true );
+ videoDevice.set3DAcceleration( true );
+ } else {
+ // enable graphic acceleration of existing graphics and video devices
+ for ( Video videoDevice : videoDevices ) {
+ // set hardware acceleration for Virtio GPUs
+ // other GPUs do not support hardware acceleration
+ if ( videoDevice.getModel() == Video.Model.VIRTIO ) {
+ videoDevice.set2DAcceleration( accelerationEnabled );
+ videoDevice.set3DAcceleration( accelerationEnabled );
+ }
}
}
}
}
- }
- @Override
- public DDAcceleration getDDAcceleration()
- {
- ArrayList<Graphics> graphicsDevices = this.vmConfig.getGraphicDevices();
- ArrayList<Video> videoDevices = this.vmConfig.getVideoDevices();
- DDAcceleration accelerationState = DDAcceleration.OFF;
+ @Override
+ public boolean isActive()
+ {
+ ArrayList<Graphics> graphicsDevices = vmConfig.getGraphicDevices();
+ ArrayList<Video> videoDevices = vmConfig.getVideoDevices();
- boolean acceleratedGraphicsAvailable = false;
- boolean acceleratedVideoDevAvailable = false;
+ boolean acceleratedGraphicsAvailable = false;
+ boolean acceleratedVideoDevAvailable = false;
- // search for hardware accelerated graphics
- for ( Graphics graphicDevice : graphicsDevices ) {
- // only SPICE based graphic devices support hardware acceleration
- if ( graphicDevice instanceof GraphicsSpice ) {
- acceleratedGraphicsAvailable = true;
- break;
+ // search for hardware accelerated graphics
+ for ( Graphics graphicDevice : graphicsDevices ) {
+ // only SPICE based graphic devices support hardware acceleration
+ if ( graphicDevice instanceof GraphicsSpice ) {
+ acceleratedGraphicsAvailable = true;
+ break;
+ }
}
- }
- // search for hardware accelerated video devices
- for ( Video videoDevice : videoDevices ) {
- // only Virtio based video devices support hardware acceleration
- if ( videoDevice.getModel() == Video.Model.VIRTIO ) {
- acceleratedVideoDevAvailable = true;
- break;
+ // search for hardware accelerated video devices
+ for ( Video videoDevice : videoDevices ) {
+ // only Virtio based video devices support hardware acceleration
+ if ( videoDevice.getModel() == Video.Model.VIRTIO ) {
+ acceleratedVideoDevAvailable = true;
+ break;
+ }
}
- }
- // hardware acceleration is available if at least one accelerated graphics and video device is available
- if ( acceleratedGraphicsAvailable && acceleratedVideoDevAvailable ) {
- accelerationState = DDAcceleration.ON;
- } else {
- accelerationState = DDAcceleration.OFF;
+ // hardware acceleration is available if at least one accelerated graphics and video device is available
+ if ( acceleratedGraphicsAvailable && acceleratedVideoDevAvailable ) {
+ return this.id.equals( "true" );
+ } else {
+ return this.id.equals( "false" );
+ }
}
-
- return accelerationState;
+
}
@Override
@@ -716,77 +536,136 @@ public class VirtualizationConfigurationQemu extends
return checkedVersion;
}
- @Override
- public void setEthernetDevType( int cardIndex, EthernetDevType type )
+ class QemuNicModel extends AbstractConfigurableOption
{
- QemuEthernetDevTypeMeta networkDeviceConfig = this.networkCards.get( type );
- ArrayList<Interface> networkDevices = this.vmConfig.getInterfaceDevices();
- Interface networkDevice = VirtualizationConfigurationQemuUtils.getArrayIndex( networkDevices, cardIndex );
- Interface.Model networkDeviceModel = networkDeviceConfig.getModel();
+
+ private final int cardIndex;
- if ( networkDevice != null ) {
- networkDevice.setModel( networkDeviceModel );
+ public QemuNicModel( int cardIndex, Interface.Model model, String displayName )
+ {
+ super( model.toString(), displayName ); // XXX: toString/fromString would disappear if
+ this.cardIndex = cardIndex; // this were AbstractConfigurableOption<T extends Enum<T>>
}
- }
- @Override
- public EthernetDevType getEthernetDevType( int cardIndex )
- {
- ArrayList<Interface> networkDevices = this.vmConfig.getInterfaceDevices();
- Interface networkDevice = VirtualizationConfigurationQemuUtils.getArrayIndex( networkDevices, cardIndex );
- EthernetDevType networkDeviceType = EthernetDevType.NONE;
+ @Override
+ public void apply()
+ {
+ ArrayList<Interface> networkDevices = vmConfig.getInterfaceDevices();
+ Interface networkDevice = VirtualizationConfigurationQemuUtils.getArrayIndex( networkDevices, cardIndex );
- if ( networkDevice == null ) {
- // network interface device is not present
- networkDeviceType = EthernetDevType.NONE;
- } else {
+ if ( networkDevice != null ) {
+ networkDevice.setModel( Interface.Model.fromString( id ) );
+ }
+ }
+
+ @Override
+ public boolean isActive()
+ {
+ ArrayList<Interface> networkDevices = vmConfig.getInterfaceDevices();
+ Interface networkDevice = VirtualizationConfigurationQemuUtils.getArrayIndex( networkDevices, cardIndex );
+
+ if ( networkDevice == null ) {
+ // network interface device is not present
+ return Util.isEmptyString( this.id ); // XXX: would be more explicit with enum.NONE
+ }
// get model of existing network interface device
Interface.Model networkDeviceModel = networkDevice.getModel();
- networkDeviceType = VirtualizationConfigurationQemuUtils.convertNetworkDeviceModel( networkDeviceModel );
+ if ( networkDeviceModel == null ) {
+ return Util.isEmptyString( this.id ); // see above
+ }
+ // Success
+ return networkDeviceModel.toString().equals( this.id ); // XXX: enum would allow simple ==
}
-
- return networkDeviceType;
}
-
- @Override
- public void setMaxUsbSpeed( UsbSpeed speed )
+
+ class QemuSoundCardModel extends AbstractConfigurableOption
{
- QemuUsbSpeedMeta usbControllerConfig = this.usbSpeeds.get( speed );
- ArrayList<ControllerUsb> usbControllerDevices = this.vmConfig.getUsbControllerDevices();
- ControllerUsb.Model usbControllerModel = usbControllerConfig.getModel();
- if ( usbControllerDevices.isEmpty() ) {
- // add new USB controller with specified speed 'usbControllerModel'
- ControllerUsb usbControllerDevice = this.vmConfig.addControllerUsbDevice();
- usbControllerDevice.setModel( usbControllerModel );
- } else {
- // update model of all USB controller devices to support the maximum speed
- for ( ControllerUsb usbControllerDevice : usbControllerDevices ) {
- usbControllerDevice.setModel( usbControllerModel );
+ public QemuSoundCardModel( Sound.Model id, String displayName )
+ {
+ super( id.toString(), displayName );
+ }
+
+ @Override
+ public void apply()
+ {
+ ArrayList<Sound> soundDevices = vmConfig.getSoundDevices();
+ Sound.Model soundDeviceModel = Sound.Model.fromString( this.id );
+
+ if ( soundDevices.isEmpty() ) {
+ // create new sound device with 'soundDeviceModel' hardware
+ Sound soundDevice = vmConfig.addSoundDevice();
+ soundDevice.setModel( soundDeviceModel );
+ } else {
+ // update sound device model type of existing sound devices
+ for ( Sound soundDevice : soundDevices ) {
+ soundDevice.setModel( soundDeviceModel );
+ }
}
}
- }
- @Override
- public UsbSpeed getMaxUsbSpeed()
+ @Override
+ public boolean isActive()
+ {
+ ArrayList<Sound> soundDevices = vmConfig.getSoundDevices();
+
+ if ( soundDevices.isEmpty() ) {
+ // the VM configuration does not contain a sound card device
+ return Util.isEmptyString( this.id );
+ }
+ // the VM configuration at least one sound card device, so return the type of the first one
+ Sound.Model soundDeviceModel = soundDevices.get( 0 ).getModel();
+ return soundDeviceModel != null && soundDeviceModel.toString().equals( this.id );
+ }
+
+ }
+
+ class QemuUsbSpeed extends AbstractConfigurableOption
{
- ArrayList<ControllerUsb> usbControllerDevices = this.vmConfig.getUsbControllerDevices();
- UsbSpeed maxUsbSpeed = VirtualizationConfiguration.UsbSpeed.NONE;
- int maxUsbSpeedNumeric = 0;
- for ( ControllerUsb usbControllerDevice : usbControllerDevices ) {
- ControllerUsb.Model usbControllerModel = usbControllerDevice.getModel();
+ public QemuUsbSpeed( ControllerUsb.Model id, String displayName )
+ {
+ super( id.toString(), displayName );
+ }
+
+ @Override
+ public void apply()
+ {
+ ArrayList<ControllerUsb> usbControllerDevices = vmConfig.getUsbControllerDevices();
+ ControllerUsb.Model usbControllerModel = ControllerUsb.Model.fromString( this.id );
- for ( Entry<UsbSpeed, QemuUsbSpeedMeta> usbSpeedEntry : this.usbSpeeds.entrySet() ) {
- QemuUsbSpeedMeta usbSpeed = usbSpeedEntry.getValue();
- if ( usbSpeed.getSpeed() > maxUsbSpeedNumeric && usbSpeed.getModel() == usbControllerModel ) {
- maxUsbSpeed = usbSpeedEntry.getKey();
- maxUsbSpeedNumeric = usbSpeed.getSpeed();
+ if ( usbControllerDevices.isEmpty() ) {
+ // add new USB controller with specified speed 'usbControllerModel'
+ ControllerUsb usbControllerDevice = vmConfig.addControllerUsbDevice();
+ usbControllerDevice.setModel( usbControllerModel );
+ } else {
+ // update model of all USB controller devices to support the maximum speed
+ for ( ControllerUsb usbControllerDevice : usbControllerDevices ) {
+ usbControllerDevice.setModel( usbControllerModel );
}
}
}
- return maxUsbSpeed;
+ @Override
+ public boolean isActive()
+ {
+ ArrayList<ControllerUsb> usbControllerDevices = vmConfig.getUsbControllerDevices();
+ String maxUsbSpeed = null;
+ int maxUsbSpeedNumeric = 0;
+
+ for ( ControllerUsb usbControllerDevice : usbControllerDevices ) {
+ ControllerUsb.Model usbControllerModel = usbControllerDevice.getModel();
+
+ // TODO Need something to map from chip to usb speed. But this is conceptually broken anyways since
+ // it's modeled after vmware, where you only cannot configure different controllers at the same time
+ // anyways XXX
+ if ( usbControllerModel.toString().equals( this.id ) )
+ return true;
+ }
+
+ return false;
+ }
+
}
@Override
@@ -821,11 +700,10 @@ public class VirtualizationConfigurationQemu extends
*/
public boolean addEthernet( int index, EtherType type )
{
- QemuEthernetDevTypeMeta defaultNetworkDeviceConfig = this.networkCards.get( EthernetDevType.AUTO );
ArrayList<Interface> interfaceDevices = this.vmConfig.getInterfaceDevices();
Interface interfaceDevice = VirtualizationConfigurationQemuUtils.getArrayIndex( interfaceDevices, index );
- final Interface.Model defaultNetworkDeviceModel = defaultNetworkDeviceConfig.getModel();
+ final Interface.Model defaultNetworkDeviceModel = Interface.Model.VIRTIO_NET_PCI;
if ( interfaceDevice == null ) {
// network interface device does not exist, so create new network interface device
@@ -886,29 +764,40 @@ public class VirtualizationConfigurationQemu extends
@Override
public void registerVirtualHW()
{
+ // XXX Add missing qemu-only types/models
+ List<AbstractConfigurableOption> list;
// @formatter:off
- soundCards.put( VirtualizationConfiguration.SoundCardType.NONE, new QemuSoundCardMeta( null ) );
- soundCards.put( VirtualizationConfiguration.SoundCardType.DEFAULT, new QemuSoundCardMeta( Sound.Model.ICH9 ) );
- soundCards.put( VirtualizationConfiguration.SoundCardType.SOUND_BLASTER, new QemuSoundCardMeta( Sound.Model.SB16 ) );
- soundCards.put( VirtualizationConfiguration.SoundCardType.ES, new QemuSoundCardMeta( Sound.Model.ES1370 ) );
- soundCards.put( VirtualizationConfiguration.SoundCardType.AC, new QemuSoundCardMeta( Sound.Model.AC97 ) );
- soundCards.put( VirtualizationConfiguration.SoundCardType.HD_AUDIO, new QemuSoundCardMeta( Sound.Model.ICH9 ) );
-
- ddacc.put( VirtualizationConfiguration.DDAcceleration.OFF, new QemuDDAccelMeta( false ) );
- ddacc.put( VirtualizationConfiguration.DDAcceleration.ON, new QemuDDAccelMeta( true ) );
-
- networkCards.put( VirtualizationConfiguration.EthernetDevType.NONE, new QemuEthernetDevTypeMeta( null ) );
- networkCards.put( VirtualizationConfiguration.EthernetDevType.AUTO, new QemuEthernetDevTypeMeta( Interface.Model.VIRTIO_NET_PCI ) );
- networkCards.put( VirtualizationConfiguration.EthernetDevType.PCNETPCI2, new QemuEthernetDevTypeMeta( Interface.Model.PCNET ) );
- networkCards.put( VirtualizationConfiguration.EthernetDevType.E1000, new QemuEthernetDevTypeMeta( Interface.Model.E1000 ) );
- networkCards.put( VirtualizationConfiguration.EthernetDevType.E1000E, new QemuEthernetDevTypeMeta( Interface.Model.E1000E ) );
- networkCards.put( VirtualizationConfiguration.EthernetDevType.VMXNET3, new QemuEthernetDevTypeMeta( Interface.Model.VMXNET3 ) );
- networkCards.put( VirtualizationConfiguration.EthernetDevType.PARAVIRT, new QemuEthernetDevTypeMeta( Interface.Model.VIRTIO_NET_PCI ) );
-
- usbSpeeds.put( VirtualizationConfiguration.UsbSpeed.NONE, new QemuUsbSpeedMeta( 0, ControllerUsb.Model.NONE ) );
- usbSpeeds.put( VirtualizationConfiguration.UsbSpeed.USB1_1, new QemuUsbSpeedMeta( 1, ControllerUsb.Model.ICH9_UHCI1 ) );
- usbSpeeds.put( VirtualizationConfiguration.UsbSpeed.USB2_0, new QemuUsbSpeedMeta( 2, ControllerUsb.Model.ICH9_EHCI1 ) );
- usbSpeeds.put( VirtualizationConfiguration.UsbSpeed.USB3_0, new QemuUsbSpeedMeta( 3, ControllerUsb.Model.QEMU_XHCI ) );
+ list = new ArrayList<>();
+ //list.add( new QemuSoundCardModel( Sound.Model.NONE, SoundCard.NONE ) ); // XXX TODO
+ list.add( new QemuSoundCardModel( Sound.Model.ICH9, SoundCard.DEFAULT ) );
+ list.add( new QemuSoundCardModel( Sound.Model.SB16, SoundCard.SOUND_BLASTER ) );
+ list.add( new QemuSoundCardModel( Sound.Model.ES1370, SoundCard.ES ) );
+ list.add( new QemuSoundCardModel( Sound.Model.AC97, SoundCard.AC ) );
+ list.add( new QemuSoundCardModel( Sound.Model.ICH9, SoundCard.HD_AUDIO ) );
+ configurableOptions.add( new ConfigurableOptionGroup( ConfigurationGroups.SOUND_CARD_MODEL, list ) );
+
+ list = new ArrayList<>();
+ // XXX This would greatly benefit from having more meaningful options for qemu instead of on/off
+ list.add( new QemuGfxType( "false", "langsam" ) );
+ list.add( new QemuGfxType( "true", "3D OpenGL" ) );
+ configurableOptions.add( new ConfigurableOptionGroup( ConfigurationGroups.GFX_TYPE, list ) );
+
+ list = new ArrayList<>();
+ // XXX Represent NONE; can add missing models now with new approach (add human readable strings)
+ list.add( new QemuNicModel( 0, Interface.Model.VIRTIO, Ethernet.AUTO ) );
+ list.add( new QemuNicModel( 0, Interface.Model.PCNET, Ethernet.PCNETPCI2 ) );
+ list.add( new QemuNicModel( 0, Interface.Model.E1000, Ethernet.E1000 ) );
+ list.add( new QemuNicModel( 0, Interface.Model.E1000E, Ethernet.E1000E ) );
+ list.add( new QemuNicModel( 0, Interface.Model.VMXNET3, Ethernet.VMXNET3 ) );
+ list.add( new QemuNicModel( 0, Interface.Model.VIRTIO_NET_PCI, Ethernet.PARAVIRT ) );
+ configurableOptions.add( new ConfigurableOptionGroup( ConfigurationGroups.NIC_MODEL, list ) );
+
+ list = new ArrayList<>();
+ list.add( new QemuUsbSpeed( ControllerUsb.Model.NONE, Usb.NONE ) );
+ list.add( new QemuUsbSpeed( ControllerUsb.Model.ICH9_UHCI1, Usb.USB1_1 ) );
+ list.add( new QemuUsbSpeed( ControllerUsb.Model.ICH9_EHCI1, Usb.USB2_0 ) );
+ list.add( new QemuUsbSpeed( ControllerUsb.Model.QEMU_XHCI, Usb.USB3_0 ) );
+ configurableOptions.add( new ConfigurableOptionGroup( ConfigurationGroups.USB_SPEED, list ) );
// @formatter:on
}