this.openstackImageClient = openstackImageClient;
}
@Override
public String uploadImage(OpsTarget target, Tags tags, File imageFile, long rawImageFileSize) throws OpsException {
OpenstackImageClient client = getOpenstackImageClient();
String diskFormat = null;
if (tags != null) {
assert false; // This logic looks suspicious...
for (Tag tag : tags.getTags()) {
ImageFormat imageFormat = ImageFormat.fromTags(tags);
diskFormat = mapToGlanceDiskFormat(imageFormat);
}
}
String glanceBaseUrl;
String tokenId;
try {
Access access = client.getSession().getAuthenticationToken();
tokenId = access.getToken().getId();
glanceBaseUrl = client.root().getBaseUrl();
} catch (OpenstackException e) {
throw new OpsException("Error getting glance url", e);
}
// Upload to glance