summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/util/vm/VboxMetaData.java
diff options
context:
space:
mode:
authorJonathan Bauer2018-02-05 17:30:29 +0100
committerJonathan Bauer2018-02-05 17:30:29 +0100
commitbc32fca470e84a95e1571bb00fd6f583d8df4c24 (patch)
treeedd10dc7c089559aa0b477a8e40cbb4736d65f9d /src/main/java/org/openslx/util/vm/VboxMetaData.java
parent[VBox - Qemu] refined and improved the qemu metadata class (diff)
downloadmaster-sync-shared-bc32fca470e84a95e1571bb00fd6f583d8df4c24.tar.gz
master-sync-shared-bc32fca470e84a95e1571bb00fd6f583d8df4c24.tar.xz
master-sync-shared-bc32fca470e84a95e1571bb00fd6f583d8df4c24.zip
[vbox] use vboxnet1 for NAT on bwlp clients
do not use vbox's embedded NAT mode for network adapter when delivering the machine config to clients. (Still do use it when downloading locally though) + minor cleanup
Diffstat (limited to 'src/main/java/org/openslx/util/vm/VboxMetaData.java')
-rw-r--r--src/main/java/org/openslx/util/vm/VboxMetaData.java26
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