Search in sources :

Example 11 with Vms

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

the class AffinityGroupMapperTest method testVmIds.

@Test
public void testVmIds() throws Exception {
    AffinityGroup model = new AffinityGroup();
    Vm vm = new Vm();
    final Guid vmGuid = Guid.newGuid();
    vm.setId(vmGuid.toString());
    model.setVms(new Vms());
    model.getVms().getVms().add(vm);
    org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
    AffinityGroupMapper.map(model, entity);
    assertEquals(vmGuid, entity.getVmIds().get(0));
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Guid(org.ovirt.engine.core.compat.Guid) Vms(org.ovirt.engine.api.model.Vms) AffinityGroup(org.ovirt.engine.api.model.AffinityGroup) Test(org.junit.Test)

Example 12 with Vms

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

the class V3CdRomInAdapter method adapt.

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

Example 13 with Vms

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

the class BackendAffinityGroupVmsResource method list.

@Override
public Vms list() {
    Vms vms = new Vms();
    AffinityGroup affinityGroup = getEntity();
    if (affinityGroup.getVmIds() != null) {
        for (int i = 0; i < affinityGroup.getVmIds().size(); i++) {
            Vm vm = new Vm();
            vm.setId(affinityGroup.getVmIds().get(i).toString());
            vm.setName(affinityGroup.getVmEntityNames().get(i));
            vm = addLinks(populate(vm, null));
            // remove vm actions, not relevant to this context
            vm.setActions(null);
            vms.getVms().add(vm);
        }
    }
    return vms;
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Vms(org.ovirt.engine.api.model.Vms) AffinityGroup(org.ovirt.engine.core.common.scheduling.AffinityGroup)

Example 14 with Vms

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

the class V3DiskSnapshotInAdapter method adapt.

@Override
public DiskSnapshot adapt(V3DiskSnapshot from) {
    DiskSnapshot to = new DiskSnapshot();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActualSize()) {
        to.setActualSize(from.getActualSize());
    }
    if (from.isSetAlias()) {
        to.setAlias(from.getAlias());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDisk()) {
        to.setDisk(adaptIn(from.getDisk()));
    }
    if (from.isSetDiskProfile()) {
        to.setDiskProfile(adaptIn(from.getDiskProfile()));
    }
    if (from.isSetFormat()) {
        to.setFormat(DiskFormat.fromValue(from.getFormat()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetImageId()) {
        to.setImageId(from.getImageId());
    }
    if (from.isSetInstanceType()) {
        to.setInstanceType(adaptIn(from.getInstanceType()));
    }
    if (from.isSetLogicalName()) {
        to.setLogicalName(from.getLogicalName());
    }
    if (from.isSetLunStorage()) {
        to.setLunStorage(adaptIn(from.getLunStorage()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetOpenstackVolumeType()) {
        to.setOpenstackVolumeType(adaptIn(from.getOpenstackVolumeType()));
    }
    if (from.isSetPropagateErrors()) {
        to.setPropagateErrors(from.isPropagateErrors());
    }
    if (from.isSetProvisionedSize()) {
        to.setProvisionedSize(from.getProvisionedSize());
    }
    if (from.isSetQuota()) {
        to.setQuota(adaptIn(from.getQuota()));
    }
    if (from.isSetReadOnly()) {
        to.setReadOnly(from.isReadOnly());
    }
    if (from.isSetSgio()) {
        to.setSgio(ScsiGenericIO.fromValue(from.getSgio()));
    }
    if (from.isSetShareable()) {
        to.setShareable(from.isShareable());
    }
    if (from.isSetSnapshot()) {
        to.setSnapshot(adaptIn(from.getSnapshot()));
    }
    if (from.isSetSparse()) {
        to.setSparse(from.isSparse());
    }
    if (from.isSetStatistics()) {
        to.setStatistics(new Statistics());
        to.getStatistics().getStatistics().addAll(adaptIn(from.getStatistics().getStatistics()));
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(DiskStatus.fromValue(from.getStatus().getState()));
    }
    if (from.isSetStorageDomain()) {
        to.setStorageDomain(adaptIn(from.getStorageDomain()));
    }
    if (from.isSetStorageDomains()) {
        to.setStorageDomains(new StorageDomains());
        to.getStorageDomains().getStorageDomains().addAll(adaptIn(from.getStorageDomains().getStorageDomains()));
    }
    if (from.isSetStorageType()) {
        to.setStorageType(DiskStorageType.fromValue(from.getStorageType()));
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptIn(from.getTemplate()));
    }
    if (from.isSetUsesScsiReservation()) {
        to.setUsesScsiReservation(from.isUsesScsiReservation());
    }
    if (from.isSetVm()) {
        to.setVm(adaptIn(from.getVm()));
    }
    if (from.isSetVms()) {
        to.setVms(new Vms());
        to.getVms().getVms().addAll(adaptIn(from.getVms().getVMs()));
    }
    if (from.isSetWipeAfterDelete()) {
        to.setWipeAfterDelete(from.isWipeAfterDelete());
    }
    return to;
}
Also used : V3DiskSnapshot(org.ovirt.engine.api.v3.types.V3DiskSnapshot) DiskSnapshot(org.ovirt.engine.api.model.DiskSnapshot) StorageDomains(org.ovirt.engine.api.model.StorageDomains) Statistics(org.ovirt.engine.api.model.Statistics) Vms(org.ovirt.engine.api.model.Vms)

Example 15 with Vms

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

the class V3WatchDogInAdapter method adapt.

@Override
public Watchdog adapt(V3WatchDog from) {
    Watchdog to = new Watchdog();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAction()) {
        to.setAction(WatchdogAction.fromValue(from.getAction()));
    }
    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(adaptIn(from.getInstanceType()));
    }
    if (from.isSetModel()) {
        to.setModel(WatchdogModel.fromValue(from.getModel()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptIn(from.getTemplate()));
    }
    if (from.isSetVm()) {
        to.setVm(adaptIn(from.getVm()));
    }
    if (from.isSetVms()) {
        to.setVms(new Vms());
        to.getVms().getVms().addAll(adaptIn(from.getVms().getVMs()));
    }
    return to;
}
Also used : Watchdog(org.ovirt.engine.api.model.Watchdog) Vms(org.ovirt.engine.api.model.Vms)

Aggregations

Vms (org.ovirt.engine.api.model.Vms)17 Vm (org.ovirt.engine.api.model.Vm)8 ArrayList (java.util.ArrayList)4 Guid (org.ovirt.engine.core.compat.Guid)4 List (java.util.List)3 Test (org.junit.Test)3 AffinityGroup (org.ovirt.engine.api.model.AffinityGroup)3 Statistics (org.ovirt.engine.api.model.Statistics)3 StorageDomains (org.ovirt.engine.api.model.StorageDomains)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 Method (java.lang.reflect.Method)1 LinkedList (java.util.LinkedList)1 AffinityRule (org.ovirt.engine.api.model.AffinityRule)1 Cdrom (org.ovirt.engine.api.model.Cdrom)1 Cluster (org.ovirt.engine.api.model.Cluster)1 Disk (org.ovirt.engine.api.model.Disk)1 DiskSnapshot (org.ovirt.engine.api.model.DiskSnapshot)1 Disks (org.ovirt.engine.api.model.Disks)1 Floppy (org.ovirt.engine.api.model.Floppy)1