Search in sources :

Example 16 with VmDynamic

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

the class AddVmCommandTestBase method initVM.

protected void initVM() {
    vm = new VM();
    VmDynamic dynamic = new VmDynamic();
    VmStatic stat = new VmStatic();
    stat.setVmtGuid(Guid.newGuid());
    stat.setName("testVm");
    stat.setPriority(1);
    stat.setMemSizeMb(MEMORY_SIZE);
    stat.setMaxMemorySizeMb(MAX_MEMORY_SIZE);
    vm.setStaticData(stat);
    vm.setDynamicData(dynamic);
    vm.setSingleQxlPci(false);
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) VM(org.ovirt.engine.core.common.businessentities.VM) VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic)

Example 17 with VmDynamic

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

the class RestoreAllSnapshotsCommandTest method mockDynamicVmDao.

private void mockDynamicVmDao() {
    VmDynamic mockDynamicVm = getVmDynamic();
    when(vmDynamicDao.get(vmId)).thenReturn(mockDynamicVm);
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic)

Example 18 with VmDynamic

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

Example 19 with VmDynamic

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

the class VmHandler method updateCurrentCd.

public void updateCurrentCd(VM vm, String currentCd) {
    VmDynamic vmDynamic = vm.getDynamicData();
    vmDynamic.setCurrentCd(currentCd);
    vdsBrokerFrontend.runVdsCommand(VDSCommandType.UpdateVmDynamicData, new UpdateVmDynamicDataVDSCommandParameters(vmDynamic));
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) UpdateVmDynamicDataVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.UpdateVmDynamicDataVDSCommandParameters)

Example 20 with VmDynamic

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

the class VmHandler method checkStatusAndLockVm.

/**
 * Lock VM after check its status, If VM status is locked, we throw an exception.
 *
 * @param vmId
 *            - The ID of the VM.
 */
public void checkStatusAndLockVm(Guid vmId) {
    VmDynamic vmDynamic = vmDynamicDao.get(vmId);
    checkStatusBeforeLock(vmDynamic.getStatus());
    lockVm(vmId);
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic)

Aggregations

VmDynamic (org.ovirt.engine.core.common.businessentities.VmDynamic)54 Test (org.junit.Test)13 Guid (org.ovirt.engine.core.compat.Guid)12 VmStatic (org.ovirt.engine.core.common.businessentities.VmStatic)8 VM (org.ovirt.engine.core.common.businessentities.VM)7 VmStatistics (org.ovirt.engine.core.common.businessentities.VmStatistics)6 Vm (org.ovirt.engine.api.model.Vm)4 Date (java.util.Date)3 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 VdsmVm (org.ovirt.engine.core.vdsbroker.monitoring.VdsmVm)2 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1