public String getFileExtension() { if (fileExtension == null) return toString().toLowerCase(); return fileExtension; }
String userSelectedFormat = uploadEntity.getFormat().toString(); if (uploadedFileExtension.equals("zip") || uploadedFileExtension.equals("bz2") || uploadedFileExtension.equals("gz")) { userSelectedFormat += "." + uploadedFileExtension;
processor = new RawImageProcessor(); } else { throw new ConfigurationException("Unknown image format " + srcFormat.toString());
RegisterVolumePayload payload = new RegisterVolumePayload(volumeHost.getDownloadUrl(), volumeHost.getChecksum(), vol.getFormat().toString()); vol.addPayload(payload); createVolumeAsync(vol, store);
data.put(StartAnswer.IMAGE_FORMAT, Storage.ImageFormat.VHD.toString());
.getChecksum(), tmpl.getType().toString(), template.getUniqueName(), template.getFormat().toString(), templateOnStore.getDataStore().getUri(), templateOnStore.getDataStore().getRole().toString());
String uuid = UUID.randomUUID().toString() + "." + format.toString().toLowerCase(); DataStore secStore = storeMgr.getDataStore(ApiDBUtils.findUploadById(uploadId).getDataStoreId(), DataStoreRole.Image); EndPoint ep = _epSelector.select(secStore);
volume.setFormat(PhysicalDiskFormat.valueOf(srcFormat.toString()));
volume.setFormat(PhysicalDiskFormat.valueOf(srcFormat.toString()));
vol.getName(), vol.getFormat().toString(), dataObject.getDataStore().getUri(), dataObject.getDataStore().getRole().toString()); command.setLocalPath(volumeStore.getLocalDownloadPath());
@Override public Answer createVolume(final CreateObjectCommand cmd) { final VolumeObjectTO volume = (VolumeObjectTO)cmd.getData(); final PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)volume.getDataStore(); KVMStoragePool primaryPool = null; KVMPhysicalDisk vol = null; long disksize; try { primaryPool = storagePoolMgr.getStoragePool(primaryStore.getPoolType(), primaryStore.getUuid()); disksize = volume.getSize(); PhysicalDiskFormat format; if (volume.getFormat() == null) { format = primaryPool.getDefaultFormat(); } else { format = PhysicalDiskFormat.valueOf(volume.getFormat().toString().toUpperCase()); } vol = primaryPool.createPhysicalDisk(volume.getUuid(), format, volume.getProvisioningType(), disksize); final VolumeObjectTO newVol = new VolumeObjectTO(); if(vol != null) { newVol.setPath(vol.getName()); } newVol.setSize(volume.getSize()); newVol.setFormat(ImageFormat.valueOf(format.toString().toUpperCase())); return new CreateObjectAnswer(newVol); } catch (final Exception e) { s_logger.debug("Failed to create volume: ", e); return new CreateObjectAnswer(e.toString()); } }
@Override public TemplateProfile prepare(RegisterIsoCmd cmd) throws ResourceAllocationException { //check if the caller can operate with the template owner Account caller = CallContext.current().getCallingAccount(); Account owner = _accountMgr.getAccount(cmd.getEntityOwnerId()); _accountMgr.checkAccess(caller, null, true, owner); List<Long> zoneList = null; Long zoneId = cmd.getZoneId(); // ignore passed zoneId if we are using region wide image store List<ImageStoreVO> stores = _imgStoreDao.findRegionImageStores(); if (CollectionUtils.isEmpty(stores) && zoneId != null && zoneId > 0L) { zoneList = new ArrayList<>(); zoneList.add(zoneId); } return prepare(true, CallContext.current().getCallingUserId(), cmd.getIsoName(), cmd.getDisplayText(), 64, cmd.isPasswordEnabled(), true, cmd.getUrl(), cmd.isPublic(), cmd.isFeatured(), cmd.isExtractable(), ImageFormat.ISO.toString(), cmd.getOsTypeId(), zoneList, HypervisorType.None, cmd.getChecksum(), cmd.isBootable(), null, owner, null, false, cmd.getImageStoreUuid(), cmd.isDynamicallyScalable(), TemplateType.USER, cmd.isDirectDownload()); }
private void verifyFormat(ImageFormat imageFormat) { if (imageFormat != ImageFormat.VHD && imageFormat != ImageFormat.OVA && imageFormat != ImageFormat.QCOW2) { throw new CloudRuntimeException("Only the following image types are currently supported: " + ImageFormat.VHD.toString() + ", " + ImageFormat.OVA.toString() + ", and " + ImageFormat.QCOW2); } }
private void verifyFormat(VolumeInfo volumeInfo) { ImageFormat imageFormat = volumeInfo.getFormat(); if (imageFormat != ImageFormat.VHD && imageFormat != ImageFormat.OVA && imageFormat != ImageFormat.QCOW2) { throw new CloudRuntimeException("Only the following image types are currently supported: " + ImageFormat.VHD.toString() + ", " + ImageFormat.OVA.toString() + ", and " + ImageFormat.QCOW2); } }