diff options
Diffstat (limited to 'src/main/java/org/openslx/util/vm/VboxMetaData.java')
-rw-r--r-- | src/main/java/org/openslx/util/vm/VboxMetaData.java | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/main/java/org/openslx/util/vm/VboxMetaData.java b/src/main/java/org/openslx/util/vm/VboxMetaData.java index 1110e2f..d5e26a6 100644 --- a/src/main/java/org/openslx/util/vm/VboxMetaData.java +++ b/src/main/java/org/openslx/util/vm/VboxMetaData.java @@ -65,6 +65,20 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, private final VboxConfig config; + public static enum EthernetType + { + NAT( "vboxnet1" ), + BRIDGED( "vboxnet0" ), + HOST_ONLY( "vboxnet2" ); + + public final String vnet; + + private EthernetType( String vnet ) + { + this.vnet = vnet; + } + } + public VboxMetaData( List<OperatingSystem> osList, File file ) throws IOException, UnsupportedVirtualizerFormatException { super( osList ); @@ -421,16 +435,12 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, @Override public boolean addEthernet( VmMetaData.EtherType type ) { - switch ( type ) { - case NAT: - return addDefaultNat(); - case BRIDGED: // implement later - return false; - case HOST_ONLY: // implement later - return false; - default: // implement later + Node hostOnlyInterfaceNode = config.addNewNode( "Adapter", "HostOnlyInterface", true, "slot", "0" ); + if (hostOnlyInterfaceNode == null) { + LOGGER.error("Failed to create node for HostOnlyInterface."); return false; } + return config.addAttributeToNode(hostOnlyInterfaceNode, "name", EthernetType.valueOf(type.name()).vnet); } @Override |