/** * Test the use of the special procedure to update emulated_machine */ @Test public void testSetEmulatedMachine() { String preUpdate = existingCluster.getEmulatedMachine(); String updatedValue = "pc-version-1.2.3"; assertNotSame(updatedValue, preUpdate); existingCluster.setEmulatedMachine(updatedValue); dao.setEmulatedMachine(existingCluster.getId(), updatedValue, false); assertEquals(updatedValue, dao.get(existingCluster.getId()).getEmulatedMachine()); }
@Test public void testUpdateClustersProps() { assertNotSame("pc-1.2.3", existingCluster.getEmulatedMachine()); existingCluster.setEmulatedMachine("pc-1.2.3"); dao.update(existingCluster); assertEquals("pc-1.2.3", existingCluster.getEmulatedMachine()); existingCluster.setDetectEmulatedMachine(true); dao.update(existingCluster); assertTrue(existingCluster.isDetectEmulatedMachine()); }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); existingCluster = dao.get(FixturesTool.CLUSTER_RHEL6_ISCSI); groupWithNoRunningVms = dao.get(FixturesTool.CLUSTER_NO_RUNNING_VMS); newGroup = new Cluster(); newGroup.setName("New VDS Group"); newGroup.setCompatibilityVersion(Version.getLast()); newGroup.setVirtService(true); newGroup.setGlusterService(false); newGroup.setClusterPolicyId(existingCluster.getClusterPolicyId()); // set cluster policy name to allow equals method to succeed newGroup.setClusterPolicyName(clusterPolicyDao.get(existingCluster.getClusterPolicyId(), Collections.emptyMap()).getName()); newGroup.setClusterPolicyProperties(new LinkedHashMap<>()); newGroup.setDetectEmulatedMachine(true); newGroup.setEmulatedMachine("rhel6.4.0"); newGroup.setArchitecture(ArchitectureType.x86_64); newGroup.setGlusterCliBasedSchedulingOn(true); newGroup.setMigrationBandwidthLimitType(MigrationBandwidthLimitType.CUSTOM); newGroup.setCustomMigrationNetworkBandwidth(1000); newGroup.setMigrationPolicyId(Guid.newGuid()); newGroup.setMacPoolId(FixturesTool.DEFAULT_MAC_POOL_ID); newGroup.setFirewallType(FirewallType.FIREWALLD); newGroup.setLogMaxMemoryUsedThreshold(95); newGroup.setLogMaxMemoryUsedThresholdType(LogMaxMemoryUsedThresholdType.PERCENTAGE); newGroup.setVncEncryptionEnabled(true); }
private static Cluster cloneCluster(Cluster instance) { Cluster obj = new Cluster(); obj.setId(instance.getId()); obj.setName(instance.getName()); obj.setDescription(instance.getDescription()); obj.setComment(instance.getComment()); obj.setCpuName(instance.getCpuName()); obj.setClusterCompatibilityLevelUpgradeNeeded(instance.isClusterCompatibilityLevelUpgradeNeeded()); obj.setCompatibilityVersion(instance.getCompatibilityVersion()); obj.setMigrateOnError(instance.getMigrateOnError()); obj.setTransparentHugepages(instance.getTransparentHugepages()); obj.setStoragePoolId(instance.getStoragePoolId()); obj.setMaxVdsMemoryOverCommit(instance.getMaxVdsMemoryOverCommit()); obj.setCountThreadsAsCores(instance.getCountThreadsAsCores()); obj.setEmulatedMachine(instance.getEmulatedMachine()); obj.setDetectEmulatedMachine(instance.isDetectEmulatedMachine()); obj.setArchitecture(instance.getArchitecture()); obj.setSerialNumberPolicy(instance.getSerialNumberPolicy()); obj.setCustomSerialNumber(instance.getCustomSerialNumber()); obj.setFencingPolicy(new FencingPolicy(instance.getFencingPolicy())); obj.setAutoConverge(instance.getAutoConverge()); obj.setMigrateCompressed(instance.getMigrateCompressed()); return obj; }