@@ -904,13 +904,21 @@ public Answer attachIso(final AttachCommand cmd) {
904904 final DiskTO disk = cmd .getDisk ();
905905 final TemplateObjectTO isoTO = (TemplateObjectTO )disk .getData ();
906906 final DataStoreTO store = isoTO .getDataStore ();
907- if (!(store instanceof NfsTO )) {
907+ String dataStoreUrl = null ;
908+ if (store instanceof NfsTO ) {
909+ NfsTO nfsStore = (NfsTO )store ;
910+ dataStoreUrl = nfsStore .getUrl ();
911+ } else if (store instanceof PrimaryDataStoreTO && ((PrimaryDataStoreTO ) store ).getPoolType ().equals (StoragePoolType .NetworkFilesystem )) {
912+ //In order to support directly downloaded ISOs
913+ String psHost = ((PrimaryDataStoreTO ) store ).getHost ();
914+ String psPath = ((PrimaryDataStoreTO ) store ).getPath ();
915+ dataStoreUrl = "nfs://" + psHost + File .separator + psPath ;
916+ } else {
908917 return new AttachAnswer ("unsupported protocol" );
909918 }
910- final NfsTO nfsStore = (NfsTO )store ;
911919 try {
912920 final Connect conn = LibvirtConnection .getConnectionByVmName (cmd .getVmName ());
913- attachOrDetachISO (conn , cmd .getVmName (), nfsStore . getUrl () + File .separator + isoTO .getPath (), true );
921+ attachOrDetachISO (conn , cmd .getVmName (), dataStoreUrl + File .separator + isoTO .getPath (), true );
914922 } catch (final LibvirtException e ) {
915923 return new Answer (cmd , false , e .toString ());
916924 } catch (final URISyntaxException e ) {
0 commit comments