Exemple #1
0
  @Test
  public void refuseSoundDeviceOnPPC() {
    AddVmCommand<AddVmParameters> cmd = setupCanAddPpcTest();
    cmd.getParameters().setSoundDeviceEnabled(true);
    when(osRepository.isSoundDeviceEnabled(
            cmd.getParameters().getVm().getVmOsId(), cmd.getCluster().getCompatibilityVersion()))
        .thenReturn(false);

    ValidateTestUtils.runAndAssertValidateFailure(
        cmd, EngineMessage.SOUND_DEVICE_REQUESTED_ON_NOT_SUPPORTED_ARCH);
  }
Exemple #2
0
 @Test
 public void isVirtioScsiEnabledDefaultedToTrue() {
   AddVmCommand<AddVmParameters> cmd = setupCanAddVmTests(0);
   Cluster cluster = createCluster();
   doReturn(cluster).when(cmd).getCluster();
   cmd.getParameters().getVm().setClusterId(cluster.getId());
   cmd.initEffectiveCompatibilityVersion();
   when(osRepository.getDiskInterfaces(any(Integer.class), any(Version.class)))
       .thenReturn(new ArrayList<>(Collections.singletonList("VirtIO_SCSI")));
   assertTrue(
       "isVirtioScsiEnabled hasn't been defaulted to true on cluster >= 3.3.",
       cmd.isVirtioScsiEnabled());
 }
Exemple #3
0
  private AddVmCommand<AddVmParameters> setupCanAddPpcTest() {
    final int domainSizeGB = 20;
    AddVmCommand<AddVmParameters> cmd = setupCanAddVmTests(domainSizeGB);

    doReturn(true).when(cmd).validateSpaceRequirements();
    doReturn(true).when(cmd).buildAndCheckDestStorageDomains();
    cmd.getParameters().getVm().setClusterArch(ArchitectureType.ppc64);
    Cluster cluster = new Cluster();
    cluster.setArchitecture(ArchitectureType.ppc64);
    cluster.setCompatibilityVersion(Version.getLast());
    doReturn(cluster).when(cmd).getCluster();

    return cmd;
  }
Exemple #4
0
 @Test
 public void testPatternBasedNameFails() {
   AddVmCommand<AddVmParameters> cmd = createCommand(initializeMock(1));
   cmd.getParameters().getVm().setName("aa-??bb");
   assertFalse("Pattern-based name should not be supported for VM", cmd.validateInputs());
 }