Search in sources :

Example 26 with VmDeviceId

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

the class VmDeviceCommonUtils method addCdDevice.

public static void addCdDevice(VmBase vmBase) {
    VmDevice vmDevice = new VmDevice();
    vmDevice.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId()));
    vmDevice.setType(VmDeviceGeneralType.DISK);
    vmDevice.setDevice(VmDeviceType.CDROM.getName());
    vmDevice.setManaged(true);
    vmDevice.setPlugged(true);
    vmDevice.setReadOnly(true);
    vmDevice.setAddress("");
    vmBase.getManagedDeviceMap().put(vmDevice.getDeviceId(), vmDevice);
}
Also used : VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId)

Example 27 with VmDeviceId

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

the class BackendVmDiskResourceTest method setUpDiskVmElementExpectations.

private void setUpDiskVmElementExpectations() throws Exception {
    DiskVmElement dve = new DiskVmElement(DISK_ID, VM_ID);
    dve.setDiskInterface(DiskInterface.VirtIO);
    dve.setBoot(false);
    setUpGetEntityExpectations(QueryType.GetDiskVmElementById, VmDeviceIdQueryParameters.class, new String[] { "Id" }, new Object[] { new VmDeviceId(DISK_ID, VM_ID) }, dve);
}
Also used : DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId)

Example 28 with VmDeviceId

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

the class ExportOvaCommand method buildCreateOvaParameters.

private CreateOvaParameters buildCreateOvaParameters() {
    CreateOvaParameters parameters = new CreateOvaParameters();
    parameters.setVm(vmDao.get(getParameters().getEntityId()));
    getParameters().getDiskInfoDestinationMap().forEach((source, destination) -> {
        // same as the disk<->vm element for the original disk
        destination.setDiskVmElements(Collections.singleton(diskVmElementDao.get(new VmDeviceId(source.getId(), getParameters().getEntityId()))));
    });
    parameters.setDiskInfoDestinationMap(getParameters().getDiskInfoDestinationMap());
    parameters.setProxyHostId(getParameters().getProxyHostId());
    parameters.setDirectory(getParameters().getDirectory());
    parameters.setName(getParameters().getName());
    return parameters;
}
Also used : VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId) CreateOvaParameters(org.ovirt.engine.core.common.action.CreateOvaParameters)

Example 29 with VmDeviceId

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

the class ImportUtils method getCompatibleGraphics.

private GraphicsDevice getCompatibleGraphics(VmDeviceType videoDeviceType, Version clusterVersion, VmBase vmBase) {
    GraphicsDevice graphicsDevice = null;
    GraphicsType compatibleType = null;
    for (Pair<GraphicsType, DisplayType> graphicsDisplayPair : osRepository.getGraphicsAndDisplays(vmBase.getOsId(), clusterVersion)) {
        if (graphicsDisplayPair.getSecond().getDefaultVmDeviceType() == videoDeviceType) {
            compatibleType = graphicsDisplayPair.getFirst();
            // previously to spice+vnc, QXL was only used by spice, so prefer spice if available
            if (videoDeviceType == VmDeviceType.QXL && compatibleType == GraphicsType.SPICE) {
                break;
            }
        }
    }
    if (compatibleType != null) {
        graphicsDevice = new GraphicsDevice(compatibleType.getCorrespondingDeviceType());
        graphicsDevice.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId()));
    }
    return graphicsDevice;
}
Also used : GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId)

Example 30 with VmDeviceId

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

the class VmHandler method updateDisksVmDataForVm.

public void updateDisksVmDataForVm(VM vm) {
    for (Disk disk : vm.getDiskMap().values()) {
        DiskVmElement dve = diskVmElementDao.get(new VmDeviceId(disk.getId(), vm.getId()));
        disk.setDiskVmElements(Collections.singletonList(dve));
    }
}
Also used : DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId)

Aggregations

VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)75 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)40 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)21 Guid (org.ovirt.engine.core.compat.Guid)19 HashMap (java.util.HashMap)13 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)12 Test (org.junit.Test)10 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)9 ArrayList (java.util.ArrayList)7 Map (java.util.Map)5 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)5 VM (org.ovirt.engine.core.common.businessentities.VM)5 VmPayload (org.ovirt.engine.core.common.businessentities.VmPayload)4 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)4 VmNic (org.ovirt.engine.core.common.businessentities.network.VmNic)4 Collection (java.util.Collection)3 HashSet (java.util.HashSet)3 DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)3 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)3 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)3