use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class JsonObjectSerializationEntitiesTest method data.
@Parameterized.Parameters
public static Object[] data() {
RandomUtils random = RandomUtils.instance();
VdsStatic vdsStatic = new VdsStatic(random.nextString(10), random.nextString(10), random.nextInt(), random.nextInt(), random.nextString(10), Guid.newGuid(), Guid.newGuid(), random.nextString(10), random.nextBoolean(), random.nextEnum(VDSType.class), Guid.newGuid());
return new Object[] { vdsStatic, randomVdsDynamic(), randomVdsStatistics(), new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt()), randomStorageDomainStatic(), new StorageDomainDynamic(random.nextInt(), Guid.newGuid(), random.nextInt()), randomStoragePool(), new StoragePoolIsoMap(Guid.newGuid(), Guid.newGuid(), random.nextEnum(StorageDomainStatus.class)), randomRole(), new IdContainerClass<>(new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt())), new IdContainerClass<>(Guid.newGuid()) };
}
use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class RunVmValidator method validateIsoPath.
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);
}
String effectiveIsoPath = StringUtils.isEmpty(diskPath) ? vm.getIsoPath() : diskPath;
if (!StringUtils.isEmpty(effectiveIsoPath)) {
if (effectiveIsoPath.matches(ValidationUtils.GUID)) {
BaseDisk disk = diskDao.get(Guid.createGuidFromString(effectiveIsoPath));
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(effectiveIsoPath, 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;
}
use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class AddDiskCommandTest method mockStoragePoolIsoMap.
/**
* Mock a good {@link StoragePoolIsoMap}.
*/
private void mockStoragePoolIsoMap() {
StoragePoolIsoMap spim = new StoragePoolIsoMap();
when(storagePoolIsoMapDao.get(any())).thenReturn(spim);
}
use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class AttachDiskToVmCommandTest method mockStoragePoolIsoMap.
private void mockStoragePoolIsoMap() {
StoragePoolIsoMap spim = new StoragePoolIsoMap();
when(storagePoolIsoMapDao.get(any())).thenReturn(spim);
}
use of org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommandTest method succeedUpdateNFSCommandWithDomain.
@Test
public void succeedUpdateNFSCommandWithDomain() {
StorageServerConnections newNFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
parameters.setStorageServerConnection(newNFSConnection);
VDSReturnValue returnValueConnectSuccess = new VDSReturnValue();
StoragePoolIsoMap map = new StoragePoolIsoMap();
returnValueConnectSuccess.setSucceeded(true);
StorageDomain domain = createDomain();
doReturn(Collections.singletonList(map)).when(command).getStoragePoolIsoMap(domain);
returnValueConnectSuccess.setReturnValue(domain);
doReturn(returnValueConnectSuccess).when(command).getStatsForDomain(domain);
doReturn(true).when(command).connectToStorage();
List<StorageDomain> domains = Collections.singletonList(domain);
doReturn(domains).when(command).getStorageDomainsByConnId(newNFSConnection.getId());
doNothing().when(command).changeStorageDomainStatusInTransaction(StorageDomainStatus.Locked);
doNothing().when(command).disconnectFromStorage();
doNothing().when(command).updateStorageDomain(domains);
command.executeCommand();
CommandAssertUtils.checkSucceeded(command, true);
}
Aggregations