protected Cluster getClusterEntity() { return new Cluster(); }
@Override protected void setUpClusterQueryExpectations() { setUpEntityQueryExpectations(QueryType.GetClusterById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { CLUSTER_ID }, new Cluster()); } }
protected Cluster getCluster(int idx) { Cluster cluster = new Cluster(); cluster.setId(GUIDS[idx]); return cluster; } }
protected Cluster getCluster(int idx) { Cluster cluster = new Cluster(); cluster.setId(GUIDS[idx]); return cluster; }
@Mapping(from = StoragePool.class, to = Cluster.class) public static Cluster map(StoragePool pool, Cluster template) { Cluster entity = template != null ? template : new Cluster(); if (pool.getCompatibilityVersion() != null) { entity.setCompatibilityVersion(pool.getCompatibilityVersion()); } return entity; }
private Cluster getCluster() { Cluster cluster = new Cluster(); cluster.setId(CLUSTER_ID); cluster.setDefaultNetworkProviderId(PROVIDER_ID); return cluster; }
protected UnitVmModel initModel(VmModelBehaviorBase behavior) { final Cluster cluster = new Cluster(); cluster.setCompatibilityVersion(CLUSTER_VERSION); UnitVmModel model = spy(createModel(behavior)); doReturn(cluster).when(model).getSelectedCluster(); doReturn(new EntityModel<>(true)).when(model).getIsSingleQxlEnabled(); model.initialize(); model.getInstanceImages().setItems(new ArrayList<InstanceImageLineModel>()); return model; }
@Test public void getClusterNotNull() { final Cluster g = new Cluster(); b.setCluster(g); final Cluster gr = b.getCluster(); assertEquals(g, gr); }
protected Cluster getClusterEntity() { Cluster cluster = new Cluster(); cluster.setStoragePoolId(GUIDS[3]); cluster.setArchitecture(ArchitectureType.x86_64); cluster.setCompatibilityVersion(Version.getLast()); return cluster; }
public void onAddCluster() { ClusterModel model = (ClusterModel) getWindow(); Cluster cluster = ClusterListModel.buildCluster(model, new Cluster()); if (model.getProgress() != null) { return; } model.startProgress(); Frontend.getInstance().runAction(ActionType.AddCluster, new ManagementNetworkOnClusterOperationParameters(cluster), result -> { DataCenterGuideModel localModel = (DataCenterGuideModel) result.getState(); localModel.postOnAddCluster(result.getReturnValue()); }, this); }
@Test public void getClusterIdCluster() { final Cluster gr = new Cluster(); gr.setId(GUID); b.setCluster(gr); final Guid g = b.getClusterId(); assertEquals(GUID, g); }
@Test public void getClusterName() { final Cluster g = new Cluster(); g.setName(NAME); b.setCluster(g); final String n = b.getClusterName(); assertEquals(NAME, n); }
public void setSelectedCluster(VDS host) { ArrayList<Cluster> clusters; if (getCluster().getItems() == null) { Cluster tempVar = new Cluster(); tempVar.setName(host.getClusterName()); tempVar.setId(host.getClusterId()); tempVar.setCompatibilityVersion(host.getClusterCompatibilityVersion()); getCluster() .setItems(new ArrayList<>(Arrays.asList(new Cluster[]{tempVar}))); } clusters = (ArrayList<Cluster>) getCluster().getItems(); updateModelClusterFromVds(clusters, host); if (getCluster().getSelectedItem() == null) { getCluster().setSelectedItem(Linq.firstOrNull(clusters)); } }
private void onSaveConfirmGenericWarnings() { ClusterModel model = (ClusterModel) getWindow(); cancelConfirmation(); Cluster cluster = buildCluster(model, model.getIsNew() ? new Cluster() : (Cluster) Cloner.clone(getSelectedItem())); AsyncDataProvider.getInstance().getClusterEditWarnings(new AsyncQuery<>(warnings -> { if (!warnings.isEmpty()) { ClusterWarningsModel confirmWindow = new ClusterWarningsModel(); confirmWindow.init(warnings); confirmWindow.getCommands().add(UICommand.createDefaultOkUiCommand("OnSaveInternal", ClusterListModel.this)); //$NON-NLS-1$ confirmWindow.getCommands().add(UICommand.createCancelUiCommand("CancelConfirmation", ClusterListModel.this)); //$NON-NLS-1$ setConfirmWindow(confirmWindow); } else { onSaveInternal(); } }), model.getClusterId(), cluster); }
ExistingVmModelBehavior behavior = (ExistingVmModelBehavior) getModel().getBehavior(); VM currentVm = behavior.vm; Cluster cluster = new Cluster(); cluster.setId(currentVm.getClusterId()); cluster.setName(currentVm.getClusterName());
@Mapping(from = MemoryPolicy.class, to = Cluster.class) public static Cluster map(MemoryPolicy model, Cluster template) { Cluster entity = template != null ? template : new Cluster(); if (model.isSetOverCommit() && model.getOverCommit().getPercent()!=null) { entity.setMaxVdsMemoryOverCommit(model.getOverCommit().getPercent()); } if (model.isSetTransparentHugepages() && model.getTransparentHugepages().isSetEnabled()) { entity.setTransparentHugepages(model.getTransparentHugepages().isEnabled()); } else if (template != null && greaterOrEqual(template.getCompatibilityVersion(), min_thp_version)){ entity.setTransparentHugepages(true); } return entity; }
private void onSaveInternalWithModel(final ClusterModel model) { Cluster cluster = buildCluster(model, model.getIsNew() ? new Cluster() : (Cluster) Cloner.clone(getSelectedItem())); model.startProgress(); final Network managementNetwork = model.getManagementNetwork().getSelectedItem(); final ManagementNetworkOnClusterOperationParameters clusterOperationParameters = new ManagementNetworkOnClusterOperationParameters(cluster, managementNetwork.getId()); final ActionType actionType = model.getIsNew() ? ActionType.AddCluster : ActionType.UpdateCluster; Frontend.getInstance().runAction( actionType, clusterOperationParameters, result -> { ClusterListModel<Void> localModel = (ClusterListModel<Void>) result.getState(); if (model.getIsImportGlusterConfiguration().getEntity()) { localModel.postOnSaveInternalWithImport(result.getReturnValue()); } else { localModel.postOnSaveInternal(result.getReturnValue()); } }, this); }
@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); }
@BeforeEach @Override public void setUp() { Cluster cluster = new Cluster(); cluster.setName("test-cluster"); cluster.setId(Guid.newGuid()); cluster.setCompatibilityVersion(Version.v4_3); cluster.setArchitecture(ArchitectureType.x86); cluster.setMacPoolId(FixturesTool.DEFAULT_MAC_POOL_ID); cluster.setFirewallType(FirewallType.IPTABLES); cluster.setLogMaxMemoryUsedThreshold(95); cluster.setLogMaxMemoryUsedThresholdType(LogMaxMemoryUsedThresholdType.PERCENTAGE); clusterDao.save(cluster); host = new VdsStatic(); host.setId(Guid.newGuid()); host.setName("test-host"); host.setHostName("host-ip"); host.setClusterId(cluster.getId()); vdsDao.save(host); }
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; }