private Guid getClusterIdOfSelectedHosts() { Guid clusterId = null; for (Object item : getSelectedItems()) { VDS host = (VDS) item; if (clusterId == null) { clusterId = host.getClusterId(); } else if (!clusterId.equals(host.getClusterId())) { clusterId = null; break; } } return clusterId; }
@Override protected Guid getClusterId() { return getEntity().getClusterId(); }
private void assertGetHostsForStorageOperationNonGluster(List<VDS> result) { for (VDS vds : result) { assertThat(vds.getClusterId(), not(equalTo(FixturesTool.GLUSTER_CLUSTER_ID))); } }
public void setDefaultNames2() { VDS host = context.host; // Get cluster of the host. if (host.getClusterId() != null) { AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>( returnValue -> { context.hostCluster = returnValue; setDefaultNames3(); }), host.getClusterId()); } else { setDefaultNames3(); } }
@Override protected void updateModelClusterFromVds(ArrayList<Cluster> clusters, VDS vds) { if (clusters != null) { getCluster().setSelectedItem(Linq.firstOrNull(clusters, new Linq.IdPredicate<>(vds.getClusterId()))); } }
/** * Ensures that all VDS related to the VDS group supplied. */ @Test public void testGetAllForCluster() { List<VDS> result = dao.getAllForCluster(existingVds.getClusterId()); assertNotNull(result); assertFalse(result.isEmpty()); for (VDS vds : result) { assertEquals(existingVds.getClusterId(), vds.getClusterId()); } }
private void assertGetAllForClusterCorrectResult(List<VDS> result) { assertNotNull(result); assertFalse(result.isEmpty()); assertEquals(result.iterator().next(), existingVds); for (VDS vds : result) { assertEquals(vds.getClusterId(), existingVds.getClusterId()); } }
/** * Ensures the API works as expected. */ @Test public void testGetAllForClusterWithoutMigrating() { List<VDS> result = dao.getAllForClusterWithoutMigrating(existingVds .getClusterId()); assertNotNull(result); assertFalse(result.isEmpty()); for (VDS vds : result) { assertEquals(existingVds.getClusterId(), vds.getClusterId()); } }
private void queryNetworks() { VDS vds = getEntity(); // query for networks AsyncDataProvider.getInstance().getClusterNetworkList(new AsyncQuery<>(returnValue -> { allNetworks = returnValue; // chain the qoss query queryQoss(); }), vds.getClusterId()); }
private void manageSwift(String action) { GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getClusterId(), getEntity().getId(), ServiceType.GLUSTER_SWIFT, action); Frontend.getInstance().runAction(ActionType.ManageGlusterService, parameters); }
public void restartGluster() { // call restart gluster GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getClusterId(), getEntity().getId(), ServiceType.GLUSTER, "restart"); //$NON-NLS-1$ Frontend.getInstance().runAction(ActionType.ManageGlusterService, parameters); }
@SuppressWarnings("unchecked") protected List<org.ovirt.engine.core.common.businessentities.network.Network> getClusterNetworks(){ VDS vds = getEntity(VDS.class, QueryType.GetVdsByVdsId, new IdQueryParameters(Guid.createGuidFromStringDefaultEmpty(getHostId())), "Host"); return getEntity(List.class, QueryType.GetAllNetworksByClusterId, new IdQueryParameters(vds.getClusterId()), "Networks"); }
/** * Asserts that the right collection containing the existing host is returned for a non privileged user with filtering disabled */ @Test public void testGetAllForClusterWithPermissionsDisabledForUnpriviligedUser() { List<VDS> result = dao.getAllForCluster(existingVds.getClusterId(), UNPRIVILEGED_USER_ID, false); assertGetAllForClusterCorrectResult(result); }
/** * Asserts that an empty collection is returned for an non privileged user with filtering enabled */ @Test public void testGetAllForClusterWithPermissionsForUnpriviligedUser() { List<VDS> result = dao.getAllForCluster(existingVds.getClusterId(), UNPRIVILEGED_USER_ID, true); assertNotNull(result); assertTrue(result.isEmpty()); }
/** * Asserts that the right collection containing the existing host is returned for a privileged user with filtering enabled */ @Test public void testGetAllForClusterWithPermissionsForPriviligedUser() { List<VDS> result = dao.getAllForCluster(existingVds.getClusterId(), PRIVILEGED_USER_ID, true); assertGetAllForClusterCorrectResult(result); }
@Test public void testGetHostsForStorageOperationLocalFsOnly() { List<VDS> result = dao.getHostsForStorageOperation(null, true); assertNotNull(result); assertEquals(1, result.size()); assertEquals(FixturesTool.CLUSTER_RHEL6_LOCALFS, result.get(0).getClusterId()); }
private void updateNetworkProviderModel() { if (vds != null && networkProviderModel != null) { networkProviderModel.selectProviderById(vds.getOpenstackNetworkProviderId()); startProgress(); AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> { stopProgress(); networkProviderModel.setDefaultProviderId(cluster.getDefaultNetworkProviderId()); }), vds.getClusterId()); } } }
protected void initHostNUMATopology() { startProgress(); AsyncDataProvider.getInstance().getHostNumaTopologyByHostId(new AsyncQuery<>(returnValue -> { // TODO: host query can be skipped in case it was already fetched. getNumaNodeList().addAll(returnValue); initFirstLevelDistanceSetList(); AsyncDataProvider.getInstance().getVMsWithVNumaNodesByClusterId(new AsyncQuery<>(returnValue1 -> { setVmsWithvNumaNodeList(returnValue1); initVNumaNodes(); modelReady(); }), hosts.getSelectedItem().getClusterId()); }), hosts.getSelectedItem().getId()); }
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)); } }
public Cluster getCluster() { if (cluster == null) { if (clusterId != null) { cluster = clusterDao.get(clusterId); } else if (getVds() != null) { clusterId = getVds().getClusterId(); cluster = clusterDao.get(clusterId); } else if (getVm() != null) { clusterId = getVm().getClusterId(); cluster = clusterDao.get(clusterId); } else if (getVmTemplate() != null) { clusterId = getVmTemplate().getClusterId(); cluster = clusterDao.get(clusterId); } } return cluster; }