Search in sources :

Example 6 with ImportVmParameters

use of org.ovirt.engine.core.common.action.ImportVmParameters in project ovirt-engine by oVirt.

the class ImportValidatorTest method insufficientDiskSpaceWithSnapshots.

@Test
public void insufficientDiskSpaceWithSnapshots() {
    ImportVmParameters parameters = createParameters();
    ImportValidator validator = setupDiskSpaceTest(parameters);
    parameters.setCopyCollapse(false);
    doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)).when(multipleSdValidator).allDomainsHaveSpaceForDisksWithSnapshots(any());
    assertThat(validator.validateSpaceRequirements(Collections.emptyList()), failsWith(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN));
    verify(multipleSdValidator, never()).allDomainsHaveSpaceForClonedDisks(any());
    verify(multipleSdValidator).allDomainsHaveSpaceForDisksWithSnapshots(any());
    verify(multipleSdValidator, never()).allDomainsHaveSpaceForNewDisks(any());
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) ImportVmParameters(org.ovirt.engine.core.common.action.ImportVmParameters) Test(org.junit.Test)

Example 7 with ImportVmParameters

use of org.ovirt.engine.core.common.action.ImportVmParameters in project ovirt-engine by oVirt.

the class ImportVmCommandTest method createParameters.

protected ImportVmParameters createParameters() {
    final VM vm = createVmWithSnapshots();
    vm.setName("testVm");
    Guid clusterId = Guid.newGuid();
    vm.setClusterId(clusterId);
    Guid spId = Guid.newGuid();
    return new ImportVmParameters(vm, Guid.newGuid(), Guid.newGuid(), spId, clusterId);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Guid(org.ovirt.engine.core.compat.Guid) ImportVmParameters(org.ovirt.engine.core.common.action.ImportVmParameters)

Aggregations

ImportVmParameters (org.ovirt.engine.core.common.action.ImportVmParameters)7 Guid (org.ovirt.engine.core.compat.Guid)4 VM (org.ovirt.engine.core.common.businessentities.VM)3 Test (org.junit.Test)2 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)2 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 CpuProfile (org.ovirt.engine.core.common.businessentities.profiles.CpuProfile)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1