boolean isPublic = rs.getBoolean(4); String value = rs.getString(5); ImageFormat format = ImageFormat.valueOf(value); String tmpltType = rs.getString(6); boolean requiresHVM = rs.getBoolean(7);
private void handlePath(final DiskTO[] disks, final Map<String, Map<String, String>> iqnToData) { if (disks != null && iqnToData != null) { for (final DiskTO disk : disks) { final Map<String, String> details = disk.getDetails(); final boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED)); if (isManaged) { final Long volumeId = disk.getData().getId(); final VolumeVO volume = _volsDao.findById(volumeId); final String iScsiName = volume.get_iScsiName(); boolean update = false; final Map<String, String> data = iqnToData.get(iScsiName); if (data != null) { final String path = data.get(StartAnswer.PATH); if (path != null) { volume.setPath(path); update = true; } final String imageFormat = data.get(StartAnswer.IMAGE_FORMAT); if (imageFormat != null) { volume.setFormat(ImageFormat.valueOf(imageFormat)); update = true; } if (update) { _volsDao.update(volumeId, volume); } } } } } }
imgfmt = ImageFormat.valueOf(format.toUpperCase()); } catch (IllegalArgumentException e) { s_logger.debug("ImageFormat IllegalArgumentException: " + e.getMessage());
if (format != null) { try { imageFormat = ImageFormat.valueOf(format.toUpperCase()); } catch (IllegalArgumentException e) { throw new InvalidParameterValueException("Image format: " + format + " is incorrect. Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
uploadEntity.setResourceType(UploadEntity.ResourceType.valueOf(cmd.getType())); uploadEntity.setProcessTimeout(processTimeout); uploadEntity.setFormat(Storage.ImageFormat.valueOf(cmd.getImageFormat()));
newVol.setFormat(ImageFormat.valueOf(newDisk.getFormat().toString().toUpperCase())); newVol.setPath(path != null ? path : volumeName);
ImageFormat.valueOf(format.toUpperCase()); } catch (IllegalArgumentException e) { s_logger.debug("ImageFormat IllegalArgumentException: " + e.getMessage());
String url = payload.getUrl(); String checkSum = payload.getChecksum(); ImageFormat format = ImageFormat.valueOf(payload.getFormat());
volume.setUpdated(new Date()); volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner.getDomainId()); volume.setFormat(ImageFormat.valueOf(format)); volume = _volsDao.persist(volume); CallContext.current().setEventDetails("Volume Id: " + volume.getUuid());
newVol.setPath(disk.getName()); newVol.setSize(disk.getVirtualSize()); newVol.setFormat(ImageFormat.valueOf(disk.getFormat().toString().toUpperCase()));
@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()); } }