use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class VmValidatorTest method validateVMPluggedDisksWithReservationStatus.
private void validateVMPluggedDisksWithReservationStatus(boolean vmHasDisksPluggedWithReservation) {
DiskVmElement dve = new DiskVmElement(null, vm.getId());
dve.setUsingScsiReservation(vmHasDisksPluggedWithReservation);
when(DbFacade.getInstance().getDiskVmElementDao()).thenReturn(diskVmElementDao);
when(diskVmElementDao.getAllPluggedToVm(vm.getId())).thenReturn(Collections.singletonList(dve));
if (vmHasDisksPluggedWithReservation) {
// If the VM has plugged disks using ISCSI reservation the validation should fail
assertThat(validator.isVmPluggedDiskNotUsingScsiReservation(), failsWith(EngineMessage.ACTION_TYPE_FAILED_VM_USES_SCSI_RESERVATION));
} else {
assertThat(validator.isVmPluggedDiskNotUsingScsiReservation(), isValid());
}
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class VmValidatorTest method canDisableVirtioScsiFail.
@Test
public void canDisableVirtioScsiFail() {
Disk disk = new DiskImage();
DiskVmElement dve = new DiskVmElement(disk.getId(), vm.getId());
dve.setDiskInterface(DiskInterface.VirtIO_SCSI);
disk.setDiskVmElements(Collections.singletonList(dve));
assertThat(validator.canDisableVirtioScsi(Collections.singletonList(disk)), failsWith(EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS));
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class DiskValidatorTest method createDiskVmElementUsingScsiReserevation.
private static DiskVmElement createDiskVmElementUsingScsiReserevation() {
DiskVmElement dve = new DiskVmElement();
dve.setUsingScsiReservation(true);
return dve;
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class DiskVmElementValidatorTest method readOnlyIsSupportedByDiskInterface.
@Test
public void readOnlyIsSupportedByDiskInterface() {
dve.setReadOnly(true);
DiskVmElement dve = new DiskVmElement();
dve.setDiskInterface(DiskInterface.VirtIO);
assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid());
dve.setDiskInterface(DiskInterface.VirtIO_SCSI);
assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid());
dve.setReadOnly(false);
dve.setDiskInterface(DiskInterface.IDE);
assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid());
dve.setReadOnly(true);
dve.setDiskInterface(DiskInterface.VirtIO);
assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid());
dve.setReadOnly(false);
dve.setDiskInterface(DiskInterface.VirtIO_SCSI);
assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid());
dve.setDiskInterface(DiskInterface.IDE);
assertThat(validator.isReadOnlyPropertyCompatibleWithInterface(), isValid());
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement in project ovirt-engine by oVirt.
the class DiskVmElementValidatorTest method setUp.
@Before
public void setUp() {
injectorRule.bind(OsRepository.class, osRepository);
initializeInterfaceValidation(DiskInterface.VirtIO);
disk = new DiskImage();
dve = new DiskVmElement();
validator = new DiskVmElementValidator(disk, dve);
}
Aggregations