Search in sources :

Example 16 with DiskAttachment

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

the class DiskAttachmentMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.storage.DiskVmElement.class, to = DiskAttachment.class)
public static DiskAttachment map(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement entity, DiskAttachment template) {
    DiskAttachment model = template != null ? template : new DiskAttachment();
    Guid vmId = entity.getVmId();
    if (vmId != null) {
        Vm vm = new Vm();
        vm.setId(vmId.toString());
        model.setVm(vm);
    }
    Guid diskId = entity.getDiskId();
    if (diskId != null) {
        Disk disk = new Disk();
        disk.setId(diskId.toString());
        model.setDisk(disk);
    }
    model.setId(entity.getDiskId().toString());
    model.setBootable(entity.isBoot());
    model.setPassDiscard(entity.isPassDiscard());
    model.setInterface(DiskMapper.mapInterface(entity.getDiskInterface()));
    model.setActive(entity.isPlugged());
    model.setLogicalName(entity.getLogicalName());
    model.setUsesScsiReservation(entity.isUsingScsiReservation());
    model.setReadOnly(entity.isReadOnly());
    return model;
}
Also used : DiskAttachment(org.ovirt.engine.api.model.DiskAttachment) Vm(org.ovirt.engine.api.model.Vm) Guid(org.ovirt.engine.core.compat.Guid) Disk(org.ovirt.engine.api.model.Disk)

Aggregations

DiskAttachment (org.ovirt.engine.api.model.DiskAttachment)16 Disk (org.ovirt.engine.api.model.Disk)10 DiskAttachments (org.ovirt.engine.api.model.DiskAttachments)5 Vm (org.ovirt.engine.api.model.Vm)5 V3Disk (org.ovirt.engine.api.v3.types.V3Disk)5 V3Status (org.ovirt.engine.api.v3.types.V3Status)4 Guid (org.ovirt.engine.core.compat.Guid)4 DiskAttachmentsResource (org.ovirt.engine.api.resource.DiskAttachmentsResource)3 VmResource (org.ovirt.engine.api.resource.VmResource)3 VmsResource (org.ovirt.engine.api.resource.VmsResource)3 V3Disks (org.ovirt.engine.api.v3.types.V3Disks)3 V3Statistics (org.ovirt.engine.api.v3.types.V3Statistics)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 WebApplicationException (javax.ws.rs.WebApplicationException)2 TimeZone (org.ovirt.engine.api.model.TimeZone)2 DiskAttachmentResource (org.ovirt.engine.api.resource.DiskAttachmentResource)2 SystemResource (org.ovirt.engine.api.resource.SystemResource)2 V3CdRoms (org.ovirt.engine.api.v3.types.V3CdRoms)2 V3CustomProperties (org.ovirt.engine.api.v3.types.V3CustomProperties)2 V3Floppies (org.ovirt.engine.api.v3.types.V3Floppies)2