static Cluster setUpEntityExpectations(Cluster entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getDescription()).thenReturn(DESCRIPTIONS[index]); when(entity.getMigrationBandwidthLimitType()).thenReturn(MigrationBandwidthLimitType.AUTO); return entity; }
static Cluster setUpEntityExpectations(Cluster entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getDescription()).thenReturn(DESCRIPTIONS[index]); when(entity.getMigrationBandwidthLimitType()).thenReturn(MigrationBandwidthLimitType.AUTO); return entity; }
@Mapping(from = Cluster.class, to = MigrationOptions.class) public static MigrationOptions map(Cluster entity, MigrationOptions template) { template = MigrationOptionsMapper.map(entity, template); MigrationBandwidth bandwidth = template.getBandwidth(); if (bandwidth == null) { bandwidth = new MigrationBandwidth(); template.setBandwidth(bandwidth); } switch (entity.getMigrationBandwidthLimitType()) { case AUTO: bandwidth.setAssignmentMethod(MigrationBandwidthAssignmentMethod.AUTO); break; case VDSM_CONFIG: bandwidth.setAssignmentMethod(MigrationBandwidthAssignmentMethod.HYPERVISOR_DEFAULT); break; case CUSTOM: bandwidth.setAssignmentMethod(MigrationBandwidthAssignmentMethod.CUSTOM); bandwidth.setCustomValue(entity.getCustomMigrationNetworkBandwidth()); break; } return template; }
clusterModel.getGlusterTunedProfile().setIsChangeable(cluster.getClusterHostsAndVms().getHosts() == 0); clusterModel.getMigrationBandwidthLimitType().setItems(Arrays.asList(MigrationBandwidthLimitType.values())); clusterModel.getMigrationBandwidthLimitType().setSelectedItem(cluster.getMigrationBandwidthLimitType() != null ? cluster.getMigrationBandwidthLimitType() : MigrationBandwidthLimitType.DEFAULT); clusterModel.getCustomMigrationNetworkBandwidth().setEntity(cluster.getCustomMigrationNetworkBandwidth());
.addValue("gluster_tuned_profile", cluster.getGlusterTunedProfile()) .addValue("ksm_merge_across_nodes", cluster.isKsmMergeAcrossNumaNodes()) .addValue("migration_bandwidth_limit_type", cluster.getMigrationBandwidthLimitType().name()) .addValue("custom_migration_bandwidth_limit", cluster.getCustomMigrationNetworkBandwidth()) .addValue("migration_policy_id", cluster.getMigrationPolicyId())