From c2d5e99c47dcc7e6942e47377b2c7bc522c0b642 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Wed, 24 Mar 2021 12:34:42 +0100 Subject: Add MAC address for network interfaces in Libvirt domain XML documents --- .../openslx/libvirt/domain/device/Interface.java | 34 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/openslx/libvirt/domain/device') diff --git a/src/main/java/org/openslx/libvirt/domain/device/Interface.java b/src/main/java/org/openslx/libvirt/domain/device/Interface.java index b09c7da..dae3c11 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/Interface.java +++ b/src/main/java/org/openslx/libvirt/domain/device/Interface.java @@ -59,16 +59,16 @@ public class Interface extends Device { return Type.fromString( this.getXmlElementAttributeValue( "type" ) ); } - + /** * Sets type of the network device. * * @return type of the network device. */ - public void setType(Type type) + public void setType( Type type ) { String source = this.getSource(); - + // change type and set source again this.setXmlElementAttributeValue( "type", type.toString() ); this.setSource( source ); @@ -118,6 +118,26 @@ public class Interface extends Device } } + /** + * Returns MAC address of the network device. + * + * @return MAC address of the network device. + */ + public String getMacAddress() + { + return this.getXmlElementAttributeValue( "mac", "address" ); + } + + /** + * Sets MAC address of the network device. + * + * @param macAddress MAC address for the network device. + */ + public void setMacAddress( String macAddress ) + { + this.setXmlElementAttributeValue( "mac", "address", macAddress ); + } + /** * Removes boot oder entry of the network interface device. */ @@ -134,6 +154,14 @@ public class Interface extends Device this.removeXmlElement( "source" ); } + /** + * Removes MAC address of the network interface device. + */ + public void removeMacAddress() + { + this.removeXmlElement( "mac" ); + } + /** * Creates a non-existent network interface device as Libvirt XML device element. * -- cgit v1.2.3-55-g7522 From 936887890b6517d844331c7a37a1dc56c6a47da1 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Wed, 24 Mar 2021 12:35:37 +0100 Subject: Add parallel and serial devices to Libvirt domain XML documents --- .../java/org/openslx/libvirt/domain/Domain.java | 44 ++++++ .../org/openslx/libvirt/domain/device/Device.java | 14 ++ .../openslx/libvirt/domain/device/Parallel.java | 158 +++++++++++++++++++++ .../org/openslx/libvirt/domain/device/Serial.java | 156 ++++++++++++++++++++ .../org/openslx/libvirt/domain/DomainTest.java | 18 ++- 5 files changed, 389 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/openslx/libvirt/domain/device/Parallel.java create mode 100644 src/main/java/org/openslx/libvirt/domain/device/Serial.java (limited to 'src/main/java/org/openslx/libvirt/domain/device') diff --git a/src/main/java/org/openslx/libvirt/domain/Domain.java b/src/main/java/org/openslx/libvirt/domain/Domain.java index ca3df77..e399340 100644 --- a/src/main/java/org/openslx/libvirt/domain/Domain.java +++ b/src/main/java/org/openslx/libvirt/domain/Domain.java @@ -28,6 +28,8 @@ import org.openslx.libvirt.domain.device.Hostdev; import org.openslx.libvirt.domain.device.Interface; import org.openslx.libvirt.domain.device.InterfaceBridge; import org.openslx.libvirt.domain.device.InterfaceNetwork; +import org.openslx.libvirt.domain.device.Parallel; +import org.openslx.libvirt.domain.device.Serial; import org.openslx.libvirt.domain.device.Sound; import org.openslx.libvirt.domain.device.Video; import org.openslx.libvirt.xml.LibvirtXmlDocument; @@ -853,6 +855,28 @@ public class Domain extends LibvirtXmlDocument return Domain.filterDevices( Graphics.class, this.getDevices() ); } + /** + * Returns list of virtual machine parallel port devices specified in the Libvirt domain XML + * document. + * + * @return list of virtual machine parallel port devices. + */ + public ArrayList getParallelDevices() + { + return Domain.filterDevices( Parallel.class, this.getDevices() ); + } + + /** + * Returns list of virtual machine serial port devices specified in the Libvirt domain XML + * document. + * + * @return list of virtual machine serial port devices. + */ + public ArrayList getSerialDevices() + { + return Domain.filterDevices( Serial.class, this.getDevices() ); + } + /** * Returns list of virtual machine sound devices specified in the Libvirt domain XML document. * @@ -1086,6 +1110,26 @@ public class Domain extends LibvirtXmlDocument return GraphicsVnc.class.cast( this.addDevice( new GraphicsVnc() ) ); } + /** + * Adds a virtual machine parallel port device to the Libvirt domain XML document. + * + * @return reference to the added parallel port device if creation was successful. + */ + public Parallel addParallelDevice() + { + return Parallel.class.cast( this.addDevice( new Parallel() ) ); + } + + /** + * Adds a virtual machine serial port device to the Libvirt domain XML document. + * + * @return reference to the added serial port device if creation was successful. + */ + public Serial addSerialDevice() + { + return Serial.class.cast( this.addDevice( new Serial() ) ); + } + /** * Adds a virtual machine sound device to the Libvirt domain XML document. * diff --git a/src/main/java/org/openslx/libvirt/domain/device/Device.java b/src/main/java/org/openslx/libvirt/domain/device/Device.java index 5c26c55..b7403cd 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/Device.java +++ b/src/main/java/org/openslx/libvirt/domain/device/Device.java @@ -86,6 +86,12 @@ public class Device extends LibvirtXmlNode } else if ( device instanceof Graphics ) { LibvirtXmlNode xmlNode = Device.createDeviceElement( xmlParentNode, Type.GRAPHICS ); createdDevice = Graphics.createInstance( Graphics.class.cast( device ), xmlNode ); + } else if ( device instanceof Parallel ) { + LibvirtXmlNode xmlNode = Device.createDeviceElement( xmlParentNode, Type.PARALLEL ); + createdDevice = Parallel.createInstance( xmlNode ); + } else if ( device instanceof Serial ) { + LibvirtXmlNode xmlNode = Device.createDeviceElement( xmlParentNode, Type.SERIAL ); + createdDevice = Serial.createInstance( xmlNode ); } else if ( device instanceof Sound ) { LibvirtXmlNode xmlNode = Device.createDeviceElement( xmlParentNode, Type.SOUND ); createdDevice = Sound.createInstance( xmlNode ); @@ -134,6 +140,12 @@ public class Device extends LibvirtXmlNode case GRAPHICS: device = Graphics.newInstance( xmlNode ); break; + case PARALLEL: + device = Parallel.newInstance( xmlNode ); + break; + case SERIAL: + device = Serial.newInstance( xmlNode ); + break; case SOUND: device = Sound.newInstance( xmlNode ); break; @@ -160,6 +172,8 @@ public class Device extends LibvirtXmlNode HOSTDEV ( "hostdev" ), INTERFACE ( "interface" ), GRAPHICS ( "graphics" ), + PARALLEL ( "parallel" ), + SERIAL ( "serial" ), SOUND ( "sound" ), VIDEO ( "video" ); // @formatter:on diff --git a/src/main/java/org/openslx/libvirt/domain/device/Parallel.java b/src/main/java/org/openslx/libvirt/domain/device/Parallel.java new file mode 100644 index 0000000..7db60ca --- /dev/null +++ b/src/main/java/org/openslx/libvirt/domain/device/Parallel.java @@ -0,0 +1,158 @@ +package org.openslx.libvirt.domain.device; + +import org.openslx.libvirt.xml.LibvirtXmlNode; + +/** + * A parallel port device node in a Libvirt domain XML document. + * + * @author Manuel Bentele + * @version 1.0 + */ +public class Parallel extends Device +{ + /** + * Creates an empty parallel port device. + */ + public Parallel() + { + super(); + } + + /** + * Creates a parallel port device representing an existing Libvirt XML parallel port device + * element. + * + * @param xmlNode existing Libvirt XML parallel port device element. + */ + public Parallel( LibvirtXmlNode xmlNode ) + { + super( xmlNode ); + } + + /** + * Returns the type of the parallel port device. + * + * @return type of the parallel port device. + */ + public Type getType() + { + final String type = this.getXmlElementAttributeValue( "type" ); + return Type.fromString( type ); + } + + /** + * Sets the type for the parallel port device. + * + * @param type type for the parallel port device. + */ + public void setType( Type type ) + { + this.setXmlElementAttributeValue( "type", type.toString() ); + } + + /** + * Returns the source of the parallel port device. + * + * @return source of the parallel port device. + */ + public String getSource() + { + return this.getXmlElementAttributeValue( "source", "path" ); + } + + /** + * Sets the source for the parallel port device. + * + * @param source source for the parallel port device. + */ + public void setSource( String source ) + { + this.setXmlElementAttributeValue( "source", "path", source ); + } + + /** + * Creates a non-existent parallel port device as Libvirt XML parallel port device element. + * + * @param xmlNode Libvirt XML node of the Libvirt XML parallel port device that is created. + * @return created parallel port device instance. + */ + public static Parallel createInstance( LibvirtXmlNode xmlNode ) + { + return Parallel.newInstance( xmlNode ); + } + + /** + * Creates a parallel port device representing an existing Libvirt XML parallel port device + * element. + * + * @param xmlNode existing Libvirt XML parallel port device element. + * @return parallel port device instance. + */ + public static Parallel newInstance( LibvirtXmlNode xmlNode ) + { + return new Parallel( xmlNode ); + } + + /** + * Type of parallel port device. + * + * @author Manuel Bentele + * @version 1.0 + */ + public enum Type + { + // @formatter:off + DEV ( "dev" ), + FILE ( "file" ), + PIPE ( "pipe" ), + UNIX ( "unix" ), + TCP ( "tcp" ), + UDP ( "udp" ), + NULL ( "null" ), + STDIO ( "stdio" ), + VC ( "vc" ), + PTY ( "pty" ), + SPICEVMC ( "spicevmc" ), + SPICEPORT( "spiceport" ), + NMDM ( "nmdm" ); + // @formatter:on + + /** + * Name of the parallel port device type. + */ + private String type; + + /** + * Creates parallel port device type. + * + * @param type valid name of the parallel port device type in a Libvirt domain XML document. + */ + Type( String type ) + { + this.type = type; + } + + @Override + public String toString() + { + return this.type; + } + + /** + * Creates parallel port device type from its name with error check. + * + * @param type name of the parallel port device type in a Libvirt domain XML document. + * @return valid parallel port device type. + */ + public static Type fromString( String type ) + { + for ( Type t : Type.values() ) { + if ( t.type.equalsIgnoreCase( type ) ) { + return t; + } + } + + return null; + } + } +} diff --git a/src/main/java/org/openslx/libvirt/domain/device/Serial.java b/src/main/java/org/openslx/libvirt/domain/device/Serial.java new file mode 100644 index 0000000..54be26e --- /dev/null +++ b/src/main/java/org/openslx/libvirt/domain/device/Serial.java @@ -0,0 +1,156 @@ +package org.openslx.libvirt.domain.device; + +import org.openslx.libvirt.xml.LibvirtXmlNode; + +/** + * A serial port device node in a Libvirt domain XML document. + * + * @author Manuel Bentele + * @version 1.0 + */ +public class Serial extends Device +{ + /** + * Creates an empty serial port device. + */ + public Serial() + { + super(); + } + + /** + * Creates a serial port device representing an existing Libvirt XML serial port device element. + * + * @param xmlNode existing Libvirt XML serial port device element. + */ + public Serial( LibvirtXmlNode xmlNode ) + { + super( xmlNode ); + } + + /** + * Returns the type of the serial port device. + * + * @return type of the serial port device. + */ + public Type getType() + { + final String type = this.getXmlElementAttributeValue( "type" ); + return Type.fromString( type ); + } + + /** + * Sets the type for the serial port device. + * + * @param type type for the serial port device. + */ + public void setType( Type type ) + { + this.setXmlElementAttributeValue( "type", type.toString() ); + } + + /** + * Returns the source of the serial port device. + * + * @return source of the serial port device. + */ + public String getSource() + { + return this.getXmlElementAttributeValue( "source", "path" ); + } + + /** + * Sets the source for the serial port device. + * + * @param source source for the serial port device. + */ + public void setSource( String source ) + { + this.setXmlElementAttributeValue( "source", "path", source ); + } + + /** + * Creates a non-existent serial port device as Libvirt XML serial port device element. + * + * @param xmlNode Libvirt XML node of the Libvirt XML serial port device that is created. + * @return created serial port device instance. + */ + public static Serial createInstance( LibvirtXmlNode xmlNode ) + { + return Serial.newInstance( xmlNode ); + } + + /** + * Creates a serial port device representing an existing Libvirt XML serial port device element. + * + * @param xmlNode existing Libvirt XML serial port device element. + * @return serial port device instance. + */ + public static Serial newInstance( LibvirtXmlNode xmlNode ) + { + return new Serial( xmlNode ); + } + + /** + * Type of serial port device. + * + * @author Manuel Bentele + * @version 1.0 + */ + public enum Type + { + // @formatter:off + DEV ( "dev" ), + FILE ( "file" ), + PIPE ( "pipe" ), + UNIX ( "unix" ), + TCP ( "tcp" ), + UDP ( "udp" ), + NULL ( "null" ), + STDIO ( "stdio" ), + VC ( "vc" ), + PTY ( "pty" ), + SPICEVMC ( "spicevmc" ), + SPICEPORT( "spiceport" ), + NMDM ( "nmdm" ); + // @formatter:on + + /** + * Name of the serial port device type. + */ + private String type; + + /** + * Creates serial port device type. + * + * @param type valid name of the serial port device type in a Libvirt domain XML document. + */ + Type( String type ) + { + this.type = type; + } + + @Override + public String toString() + { + return this.type; + } + + /** + * Creates serial port device type from its name with error check. + * + * @param type name of the serial port device type in a Libvirt domain XML document. + * @return valid serial port device type. + */ + public static Type fromString( String type ) + { + for ( Type t : Type.values() ) { + if ( t.type.equalsIgnoreCase( type ) ) { + return t; + } + } + + return null; + } + } +} diff --git a/src/test/java/org/openslx/libvirt/domain/DomainTest.java b/src/test/java/org/openslx/libvirt/domain/DomainTest.java index 1712b68..b4e0187 100644 --- a/src/test/java/org/openslx/libvirt/domain/DomainTest.java +++ b/src/test/java/org/openslx/libvirt/domain/DomainTest.java @@ -302,7 +302,7 @@ public class DomainTest public void testGetDevices() { Domain vm = this.newDomainInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" ); - assertEquals( 21, vm.getDevices().size() ); + assertEquals( 22, vm.getDevices().size() ); } @Test @@ -345,6 +345,22 @@ public class DomainTest assertEquals( 1, vm.getGraphicDevices().size() ); } + @Test + @DisplayName( "Get all VM parallel port devices from libvirt XML file" ) + public void testGetParallelDevices() + { + Domain vm = this.newDomainInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" ); + assertEquals( 0, vm.getParallelDevices().size() ); + } + + @Test + @DisplayName( "Get all VM serial port devices from libvirt XML file" ) + public void testGetSerialDevices() + { + Domain vm = this.newDomainInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" ); + assertEquals( 1, vm.getSerialDevices().size() ); + } + @Test @DisplayName( "Get all VM sound devices from libvirt XML file" ) public void testGetSoundDevices() -- cgit v1.2.3-55-g7522 From 2d012afbaf72794ad8ff16cc7ac50bc2e05b0c74 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Wed, 24 Mar 2021 15:20:33 +0100 Subject: Add shared folder support to Libvirt domain XML documents --- .../java/org/openslx/libvirt/domain/Domain.java | 22 ++ .../org/openslx/libvirt/domain/device/Device.java | 7 + .../openslx/libvirt/domain/device/FileSystem.java | 292 +++++++++++++++++++++ .../org/openslx/libvirt/domain/DomainTest.java | 8 + 4 files changed, 329 insertions(+) create mode 100644 src/main/java/org/openslx/libvirt/domain/device/FileSystem.java (limited to 'src/main/java/org/openslx/libvirt/domain/device') diff --git a/src/main/java/org/openslx/libvirt/domain/Domain.java b/src/main/java/org/openslx/libvirt/domain/Domain.java index e399340..f29fcd0 100644 --- a/src/main/java/org/openslx/libvirt/domain/Domain.java +++ b/src/main/java/org/openslx/libvirt/domain/Domain.java @@ -20,6 +20,7 @@ import org.openslx.libvirt.domain.device.Disk; import org.openslx.libvirt.domain.device.DiskCdrom; import org.openslx.libvirt.domain.device.DiskFloppy; import org.openslx.libvirt.domain.device.DiskStorage; +import org.openslx.libvirt.domain.device.FileSystem; import org.openslx.libvirt.domain.device.Graphics; import org.openslx.libvirt.domain.device.GraphicsSdl; import org.openslx.libvirt.domain.device.GraphicsSpice; @@ -824,6 +825,17 @@ public class Domain extends LibvirtXmlDocument return Domain.filterDevices( DiskStorage.class, this.getDevices() ); } + /** + * Returns list of virtual machine file system devices specified in the Libvirt domain XML + * document. + * + * @return list of virtual machine file system devices. + */ + public ArrayList getFileSystemDevices() + { + return Domain.filterDevices( FileSystem.class, this.getDevices() ); + } + /** * Returns list of virtual machine hostdev devices specified in the Libvirt domain XML document. * @@ -1030,6 +1042,16 @@ public class Domain extends LibvirtXmlDocument return DiskStorage.class.cast( this.addDevice( new DiskStorage() ) ); } + /** + * Adds a virtual machine file system device to the Libvirt domain XML document. + * + * @return reference to the added file system device if creation was successful. + */ + public FileSystem addFileSystemDevice() + { + return FileSystem.class.cast( this.addDevice( new FileSystem() ) ); + } + /** * Adds a virtual machine disk device to the Libvirt domain XML document. * diff --git a/src/main/java/org/openslx/libvirt/domain/device/Device.java b/src/main/java/org/openslx/libvirt/domain/device/Device.java index b7403cd..151592a 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/Device.java +++ b/src/main/java/org/openslx/libvirt/domain/device/Device.java @@ -77,6 +77,9 @@ public class Device extends LibvirtXmlNode } else if ( device instanceof Disk ) { LibvirtXmlNode xmlNode = Device.createDeviceElement( xmlParentNode, Type.DISK ); createdDevice = Disk.createInstance( Disk.class.cast( device ), xmlNode ); + } else if ( device instanceof FileSystem ) { + LibvirtXmlNode xmlNode = Device.createDeviceElement( xmlParentNode, Type.FILESYSTEM ); + createdDevice = FileSystem.createInstance( FileSystem.class.cast( device ), xmlNode ); } else if ( device instanceof Hostdev ) { LibvirtXmlNode xmlNode = Device.createDeviceElement( xmlParentNode, Type.HOSTDEV ); createdDevice = Hostdev.createInstance( Hostdev.class.cast( device ), xmlNode ); @@ -131,6 +134,9 @@ public class Device extends LibvirtXmlNode case DISK: device = Disk.newInstance( xmlNode ); break; + case FILESYSTEM: + device = FileSystem.newInstance( xmlNode ); + break; case HOSTDEV: device = Hostdev.newInstance( xmlNode ); break; @@ -169,6 +175,7 @@ public class Device extends LibvirtXmlNode // @formatter:off CONTROLLER( "controller" ), DISK ( "disk" ), + FILESYSTEM( "filesystem" ), HOSTDEV ( "hostdev" ), INTERFACE ( "interface" ), GRAPHICS ( "graphics" ), diff --git a/src/main/java/org/openslx/libvirt/domain/device/FileSystem.java b/src/main/java/org/openslx/libvirt/domain/device/FileSystem.java new file mode 100644 index 0000000..9ec8caf --- /dev/null +++ b/src/main/java/org/openslx/libvirt/domain/device/FileSystem.java @@ -0,0 +1,292 @@ +package org.openslx.libvirt.domain.device; + +import org.openslx.libvirt.xml.LibvirtXmlNode; + +/** + * A file system device node in a Libvirt domain XML document. + * + * @author Manuel Bentele + * @version 1.0 + */ +public class FileSystem extends Device +{ + /** + * Creates an empty file system device. + */ + public FileSystem() + { + super(); + } + + /** + * Creates a file system device representing an existing Libvirt XML file system device element. + * + * @param xmlNode existing Libvirt XML file system device element. + */ + public FileSystem( LibvirtXmlNode xmlNode ) + { + super( xmlNode ); + } + + /** + * Returns access mode of the file system device. + * + * @return access mode of the file system device. + */ + public AccessMode getAccessMode() + { + final String mode = this.getXmlElementAttributeValue( "accessmode" ); + return AccessMode.fromString( mode ); + } + + /** + * Sets access mode for the file system device. + * + * @param mode access mode for the file system device. + */ + public void setAccessMode( AccessMode mode ) + { + this.setXmlElementAttributeValue( "accessmode", mode.toString() ); + } + + /** + * Returns type of the file system device. + * + * @return type of the file system device. + */ + public Type getType() + { + final String type = this.getXmlElementAttributeValue( "type" ); + return Type.fromString( type ); + } + + /** + * Sets type for the file system device. + * + * @param type type for the file system device. + */ + public void setType( Type type ) + { + this.setXmlElementAttributeValue( "type", type.toString() ); + } + + /** + * Returns source of the file system device. + * + * @return source of the file system device. + */ + public String getSource() + { + final Type type = this.getType(); + String source = null; + + switch ( type ) { + case BIND: + source = this.getXmlElementAttributeValue( "source", "dir" ); + break; + case BLOCK: + source = this.getXmlElementAttributeValue( "source", "dev" ); + break; + case FILE: + source = this.getXmlElementAttributeValue( "source", "file" ); + break; + case MOUNT: + source = this.getXmlElementAttributeValue( "source", "dir" ); + break; + case RAM: + source = this.getXmlElementAttributeValue( "source", "usage" ); + break; + case TEMPLATE: + source = this.getXmlElementAttributeValue( "source", "name" ); + break; + } + + return source; + } + + /** + * Sets source for the file system device. + * + * @param source source for the file system device. + */ + public void setSource( String source ) + { + Type type = this.getType(); + + // remove all attributes from sub-element 'source' + this.removeXmlElementAttributes( "source" ); + + switch ( type ) { + case BIND: + this.setXmlElementAttributeValue( "source", "dir", source ); + break; + case BLOCK: + this.setXmlElementAttributeValue( "source", "dev", source ); + break; + case FILE: + this.setXmlElementAttributeValue( "source", "file", source ); + break; + case MOUNT: + this.setXmlElementAttributeValue( "source", "dir", source ); + break; + case RAM: + this.setXmlElementAttributeValue( "source", "usage", source ); + break; + case TEMPLATE: + this.setXmlElementAttributeValue( "source", "name", source ); + break; + } + } + + /** + * Returns target of the file system device. + * + * @return target of the file system device. + */ + public String getTarget() + { + return this.getXmlElementAttributeValue( "target", "dir" ); + } + + /** + * Sets target for the file system device. + * + * @param target target for the file system device. + */ + public void setTarget( String target ) + { + this.setXmlElementAttributeValue( "target", "dir", target ); + } + + /** + * Creates a non-existent file system device as Libvirt XML device element. + * + * @param xmlNode Libvirt XML node of the Libvirt XML device that is created. + * @return created file system device instance. + */ + public static FileSystem createInstance( LibvirtXmlNode xmlNode ) + { + return FileSystem.newInstance( xmlNode ); + } + + /** + * Creates a file system device representing an existing Libvirt XML file system device element. + * + * @param xmlNode existing Libvirt XML file system device element. + * @return file system device instance. + */ + public static FileSystem newInstance( LibvirtXmlNode xmlNode ) + { + return new FileSystem( xmlNode ); + } + + /** + * Access mode for the file system device. + * + * @author Manuel Bentele + * @version 1.0 + */ + public enum AccessMode + { + // @formatter:off + PASSTHROUGH( "passthrough" ), + MAPPED ( "mapped" ), + SQUASH ( "squash" ); + // @formatter:on + + /** + * Name of the file system device access mode. + */ + private String mode; + + /** + * Creates file system device access mode. + * + * @param mode valid name of the file system device access mode in a Libvirt domain XML + * document. + */ + AccessMode( String mode ) + { + this.mode = mode; + } + + @Override + public String toString() + { + return this.mode; + } + + /** + * Creates file system device access mode from its name with error check. + * + * @param mode name of the file system device access mode in a Libvirt domain XML document. + * @return valid file system device access mode. + */ + public static AccessMode fromString( String mode ) + { + for ( AccessMode a : AccessMode.values() ) { + if ( a.mode.equalsIgnoreCase( mode ) ) { + return a; + } + } + + return null; + } + } + + /** + * Type of file system device. + * + * @author Manuel Bentele + * @version 1.0 + */ + public enum Type + { + // @formatter:off + MOUNT ( "mount" ), + TEMPLATE( "template" ), + FILE ( "file" ), + BLOCK ( "block" ), + RAM ( "ram" ), + BIND ( "bind" ); + // @formatter:on + + /** + * Name of the file system device type. + */ + private String type; + + /** + * Creates file system device type. + * + * @param type valid name of the file system device type in a Libvirt domain XML document. + */ + Type( String type ) + { + this.type = type; + } + + @Override + public String toString() + { + return this.type; + } + + /** + * Creates file system device type from its name with error check. + * + * @param type name of the file system device type in a Libvirt domain XML document. + * @return valid file system device type. + */ + public static Type fromString( String type ) + { + for ( Type t : Type.values() ) { + if ( t.type.equalsIgnoreCase( type ) ) { + return t; + } + } + + return null; + } + } +} diff --git a/src/test/java/org/openslx/libvirt/domain/DomainTest.java b/src/test/java/org/openslx/libvirt/domain/DomainTest.java index b4e0187..aa556f9 100644 --- a/src/test/java/org/openslx/libvirt/domain/DomainTest.java +++ b/src/test/java/org/openslx/libvirt/domain/DomainTest.java @@ -321,6 +321,14 @@ public class DomainTest assertEquals( 3, vm.getDiskDevices().size() ); } + @Test + @DisplayName( "Get all VM file system devices from libvirt XML file" ) + public void testGetFileSystemDevices() + { + Domain vm = this.newDomainInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" ); + assertEquals( 0, vm.getFileSystemDevices().size() ); + } + @Test @DisplayName( "Get all VM hostdev devices from libvirt XML file" ) public void testGetHostdevDevices() -- cgit v1.2.3-55-g7522 From 7aa2380b3bc33ad6b1a892b1b3491c93eee8edbb Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Fri, 26 Mar 2021 16:22:54 +0100 Subject: Fix issues in filtering sources of Libvirt network interfaces --- .../java/org/openslx/libvirt/domain/Domain.java | 3 +- .../org/openslx/libvirt/domain/device/Disk.java | 4 +- src/test/java/org/openslx/vm/QemuMetaDataTest.java | 104 +++++++++++++++++---- 3 files changed, 88 insertions(+), 23 deletions(-) (limited to 'src/main/java/org/openslx/libvirt/domain/device') diff --git a/src/main/java/org/openslx/libvirt/domain/Domain.java b/src/main/java/org/openslx/libvirt/domain/Domain.java index 727da13..dbc60e6 100644 --- a/src/main/java/org/openslx/libvirt/domain/Domain.java +++ b/src/main/java/org/openslx/libvirt/domain/Domain.java @@ -1216,7 +1216,8 @@ public class Domain extends LibvirtXmlDocument public void removeInterfaceDevicesSource() { for ( Interface interfaceDevice : this.getInterfaceDevices() ) { - interfaceDevice.removeSource(); + // set empty source to preserve the XML attribute (to prevent XML validation errors) + interfaceDevice.setSource( "" ); } } } diff --git a/src/main/java/org/openslx/libvirt/domain/device/Disk.java b/src/main/java/org/openslx/libvirt/domain/device/Disk.java index 464e7b6..d9007f5 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/Disk.java +++ b/src/main/java/org/openslx/libvirt/domain/device/Disk.java @@ -68,7 +68,7 @@ public class Disk extends Device storageSource = this.getXmlElementAttributeValue( "source", "file" ); break; case BLOCK: - storageSource = this.getXmlElementAttributeValue( "source", "bdev" ); + storageSource = this.getXmlElementAttributeValue( "source", "dev" ); break; } @@ -96,7 +96,7 @@ public class Disk extends Device this.setXmlElementAttributeValue( "source", "file", source ); break; case BLOCK: - this.setXmlElementAttributeValue( "source", "bdev", source ); + this.setXmlElementAttributeValue( "source", "dev", source ); break; } } diff --git a/src/test/java/org/openslx/vm/QemuMetaDataTest.java b/src/test/java/org/openslx/vm/QemuMetaDataTest.java index 3217fda..a3053a1 100644 --- a/src/test/java/org/openslx/vm/QemuMetaDataTest.java +++ b/src/test/java/org/openslx/vm/QemuMetaDataTest.java @@ -1,5 +1,6 @@ package org.openslx.vm; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -19,6 +20,7 @@ import org.apache.log4j.LogManager; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -58,64 +60,94 @@ public class QemuMetaDataTest @Test @DisplayName( "Test display name from VM configuration" ) - public void testQemuMetaDataGetDisplayName() throws UnsupportedVirtualizerFormatException, IOException + public void testQemuMetaDataGetDisplayName() + throws UnsupportedVirtualizerFormatException, IOException, NoSuchFieldException, SecurityException, + IllegalArgumentException, IllegalAccessException { File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); QemuMetaData vmConfig = new QemuMetaData( null, file ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final String displayName = vmConfig.getDisplayName(); assertEquals( "archlinux", displayName ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @Test @DisplayName( "Test machine snapshot state from VM configuration" ) - public void testQemuMetaDataIsMachineSnapshot() throws UnsupportedVirtualizerFormatException, IOException + public void testQemuMetaDataIsMachineSnapshot() + throws UnsupportedVirtualizerFormatException, IOException, NoSuchFieldException, SecurityException, + IllegalArgumentException, IllegalAccessException { File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); QemuMetaData vmConfig = new QemuMetaData( null, file ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final boolean isVmSnapshot = vmConfig.isMachineSnapshot(); assertEquals( false, isVmSnapshot ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @Test @DisplayName( "Test supported image formats from VM configuration" ) - public void testQemuMetaDataGetSupportedImageFormats() throws UnsupportedVirtualizerFormatException, IOException + public void testQemuMetaDataGetSupportedImageFormats() + throws UnsupportedVirtualizerFormatException, IOException, NoSuchFieldException, SecurityException, + IllegalArgumentException, IllegalAccessException { File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); QemuMetaData vmConfig = new QemuMetaData( null, file ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final List supportedImageFormats = vmConfig.getSupportedImageFormats(); assertNotNull( supportedImageFormats ); assertEquals( 3, supportedImageFormats.size() ); assertEquals( true, supportedImageFormats .containsAll( Arrays.asList( ImageFormat.QCOW2, ImageFormat.VMDK, ImageFormat.VDI ) ) ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @Test @DisplayName( "Test output of HDDs from VM configuration" ) - public void testQemuMetaDataGetHdds() throws UnsupportedVirtualizerFormatException, IOException + public void testQemuMetaDataGetHdds() + throws UnsupportedVirtualizerFormatException, IOException, NoSuchFieldException, SecurityException, + IllegalArgumentException, IllegalAccessException { File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); QemuMetaData vmConfig = new QemuMetaData( null, file ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final List hdds = vmConfig.getHdds(); assertNotNull( hdds ); assertEquals( 1, hdds.size() ); assertEquals( "/var/lib/libvirt/images/archlinux.qcow2", hdds.get( 0 ).diskImage ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @Test @DisplayName( "Test output of unfiltered VM configuration" ) - public void testQemuMetaDataGetDefinitionArray() throws UnsupportedVirtualizerFormatException, IOException + public void testQemuMetaDataGetDefinitionArray() + throws UnsupportedVirtualizerFormatException, IOException, NoSuchFieldException, SecurityException, + IllegalArgumentException, IllegalAccessException { File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); QemuMetaData vmConfig = new QemuMetaData( null, file ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + + final int numberOfDeletedElements = 1; + final String unfilteredXmlConfig = new String( vmConfig.getDefinitionArray(), StandardCharsets.UTF_8 ); final String originalXmlConfig = FileUtils.readFileToString( file, StandardCharsets.UTF_8 ); @@ -124,17 +156,23 @@ public class QemuMetaDataTest final int lengthUnfilteredXmlConfig = unfilteredXmlConfig.split( System.lineSeparator() ).length; final int lengthOriginalXmlConfig = originalXmlConfig.split( System.lineSeparator() ).length; - assertEquals( lengthOriginalXmlConfig, lengthUnfilteredXmlConfig ); + assertEquals( lengthOriginalXmlConfig, lengthUnfilteredXmlConfig + numberOfDeletedElements ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @Test @DisplayName( "Test output of filtered VM configuration" ) - public void testQemuMetaDataGetFilteredDefinitionArray() throws UnsupportedVirtualizerFormatException, IOException + public void testQemuMetaDataGetFilteredDefinitionArray() + throws UnsupportedVirtualizerFormatException, IOException, NoSuchFieldException, SecurityException, + IllegalArgumentException, IllegalAccessException { File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - final int numberOfDeletedElements = 4; + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + + final int numberOfDeletedElements = 2; final String filteredXmlConfig = new String( vmConfig.getFilteredDefinitionArray(), StandardCharsets.UTF_8 ); final String originalXmlConfig = FileUtils.readFileToString( file, StandardCharsets.UTF_8 ); @@ -145,6 +183,8 @@ public class QemuMetaDataTest final int lengthOriginalXmlConfig = originalXmlConfig.split( System.lineSeparator() ).length; assertEquals( lengthOriginalXmlConfig, lengthFilteredXmlConfig + numberOfDeletedElements ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -158,7 +198,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); final int numHddsLibvirtDomainXmlBeforeAdd = vmLibvirtDomainConfig.getDiskStorageDevices().size(); final int numHddsQemuMetaDataBeforeAdd = vmConfig.hdds.size(); @@ -184,6 +224,8 @@ public class QemuMetaDataTest DiskStorage addedStorageDevice = vmLibvirtDomainConfig.getDiskStorageDevices().get( 0 ); assertEquals( diskFile.getAbsolutePath(), addedStorageDevice.getStorageSource() ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -197,7 +239,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); final int numCdromsLibvirtDomainXmlBeforeAdd = vmLibvirtDomainConfig.getDiskCdromDevices().size(); @@ -210,6 +252,8 @@ public class QemuMetaDataTest DiskCdrom addedCdromDevice = vmLibvirtDomainConfig.getDiskCdromDevices().get( 0 ); assertEquals( diskFile.getAbsolutePath(), addedCdromDevice.getStorageSource() ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -222,7 +266,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); final int numCdromsLibvirtDomainXmlBeforeAdd = vmLibvirtDomainConfig.getDiskCdromDevices().size(); @@ -235,6 +279,8 @@ public class QemuMetaDataTest DiskCdrom addedCdromDevice = vmLibvirtDomainConfig.getDiskCdromDevices().get( 0 ); assertEquals( QemuMetaData.CDROM_DEFAULT_PHYSICAL_DRIVE, addedCdromDevice.getStorageSource() ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -248,7 +294,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); final int numFloppiesLibvirtDomainXmlBeforeAdd = vmLibvirtDomainConfig.getDiskFloppyDevices().size(); @@ -262,6 +308,8 @@ public class QemuMetaDataTest DiskFloppy addedFloppyDevice = vmLibvirtDomainConfig.getDiskFloppyDevices().get( 0 ); assertTrue( addedFloppyDevice.isReadOnly() ); assertEquals( diskFile.getAbsolutePath(), addedFloppyDevice.getStorageSource() ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -274,11 +322,13 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-archlinux-vm.xml" ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); vmConfig.addCpuCoreCount( coreCount ); assertEquals( coreCount, vmLibvirtDomainConfig.getVCpu() ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -291,7 +341,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); SoundCardType soundCardType = vmConfig.getSoundCard(); @@ -300,6 +350,8 @@ public class QemuMetaDataTest } else { assertEquals( SoundCardType.HD_AUDIO, soundCardType ); } + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -312,7 +364,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); final int numSoundDevsLibvirtDomainXmlBeforeAdd = vmLibvirtDomainConfig.getSoundDevices().size(); @@ -325,6 +377,8 @@ public class QemuMetaDataTest Sound addedSoundDevice = vmLibvirtDomainConfig.getSoundDevices().get( 0 ); assertEquals( Sound.Model.SB16, addedSoundDevice.getModel() ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -337,7 +391,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); EthernetDevType ethernetDeviceType = vmConfig.getEthernetDevType( 0 ); @@ -346,6 +400,8 @@ public class QemuMetaDataTest } else { assertEquals( EthernetDevType.PARAVIRT, ethernetDeviceType ); } + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -358,7 +414,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); vmConfig.setEthernetDevType( 0, EthernetDevType.E1000E ); @@ -366,6 +422,8 @@ public class QemuMetaDataTest Interface addedEthernetDevice = vmLibvirtDomainConfig.getInterfaceDevices().get( 0 ); assertEquals( Interface.Model.E1000E, addedEthernetDevice.getModel() ); } + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -378,7 +436,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); UsbSpeed maxUsbSpeed = vmConfig.getMaxUsbSpeed(); @@ -387,6 +445,8 @@ public class QemuMetaDataTest } else { assertEquals( UsbSpeed.USB3_0, maxUsbSpeed ); } + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } @ParameterizedTest @@ -399,7 +459,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); final int numUsbControllersLibvirtDomainXmlBeforeAdd = vmLibvirtDomainConfig.getUsbControllerDevices().size(); @@ -412,6 +472,8 @@ public class QemuMetaDataTest ControllerUsb addedUsbControllerDevice = vmLibvirtDomainConfig.getUsbControllerDevices().get( 0 ); assertEquals( ControllerUsb.Model.ICH9_EHCI1, addedUsbControllerDevice.getModel() ); + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } static Stream configAndEthernetTypeProvider() @@ -435,7 +497,7 @@ public class QemuMetaDataTest File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); QemuMetaData vmConfig = new QemuMetaData( null, file ); - Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); + final Domain vmLibvirtDomainConfig = QemuMetaDataTest.getPrivateDomainFromQemuMetaData( vmConfig ); final int numEthernetDevsLibvirtDomainXmlBeforeAdd = vmLibvirtDomainConfig.getInterfaceDevices().size(); @@ -464,5 +526,7 @@ public class QemuMetaDataTest assertEquals( QemuMetaData.NETWORK_DEFAULT_NAT, addedEthernetDevice.getSource() ); break; } + + assertDoesNotThrow​( () -> vmLibvirtDomainConfig.validateXml() ); } } -- cgit v1.2.3-55-g7522 From c5d35cf6b739444ba0d065203d8f21db86d0c8c1 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Fri, 30 Apr 2021 12:11:32 +0200 Subject: Fix errors in Javadoc comments --- .../java/org/openslx/libvirt/domain/Domain.java | 2 +- .../libvirt/domain/device/ControllerUsb.java | 2 +- .../org/openslx/libvirt/domain/device/Disk.java | 2 +- .../openslx/libvirt/domain/device/HostdevPci.java | 2 +- .../openslx/libvirt/domain/device/Interface.java | 6 +- .../org/openslx/libvirt/domain/device/Sound.java | 2 +- .../org/openslx/libvirt/domain/device/Video.java | 2 +- .../openslx/libvirt/xml/LibvirtXmlEditable.java | 72 +++++++++++----------- .../org/openslx/libvirt/xml/LibvirtXmlNode.java | 22 +++---- .../libvirt/xml/LibvirtXmlSchemaValidator.java | 5 +- .../libvirt/xml/LibvirtXmlSerializable.java | 12 ++++ .../java/org/openslx/virtualization/Version.java | 2 +- .../configuration/VirtualizationConfiguration.java | 9 ++- .../VirtualizationConfigurationQemuUtils.java | 2 +- ...alizationConfigurationVirtualboxFileFormat.java | 9 +-- ...onfigurationDataDozModClientToDozModServer.java | 6 +- ...onfigurationDataDozModServerToDozModClient.java | 6 +- ...igurationDataDozModServerToStatelessClient.java | 6 +- ...nfigurationLogicDozModClientToDozModServer.java | 2 +- ...nfigurationLogicDozModServerToDozModClient.java | 2 +- ...gurationLogicDozModServerToStatelessClient.java | 2 +- .../transformation/TransformationSpecific.java | 1 + src/main/java/org/openslx/vm/disk/DiskImage.java | 2 +- .../java/org/openslx/vm/disk/DiskImageQcow2.java | 4 +- .../java/org/openslx/vm/disk/DiskImageUtils.java | 8 +-- .../java/org/openslx/vm/disk/DiskImageVmdk.java | 3 +- 26 files changed, 109 insertions(+), 84 deletions(-) (limited to 'src/main/java/org/openslx/libvirt/domain/device') diff --git a/src/main/java/org/openslx/libvirt/domain/Domain.java b/src/main/java/org/openslx/libvirt/domain/Domain.java index dbc60e6..c8f5303 100644 --- a/src/main/java/org/openslx/libvirt/domain/Domain.java +++ b/src/main/java/org/openslx/libvirt/domain/Domain.java @@ -603,7 +603,7 @@ public class Domain extends LibvirtXmlDocument /** * Creates a CPU check from its name with error check. * - * @param mode name of the CPU check in the Libvirt domain XML document. + * @param check name of the CPU check in the Libvirt domain XML document. * @return valid CPU check. */ public static CpuCheck fromString( String check ) diff --git a/src/main/java/org/openslx/libvirt/domain/device/ControllerUsb.java b/src/main/java/org/openslx/libvirt/domain/device/ControllerUsb.java index 695167c..1798027 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/ControllerUsb.java +++ b/src/main/java/org/openslx/libvirt/domain/device/ControllerUsb.java @@ -122,7 +122,7 @@ public class ControllerUsb extends Controller /** * Creates USB controller device model from its name with error check. * - * @param type name of the USB controller device model in a Libvirt domain XML document. + * @param model name of the USB controller device model in a Libvirt domain XML document. * @return valid USB controller device model. */ public static Model fromString( String model ) diff --git a/src/main/java/org/openslx/libvirt/domain/device/Disk.java b/src/main/java/org/openslx/libvirt/domain/device/Disk.java index d9007f5..7694538 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/Disk.java +++ b/src/main/java/org/openslx/libvirt/domain/device/Disk.java @@ -195,7 +195,7 @@ public class Disk extends Device /** * Sets target device for the disk device. * - * @param target device for the disk device. + * @param targetDevice target device for the disk device. */ public void setTargetDevice( String targetDevice ) { diff --git a/src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java b/src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java index 3b26fb0..a0563f2 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java +++ b/src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java @@ -48,7 +48,7 @@ public class HostdevPci extends Hostdev * detached from the host before being passed on to the guest and reattached to the host after * the guest exits. * - * @return state whether PCI hostdev device is managed. + * @param managed state whether PCI hostdev device is managed or not. */ public void setManaged( boolean managed ) { diff --git a/src/main/java/org/openslx/libvirt/domain/device/Interface.java b/src/main/java/org/openslx/libvirt/domain/device/Interface.java index dae3c11..44b8e4c 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/Interface.java +++ b/src/main/java/org/openslx/libvirt/domain/device/Interface.java @@ -62,8 +62,8 @@ public class Interface extends Device /** * Sets type of the network device. - * - * @return type of the network device. + * + * @param type network device type. */ public void setType( Type type ) { @@ -327,7 +327,7 @@ public class Interface extends Device /** * Creates network interface device model from its name with error check. * - * @param type name of the network interface device model in a Libvirt domain XML document. + * @param model name of the network interface device model in a Libvirt domain XML document. * @return valid network interface device model. */ public static Model fromString( String model ) diff --git a/src/main/java/org/openslx/libvirt/domain/device/Sound.java b/src/main/java/org/openslx/libvirt/domain/device/Sound.java index e424ed4..dfeeffd 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/Sound.java +++ b/src/main/java/org/openslx/libvirt/domain/device/Sound.java @@ -111,7 +111,7 @@ public class Sound extends Device /** * Creates sound device model from its name with error check. * - * @param type name of the sound device model in a Libvirt domain XML document. + * @param model name of the sound device model in a Libvirt domain XML document. * @return valid sound device model. */ public static Model fromString( String model ) diff --git a/src/main/java/org/openslx/libvirt/domain/device/Video.java b/src/main/java/org/openslx/libvirt/domain/device/Video.java index e901b85..0f8861f 100644 --- a/src/main/java/org/openslx/libvirt/domain/device/Video.java +++ b/src/main/java/org/openslx/libvirt/domain/device/Video.java @@ -171,7 +171,7 @@ public class Video extends Device /** * Creates video device model from its name with error check. * - * @param type name of the video device model in a Libvirt domain XML document. + * @param model name of the video device model in a Libvirt domain XML document. * @return valid video device model. */ public static Model fromString( String model ) diff --git a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlEditable.java b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlEditable.java index 1ddddce..40d7b86 100644 --- a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlEditable.java +++ b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlEditable.java @@ -4,7 +4,7 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** - * Editability of XML nodes based on {@link XPath} expressions. + * Editability of XML nodes based on XPath expressions. * * @author Manuel Bentele * @version 1.0 @@ -12,17 +12,17 @@ import org.w3c.dom.NodeList; public interface LibvirtXmlEditable { /** - * Returns XML node selected by a {@link XPath} expression + * Returns XML node selected by a XPath expression * - * @param expression {@link XPath} expression to select XML node. + * @param expression XPath expression to select XML node. * @return selected XML node. */ public Node getXmlNode( String expression ); /** - * Returns XML nodes selected by a {@link XPath} expression + * Returns XML nodes selected by a XPath expression * - * @param expression {@link XPath} expression to select XML nodes. + * @param expression XPath expression to select XML nodes. * @return selected XML nodes. */ public NodeList getXmlNodes( String expression ); @@ -38,20 +38,20 @@ public interface LibvirtXmlEditable } /** - * Returns XML element from selection by a {@link XPath} expression. + * Returns XML element from selection by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @return selected XML element. */ public Node getXmlElement( String expression ); /** - * Sets an XML element selected by a {@link XPath} expression. + * Sets an XML element selected by a XPath expression. * - * If the XML element selected by the given {@link XPath} expression does not exists, the XML + * If the XML element selected by the given XPath expression does not exists, the XML * element will be created. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. */ public default void setXmlElement( String expression ) { @@ -59,43 +59,43 @@ public interface LibvirtXmlEditable } /** - * Sets a XML element selected by a {@link XPath} expression and appends child XML node. + * Sets a XML element selected by a XPath expression and appends child XML node. * - * If the XML element selected by the given {@link XPath} expression does not exists, the XML + * If the XML element selected by the given XPath expression does not exists, the XML * element will be created and the given XML child node is appended. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @param child XML node that will be appended to the selected XML element. */ public void setXmlElement( String expression, Node child ); /** - * Returns the text value of a XML element selected by a {@link XPath} expression. + * Returns the text value of a XML element selected by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @return Text value of the selected XML element. */ public String getXmlElementValue( String expression ); /** - * Sets the text value of a XML element selected by a {@link XPath} expression. + * Sets the text value of a XML element selected by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @param value text value to set selected XML element's text. */ public void setXmlElementValue( String expression, String value ); /** - * Removes a XML element and all its childs selected by a {@link XPath} expression. + * Removes a XML element and all its childs selected by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. */ public void removeXmlElement( String expression ); /** - * Removes all child elements of a XML element selected by a {@link XPath} expression. + * Removes all child elements of a XML element selected by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. */ public void removeXmlElementChilds( String expression ); @@ -128,14 +128,14 @@ public interface LibvirtXmlEditable } /** - * Returns the binary choice of a XML attribute from a XML element selected by a - * {@link XPath}expression. + * Returns the binary choice of a XML attribute from a XML element selected by a XPath + * expression. * * If the text value of the XML attribute equals to yes, the returned {@link boolean} * value is set to true. Otherwise, if the text value of the XML attribute equals to * no, the returned {@link boolean} value is set to false. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @param attributeName name to select XML attribute of the current XML root element. * @return attribute value of the XML attribute from the current XML root element as * {@link boolean}. @@ -146,10 +146,9 @@ public interface LibvirtXmlEditable } /** - * Returns the text value of a XML attribute from a XML element selected by a - * {@link XPath}expression. + * Returns the text value of a XML attribute from a XML element selected by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @param attributeName name to select XML attribute of the selected XML element. * @return attribute text of the XML attribute from the selected XML element. */ @@ -185,15 +184,15 @@ public interface LibvirtXmlEditable } /** - * Sets the binary choice value of a XML attribute from a XML element selected by a - * {@link XPath} expression. + * Sets the binary choice value of a XML attribute from a XML element selected by a XPath + * expression. * * If the binary choice value for the XML attribute equals to true, the text value of the * selected XML attribute is set to yes. Otherwise, if the binary choice value for the * selected XML attribute equals to false, the text value of the selected XML attribute is * set to no. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @param attributeName name to select XML attribute of the selected XML element. * @param value binary choice value for the selected XML attribute from the selected XML element. */ @@ -204,10 +203,9 @@ public interface LibvirtXmlEditable } /** - * Sets the text value of a XML attribute from a XML element selected by a - * {@link XPath} expression. + * Sets the text value of a XML attribute from a XML element selected by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @param attributeName name to select XML attribute of the selected XML element. * @param value XML attribute value for the selected XML attribute from the selected XML element. */ @@ -224,17 +222,17 @@ public interface LibvirtXmlEditable } /** - * Removes an XML attribute from a XML element selected by a {@link XPath} expression. + * Removes an XML attribute from a XML element selected by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. * @param attributeName name of the attribute which should be deleted. */ public void removeXmlElementAttribute( String expression, String attributeName ); /** - * Removes all XML attributes from a XML element selected by a {@link XPath} expression. + * Removes all XML attributes from a XML element selected by a XPath expression. * - * @param expression {@link XPath} expression to select XML element. + * @param expression XPath expression to select XML element. */ public void removeXmlElementAttributes( String expression ); diff --git a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlNode.java b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlNode.java index 93e28de..6d00271 100644 --- a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlNode.java +++ b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlNode.java @@ -12,7 +12,7 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** - * A representation of a XML node as part of a {@link LibvirtXMLDocument}. + * A representation of a XML node as part of a {@link LibvirtXmlDocument}. * * @author Manuel Bentele * @version 1.0 @@ -20,17 +20,17 @@ import org.w3c.dom.NodeList; public class LibvirtXmlNode implements LibvirtXmlCreatable, LibvirtXmlEditable { /** - * Separation character for internal {@link XPath} expressions. + * Separation character for internal XPath expressions. */ private static final String XPATH_EXPRESSION_SEPARATOR = "/"; /** - * Current XML node selection character for internal {@link XPath} expressions. + * Current XML node selection character for internal XPath expressions. */ private static final String XPATH_EXPRESSION_CURRENT_NODE = "."; /** - * Factory to create {@link XPath} objects. + * Factory to create XPath objects. */ private XPathFactory xPathFactory = null; @@ -40,13 +40,12 @@ public class LibvirtXmlNode implements LibvirtXmlCreatable, LibvirtXmlEditable private Document xmlDocument = null; /** - * Current XML base node as XML root anchor for relative internal {@link XPath} expressions. + * Current XML base node as XML root anchor for relative internal XPath expressions. */ private Node xmlBaseNode = null; /** - * Create and initialize {@link XPath} context to define and compile custom {@link XPath} - * expressions. + * Create and initialize XPath context to define and compile custom XPath expressions. */ private void createXPathContext() { @@ -139,8 +138,7 @@ public class LibvirtXmlNode implements LibvirtXmlCreatable, LibvirtXmlEditable /** * Returns current XML base node. * - * @return current XML base node as XML root anchor of relative internal {@link XPath} - * expressions. + * @return current XML base node as XML root anchor of relative internal XPath expressions. */ public Node getXmlBaseNode() { @@ -150,8 +148,8 @@ public class LibvirtXmlNode implements LibvirtXmlCreatable, LibvirtXmlEditable /** * Sets existing XML base node for Libvirt XML node. * - * @param xmlBaseNode existing XML base node as XML root anchor for relative internal - * {@link XPath} expressions. + * @param xmlBaseNode existing XML base node as XML root anchor for relative internal XPath + * expressions. */ public void setXmlBaseNode( Node xmlBaseNode ) { @@ -317,7 +315,7 @@ public class LibvirtXmlNode implements LibvirtXmlCreatable, LibvirtXmlEditable attribute.setNodeValue( value ); } } - + @Override public void removeXmlElementAttribute( String expression, String attributeName ) { diff --git a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlSchemaValidator.java b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlSchemaValidator.java index e074948..bc8f90f 100644 --- a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlSchemaValidator.java +++ b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlSchemaValidator.java @@ -196,8 +196,9 @@ public class LibvirtXmlSchemaValidator /** * Creates a validator for validation of Libvirt XML documents with RelaxNG schemas. * - * @param rngSchema - * @throws SAXException + * @param rngSchema RelaxNG schema used for validation with {@link #validate(Document)}. + * + * @throws SAXException creation of a Libvirt XML validator failed. */ public LibvirtXmlSchemaValidator( InputStream rngSchema ) throws SAXException { diff --git a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlSerializable.java b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlSerializable.java index 6f11ce5..4cd0a32 100644 --- a/src/main/java/org/openslx/libvirt/xml/LibvirtXmlSerializable.java +++ b/src/main/java/org/openslx/libvirt/xml/LibvirtXmlSerializable.java @@ -17,6 +17,8 @@ public abstract interface LibvirtXmlSerializable * Serialize Libvirt XML document from {@link String}. * * @param xml {@link String} containing XML content. + * + * @throws LibvirtXmlSerializationException serialization of Libvirt XML document failed. */ public void fromXml( String xml ) throws LibvirtXmlSerializationException; @@ -24,6 +26,8 @@ public abstract interface LibvirtXmlSerializable * Serialize Libvirt XML document from {@link File}. * * @param xml {@link File} containing XML content. + * + * @throws LibvirtXmlSerializationException serialization of Libvirt XML document failed. */ public void fromXml( File xml ) throws LibvirtXmlSerializationException; @@ -31,6 +35,8 @@ public abstract interface LibvirtXmlSerializable * Serialize Libvirt XML document from {@link InputStream}. * * @param xml {@link InputStream} providing XML content. + * + * @throws LibvirtXmlSerializationException serialization of Libvirt XML document failed. */ void fromXml( InputStream xml ) throws LibvirtXmlSerializationException; @@ -38,6 +44,8 @@ public abstract interface LibvirtXmlSerializable * Serialize Libvirt XML document from {@link InputSource}. * * @param xml {@link InputSource} providing XML content. + * + * @throws LibvirtXmlSerializationException serialization of Libvirt XML document failed. */ public void fromXml( InputSource xml ) throws LibvirtXmlSerializationException; @@ -45,6 +53,8 @@ public abstract interface LibvirtXmlSerializable * Serialize Libvirt XML document to {@link String}. * * @return XML {@link String} containing Libvirt XML document content. + * + * @throws LibvirtXmlSerializationException serialization of Libvirt XML document failed. */ public String toXml() throws LibvirtXmlSerializationException; @@ -52,6 +62,8 @@ public abstract interface LibvirtXmlSerializable * Serialize Libvirt XML document to {@link File}. * * @param xml XML {@link File} containing Libvirt XML document content. + * + * @throws LibvirtXmlSerializationException serialization of Libvirt XML document failed. */ public void toXml( File xml ) throws LibvirtXmlSerializationException; } diff --git a/src/main/java/org/openslx/virtualization/Version.java b/src/main/java/org/openslx/virtualization/Version.java index efc23af..5d99ac1 100644 --- a/src/main/java/org/openslx/virtualization/Version.java +++ b/src/main/java/org/openslx/virtualization/Version.java @@ -24,7 +24,7 @@ public class Version implements Comparable * The version consists of a major version, whereas the minor version is set to the value * 0 and the version name is undefined. * - * @param major + * @param major major version. */ public Version( short major ) { diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java index b8e46ed..0ecd693 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfiguration.java @@ -173,6 +173,8 @@ public abstract class VirtualizationConfiguration /** * Get operating system of this VM. + * + * @return operating system of the VM. */ public OperatingSystem getOs() { @@ -181,6 +183,8 @@ public abstract class VirtualizationConfiguration /** * Get all hard disks of this VM. + * + * @return list of hard disks of the VM. */ public List getHdds() { @@ -189,6 +193,8 @@ public abstract class VirtualizationConfiguration /** * Get display name of VM. + * + * @return display name of the VM. */ public String getDisplayName() { @@ -252,6 +258,7 @@ public abstract class VirtualizationConfiguration * @param osList List of supported operating systems * @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 + * @throws IOException failed to read machine description from specified file. */ public static VirtualizationConfiguration getInstance( List osList, File file ) throws IOException @@ -288,7 +295,7 @@ public abstract class VirtualizationConfiguration * @param vmContent VM's machine description as byte array (e.g. stored in DB) * @param length length of the byte array given as vmContent * @return VmMetaData object representing the relevant parts of the given machine description - * @throws IOException + * @throws IOException failed to read machine description from specified byte stream. */ public static VirtualizationConfiguration getInstance( List osList, byte[] vmContent, int length ) diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuUtils.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuUtils.java index 7ac3632..0288029 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuUtils.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuUtils.java @@ -116,7 +116,7 @@ public class VirtualizationConfigurationQemuUtils /** * Converts a Libvirt network device model to a VM metadata ethernet device type. * - * @param soundDeviceModel Libvirt network device model. + * @param networkDeviceModel Libvirt network device model. * @return VM metadata ethernet device type. */ public static EthernetDevType convertNetworkDeviceModel( Interface.Model networkDeviceModel ) diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java index 6a1f5a5..a0e1a1f 100644 --- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java +++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java @@ -116,7 +116,7 @@ public class VirtualizationConfigurationVirtualboxFileFormat * * @param machineDescription content of the XML file saved as a byte array. * @param length of the machine description byte array. - * @throws IOException if an + * @throws VirtualizationConfigurationException creation of VirtualBox configuration file representation failed. */ public VirtualizationConfigurationVirtualboxFileFormat( byte[] machineDescription, int length ) throws VirtualizationConfigurationException { @@ -313,7 +313,7 @@ public class VirtualizationConfigurationVirtualboxFileFormat /** * Function finds and saves the name of the guest OS * - * @throws XPathExpressionException + * @throws XPathExpressionException failed to find and retrieve name of the guest OS. */ public void setOsType() throws XPathExpressionException { @@ -336,7 +336,7 @@ public class VirtualizationConfigurationVirtualboxFileFormat /** * Search for attached hard drives and determine their controller and their path. * - * @throws XPathExpressionException + * @throws XPathExpressionException failed to find attached hard drives and their controllers. */ public void setHdds() throws XPathExpressionException { @@ -452,6 +452,7 @@ public class VirtualizationConfigurationVirtualboxFileFormat * @param elementXPath given as an xpath expression * @param attribute attribute to change * @param value to set the attribute to + * @return state of the change operation whether the attribute was changed successful or not. */ public boolean changeAttribute( String elementXPath, String attribute, String value ) { @@ -491,7 +492,7 @@ public class VirtualizationConfigurationVirtualboxFileFormat * Adds a new node named nameOfNewNode to the given parent found by parentXPath. * * @param parentXPath XPath expression to the parent - * @param nameOfnewNode name of the node to be added + * @param childName name of the node to be added * @return the newly added Node */ public Node addNewNode( String parentXPath, String childName ) diff --git a/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModClientToDozModServer.java b/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModClientToDozModServer.java index 0d0c457..8a08d05 100644 --- a/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModClientToDozModServer.java +++ b/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModClientToDozModServer.java @@ -2,7 +2,8 @@ package org.openslx.virtualization.configuration.data; /** * Data container to collect and store input arguments for a - * {@link ConfigurationLogicDozModClientToDozModServer} transformation. + * {@link org.openslx.virtualization.configuration.logic.ConfigurationLogicDozModClientToDozModServer} + * transformation. * * @author Manuel Bentele * @version 1.0 @@ -11,7 +12,8 @@ public class ConfigurationDataDozModClientToDozModServer { /** * Creates a new data container to collect and store input arguments for a - * {@link ConfigurationLogicDozModClientToDozModServer} transformation. + * {@link org.openslx.virtualization.configuration.logic.ConfigurationLogicDozModClientToDozModServer} + * transformation. */ public ConfigurationDataDozModClientToDozModServer() { diff --git a/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModServerToDozModClient.java b/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModServerToDozModClient.java index 7b1c0b4..4e18d48 100644 --- a/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModServerToDozModClient.java +++ b/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModServerToDozModClient.java @@ -6,7 +6,8 @@ import org.openslx.bwlp.thrift.iface.OperatingSystem; /** * Data container to collect and store input arguments for a - * {@link ConfigurationLogicDozModServerToDozModClient} transformation. + * {@link org.openslx.virtualization.configuration.logic.ConfigurationLogicDozModServerToDozModClient} + * transformation. * * @author Manuel Bentele * @version 1.0 @@ -40,7 +41,8 @@ public class ConfigurationDataDozModServerToDozModClient /** * Creates a new data container to collect and store input arguments for a - * {@link ConfigurationLogicDozModServerToDozModClient} transformation. + * {@link org.openslx.virtualization.configuration.logic.ConfigurationLogicDozModServerToDozModClient} + * transformation. * * @param displayName display name for a transformation of a virtualization configuration. * @param diskImage disk image file for a transformation of a virtualization configuration. diff --git a/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModServerToStatelessClient.java b/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModServerToStatelessClient.java index e92df92..65cc7ce 100644 --- a/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModServerToStatelessClient.java +++ b/src/main/java/org/openslx/virtualization/configuration/data/ConfigurationDataDozModServerToStatelessClient.java @@ -2,7 +2,8 @@ package org.openslx.virtualization.configuration.data; /** * Data container to collect and store input arguments for a - * {@link ConfigurationLogicDozModServerToStatelessClient} transformation. + * {@link org.openslx.virtualization.configuration.logic.ConfigurationLogicDozModServerToStatelessClient} + * transformation. * * @author Manuel Bentele * @version 1.0 @@ -27,7 +28,8 @@ public class ConfigurationDataDozModServerToStatelessClient /** * Creates a new data container to collect and store input arguments for a - * {@link ConfigurationLogicDozModServerToStatelessClient} transformation. + * {@link org.openslx.virtualization.configuration.logic.ConfigurationLogicDozModServerToStatelessClient} + * transformation. * * @param displayName display name for a transformation of a virtualization configuration. * @param osId operating system identifier for a transformation of a virtualization diff --git a/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServer.java b/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServer.java index d64f42a..f375693 100644 --- a/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServer.java +++ b/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModClientToDozModServer.java @@ -14,7 +14,7 @@ import org.openslx.virtualization.configuration.transformation.TransformationExc * *
  *   +------------------------------+  DozModClientToDozModServer   +------------------------------+
- *   | virtualization configuration | ----------------------------> | virtualization configuration |
+ *   | virtualization configuration | ----------------------------▶ | virtualization configuration |
  *   +---------------+--------------+     transformation logic      +---------------+--------------+
  *   | dozmod-client |                                              | dozmod-server |
  *   +---------------+                                              +---------------+
diff --git a/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClient.java b/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClient.java
index 05b3d4a..06c8ad1 100644
--- a/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClient.java
+++ b/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToDozModClient.java
@@ -18,7 +18,7 @@ import org.openslx.virtualization.configuration.transformation.TransformationExc
  * 
  * 
  *   +------------------------------+  DozModServerToDozModClient   +------------------------------+
- *   | virtualization configuration | ----------------------------> | virtualization configuration |
+ *   | virtualization configuration | ----------------------------▶ | virtualization configuration |
  *   +---------------+--------------+     transformation logic      +---------------+--------------+
  *   | dozmod-server |                                              | dozmod-client |
  *   +---------------+                                              +---------------+
diff --git a/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java b/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java
index 580b0fc..30d690a 100644
--- a/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java
+++ b/src/main/java/org/openslx/virtualization/configuration/logic/ConfigurationLogicDozModServerToStatelessClient.java
@@ -16,7 +16,7 @@ import org.openslx.virtualization.configuration.transformation.TransformationExc
  * 
  * 
  *   +------------------------------+  DozModServerToStatelessClient   +------------------------------+
- *   | virtualization configuration | -------------------------------> | virtualization configuration |
+ *   | virtualization configuration | -------------------------------▶ | virtualization configuration |
  *   +---------------+--------------+      transformation logic        +------------------+-----------+
  *   | dozmod-server |                                                 | stateless client |
  *   +---------------+                                                 +------------------+
diff --git a/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationSpecific.java b/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationSpecific.java
index 5b13f45..7038abf 100644
--- a/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationSpecific.java
+++ b/src/main/java/org/openslx/virtualization/configuration/transformation/TransformationSpecific.java
@@ -23,6 +23,7 @@ public abstract class TransformationSpecific extends Transformationtrue if image type is supported by the virtualizer; otherwise
 		 *         false.
 		 */
diff --git a/src/main/java/org/openslx/vm/disk/DiskImageQcow2.java b/src/main/java/org/openslx/vm/disk/DiskImageQcow2.java
index 04e61ea..657c144 100644
--- a/src/main/java/org/openslx/vm/disk/DiskImageQcow2.java
+++ b/src/main/java/org/openslx/vm/disk/DiskImageQcow2.java
@@ -51,7 +51,7 @@ public class DiskImageQcow2 extends DiskImage
 	/**
 	 * Creates a new QCOW2 disk image from an existing QCOW2 image file.
 	 * 
-	 * @param diskImage file to a QCOW2 disk storing the image content.
+	 * @param disk file to a QCOW2 disk storing the image content.
 	 * 
 	 * @throws FileNotFoundException cannot find specified QCOW2 disk image file.
 	 * @throws IOException cannot access the content of the QCOW2 disk image file.
@@ -64,7 +64,7 @@ public class DiskImageQcow2 extends DiskImage
 	/**
 	 * Creates a new QCOW2 disk image from an existing QCOW2 image file.
 	 * 
-	 * @param diskImage file to a QCOW2 disk storing the image content.
+	 * @param disk file to a QCOW2 disk storing the image content.
 	 */
 	public DiskImageQcow2( RandomAccessFile disk )
 	{
diff --git a/src/main/java/org/openslx/vm/disk/DiskImageUtils.java b/src/main/java/org/openslx/vm/disk/DiskImageUtils.java
index cc29721..ccb053f 100644
--- a/src/main/java/org/openslx/vm/disk/DiskImageUtils.java
+++ b/src/main/java/org/openslx/vm/disk/DiskImageUtils.java
@@ -114,12 +114,12 @@ public class DiskImageUtils
 	}
 
 	/**
-	 * Reads two bytes ({@link Short}) at a given offset from the specified disk image
-	 * file.
+	 * Reads a variable number of bytes (numBytes) at a given offset from the specified disk image file.
 	 * 
 	 * @param diskImage file to a disk storing the image content.
-	 * @param offset offset in bytes for reading the two bytes.
-	 * @return value of the two bytes from the disk image file as {@link Short}.
+	 * @param offset offset in bytes for reading numBytes bytes.
+	 * @param numBytes number of bytes to read at offset.
+	 * @return read bytes from the disk image file as {@link String}.
 	 * 
 	 * @throws DiskImageException unable to read two bytes from the disk image file.
 	 */
diff --git a/src/main/java/org/openslx/vm/disk/DiskImageVmdk.java b/src/main/java/org/openslx/vm/disk/DiskImageVmdk.java
index 7f59bc3..b2f45a1 100644
--- a/src/main/java/org/openslx/vm/disk/DiskImageVmdk.java
+++ b/src/main/java/org/openslx/vm/disk/DiskImageVmdk.java
@@ -183,7 +183,8 @@ public class DiskImageVmdk extends DiskImage
 	 * 
 	 * @return hardware version from the VMDK's embedded descriptor file.
 	 * 
-	 * @throws DiskImageException
+	 * @throws DiskImageException unable to obtain the VMDK's hardware version of the disk image
+	 *            format.
 	 */
 	public Version getHwVersion() throws DiskImageException
 	{
-- 
cgit v1.2.3-55-g7522