Search in sources :

Example 1 with GetVmFromConfigurationQueryParameters

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

the class AsyncDataProvider method getVmFromOva.

public void getVmFromOva(AsyncQuery<QueryReturnValue> aQuery, String ovf) {
    aQuery.setHandleFailure(true);
    Frontend.getInstance().runQuery(QueryType.GetVmFromConfiguration, new GetVmFromConfigurationQueryParameters(ConfigurationType.OVA, ovf), aQuery);
}
Also used : GetVmFromConfigurationQueryParameters(org.ovirt.engine.core.common.queries.GetVmFromConfigurationQueryParameters)

Example 2 with GetVmFromConfigurationQueryParameters

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

the class BackendVmsResource method importVmFromConfiguration.

public Response importVmFromConfiguration(Vm vm) {
    Initialization initialization = vm.getInitialization();
    Configuration config = initialization.getConfiguration();
    org.ovirt.engine.core.common.businessentities.VM vmConfiguration = getEntity(org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmFromConfiguration, new GetVmFromConfigurationQueryParameters(VmMapper.map(config.getType(), null), config.getData().trim()), "");
    VmMapper.map(vm, vmConfiguration.getStaticData());
    Guid clusterId = namedCluster(vm) ? getCluster(vm).getId() : asGuid(vm.getCluster().getId());
    ImportVmFromConfParameters parameters = new ImportVmFromConfParameters();
    parameters.setVm(vmConfiguration);
    parameters.setClusterId(clusterId);
    if (initialization.isSetRegenerateIds()) {
        parameters.setImportAsNewEntity(initialization.isRegenerateIds());
    }
    return performCreate(ActionType.ImportVmFromConfiguration, parameters, new QueryIdResolver<Guid>(QueryType.GetVmByVmId, IdQueryParameters.class));
}
Also used : Initialization(org.ovirt.engine.api.model.Initialization) VM(org.ovirt.engine.core.common.businessentities.VM) GetVmFromConfigurationQueryParameters(org.ovirt.engine.core.common.queries.GetVmFromConfigurationQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Configuration(org.ovirt.engine.api.model.Configuration) ImportVmFromConfParameters(org.ovirt.engine.core.common.action.ImportVmFromConfParameters) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

GetVmFromConfigurationQueryParameters (org.ovirt.engine.core.common.queries.GetVmFromConfigurationQueryParameters)2 Configuration (org.ovirt.engine.api.model.Configuration)1 Initialization (org.ovirt.engine.api.model.Initialization)1 ImportVmFromConfParameters (org.ovirt.engine.core.common.action.ImportVmFromConfParameters)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1