From c3c0c248cc701af1d44f85277aa0fc96ff6b77c8 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 17 Apr 2018 15:55:26 +0200 Subject: [vbox] reworked VDI disk validation --- src/main/java/org/openslx/util/vm/VboxConfig.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/org/openslx/util/vm/VboxConfig.java') diff --git a/src/main/java/org/openslx/util/vm/VboxConfig.java b/src/main/java/org/openslx/util/vm/VboxConfig.java index 99ef5be..7440b1d 100644 --- a/src/main/java/org/openslx/util/vm/VboxConfig.java +++ b/src/main/java/org/openslx/util/vm/VboxConfig.java @@ -256,6 +256,11 @@ public class VboxConfig // take the uuid String uuid = hddElement.getAttribute( "uuid" ); // search in the xml object and give back the parent of the parent of the node that is called Image and has the given uuid + String type = hddElement.getAttribute( "type" ); + if ( !type.equals( "Normal" ) && !type.equals( "Writethrough" ) ) { + LOGGER.warn( "Type of the disk file is neither 'Normal' nor 'Writethrough' but: " + type ); + LOGGER.warn( "This makes the image not directly modificable, which might lead to problems when editing it locally." ); + } String pathToParent = givePathToStorageController( uuid ); XPathExpression attachedDevicesExpr = xPath.compile( pathToParent ); Object devicesResult = attachedDevicesExpr.evaluate( this.doc, XPathConstants.NODESET ); @@ -265,6 +270,10 @@ public class VboxConfig LOGGER.error( "There can not be more HDDs with the same UUID!" ); return; } + if ( devicesNodes.getLength() == 0 ) { + LOGGER.error( "Image with UUID '" + uuid + "' does not seem connected to any storage controller. Is it a snapshot?" ); + return; + } Element deviceElement = (Element)devicesNodes.item( 0 ); String controllerDevice = deviceElement.getAttribute( "type" ); String bus = deviceElement.getAttribute( "name" ); -- cgit v1.2.3-55-g7522