Source:
protected ValidationResult validateIsoPath(VM vm, String diskPath, String floppyPath, Guid activeIsoDomainId) { if (vm.isAutoStartup()) { return ValidationResult.VALID; } if (StringUtils.isEmpty(vm.getIsoPath()) && StringUtils.isEmpty(diskPath) && StringUtils.isEmpty(floppyPath)) { return ValidationResult.VALID; } if (!StringUtils.isEmpty(floppyPath) && activeIsoDomainId == null) { return new ValidationResult(EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } if (!StringUtils.isEmpty(diskPath)) { if (diskPath.matches(ValidationUtils.GUID)) { BaseDisk disk = diskDao.get(Guid.createGuidFromString(diskPath)); if (disk == null || disk.getContentType() != DiskContentType.ISO) { return new ValidationResult(EngineMessage.ERROR_CANNOT_FIND_ISO_IMAGE_PATH); } StorageDomain storageDomain = storageDomainDao.get(((DiskImage) disk).getStorageIds().get(0)); if (storageDomain == null || storageDomain.getStatus() != StorageDomainStatus.Active) { return new ValidationResult(EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } } else if (activeIsoDomainId == null) { return new ValidationResult(EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } else if (!isRepoImageExists(diskPath, activeIsoDomainId, ImageFileType.ISO)) { return new ValidationResult(EngineMessage.ERROR_CANNOT_FIND_ISO_IMAGE_PATH); } return ValidationResult.VALID; } if (!StringUtils.isEmpty(floppyPath) && !isRepoImageExists(floppyPath, activeIsoDomainId, ImageFileType.Floppy)) { return new ValidationResult(EngineMessage.ERROR_CANNOT_FIND_FLOPPY_IMAGE_PATH); } return ValidationResult.VALID; }

Target:
protected ValidationResult validateIsoPath(VM vm, String diskPath, String floppyPath, Guid activeIsoDomainId) { if (vm.isAutoStartup()) { return ValidationResult.VALID; } if (StringUtils.isEmpty(vm.getIsoPath()) && StringUtils.isEmpty(diskPath) && StringUtils.isEmpty(floppyPath)) { return ValidationResult.VALID; } if (!StringUtils.isEmpty(floppyPath) && activeIsoDomainId == null) { return new ValidationResult(EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } if (!StringUtils.isEmpty(diskPath)) { if (diskPath.matches(ValidationUtils.GUID)) { BaseDisk disk = diskDao.get(Guid.createGuidFromString(diskPath)); if (disk == null || disk.getContentType() != DiskContentType.ISO) { return new ValidationResult(EngineMessage.ERROR_CANNOT_FIND_ISO_IMAGE_PATH); } Guid domainId = ((DiskImage) disk).getStorageIds().get(0); StoragePoolIsoMap spim = storagePoolIsoMapDao.get(new StoragePoolIsoMapId(domainId, vm.getStoragePoolId())); if (spim == null || spim.getStatus() != StorageDomainStatus.Active) { return new ValidationResult(EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } } else if (activeIsoDomainId == null) { return new ValidationResult(EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } else if (!isRepoImageExists(diskPath, activeIsoDomainId, ImageFileType.ISO)) { return new ValidationResult(EngineMessage.ERROR_CANNOT_FIND_ISO_IMAGE_PATH); } return ValidationResult.VALID; } if (!StringUtils.isEmpty(floppyPath) && !isRepoImageExists(floppyPath, activeIsoDomainId, ImageFileType.Floppy)) { return new ValidationResult(EngineMessage.ERROR_CANNOT_FIND_FLOPPY_IMAGE_PATH); } return ValidationResult.VALID; }