use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class VdsHandlerTest method testInvalidUpdateOfNonEditableFieldOnRunningHost.
@Test
public void testInvalidUpdateOfNonEditableFieldOnRunningHost() {
// Given
VdsStatic src = new VdsStatic();
src.setServerSslEnabled(true);
VdsStatic dest = new VdsStatic();
dest.setServerSslEnabled(false);
// When
boolean updateIsValid = vdsHandler.isUpdateValid(src, dest, VDSStatus.Up);
// Then
assertFalse("Update should not be valid for different server SSL enabled states", updateIsValid);
}
use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class VdsHandlerTest method testValidUpdateOfStatusRestrictedEditableFieldOnDownHost.
@Test
public void testValidUpdateOfStatusRestrictedEditableFieldOnDownHost() {
// Given
int srcSshPort = 22;
int destSshPort = 23;
VdsStatic src = new VdsStatic();
src.setSshPort(srcSshPort);
VdsStatic dest = new VdsStatic();
dest.setSshPort(destSshPort);
// When
boolean updateIsValid = vdsHandler.isUpdateValid(src, dest, VDSStatus.Down);
// Then
assertTrue("Update should be valid for different SSH ports in Down status", updateIsValid);
}
use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class HostMapper method map.
@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()));
}
if (model.isSetName()) {
entity.setName(model.getName());
}
if (model.isSetCluster() && model.getCluster().isSetId()) {
entity.setClusterId(GuidUtils.asGuid(model.getCluster().getId()));
}
if (model.isSetAddress()) {
entity.setHostName(model.getAddress());
}
if (model.isSetPort() && model.getPort() > 0) {
entity.setPort(model.getPort());
} else {
entity.setPort(DEFAULT_VDSM_PORT);
}
if (model.isSetSsh()) {
map(model.getSsh(), entity);
}
if (model.isSetPowerManagement()) {
entity = map(model.getPowerManagement(), entity);
}
if (model.isSetSpm()) {
if (model.getSpm().getPriority() != null) {
entity.setVdsSpmPriority(model.getSpm().getPriority());
}
}
if (model.isSetDisplay() && model.getDisplay().isSetAddress()) {
entity.setConsoleAddress("".equals(model.getDisplay().getAddress()) ? null : model.getDisplay().getAddress());
}
if (model.isSetComment()) {
entity.setComment(model.getComment());
}
if (model.isSetExternalHostProvider()) {
String providerId = model.getExternalHostProvider().getId();
entity.setHostProviderId(providerId == null ? null : GuidUtils.asGuid(providerId));
}
if (model.isSetOs()) {
mapOperatingSystem(model.getOs(), entity);
}
if (model.isSetExternalNetworkProviderConfigurations() && model.getExternalNetworkProviderConfigurations().isSetExternalNetworkProviderConfigurations()) {
List<ExternalNetworkProviderConfiguration> externalProviders = model.getExternalNetworkProviderConfigurations().getExternalNetworkProviderConfigurations();
if (externalProviders.size() > 0) {
// Ignore everything but the first external provider, because engine's VdsStatic currently supports
// only a single external network provider
String providerId = externalProviders.get(0).getExternalNetworkProvider().getId();
entity.setOpenstackNetworkProviderId(providerId == null ? null : GuidUtils.asGuid(providerId));
}
}
return entity;
}
use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class HostMapper method mapOperatingSystem.
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;
}
use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.
the class GetErrataForHostQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
VdsStatic host = hostStaticDao.get(getParameters().getId());
if (host == null || host.getHostProviderId() == null) {
getQueryReturnValue().setReturnValue(ErrataData.emptyData());
return;
}
Provider<?> provider = providerDao.get(host.getHostProviderId());
if (provider != null) {
HostProviderProxy proxy = providerProxyFactory.create(provider);
ErrataData errataForHost = proxy.getErrataForHost(host.getHostName(), getParameters().getErrataFilter());
getQueryReturnValue().setReturnValue(errataForHost);
} else {
getQueryReturnValue().setReturnValue(ErrataData.emptyData());
}
}
Aggregations