Search in sources :

Example 31 with DiskVmElement

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

the class CloneVmCommand method attachDetachDisk.

private void attachDetachDisk(Disk disk, ActionType actionType) {
    DiskVmElement oldDve = disk.getDiskVmElementForVm(oldVmId);
    runInternalAction(actionType, new AttachDetachVmDiskParameters(new DiskVmElement(disk.getId(), getParameters().getNewVmGuid()), oldDve.isPlugged()));
}
Also used : AttachDetachVmDiskParameters(org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)

Example 32 with DiskVmElement

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

the class DiskVmElementDaoTest method testUpdateVmDeviceUsingScsiReservationProperty.

@Test
public void testUpdateVmDeviceUsingScsiReservationProperty() {
    DiskVmElement dve = dao.get(getExistingEntityId());
    boolean usingScsiReservation = !dve.isUsingScsiReservation();
    dve.setUsingScsiReservation(usingScsiReservation);
    dao.update(dve);
    DiskVmElement dveFromDb = dao.get(getExistingEntityId());
    assertEquals(dveFromDb.isUsingScsiReservation(), usingScsiReservation);
}
Also used : DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) Test(org.junit.Test)

Example 33 with DiskVmElement

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

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

the class BackendVmDiskResourceTest method testDeactivate.

@Test
public void testDeactivate() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.HotUnPlugDiskFromVm, VmDiskOperationParameterBase.class, new String[] { "DiskVmElement" }, new Object[] { new DiskVmElement(DISK_ID, VM_ID) }, true, true));
    Response response = resource.deactivate(new Action());
    assertEquals(200, response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) Action(org.ovirt.engine.api.model.Action) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) VmDiskOperationParameterBase(org.ovirt.engine.core.common.action.VmDiskOperationParameterBase) Test(org.junit.Test)

Example 35 with DiskVmElement

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

DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)91 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)30 Test (org.junit.Test)26 VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)23 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)22 Guid (org.ovirt.engine.core.compat.Guid)17 ArrayList (java.util.ArrayList)16 VM (org.ovirt.engine.core.common.businessentities.VM)12 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)11 HashMap (java.util.HashMap)8 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)8 Map (java.util.Map)7 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)7 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)7 ActionType (org.ovirt.engine.core.common.action.ActionType)6 AttachDetachVmDiskParameters (org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters)6 List (java.util.List)5 Collectors (java.util.stream.Collectors)5 VmDiskOperationParameterBase (org.ovirt.engine.core.common.action.VmDiskOperationParameterBase)5 Collection (java.util.Collection)4