use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class GetHostListFromExternalProviderQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
Provider hostProvider = getProvider();
List<VDS> providerHosts = getProviderHosts(hostProvider, getParameters().getSearchFilter());
if (providerHosts != null && getParameters().isFilterOutExistingHosts()) {
filterOutExistingHosts(providerHosts);
}
getQueryReturnValue().setReturnValue(providerHosts);
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class GetDiscoveredHostListFromExternalProviderQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
Provider hostProvider = getParameters().getProvider();
List<ExternalDiscoveredHost> providerHosts = getProviderHosts(hostProvider);
getQueryReturnValue().setReturnValue(providerHosts);
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class VdsCommand method validateNetworkProviderConfiguration.
protected boolean validateNetworkProviderConfiguration(Guid providerId, String networkMappings) {
if (providerId == null) {
return true;
} else {
Provider provider = providerDao.get(providerId);
NetworkProviderValidator validator = new NetworkProviderValidator(provider);
if (!(validate(validator.providerIsSet()) && validate(validator.providerTypeIsNetwork()))) {
return false;
}
if ((provider.getType() == ProviderType.OPENSTACK_NETWORK) && !validateOpenstackNetworkProviderProperties(validator, networkMappings)) {
return false;
}
return true;
}
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class ClusterPopupView method initListBoxEditors.
private void initListBoxEditors() {
dataCenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>());
managementNetworkEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Network>() {
@Override
protected String renderNullSafe(Network network) {
return network.getName();
}
});
cpuEditor = new ListModelListBoxEditor<>(new AbstractRenderer<ServerCpu>() {
@Override
public String render(ServerCpu object) {
return object != null ? object.getCpuName() : constants.autoDetect();
}
});
versionEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Version>() {
@Override
public String renderNullSafe(Version object) {
return object.toString();
}
});
switchTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<SwitchType>());
firewallTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<FirewallType>());
defaultNetworkProviderEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Provider>() {
@Override
protected String renderNullSafe(Provider provider) {
return provider.getName();
}
});
architectureEditor = new ListModelListBoxEditor<>(new EnumRenderer<ArchitectureType>() {
@Override
public String render(ArchitectureType object) {
if (object == null || object == ArchitectureType.undefined) {
// only localize the 'undefined' enum value
return super.render(object);
} else {
// all other (concrete) architectures should be displayed directly
return object.toString();
}
}
});
clusterPolicyEditor = new ListModelListBoxEditor<>(new NameRenderer<ClusterPolicy>());
hostsWithBrokenConnectivityThresholdEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Integer>() {
@Override
public String renderNullSafe(Integer object) {
if (object == null) {
return "";
}
NumberFormatRenderer renderer = new NumberFormatRenderer(NumberFormat.getPercentFormat());
// Since this is a percentage renderer, you need to divide by 100 to get the right values to show.
return renderer.render(object.doubleValue() / 100);
}
});
autoConvergeEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.autoConverge(), constants.dontAutoConverge(), constants.inheritFromGlobal()));
migrateCompressedEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.compress(), constants.dontCompress(), constants.inheritFromGlobal()));
migrationBandwidthLimitTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<MigrationBandwidthLimitType>());
migrationBandwidthLimitTypeEditor.hideLabel();
migrationPolicyEditor = new ListModelListBoxEditor<>(new NameRenderer());
migrationPolicyEditor.hideLabel();
macPoolListEditor = new ListModelListBoxEditor<>(new NameRenderer<MacPool>());
macPoolListEditor.setLabel(constants.clusterPopupMacPoolLabel());
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class ProviderValidatorTest method testValidateReadOnlyActions.
@Test
public void testValidateReadOnlyActions() {
String providerName = "providerName";
OpenstackNetworkProviderProperties additionalProperties = new OpenstackNetworkProviderProperties();
additionalProperties.setReadOnly(true);
Provider<AdditionalProperties> provider = new Provider<>();
provider.setAdditionalProperties(additionalProperties);
provider.setType(ProviderType.EXTERNAL_NETWORK);
provider.setName(providerName);
ProviderValidator validator = new ProviderValidator(provider);
EngineMessage engineMessage = EngineMessage.ACTION_TYPE_FAILED_EXTERNAL_PROVIDER_IS_READ_ONLY;
assertThat(validator.validateReadOnlyActions(), failsWith(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, providerName)));
additionalProperties.setReadOnly(false);
assertThat(validator.validateReadOnlyActions(), isValid());
provider.setType(ProviderType.OPENSTACK_NETWORK);
assertThat(validator.validateReadOnlyActions(), isValid());
}
Aggregations