use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class AddVmCommandTestBase method createStorageDomain.
protected StorageDomain createStorageDomain(Guid sdId) {
StorageDomain sd = new StorageDomain();
sd.setStorageDomainType(StorageDomainType.Data);
sd.setStatus(StorageDomainStatus.Active);
sd.setId(sdId);
return sd;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class AddVmCommandTestBase method initDestSDs.
private void initDestSDs() {
StorageDomain sd1 = new StorageDomain();
StorageDomain sd2 = new StorageDomain();
sd1.setId(STORAGE_DOMAIN_ID_1);
sd2.setId(STORAGE_DOMAIN_ID_2);
sd1.setStatus(StorageDomainStatus.Active);
sd2.setStatus(StorageDomainStatus.Active);
cmd.destStorages.put(STORAGE_DOMAIN_ID_1, sd1);
cmd.destStorages.put(STORAGE_DOMAIN_ID_2, sd2);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class ImportValidator method validateStorageExistsForMemoryDisks.
public ValidationResult validateStorageExistsForMemoryDisks(List<Snapshot> snapshots, boolean allowPartial, Map<Guid, String> failedDisksToImport) {
for (Snapshot snap : snapshots) {
if (snap.containsMemory()) {
DiskImage memoryDump = (DiskImage) getDiskDao().get(snap.getMemoryDiskId());
StorageDomain dumpSd = getStorageDomainDao().getForStoragePool(memoryDump.getStorageIds().get(0), params.getStoragePoolId());
ValidationResult dumpSdResult = new StorageDomainValidator(dumpSd).isDomainExistAndActive();
if (!handleStorageValidationResult(dumpSdResult, memoryDump, snap, failedDisksToImport) && !allowPartial) {
return dumpSdResult;
}
DiskImage memoryConf = (DiskImage) getDiskDao().get(snap.getMetadataDiskId());
StorageDomain confSd = getStorageDomainDao().getForStoragePool(memoryConf.getStorageIds().get(0), params.getStoragePoolId());
ValidationResult confSdResult = new StorageDomainValidator(confSd).isDomainExistAndActive();
if (!handleStorageValidationResult(confSdResult, memoryConf, snap, failedDisksToImport) && !allowPartial) {
return confSdResult;
}
}
}
return ValidationResult.VALID;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class UpdateVmDiskCommandTest method addNewStorageDomainToDisk.
private StorageDomain addNewStorageDomainToDisk(DiskImage diskImage, StorageType storageType) {
StorageDomain storage = new StorageDomain();
storage.setId(Guid.newGuid());
storage.setStorageType(storageType);
storage.setStatus(StorageDomainStatus.Active);
diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(storage.getId())));
return storage;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class UpdateVmDiskCommandTest method testInvalidDiskExtend.
@Test
public void testInvalidDiskExtend() {
DiskImage oldDiskImage = createDiskImage();
oldDiskImage.setSize(SizeConverter.convert(8L, SizeConverter.SizeUnit.GiB, SizeConverter.SizeUnit.BYTES).longValue());
DiskImage newDiskImage = createDiskImage();
newDiskImage.setSize(SizeConverter.convert(10L, SizeConverter.SizeUnit.GiB, SizeConverter.SizeUnit.BYTES).longValue());
command.getParameters().setDiskVmElement(new DiskVmElement(newDiskImage.getId(), vmId));
command.getParameters().setDiskInfo(newDiskImage);
when(diskDao.get(diskImageGuid)).thenReturn(oldDiskImage);
initializeCommand();
StorageDomain sd = new StorageDomain();
sd.setId(Guid.newGuid());
sd.setStorageType(StorageType.ISCSI);
when(storageDomainDao.get(any())).thenReturn(sd);
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_DISK_MAX_SIZE_EXCEEDED);
}
Aggregations