org.ovirt.engine.core.compat.Version.getLast()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中org.ovirt.engine.core.compat.Version.getLast()方法的一些代码示例,展示了Version.getLast()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.getLast()方法的具体详情如下:
包路径:org.ovirt.engine.core.compat.Version
类名称:Version
方法名:getLast

Version.getLast介绍

暂无

代码示例

代码示例来源:origin: oVirt/ovirt-engine

@Override
  public Version getCompatibilityVersion() {
    return Version.getLast();
  }
}

代码示例来源:origin: oVirt/ovirt-engine

protected Version latestCluster() {
  // instance type and blank template always exposes all the features of the latest cluster and if some is not applicable
  // than that particular feature will not be applicable on the instance creation
  return Version.getLast();
}

代码示例来源:origin: oVirt/ovirt-engine

public static Version getEffective(Version vmCustomCompatibilityVersion,
    Supplier<Version> clusterCompatibilityVersionSupplier) {
  if (vmCustomCompatibilityVersion != null) {
    return vmCustomCompatibilityVersion;
  }
  if (clusterCompatibilityVersionSupplier != null) {
    Version clusterCompatibilityVersion = clusterCompatibilityVersionSupplier.get();
    if (clusterCompatibilityVersion != null) {
      return clusterCompatibilityVersion;
    }
  }
  return Version.getLast();
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
protected void initGraphicsConsoles() {
  // typically the Other OS
  Integer osType = getOSType().getSelectedItem();
  if (osType == null) {
    return;
  }
  initGraphicsConsoles(osType, Version.getLast());
}

代码示例来源:origin: oVirt/ovirt-engine

public static Version getEffective(VmBase vmBase, Cluster cluster) {
  Version vmCustomCompatibilityVersion = vmBase != null ? vmBase.getCustomCompatibilityVersion() : null;
  Version clusterCompatibilityVersion = cluster != null ? cluster.getCompatibilityVersion() : null;
  return getEffective(vmCustomCompatibilityVersion, clusterCompatibilityVersion, Version.getLast());
}

代码示例来源:origin: oVirt/ovirt-engine

protected Cluster setUpCluster(Guid id) {
  Cluster cluster = mock(Cluster.class);
  when(cluster.getId()).thenReturn(id);
  when(cluster.getCompatibilityVersion()).thenReturn(Version.getLast());
  return cluster;
}

代码示例来源:origin: oVirt/ovirt-engine

public static Stream<MockConfigDescriptor<?>> mockConfiguration() {
  return Stream.of(
      MockConfigDescriptor.of(ConfigValues.VdcVersion, Version.getLast().getValue()),
      MockConfigDescriptor.of(ConfigValues.MaxNumOfVmCpus, Version.getLast(), 160),
      MockConfigDescriptor.of(ConfigValues.MaxNumOfVmSockets, Version.getLast(), 4)
  );
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Return total maximum possible memory size for the given VM, including hotplugged memory.
 *
 * <p>Note: backend only</p>
 *
 * @param osId id of operating system
 * @param compatibilityVersion version of config value to query
 * @return the total possible memory size with hotplug
 */
public static int maxMemorySizeWithHotplugInMb(int osId, Version compatibilityVersion) {
  final ConfigValues configValue = getMaxMemConfigValueByOsId(osId);
  return Config.<Integer>getValue(
    configValue,
    compatibilityVersion != null ? compatibilityVersion.getValue() : Version.getLast().getValue()
  );
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Tries to set property with no value (value is invalid due provided REGEX) to a device with supported version
 */
@Test
public void invalidPropertyValue1() {
  DevicePropertiesUtils utils = mockDevicePropertiesUtils();
  Map<String, String> map = new HashMap<>();
  map.put("bootable", null);
  List<ValidationError> errors = utils.validateProperties(Version.getLast(), VmDeviceGeneralType.DISK, map);
  validateFailure(errors, ValidationFailureReason.INCORRECT_VALUE);
}

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void testUnsupportedCpus() {
  assertFalse(
      OsRepositoryImpl.INSTANCE.isCpuSupported(
          OsRepositoryImpl.INSTANCE.getOsIdByUniqueName("windows_8"),
          Version.getLast(),
          "OpTeRon_g1"));
  assertTrue(
      OsRepositoryImpl.INSTANCE.isCpuSupported(
          OsRepositoryImpl.INSTANCE.getOsIdByUniqueName("windows_8"),
          Version.getLast(),
          "OpTeRon_g2"));
  assertFalse(
      OsRepositoryImpl.INSTANCE.getUnsupportedCpus()
          .get(new Pair<>(20, Version.getLast())).contains("Penrin".toLowerCase()));
  assertTrue(
      OsRepositoryImpl.INSTANCE.getUnsupportedCpus()
          .get(new Pair<>(20, Version.getLast())).contains("Conroe".toLowerCase()));
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Tries to set valid properties to valid device type with supported version
 */
@Test
public void validPropertyValidDeviceType() {
  DevicePropertiesUtils utils = mockDevicePropertiesUtils();
  List<ValidationError> errors =
      utils.validateProperties(Version.getLast(),
          VmDeviceGeneralType.INTERFACE,
          utils.convertProperties("speed=10;duplex=half;debug="));
  assertTrue(errors.isEmpty());
}

代码示例来源:origin: oVirt/ovirt-engine

protected Cluster getClusterEntity() {
  Cluster cluster = new Cluster();
  cluster.setStoragePoolId(GUIDS[3]);
  cluster.setArchitecture(ArchitectureType.x86_64);
  cluster.setCompatibilityVersion(Version.getLast());
  return cluster;
}

代码示例来源:origin: oVirt/ovirt-engine

private Version getEffectiveVersion() {
  if (getVersion().getSelectedItem() != null) {
    return getVersion().getSelectedItem();
  } else {
    if (getDataCenter().getSelectedItem() != null) {
      return getDataCenter().getSelectedItem().getCompatibilityVersion();
    } else {
      return Version.getLast();
    }
  }
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Tries to set invalid property value to a device with supported version
 */
@Test
public void invalidPropertyValue2() {
  DevicePropertiesUtils utils = mockDevicePropertiesUtils();
  List<ValidationError> errors =
      utils.validateProperties(Version.getLast(),
          VmDeviceGeneralType.DISK,
          utils.convertProperties("bootable=x"));
  validateFailure(errors, ValidationFailureReason.INCORRECT_VALUE);
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
protected StoragePool generateNewEntity() {
  StoragePool newPool = new StoragePool();
  newPool.setId(Guid.newGuid());
  newPool.setName("newPoolDude");
  newPool.setCompatibilityVersion(Version.getLast());
  return newPool;
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Tries to set valid property to unknown device type with supported version
 */
@Test
public void validPropertyUnknownDeviceType() {
  DevicePropertiesUtils utils = mockDevicePropertiesUtils();
  List<ValidationError> errors =
      utils.validateProperties(Version.getLast(),
          VmDeviceGeneralType.UNKNOWN,
          utils.convertProperties("speed=10;duplex=half"));
  validateFailure(errors, ValidationFailureReason.INVALID_DEVICE_TYPE);
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Tries to set valid property to a device (device type differs from the type the properties are defined for) with
 * supported version
 */
@Test
public void validPropertyInvalidDeviceType() {
  DevicePropertiesUtils utils = mockDevicePropertiesUtils();
  List<ValidationError> errors =
      utils.validateProperties(Version.getLast(),
          VmDeviceGeneralType.DISK,
          utils.convertProperties("speed=10;duplex=half"));
  validateFailure(errors, ValidationFailureReason.KEY_DOES_NOT_EXIST);
}

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void testInsertTemplateToUnregisteredEntity() {
  final String ovfExtraData = "<ovf> Some extra OVF data </ovf>";
  OvfEntityData ovfEntityData = new OvfEntityData(FixturesTool.VM_TEMPLATE_RHEL5,
      "AnyVM",
      VmEntityType.TEMPLATE,
      ArchitectureType.x86_64,
      Version.getLast(),
      FixturesTool.STORAGE_DOMAIN_NFS2_1,
      null,
      ovfExtraData);
  dao.saveOVFData(ovfEntityData);
  List<OvfEntityData> fetchedOvfEntityData =
      dao.getByEntityIdAndStorageDomain(FixturesTool.VM_TEMPLATE_RHEL5, FixturesTool.STORAGE_DOMAIN_NFS2_1);
  assertEquals(1, fetchedOvfEntityData.size());
  assertTrue(fetchedOvfEntityData.get(0).getEntityType().isTemplateType(), "The entity type should be template");
  assertEquals(ovfExtraData, fetchedOvfEntityData.get(0).getOvfExtraData(), "The entity OVF extra data should be updated");
}

代码示例来源:origin: oVirt/ovirt-engine

private boolean isRestoreMemoryVolumeSupported() {
  Version oldVmEffectiveVersion = getVm().getCompatibilityVersion(); // before edit
  Version newVmCustomCompatibilityVersion = getModel().getCustomCompatibilityVersion() == null ?
      null : getModel().getCustomCompatibilityVersion().getSelectedItem();
  Version newClusterVersion = getModel().getSelectedCluster() == null ?
      null : getModel().getSelectedCluster().getCompatibilityVersion();
  Version newVmEffectiveVersion = CompatibilityVersionUtils.getEffective(newVmCustomCompatibilityVersion,
      newClusterVersion, Version.getLast());
  return oldVmEffectiveVersion.equals(newVmEffectiveVersion);
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * If someone overrides the initialize not calling the super, at least this has to be called
 */
protected void commonInitialize() {
  priorityUtil = new PriorityUtil(getModel());
  virtioScsiUtil = new VirtioScsiUtil(getModel());
  getModel().getVmId().setIsAvailable(false);
  getModel().getLease().setIsChangeable(false);
  getModel().getIsHighlyAvailable().getEntityChangedEvent().addListener((ev, sender, args) -> {
    boolean ha = getModel().getIsHighlyAvailable().getEntity();
    setVmLeasesAvailability();
    if (!ha) {
      getModel().getLease().setSelectedItem(null);
    }
  });
  getModel().getMigrationPolicies()
      .setItems(AsyncDataProvider.getInstance().getMigrationPolicies(Version.getLast()));
}

相关文章