Search in sources :

Example 6 with V3VMs

use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.

the class V3VmsOutAdapter method adapt.

@Override
public V3VMs adapt(Vms from) {
    V3VMs to = new V3VMs();
    if (from.isSetActions()) {
        to.setActions(adaptOut(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getVMs().addAll(adaptOut(from.getVms()));
    return to;
}
Also used : V3VMs(org.ovirt.engine.api.v3.types.V3VMs)

Example 7 with V3VMs

use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.

the class V3NicOutAdapter method adapt.

@Override
public V3NIC adapt(Nic from) {
    V3NIC to = new V3NIC();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptOut(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptOut(from.getActions()));
    }
    if (from.isSetBootProtocol()) {
        to.setBootProtocol(from.getBootProtocol().value());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetInstanceType()) {
        to.setInstanceType(adaptOut(from.getInstanceType()));
    }
    if (from.isSetInterface()) {
        to.setInterface(from.getInterface().value());
    }
    if (from.isSetLinked()) {
        to.setLinked(from.isLinked());
    }
    if (from.isSetMac()) {
        to.setMac(adaptOut(from.getMac()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNetwork()) {
        to.setNetwork(adaptOut(from.getNetwork()));
    }
    if (from.isSetOnBoot()) {
        to.setOnBoot(from.isOnBoot());
    }
    if (from.isSetPlugged()) {
        to.setPlugged(from.isPlugged());
        // In V3 the "active" property used to be a synonym of "plugged":
        to.setActive(from.isPlugged());
    }
    if (from.isSetReportedDevices()) {
        to.setReportedDevices(new V3ReportedDevices());
        to.getReportedDevices().getReportedDevices().addAll(adaptOut(from.getReportedDevices().getReportedDevices()));
    }
    if (from.isSetStatistics()) {
        to.setStatistics(new V3Statistics());
        to.getStatistics().getStatistics().addAll(adaptOut(from.getStatistics().getStatistics()));
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptOut(from.getTemplate()));
    }
    if (from.isSetVm()) {
        to.setVm(adaptOut(from.getVm()));
    }
    if (from.isSetVms()) {
        to.setVms(new V3VMs());
        to.getVms().getVMs().addAll(adaptOut(from.getVms().getVms()));
    }
    if (from.isSetVnicProfile()) {
        to.setVnicProfile(adaptOut(from.getVnicProfile()));
        // In V4 the "network" and "port_mirroring" properties of the NIC have been removed, but in V3 they must
        // be populated:
        setNetworkAndPortMirroring(from, to);
    }
    return to;
}
Also used : V3ReportedDevices(org.ovirt.engine.api.v3.types.V3ReportedDevices) V3Statistics(org.ovirt.engine.api.v3.types.V3Statistics) V3VMs(org.ovirt.engine.api.v3.types.V3VMs) V3NIC(org.ovirt.engine.api.v3.types.V3NIC)

Example 8 with V3VMs

use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.

the class V3FloppyOutAdapter method adapt.

@Override
public V3Floppy adapt(Floppy from) {
    V3Floppy to = new V3Floppy();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptOut(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptOut(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetFile()) {
        to.setFile(adaptOut(from.getFile()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetInstanceType()) {
        to.setInstanceType(adaptOut(from.getInstanceType()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptOut(from.getTemplate()));
    }
    if (from.isSetVm()) {
        to.setVm(adaptOut(from.getVm()));
    }
    if (from.isSetVms()) {
        to.setVms(new V3VMs());
        to.getVms().getVMs().addAll(adaptOut(from.getVms().getVms()));
    }
    return to;
}
Also used : V3Floppy(org.ovirt.engine.api.v3.types.V3Floppy) V3VMs(org.ovirt.engine.api.v3.types.V3VMs)

Example 9 with V3VMs

use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.

the class V3QuotaOutAdapter method adapt.

@Override
public V3Quota adapt(Quota from) {
    V3Quota to = new V3Quota();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptOut(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptOut(from.getActions()));
    }
    if (from.isSetClusterHardLimitPct()) {
        to.setClusterHardLimitPct(from.getClusterHardLimitPct());
    }
    if (from.isSetClusterSoftLimitPct()) {
        to.setClusterSoftLimitPct(from.getClusterSoftLimitPct());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDataCenter()) {
        to.setDataCenter(adaptOut(from.getDataCenter()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDisks()) {
        to.setDisks(new V3Disks());
        to.getDisks().getDisks().addAll(adaptOut(from.getDisks().getDisks()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetStorageHardLimitPct()) {
        to.setStorageHardLimitPct(from.getStorageHardLimitPct());
    }
    if (from.isSetStorageSoftLimitPct()) {
        to.setStorageSoftLimitPct(from.getStorageSoftLimitPct());
    }
    if (from.isSetUsers()) {
        to.setUsers(new V3Users());
        to.getUsers().getUsers().addAll(adaptOut(from.getUsers().getUsers()));
    }
    if (from.isSetVms()) {
        to.setVms(new V3VMs());
        to.getVms().getVMs().addAll(adaptOut(from.getVms().getVms()));
    }
    return to;
}
Also used : V3Quota(org.ovirt.engine.api.v3.types.V3Quota) V3Disks(org.ovirt.engine.api.v3.types.V3Disks) V3Users(org.ovirt.engine.api.v3.types.V3Users) V3VMs(org.ovirt.engine.api.v3.types.V3VMs)

Example 10 with V3VMs

use of org.ovirt.engine.api.v3.types.V3VMs in project ovirt-engine by oVirt.

the class V3VmsServer method list.

@GET
public V3VMs list(@Context HttpHeaders headers, @Context UriInfo ui) {
    // Transform the data:
    V3VMs vms = adaptList(getDelegate()::list);
    // Add the link to the disks collection:
    vms.getVMs().forEach(V3VmHelper::addDisksLink);
    // Add the requested inline details:
    Set<String> details = DetailHelper.getDetails(headers, ui);
    if (details != null && !details.isEmpty()) {
        vms.getVMs().forEach(vm -> {
            V3VmServer server = getVmResource(vm.getId());
            V3VmHelper.addInlineDetails(vm, server, details);
        });
    }
    // Add the guest IP address:
    vms.getVMs().forEach(V3VmHelper::addGuestIp);
    return vms;
}
Also used : V3VMs(org.ovirt.engine.api.v3.types.V3VMs) V3VmHelper(org.ovirt.engine.api.v3.helpers.V3VmHelper) GET(javax.ws.rs.GET)

Aggregations

V3VMs (org.ovirt.engine.api.v3.types.V3VMs)10 V3Statistics (org.ovirt.engine.api.v3.types.V3Statistics)3 V3StorageDomains (org.ovirt.engine.api.v3.types.V3StorageDomains)3 V3Status (org.ovirt.engine.api.v3.types.V3Status)2 V3Users (org.ovirt.engine.api.v3.types.V3Users)2 GET (javax.ws.rs.GET)1 ApiSummaryItem (org.ovirt.engine.api.model.ApiSummaryItem)1 DiskAttachment (org.ovirt.engine.api.model.DiskAttachment)1 DiskAttachmentResource (org.ovirt.engine.api.resource.DiskAttachmentResource)1 DiskAttachmentsResource (org.ovirt.engine.api.resource.DiskAttachmentsResource)1 VmResource (org.ovirt.engine.api.resource.VmResource)1 VmsResource (org.ovirt.engine.api.resource.VmsResource)1 V3VmHelper (org.ovirt.engine.api.v3.helpers.V3VmHelper)1 V3ApiSummary (org.ovirt.engine.api.v3.types.V3ApiSummary)1 V3CdRom (org.ovirt.engine.api.v3.types.V3CdRom)1 V3Disk (org.ovirt.engine.api.v3.types.V3Disk)1 V3DiskSnapshot (org.ovirt.engine.api.v3.types.V3DiskSnapshot)1 V3Disks (org.ovirt.engine.api.v3.types.V3Disks)1 V3Floppy (org.ovirt.engine.api.v3.types.V3Floppy)1 V3Hosts (org.ovirt.engine.api.v3.types.V3Hosts)1