@@ -2722,25 +2722,25 @@ public String getVolumePath(final Connect conn, final DiskTO volume) throws Libv
27222722 public String getVolumePath (final Connect conn , final DiskTO volume , boolean diskOnHostCache ) throws LibvirtException , URISyntaxException {
27232723 final DataTO data = volume .getData ();
27242724 final DataStoreTO store = data .getDataStore ();
2725+ final String dataPath = data .getPath ();
27252726
2726- if (volume .getType () == Volume .Type .ISO && data .getPath () != null && (store instanceof NfsTO ||
2727- store instanceof PrimaryDataStoreTO && data instanceof TemplateObjectTO && !((TemplateObjectTO ) data ).isDirectDownload ())) {
2728-
2729- if (data .getPath ().startsWith (ConfigDrive .CONFIGDRIVEDIR ) && diskOnHostCache ) {
2730- String configDrivePath = getConfigPath () + "/" + data .getPath ();
2731- return configDrivePath ;
2727+ if (volume .getType () == Volume .Type .ISO && dataPath != null ) {
2728+ if (dataPath .startsWith (ConfigDrive .CONFIGDRIVEDIR ) && diskOnHostCache ) {
2729+ return getConfigPath () + "/" + data .getPath ();
27322730 }
27332731
2734- final String isoPath = store . getUrl (). split ( " \\ ?" )[ 0 ] + File . separator + data . getPath ();
2735- final int index = isoPath . lastIndexOf ( "/" ) ;
2736- final String path = isoPath .substring ( 0 , index );
2737- final String name = isoPath .substring (index + 1 );
2738- final KVMStoragePool secondaryPool = _storagePoolMgr . getStoragePoolByURI ( path );
2739- final KVMPhysicalDisk isoVol = secondaryPool . getPhysicalDisk ( name );
2740- return isoVol . getPath ( );
2741- } else {
2742- return data . getPath ();
2732+ if ( store instanceof NfsTO || store instanceof PrimaryDataStoreTO && data instanceof TemplateObjectTO && !(( TemplateObjectTO ) data ). isDirectDownload ()) {
2733+ final String isoPath = store . getUrl (). split ( " \\ ?" )[ 0 ] + File . separator + dataPath ;
2734+ final int index = isoPath .lastIndexOf ( "/" );
2735+ final String path = isoPath .substring (0 , index );
2736+ final String name = isoPath . substring ( index + 1 );
2737+ final KVMStoragePool secondaryPool = _storagePoolMgr . getStoragePoolByURI ( path );
2738+ final KVMPhysicalDisk isoVol = secondaryPool . getPhysicalDisk ( name );
2739+ return isoVol . getPath ();
2740+ }
27432741 }
2742+
2743+ return dataPath ;
27442744 }
27452745
27462746 public void createVbd (final Connect conn , final VirtualMachineTO vmSpec , final String vmName , final LibvirtVMDef vm ) throws InternalErrorException , LibvirtException , URISyntaxException {
0 commit comments