Search in sources :

Example 1 with OsQueryParameters

use of org.ovirt.engine.core.common.queries.OsQueryParameters in project ovirt-engine by oVirt.

the class AsyncDataProvider method getNicTypeList.

public void getNicTypeList(final int osId, Version version, AsyncQuery<List<VmInterfaceType>> asyncQuery) {
    asyncQuery.converterCallback = returnValue -> {
        ArrayList<String> nics = (ArrayList<String>) returnValue;
        List<VmInterfaceType> interfaceTypes = new ArrayList<>();
        for (String nic : nics) {
            try {
                interfaceTypes.add(VmInterfaceType.valueOf(nic));
            } catch (IllegalArgumentException e) {
            // ignore if we can't find the enum value.
            }
        }
        return interfaceTypes;
    };
    Frontend.getInstance().runQuery(QueryType.OsRepository, new OsQueryParameters(OsRepositoryVerb.GetNetworkDevices, osId, version), asyncQuery);
}
Also used : OsQueryParameters(org.ovirt.engine.core.common.queries.OsQueryParameters) ArrayList(java.util.ArrayList) VmInterfaceType(org.ovirt.engine.core.common.businessentities.network.VmInterfaceType)

Example 2 with OsQueryParameters

use of org.ovirt.engine.core.common.queries.OsQueryParameters in project ovirt-engine by oVirt.

the class AsyncDataProvider method getDiskInterfaceList.

public void getDiskInterfaceList(int osId, Version clusterVersion, AsyncQuery<List<DiskInterface>> asyncQuery) {
    asyncQuery.converterCallback = returnValue -> {
        ArrayList<String> interfaces = (ArrayList<String>) returnValue;
        List<DiskInterface> interfaceTypes = new ArrayList<>();
        for (String diskIfs : interfaces) {
            try {
                interfaceTypes.add(DiskInterface.valueOf(diskIfs));
            } catch (IllegalArgumentException e) {
            // ignore if we can't find the enum value.
            }
        }
        return interfaceTypes;
    };
    Frontend.getInstance().runQuery(QueryType.OsRepository, new OsQueryParameters(OsRepositoryVerb.GetDiskInterfaces, osId, clusterVersion), asyncQuery);
}
Also used : OsQueryParameters(org.ovirt.engine.core.common.queries.OsQueryParameters) ArrayList(java.util.ArrayList) DiskInterface(org.ovirt.engine.core.common.businessentities.storage.DiskInterface)

Example 3 with OsQueryParameters

use of org.ovirt.engine.core.common.queries.OsQueryParameters in project ovirt-engine by oVirt.

the class AsyncDataProvider method isFloppySupported.

public static void isFloppySupported(AsyncQuery<Boolean> aQuery, Integer osId, Version version) {
    aQuery.converterCallback = new DefaultValueConverter<>(Boolean.FALSE);
    OsQueryParameters params = new OsQueryParameters(OsRepositoryVerb.GetFloppySupport, osId, version);
    Frontend.getInstance().runQuery(QueryType.OsRepository, params, aQuery);
}
Also used : OsQueryParameters(org.ovirt.engine.core.common.queries.OsQueryParameters)

Aggregations

OsQueryParameters (org.ovirt.engine.core.common.queries.OsQueryParameters)3 ArrayList (java.util.ArrayList)2 VmInterfaceType (org.ovirt.engine.core.common.businessentities.network.VmInterfaceType)1 DiskInterface (org.ovirt.engine.core.common.businessentities.storage.DiskInterface)1