/** * resolve the host ip address * * @param host * the host which it's address is about to be resolved * @return if succeeded, string representing the host ip, null otherwise */ public static String getHostIp(VDS host) { try { final InetAddress address = InetAddress.getByName(host.getHostName()); return address.getHostAddress().trim(); } catch (UnknownHostException ex) { final String msg = "Failed to resolve host ip by name '{}'"; log.warn(msg, " Details: '{}' ", host.getHostName(), ex.getCause()); log.debug(msg, host.getHostName(), ex); return null; } }
/** * @return A unique host name representation */ public static String getUniqueHostName(VDS host) { return host.getHostName() + "-" + DigestUtils.md5Hex(host.getId().toByteArray()).substring(0, 6); }
private void openCockpitWithoutSSO() { // https://[HOST_FQDN]:9000 String cockpitPort = (String) AsyncDataProvider.getInstance() .getConfigValuePreConverted(ConfigValues.CockpitPort); for (VDS item : getSelectedItems()) { // open new browser-tab for every selected host StringBuilder cockpitUrl = new StringBuilder(); cockpitUrl.append(Uri.SCHEME_HTTPS); cockpitUrl.append("://"); //$NON-NLS-1$ cockpitUrl.append(item.getHostName()); if (StringHelper.isNotNullOrEmpty(cockpitPort)) { cockpitUrl.append(':'); cockpitUrl.append(cockpitPort); } getLogger().info("About to open: " + cockpitUrl.toString());//$NON-NLS-1$ Window.open(cockpitUrl.toString(), "_blank", "");//$NON-NLS-1$ } }
private void filterServices() { VDS selectedVds = hostList.getSelectedItem(); ServiceType serviceType = serviceTypeList.getSelectedItem(); ArrayList<EntityModel<GlusterServerService>> list = new ArrayList<>(); List<GlusterServerService> serviceList = new ArrayList<>(getActualServiceList()); Collections.sort(serviceList, Comparator.comparing(GlusterServerService::getHostName) .thenComparing(g -> g.getServiceType().toString())); for (GlusterServerService service : serviceList) { if ((selectedVds == null || service.getHostName().equals(selectedVds.getHostName())) && (serviceType == null || service.getServiceType() == serviceType)) { list.add(new EntityModel<>(service)); } } getServiceList().setItems(list); }
@Mapping(from = VDS.class, to = ExternalHost.class) public static ExternalHost map(VDS entity, ExternalHost template) { ExternalHost model = template != null? template: new ExternalHost(); String name = entity.getName(); if (name != null) { model.setId(string2hex(name)); model.setName(name); } if (entity.getHostName() != null) { model.setAddress(entity.getHostName()); } return model; }
/** * Ensures that the right set of VDS instances are returned for the given hostname. */ @Test public void testGetAllForHostname() { List<VDS> result = dao.getAllForHostname(existingVds.getHostName()); assertNotNull(result); assertFalse(result.isEmpty()); for (VDS vds : result) { assertEquals(existingVds.getHostName(), vds.getHostName()); } }
private void hostName_SelectedItemChanged() { if (Boolean.FALSE.equals(getIsDiscoveredHosts().getEntity())) { VDS vds = getExternalHostName().getSelectedItem(); if (vds != null) { setOriginalName(vds.getName()); getName().setEntity(vds.getName()); getHost().setEntity(vds.getHostName()); } } }
return; String selectedHost = server.getHostName(); boolean isMultipleBricks = volumeEntity.getBrickDirectories() .stream().filter(brick -> brick.contains(selectedHost) && selectedHost != existingBrick.getServerName())
brickEntity.setServerName(server.getHostName()); brickEntity.setBrickDirectory(brickDir);
newBrick.setVolumeId(volumeEntity.getId()); newBrick.setServerId(server.getId()); newBrick.setServerName(server.getHostName()); newBrick.setBrickDirectory(replaceBrickModel.getBrickDirectory().getEntity()); replaceBrickModel.startProgress();
model.setCluster(cluster); model.setAddress(entity.getHostName()); if (entity.getPort() > 0) { model.setPort(entity.getPort()); if(entity.getHostName() != null) { String subject = CertificateSubjectHelper.getCertificateSubject(entity.getHostName()); model.setCertificate(new Certificate()); model.getCertificate().setSubject(subject);
private static Object cloneVDS(VDS instance) { VDS obj = new VDS(); obj.setHostName(instance.getHostName()); obj.setSshKeyFingerprint(instance.getSshKeyFingerprint()); obj.setSshPort(instance.getSshPort()); obj.setSshUsername(instance.getSshUsername()); obj.setFenceAgents(cloneAgents(instance.getFenceAgents())); obj.setDisablePowerManagementPolicy(instance.isDisablePowerManagementPolicy()); obj.setPmKdumpDetection(instance.isPmKdumpDetection()); obj.setPort(instance.getPort()); obj.setServerSslEnabled(instance.isServerSslEnabled()); obj.setClusterId(instance.getClusterId()); obj.setId(instance.getId()); obj.setVdsName(instance.getName()); obj.setVdsStrength(instance.getVdsStrength()); obj.setVdsType(instance.getVdsType()); obj.setUniqueId(instance.getUniqueId()); obj.setVdsSpmPriority(instance.getVdsSpmPriority()); obj.setCurrentKernelCmdline(instance.getCurrentKernelCmdline()); obj.setKernelCmdlineParsable(instance.isKernelCmdlineParsable()); obj.setLastStoredKernelCmdline(instance.getLastStoredKernelCmdline()); obj.setKernelCmdlineBlacklistNouveau(instance.isKernelCmdlineBlacklistNouveau()); obj.setKernelCmdlineIommu(instance.isKernelCmdlineIommu()); obj.setKernelCmdlineKvmNested(instance.isKernelCmdlineKvmNested()); obj.setKernelCmdlinePciRealloc(instance.isKernelCmdlinePciRealloc()); obj.setKernelCmdlineFips(instance.isKernelCmdlineFips()); obj.setKernelCmdlineUnsafeInterrupts(instance.isKernelCmdlineUnsafeInterrupts()); return obj; }
getName().setEntity(vds.getName()); getComment().setEntity(vds.getComment()); getHost().setEntity(vds.getHostName()); getFetchSshFingerprint().setEntity(vds.getSshKeyFingerprint()); getUserName().setEntity(vds.getSshUsername());
vds.setId(getId()); vds.setVdsName(getName()); vds.setHostName(getHostName()); vds.setComment(getComment()); vds.setPort(getPort());