use of org.ovirt.engine.core.bll.provider.storage.OpenStackImageException in project ovirt-engine by oVirt.
the class ImportRepoImageCommand method validate.
@Override
protected boolean validate() {
if (!validate(new StoragePoolValidator(getStoragePool()).existsAndUp())) {
return false;
}
if (getParameters().getImportAsTemplate()) {
if (getParameters().getClusterId() == null) {
addValidationMessage(EngineMessage.VDS_CLUSTER_IS_NOT_VALID);
return false;
}
setClusterId(getParameters().getClusterId());
if (getCluster() == null) {
addValidationMessage(EngineMessage.VDS_CLUSTER_IS_NOT_VALID);
return false;
}
// A Template cannot be added in a cluster without a defined architecture
if (getCluster().getArchitecture() == ArchitectureType.undefined) {
return failValidation(EngineMessage.ACTION_TYPE_FAILED_CLUSTER_UNDEFINED_ARCHITECTURE);
}
setStoragePoolId(getParameters().getStoragePoolId());
}
DiskImage diskImage = null;
try {
diskImage = getDiskImage();
} catch (OpenStackImageException e) {
log.error("Unable to get the disk image from the provider proxy: ({}) {}", e.getErrorType(), e.getMessage());
switch(e.getErrorType()) {
case UNSUPPORTED_CONTAINER_FORMAT:
case UNSUPPORTED_DISK_FORMAT:
return failValidation(EngineMessage.ACTION_TYPE_FAILED_IMAGE_NOT_SUPPORTED);
case UNABLE_TO_DOWNLOAD_IMAGE:
return failValidation(EngineMessage.ACTION_TYPE_FAILED_IMAGE_DOWNLOAD_ERROR);
case UNRECOGNIZED_IMAGE_FORMAT:
return failValidation(EngineMessage.ACTION_TYPE_FAILED_IMAGE_UNRECOGNIZED);
}
}
if (diskImage == null) {
return failValidation(EngineMessage.ACTION_TYPE_FAILED_DISK_NOT_EXIST);
}
diskImage.setStoragePoolId(getStoragePoolId());
if (!validate(createDiskImagesValidator(diskImage).isQcowVersionSupportedForDcVersion())) {
return false;
}
return validateSpaceRequirements(diskImage);
}
Aggregations