Dettach ISO and direct download label fixes

This commit is contained in:
nvazquez 2018-01-15 09:12:05 -03:00
parent e3ec10b826
commit e54071e674
2 changed files with 14 additions and 4 deletions

View File

@ -2139,5 +2139,5 @@ state.Stopping=Stopping
state.Suspended=Suspended
ui.listView.filters.all=All
ui.listView.filters.mine=Mine
label.directdownload=bypass secondary storage
label.direct.download=Direct Download
label.checksum=checksum

View File

@ -902,13 +902,23 @@ public class KVMStorageProcessor implements StorageProcessor {
DiskTO disk = cmd.getDisk();
TemplateObjectTO isoTO = (TemplateObjectTO)disk.getData();
DataStoreTO store = isoTO.getDataStore();
if (!(store instanceof NfsTO)) {
String dataStoreUrl;
if (store instanceof NfsTO) {
NfsTO nfsStore = (NfsTO)store;
dataStoreUrl = nfsStore.getUrl();
} else if (store instanceof PrimaryDataStoreTO && ((PrimaryDataStoreTO) store).getPoolType().equals(StoragePoolType.NetworkFilesystem)) {
//In order to support directly downloaded ISOs
String psHost = ((PrimaryDataStoreTO) store).getHost();
String psPath = ((PrimaryDataStoreTO) store).getPath();
dataStoreUrl = "nfs://" + psHost + File.separator + psPath;
} else {
return new AttachAnswer("unsupported protocol");
}
NfsTO nfsStore = (NfsTO)store;
try {
Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
attachOrDetachISO(conn, cmd.getVmName(), nfsStore.getUrl() + File.separator + isoTO.getPath(), false);
attachOrDetachISO(conn, cmd.getVmName(), dataStoreUrl + File.separator + isoTO.getPath(), false);
} catch (LibvirtException e) {
return new Answer(cmd, false, e.toString());
} catch (URISyntaxException e) {