Generate image repo token only if needed
@@ -994,13 +994,19 @@ public class GenericVIM extends Vim {
+ ")");
if (vimInstance instanceof OpenstackVimInstance) {
+ if (((NFVImage) imageToUpload).isStoredLocally()) {
String imageRepoToken = "";
try {
imageRepoToken = securityServerConfig.getNewImageToken(imageToUpload.getId());
- return client.addImage(vimInstance, imageToUpload, url, imageRepoToken).getExtId();
+ return client
+ .addImage(vimInstance, imageToUpload, url, imageRepoToken)
+ .getExtId();
} finally {
securityServerConfig.removeImageToken(imageRepoToken);
}
+ } else {
+ return client.addImage(vimInstance, imageToUpload, url).getExtId();
+ }
}
}
} catch (VimDriverException e) {
