diff options
author | Victor Mocanu | 2017-12-19 13:02:18 +0100 |
---|---|---|
committer | Victor Mocanu | 2017-12-19 13:02:18 +0100 |
commit | 00dc84be837bba2dd7bbc28f1d8f7c6e5fc05cc8 (patch) | |
tree | e490ef6a52b64872e3d36baf3a5a5e2751c05bcc /src/main/java/org/openslx/util | |
parent | [VBox] implemented the addfloppy method (diff) | |
download | master-sync-shared-00dc84be837bba2dd7bbc28f1d8f7c6e5fc05cc8.tar.gz master-sync-shared-00dc84be837bba2dd7bbc28f1d8f7c6e5fc05cc8.tar.xz master-sync-shared-00dc84be837bba2dd7bbc28f1d8f7c6e5fc05cc8.zip |
[VBox] added new placeholder, improved the addUsb function
Diffstat (limited to 'src/main/java/org/openslx/util')
-rw-r--r-- | src/main/java/org/openslx/util/vm/VboxConfig.java | 21 | ||||
-rw-r--r-- | src/main/java/org/openslx/util/vm/VboxMetaData.java | 21 |
2 files changed, 24 insertions, 18 deletions
diff --git a/src/main/java/org/openslx/util/vm/VboxConfig.java b/src/main/java/org/openslx/util/vm/VboxConfig.java index dbe9f61..70af022 100644 --- a/src/main/java/org/openslx/util/vm/VboxConfig.java +++ b/src/main/java/org/openslx/util/vm/VboxConfig.java @@ -50,7 +50,7 @@ public class VboxConfig private ArrayList<HardDisk> hddsArray = new ArrayList<HardDisk>(); // a black list of sorts of tags that need to be removed from the .vbox file - private static String[] blackList = { "USB", "ExtraData", "Adapter", "GuestProperties", "LPT", "StorageController", "FloppyImages", "DVDImages", "AttachedDevice" }; + private static String[] blackList = { "HID", "USB", "ExtraData", "Adapter", "GuestProperties", "LPT", "StorageController", "FloppyImages", "DVDImages", "AttachedDevice" }; /** * constructor with input xml file @@ -227,10 +227,13 @@ public class VboxConfig } public void addPlaceHolders() - { + { + // placeholder for the MACAddress + changeAttribute( "Adapter", "MACAddress", "#OpenSLX_Networkcard_MACAddress_place_holder" ); + // placeholder for the machine uuid changeAttribute( "Machine", "uuid", "#OpenSLX_MUUID_place_holder" ); - + // placeholder for the location of the virtual hdd changeAttribute( "HardDisk", "location", "#OpenSLX_HDD_place_holder" ); @@ -284,8 +287,8 @@ public class VboxConfig } /** - * Function uses the findANode function to narrow down the wanted node using 2 attributes and - * their values + * Function uses the findANode function to narrow down the wanted node using 1 attribute and + * its value * * @param targetTag * @param targetAttr0 @@ -404,16 +407,21 @@ public class VboxConfig } /** - * usb 2.0 will be enabled + * USB will be enabled */ public void enableUsb() { + addNewNode( "Hardware", "USB", false ); + addNewNode( "USB", "Controllers", false ); + // for USB 1. the next 3 lines are needed, for USB 2. all six are needed Node controller1 = addNewNode( "Controllers", "Controller", true ); addAttributeToNode( controller1, "name", "OHCI" ); addAttributeToNode( controller1, "type", "OHCI" ); + /* // remove comment for USB 2. Node controller2 = addNewNode( "Controllers", "Controller", true ); addAttributeToNode( controller2, "name", "EHCI" ); addAttributeToNode( controller2, "type", "EHCI" ); + */ } /** @@ -474,7 +482,6 @@ public class VboxConfig removeNode( child.getChildNodes().item( 1 ) ); } } - child.removeAttribute( "MACAddress" ); LOGGER.warn( "possible problem while removing formating node" ); continue; } diff --git a/src/main/java/org/openslx/util/vm/VboxMetaData.java b/src/main/java/org/openslx/util/vm/VboxMetaData.java index 625f11f..1110e2f 100644 --- a/src/main/java/org/openslx/util/vm/VboxMetaData.java +++ b/src/main/java/org/openslx/util/vm/VboxMetaData.java @@ -184,6 +184,7 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, public boolean addDefaultNat() { config.addNewNode( "Adapter", "NAT", true ); + config.changeAttribute( "Adapter", "MACAddress", "080027B86D12" ); return true; } @@ -214,7 +215,6 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, Node somenode = config.findANode( "StorageController", "name", "Floppy" ); if ( somenode == null ) { - LOGGER.debug( "somenode is null" ); Element controller = (Element)config.addNewNode( "StorageControllers", "StorageController", false ); controller.setAttribute( "name", "Floppy" ); controller.setAttribute( "type", "I82078" ); @@ -223,19 +223,13 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, controller.setAttribute( "Bootable", "true" ); } + Element attachedDev = null; + if ( image == null ) { - Element attachedDev = (Element)config.addNewNode( "StorageController", "AttachedDevice", true, "name", "Floppy" ); - attachedDev.setAttribute( "type", "Floppy" ); - attachedDev.setAttribute( "hotpluggable", "false" ); - attachedDev.setAttribute( "port", "0" ); - attachedDev.setAttribute( "device", Integer.toString( index ) ); + attachedDev = (Element)config.addNewNode( "StorageController", "AttachedDevice", true, "name", "Floppy" ); LOGGER.warn( "Floppy controller has no image attached" ); } else { - Element attachedDev = (Element)config.addNewNode( "StorageController", "AttachedDevice", false, "name", "Floppy" ); - attachedDev.setAttribute( "type", "Floppy" ); - attachedDev.setAttribute( "hotpluggable", "false" ); - attachedDev.setAttribute( "port", "0" ); - attachedDev.setAttribute( "device", Integer.toString( index ) ); + attachedDev = (Element)config.addNewNode( "StorageController", "AttachedDevice", false, "name", "Floppy" ); Element imageTag = (Element)config.addNewNode( "AttachedDevice", "Image", true, "type", "Floppy" ); imageTag.setAttribute( "uuid", "#OpenSLX_FloppyUUID_place_holder" ); @@ -244,6 +238,11 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta, floppyImageTag.setAttribute( "uuid", "#OpenSLX_FloppyUUID_place_holder" ); floppyImageTag.setAttribute( "location", "#OpenSLX_FloppyImageLocation_place_holder" ); } + + attachedDev.setAttribute( "type", "Floppy" ); + attachedDev.setAttribute( "hotpluggable", "false" ); + attachedDev.setAttribute( "port", "0" ); + attachedDev.setAttribute( "device", Integer.toString( index ) ); } @Override |