Search in sources :

Example 1 with PmProxy

use of org.ovirt.engine.api.model.PmProxy in project ovirt-engine by oVirt.

the class HostMapper method map.

@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;
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) TransparentHugePages(org.ovirt.engine.api.model.TransparentHugePages) VERSION_NOT_SET(org.ovirt.engine.core.compat.Version.VERSION_NOT_SET) Host(org.ovirt.engine.api.model.Host) ExternalNetworkProviderConfiguration(org.ovirt.engine.api.model.ExternalNetworkProviderConfiguration) SpmStatus(org.ovirt.engine.api.model.SpmStatus) Hook(org.ovirt.engine.api.model.Hook) PowerManagement(org.ovirt.engine.api.model.PowerManagement) Cluster(org.ovirt.engine.api.model.Cluster) SshAuthenticationMethod(org.ovirt.engine.api.model.SshAuthenticationMethod) VdsTransparentHugePagesState(org.ovirt.engine.core.common.businessentities.VdsTransparentHugePagesState) SeLinuxMode(org.ovirt.engine.api.model.SeLinuxMode) Ksm(org.ovirt.engine.api.model.Ksm) BigDecimal(java.math.BigDecimal) PmProxyType(org.ovirt.engine.api.model.PmProxyType) Ssh(org.ovirt.engine.api.model.Ssh) CertificateSubjectHelper(org.ovirt.engine.core.utils.CertificateSubjectHelper) Map(java.util.Map) OS(org.ovirt.engine.core.utils.OS) Version(org.ovirt.engine.api.model.Version) HostType(org.ovirt.engine.api.model.HostType) User(org.ovirt.engine.api.model.User) PmProxy(org.ovirt.engine.api.model.PmProxy) SeLinux(org.ovirt.engine.api.model.SeLinux) Certificate(org.ovirt.engine.api.model.Certificate) IscsiDetails(org.ovirt.engine.api.model.IscsiDetails) Hooks(org.ovirt.engine.api.model.Hooks) FenceProxySourceType(org.ovirt.engine.core.common.businessentities.pm.FenceProxySourceType) VdsSpmStatus(org.ovirt.engine.core.common.businessentities.VdsSpmStatus) HostedEngine(org.ovirt.engine.api.model.HostedEngine) Objects(java.util.Objects) VdsOperationActionParameters(org.ovirt.engine.core.common.action.VdsOperationActionParameters) AutoNumaBalanceStatus(org.ovirt.engine.core.common.businessentities.AutoNumaBalanceStatus) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Action(org.ovirt.engine.api.model.Action) Display(org.ovirt.engine.api.model.Display) KdumpStatus(org.ovirt.engine.api.model.KdumpStatus) VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) HostProtocol(org.ovirt.engine.api.model.HostProtocol) Guid(org.ovirt.engine.core.compat.Guid) HashMap(java.util.HashMap) HostDevicePassthrough(org.ovirt.engine.api.model.HostDevicePassthrough) OperatingSystem(org.ovirt.engine.api.model.OperatingSystem) GuidUtils(org.ovirt.engine.api.restapi.utils.GuidUtils) Collectors.toCollection(java.util.stream.Collectors.toCollection) ExternalStatus(org.ovirt.engine.api.model.ExternalStatus) Option(org.ovirt.engine.api.model.Option) HardwareInformation(org.ovirt.engine.api.model.HardwareInformation) LinkedList(java.util.LinkedList) OsType(org.ovirt.engine.api.model.OsType) CpuTopology(org.ovirt.engine.api.model.CpuTopology) PmProxies(org.ovirt.engine.api.model.PmProxies) VDSType(org.ovirt.engine.core.common.businessentities.VDSType) AutoNumaStatus(org.ovirt.engine.api.model.AutoNumaStatus) Cpu(org.ovirt.engine.api.model.Cpu) ExternalHostProvider(org.ovirt.engine.api.model.ExternalHostProvider) Spm(org.ovirt.engine.api.model.Spm) VmSummary(org.ovirt.engine.api.model.VmSummary) Options(org.ovirt.engine.api.model.Options) VDS(org.ovirt.engine.core.common.businessentities.VDS) HostStatus(org.ovirt.engine.api.model.HostStatus) VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) FenceProxySourceType(org.ovirt.engine.core.common.businessentities.pm.FenceProxySourceType)

Example 2 with PmProxy

use of org.ovirt.engine.api.model.PmProxy in project ovirt-engine by oVirt.

the class HostMapper method map.

@Mapping(from = VDS.class, to = PowerManagement.class)
public static PowerManagement map(VDS entity, PowerManagement template) {
    PowerManagement model = template != null ? template : new PowerManagement();
    if (entity.getFenceProxySources() != null) {
        PmProxies pmProxies = new PmProxies();
        for (FenceProxySourceType fenceProxySource : entity.getFenceProxySources()) {
            PmProxy pmProxy = new PmProxy();
            pmProxy.setType(map(fenceProxySource, null));
            pmProxies.getPmProxies().add(pmProxy);
        }
        model.setPmProxies(pmProxies);
    }
    model.setKdumpDetection(entity.isPmKdumpDetection());
    model.setEnabled(entity.isPmEnabled());
    model.setAutomaticPmEnabled(!entity.isDisablePowerManagementPolicy());
    return model;
}
Also used : PowerManagement(org.ovirt.engine.api.model.PowerManagement) FenceProxySourceType(org.ovirt.engine.core.common.businessentities.pm.FenceProxySourceType) PmProxies(org.ovirt.engine.api.model.PmProxies) PmProxy(org.ovirt.engine.api.model.PmProxy)

Aggregations

PmProxies (org.ovirt.engine.api.model.PmProxies)2 PmProxy (org.ovirt.engine.api.model.PmProxy)2 PowerManagement (org.ovirt.engine.api.model.PowerManagement)2 BigDecimal (java.math.BigDecimal)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Collectors.toCollection (java.util.stream.Collectors.toCollection)1 StringUtils (org.apache.commons.lang.StringUtils)1 Action (org.ovirt.engine.api.model.Action)1 AutoNumaStatus (org.ovirt.engine.api.model.AutoNumaStatus)1 Certificate (org.ovirt.engine.api.model.Certificate)1 Cluster (org.ovirt.engine.api.model.Cluster)1 Cpu (org.ovirt.engine.api.model.Cpu)1 CpuTopology (org.ovirt.engine.api.model.CpuTopology)1 Display (org.ovirt.engine.api.model.Display)1 ExternalHostProvider (org.ovirt.engine.api.model.ExternalHostProvider)1 ExternalNetworkProviderConfiguration (org.ovirt.engine.api.model.ExternalNetworkProviderConfiguration)1