Search in sources :

Example 6 with VdsStatic

use of org.ovirt.engine.core.common.businessentities.VdsStatic 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 7 with VdsStatic

use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.

the class InstallVdsInternalCommand method markCurrentCmdlineAsStored.

private void markCurrentCmdlineAsStored() {
    final VdsStatic vdsStatic = getVds().getStaticData();
    vdsStaticDao.updateLastStoredKernelCmdline(vdsStatic.getId(), vdsStatic.getCurrentKernelCmdline());
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic)

Example 8 with VdsStatic

use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.

the class GeorepEventSubscriber method processEvent.

@Override
public void processEvent(GlusterEvent event) {
    if (event == null) {
        log.debug("No event to process!");
        return;
    }
    GlusterServer glusterServer = glusterServerDao.getByGlusterServerUuid(Guid.createGuidFromString(event.getNodeId()));
    if (glusterServer == null) {
        log.debug("Could not determine gluster server from event '{}'", event);
        return;
    }
    VdsStatic host = vdsStaticDao.get(glusterServer.getId());
    if (host == null) {
        log.debug("No host corresponding to gluster server in '{}'", event);
        return;
    }
    if (event.getEvent().equalsIgnoreCase(EVENT_GEOREP_CHECKPOINT_COMPLETED)) {
        GlusterVolumeEntity masterVol = glusterVolumeDao.getByName(host.getClusterId(), (String) event.getMessage().get(MASTER_VOLUME));
        if (masterVol == null) {
            log.debug("Could not determine master volume from event '{}'", event);
            return;
        }
        GlusterGeoRepSession session = geoRepDao.getGeoRepSession(masterVol.getId(), (String) event.getMessage().get(SLAVE_HOST), (String) event.getMessage().get(SLAVE_VOLUME));
        // hence forcing sync for now.
        if (session != null) {
            log.debug("received event for session '{}'", session.getSessionKey());
        }
        geoRepSyncJob.refreshGeoRepDataForVolume(masterVol);
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Example 9 with VdsStatic

use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.

the class EntityDaoImplTest method testGetEntityNameByIdAndTypeForHost.

@Test
public void testGetEntityNameByIdAndTypeForHost() {
    VdsStatic vds = vdsStaticDao.get(FixturesTool.VDS_RHEL6_NFS_SPM);
    assertNotNull(vds);
    String name = vds.getName();
    assertEquals(name, underTest.getEntityNameByIdAndType(FixturesTool.VDS_RHEL6_NFS_SPM, VdcObjectType.VDS));
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) Test(org.junit.Test)

Example 10 with VdsStatic

use of org.ovirt.engine.core.common.businessentities.VdsStatic in project ovirt-engine by oVirt.

the class GetVdsCertificateSubjectByVmIdQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    // Initially we set the command as failed:
    QueryReturnValue queryReturnValue = getQueryReturnValue();
    queryReturnValue.setSucceeded(false);
    // Check if the virtual machine is running on a host, and if does then retrieve the host and copy the subject
    // of the certificate to the value returned by the query:
    Guid vmId = getParameters().getId();
    if (vmId != null) {
        VmDynamic vm = vmDynamicDao.get(vmId);
        if (vm != null) {
            Guid vdsId = vm.getRunOnVds();
            if (vdsId != null) {
                VdsStatic vds = vdsStaticDao.get(vdsId);
                queryReturnValue.setSucceeded(true);
                queryReturnValue.setReturnValue(CertificateSubjectHelper.getCertificateSubject(vds.getHostName()));
            }
        }
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)49 Test (org.junit.Test)10 Guid (org.ovirt.engine.core.compat.Guid)8 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Map (java.util.Map)3 Objects (java.util.Objects)3 Before (org.junit.Before)3 HostProviderProxy (org.ovirt.engine.core.bll.host.provider.HostProviderProxy)3 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)3 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)3 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 StringUtils (org.apache.commons.lang.StringUtils)2 Host (org.ovirt.engine.api.model.Host)2