public VDS() { vdsStatic = new VdsStatic(); vdsDynamic = new VdsDynamic(); vdsStatistics = new VdsStatistics(); storagePoolId = Guid.Empty; spmStatus = VdsSpmStatus.None; interfaces = new ArrayList<>(); networkNames = new HashSet<>(); fenceAgents = new LinkedList<>(); }
public static VdsStatic mapOperatingSystem(OperatingSystem model, VdsStatic template) { final VdsStatic entity = template != null ? template : new VdsStatic(); if (model.isSetCustomKernelCmdline()) { entity.setCurrentKernelCmdline(model.getCustomKernelCmdline()); entity.setKernelCmdlineParsable(false); } return entity; }
protected VdsStatic setUpVDStatic(int index) { VdsStatic vds = new VdsStatic(); vds.setId(GUIDS[index]); vds.setName(NAMES[index]); return vds; }
protected VdsStatic setUpVDStatic(int index) { VdsStatic vds = new VdsStatic(); vds.setId(GUIDS[index]); vds.setName(NAMES[index]); return vds; }
@Mapping(from = PowerManagement.class, to = VdsStatic.class) public static VdsStatic map(PowerManagement model, VdsStatic template) { VdsStatic entity = template != null ? template : new VdsStatic(); if (model.isSetEnabled()) { entity.setPmEnabled(model.isEnabled()); } if (model.isSetAutomaticPmEnabled()) { entity.setDisablePowerManagementPolicy(!model.isAutomaticPmEnabled()); } if (model.isSetPmProxies()) { List<FenceProxySourceType> fenceProxySources = model.getPmProxies() .getPmProxies() .stream() .map(pmProxy -> FenceProxySourceType.forValue(pmProxy.getType().toString())) .collect(toCollection(LinkedList::new)); entity.setFenceProxySources(fenceProxySources); } if (model.isSetKdumpDetection()) { entity.setPmKdumpDetection(model.isKdumpDetection()); } return entity; }
@Mapping(from = Ssh.class, to = VdsStatic.class) public static VdsStatic map(Ssh model, VdsStatic template) { VdsStatic entity = template != null ? template : new VdsStatic(); if (model.isSetUser() && model.getUser().isSetUserName()) { entity.setSshUsername(model.getUser().getUserName()); } if (model.isSetPort() && model.getPort() > 0) { entity.setSshPort(model.getPort()); } if (model.isSetFingerprint()) { entity.setSshKeyFingerprint(model.getFingerprint()); } return entity; }
@Override protected VdsStatic generateNewEntity() { VdsStatic newStaticVds = new VdsStatic(); newStaticVds.setHostName("farkle.redhat.com"); newStaticVds.setSshPort(22); newStaticVds.setSshUsername("root"); newStaticVds.setClusterId(existingEntity.getClusterId()); newStaticVds.setSshKeyFingerprint("b5:ad:16:19:06:9f:b3:41:69:eb:1c:42:1d:12:b5:31"); newStaticVds.setCurrentKernelCmdline("a=b"); newStaticVds.setLastStoredKernelCmdline("c=d"); newStaticVds.setKernelCmdlineIommu(true); return newStaticVds; }
@Test public void testUpdateSshHost() { Ssh sshConf = new Ssh(); sshConf.setPort(22); sshConf.setUser(new User()); sshConf.getUser().setUserName("root"); sshConf.setFingerprint("1234"); VdsStatic vdsStatic = new VdsStatic(); vdsStatic.setSshUsername("root"); vdsStatic.setSshPort(22); vdsStatic.setSshKeyFingerprint("1234"); VdsStatic mappedVdsStatic = HostMapper.map(sshConf, vdsStatic); assertEquals(22, mappedVdsStatic.getSshPort()); assertEquals("1234", mappedVdsStatic.getSshKeyFingerprint()); assertEquals("root", mappedVdsStatic.getSshUsername()); }
@Mapping(from = Host.class, to = VdsStatic.class) public static VdsStatic map(Host model, VdsStatic template) { VdsStatic entity = template != null ? template : new VdsStatic(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId()));
@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); }
public static Stream<BusinessEntity<?>> data() { RandomUtils random = RandomUtils.instance(); VdsStatic vdsStatic = new VdsStatic(random.nextString(10), random.nextString(10), random.nextInt(), random.nextInt(), random.nextString(10), Guid.newGuid(), Guid.newGuid(), random.nextString(10), random.nextBoolean(), random.nextEnum(VDSType.class), Guid.newGuid()); return Stream.of( vdsStatic, randomVdsDynamic(), randomVdsStatistics(), new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt()), randomStorageDomainStatic(), new StorageDomainDynamic(random.nextInt(), Guid.newGuid(), random.nextInt()), randomStoragePool(), new StoragePoolIsoMap(Guid.newGuid(), Guid.newGuid(), random.nextEnum(StorageDomainStatus.class)), randomRole(), new IdContainerClass<>(new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt())), new IdContainerClass<>(Guid.newGuid()) ); }