private boolean isSupportedImageFormatForCluster(VolumeInfo volume, HypervisorType rootDiskHyperType) { ImageFormat volumeFormat = volume.getFormat(); if (rootDiskHyperType == HypervisorType.Hyperv) { if (volumeFormat.equals(ImageFormat.VHDX) || volumeFormat.equals(ImageFormat.VHD)) { return true; } else { return false; } } else { return volume.getFormat().equals(getSupportedImageFormatForCluster(rootDiskHyperType)); } }
private boolean isForVMware(DataObject dataObj) { if (dataObj instanceof VolumeInfo) { return ImageFormat.OVA.equals(((VolumeInfo)dataObj).getFormat()); } if (dataObj instanceof SnapshotInfo) { return ImageFormat.OVA.equals(((SnapshotInfo)dataObj).getBaseVolume().getFormat()); } return dataObj instanceof TemplateInfo && HypervisorType.VMware.equals(((TemplateInfo)dataObj).getHypervisorType()); }
private void setVmdk(SnapshotInfo snapshotInfo, VolumeInfo volumeInfo) { if (!ImageFormat.OVA.equals(volumeInfo.getFormat())) { return; } String search = "]"; String path = volumeInfo.getPath(); int startIndex = path.indexOf(search); SnapshotDetailsVO snapshotDetail = new SnapshotDetailsVO(snapshotInfo.getId(), DiskTO.VMDK, path.substring(startIndex + search.length()).trim(), false); snapshotDetailsDao.persist(snapshotDetail); }
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); } }
private void verifyLocationType(SnapshotInfo snapshotInfo) { VolumeInfo volumeInfo = snapshotInfo.getBaseVolume(); if (snapshotInfo.getLocationType() == Snapshot.LocationType.SECONDARY && volumeInfo.getFormat() != ImageFormat.VHD) { throw new CloudRuntimeException("Only the '" + ImageFormat.VHD + "' image type can be used when 'LocationType' is set to 'SECONDARY'."); } }
private void verifyDiskTypeAndHypervisor(VolumeInfo volumeInfo) { ImageFormat imageFormat = volumeInfo.getFormat(); Volume.Type volumeType = volumeInfo.getVolumeType(); if (ImageFormat.OVA.equals(imageFormat) && Volume.Type.ROOT.equals(volumeType)) { throw new CloudRuntimeException("The hypervisor type is VMware and the disk type is ROOT. For this situation, " + "recover the data on the snapshot by creating a new CloudStack volume from the corresponding volume snapshot."); } }
private VolumeInfo copyVolume(StoragePool rootDiskPool, VolumeInfo volume, VirtualMachine vm, VirtualMachineTemplate rootDiskTmplt, DataCenter dcVO, Pod pod, DiskOffering diskVO, ServiceOffering svo, HypervisorType rootDiskHyperType) throws NoTransitionException { if (!isSupportedImageFormatForCluster(volume, rootDiskHyperType)) { throw new InvalidParameterValueException("Failed to attach volume to VM since volumes format " + volume.getFormat().getFileExtension() + " is not compatible with the vm hypervisor type"); } VolumeInfo volumeOnPrimary = copyVolumeFromSecToPrimary(volume, vm, rootDiskTmplt, dcVO, pod, rootDiskPool.getClusterId(), svo, diskVO, new ArrayList<StoragePool>(), volume.getSize(), rootDiskHyperType); return volumeOnPrimary; }
if (volumeInfo.getFormat() == ImageFormat.VHD) { HostVO hostVO = getHost(volumeInfo.getId()); else if (volumeInfo.getFormat() == ImageFormat.OVA || volumeInfo.getFormat() == ImageFormat.QCOW2) { computeClusterSupportsVolumeClone = true; if (ImageFormat.OVA.equals(volumeInfo.getFormat())) { setVmdk(snapshotInfo, volumeInfo); if (ImageFormat.OVA.equals(volumeInfo.getFormat())) { if (vmSnapshot != null) { deleteHypervisorSnapshot(vmSnapshot);
if (!ImageFormat.QCOW2.equals(volumeInfo.getFormat())) { throw new CloudRuntimeException("When using managed storage, you can only create a template from a volume on KVM currently.");
String extractUrl = secStore.createEntityExtractUrl(vol.getPath(), vol.getFormat(), vol); VolumeDataStoreVO volumeStoreRef = _volumeStoreDao.findByVolume(volumeId);
vol.getName(), vol.getFormat().toString(), dataObject.getDataStore().getUri(), dataObject.getDataStore().getRole().toString()); command.setLocalPath(volumeStore.getLocalDownloadPath());
if (!ImageFormat.QCOW2.equals(srcVolumeInfo.getFormat())) { throw new CloudRuntimeException("Currently, only the KVM hypervisor type is supported for the migration of a volume " + "from managed storage to non-managed storage.");
if (!ImageFormat.QCOW2.equals(srcVolumeInfo.getFormat())) { throw new CloudRuntimeException("Currently, only the KVM hypervisor type is supported for the migration of a volume " + "from managed storage to non-managed storage.");
public VolumeObjectTO(VolumeInfo volume) { uuid = volume.getUuid(); path = volume.getPath(); accountId = volume.getAccountId(); if (volume.getDataStore() != null) { dataStore = volume.getDataStore().getTO(); } else { dataStore = null; } vmName = volume.getAttachedVmName(); size = volume.getSize(); setVolumeId(volume.getId()); chainInfo = volume.getChainInfo(); volumeType = volume.getVolumeType(); name = volume.getName(); setId(volume.getId()); format = volume.getFormat(); provisioningType = volume.getProvisioningType(); bytesReadRate = volume.getBytesReadRate(); bytesWriteRate = volume.getBytesWriteRate(); iopsReadRate = volume.getIopsReadRate(); iopsWriteRate = volume.getIopsWriteRate(); cacheMode = volume.getCacheMode(); hypervisorType = volume.getHypervisorType(); setDeviceId(volume.getDeviceId()); }
(srcVolumeInfo.getDataStore().getRole() == DataStoreRole.Image || srcVolumeInfo.getDataStore().getRole() == DataStoreRole.ImageCache) && destVolumeInfo.getDataStore().getRole() == DataStoreRole.Primary) { ImageFormat imageFormat = destVolumeInfo.getFormat();
newVolume.setFormat(volumeInfo.getFormat());
if (ImageFormat.DIR.equals(volume.getFormat())) { throw new InvalidParameterValueException("Snapshot not supported for volume:" + volumeId);