use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class DiskImagesValidatorTest method diskImagesAlreadyExistBothExist.
@Test
public void diskImagesAlreadyExistBothExist() {
doReturn(new DiskImage()).when(validator).getExistingDisk(any());
assertThat(validator.diskImagesAlreadyExist(), both(failsWith(EngineMessage.ACTION_TYPE_FAILED_IMPORT_DISKS_ALREADY_EXIST)).and(replacements(hasItem(createAliasReplacements(disk1, disk2)))));
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class DiskImagesValidatorTest method diskImagesAlreadyDiskInImportWithNullAlias.
/**
* Test a case when the two validated disks exists and have a null disk alias, in that case the disk aliases in
* the CDA message should be taken from the disks existing on the setup
*/
@Test
public void diskImagesAlreadyDiskInImportWithNullAlias() {
disk1.setDiskAlias(null);
disk2.setDiskAlias(null);
DiskImage existingImage1 = new DiskImage();
existingImage1.setDiskAlias("existingDiskAlias1");
DiskImage existingImage2 = new DiskImage();
existingImage2.setDiskAlias("existingDiskAlias2");
doReturn(existingImage1).when(validator).getExistingDisk(disk1.getId());
doReturn(existingImage2).when(validator).getExistingDisk(disk2.getId());
assertThat(validator.diskImagesAlreadyExist(), both(failsWith(EngineMessage.ACTION_TYPE_FAILED_IMPORT_DISKS_ALREADY_EXIST)).and(replacements(hasItem(createAliasReplacements(existingImage1, existingImage2)))));
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class BackendAttachedStorageDomainDiskResource method register.
@Override
public Response register(Action action) {
// First we need to query the backend to fill in all the information about the disk from the VDSM.
// We don't just use the information from the Disk object because it's missing a few things like creation
// date and last modified date.
Guid dataCenterId = BackendDataCenterHelper.lookupByStorageDomainId(this, storageDomainId);
GetUnregisteredDiskQueryParameters getDiskParams = new GetUnregisteredDiskQueryParameters(guid, storageDomainId, dataCenterId);
DiskImage unregisteredDisk = getEntity(DiskImage.class, QueryType.GetUnregisteredDisk, getDiskParams, guid.toString());
RegisterDiskParameters registerDiskParams = new RegisterDiskParameters(unregisteredDisk, storageDomainId);
return doAction(ActionType.RegisterDisk, registerDiskParams, action);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class BackendStorageDomainDiskSnapshotResourceTest method getEntity.
@Override
protected Disk getEntity(int index) {
DiskImage entity = new DiskImage();
entity.setImageId(GUIDS[index]);
entity.setId(DISK_ID);
return entity;
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class BackendStorageDomainDiskSnapshotsResourceTest method getEntity.
@Override
protected Disk getEntity(int index) {
DiskImage entity = new DiskImage();
entity.setImageId(GUIDS[index]);
entity.setId(DISK_ID);
return entity;
}
Aggregations