Search in sources :

Example 1 with AddVmInterfaceParameters

use of org.ovirt.engine.core.common.action.AddVmInterfaceParameters in project ovirt-engine by oVirt.

the class BaseEditVmInterfaceModel method createVdcActionParameters.

@Override
protected ActionParametersBase createVdcActionParameters(VmNetworkInterface nicToSave) {
    AddVmInterfaceParameters parameters = new AddVmInterfaceParameters(getVm().getId(), nicToSave);
    parameters.setFilterParameters(getNetworkFilterParameterListModel().getItems().stream().map(x -> x.flush()).collect(Collectors.toList()));
    return parameters;
}
Also used : AddVmInterfaceParameters(org.ovirt.engine.core.common.action.AddVmInterfaceParameters)

Example 2 with AddVmInterfaceParameters

use of org.ovirt.engine.core.common.action.AddVmInterfaceParameters in project ovirt-engine by oVirt.

the class SyncNetworkProviderCommand method disconnectVms.

private void disconnectVms(Guid networkId) {
    Map<Guid, VnicProfile> profiles = vnicProfileDao.getAllForNetwork(networkId).stream().collect(Collectors.toConcurrentMap(VnicProfile::getId, Function.identity()));
    for (VM vm : vmDao.getAllForNetwork(networkId)) {
        vmHandler.updateNetworkInterfacesFromDb(vm);
        for (VmNetworkInterface iface : vm.getInterfaces()) {
            if (profiles.get(iface.getVnicProfileId()) != null) {
                log.warn("External network '{}' disappeared from provider '{}', disconnecting interface '{}' of VM '{}'.", networkId, getProvider().getName(), iface.getName(), vm.getName());
                iface.setVnicProfileId(null);
                iface.setPlugged(false);
                propagateReturnValue(runInternalAction(ActionType.UpdateVmInterface, new AddVmInterfaceParameters(vm.getId(), iface), getInternalCommandContext()));
            }
        }
    }
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VM(org.ovirt.engine.core.common.businessentities.VM) VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile) Guid(org.ovirt.engine.core.compat.Guid) AddVmInterfaceParameters(org.ovirt.engine.core.common.action.AddVmInterfaceParameters)

Example 3 with AddVmInterfaceParameters

use of org.ovirt.engine.core.common.action.AddVmInterfaceParameters in project ovirt-engine by oVirt.

the class NewVmInterfaceModel method createVdcActionParameters.

@Override
protected ActionParametersBase createVdcActionParameters(VmNetworkInterface nicToSave) {
    AddVmInterfaceParameters parameters = new AddVmInterfaceParameters(getVm().getId(), nicToSave);
    parameters.setFilterParameters(getNetworkFilterParameterListModel().getItems().stream().map(x -> x.flush()).collect(Collectors.toList()));
    return parameters;
}
Also used : AddVmInterfaceParameters(org.ovirt.engine.core.common.action.AddVmInterfaceParameters)

Aggregations

AddVmInterfaceParameters (org.ovirt.engine.core.common.action.AddVmInterfaceParameters)3 VM (org.ovirt.engine.core.common.businessentities.VM)1 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)1 VnicProfile (org.ovirt.engine.core.common.businessentities.network.VnicProfile)1 Guid (org.ovirt.engine.core.compat.Guid)1