Search in sources :

Example 1 with VmMacsValidation

use of org.ovirt.engine.core.bll.network.vm.mac.VmMacsValidation in project ovirt-engine by oVirt.

the class ValidateVmMacsQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    // Map with a VM id as the key and violation messages (that are related to the VM) as the values.
    final Map<Guid, List<List<String>>> result = new HashMap<>();
    for (Entry<Guid, List<VM>> clusterEntry : getParameters().getVmsByCluster().entrySet()) {
        final Guid clusterId = clusterEntry.getKey();
        final List<VM> clusterVms = clusterEntry.getValue();
        final ReadMacPool macPool = macPoolPerCluster.getMacPoolForCluster(clusterId);
        final List<VmMacsValidation> vmMacsValidations = vmMacsValidationsFactory.createVmMacsValidationList(clusterId, macPool);
        clusterVms.forEach(vm -> result.put(vm.getId(), validateVm(vm, vmMacsValidations)));
    }
    getQueryReturnValue().setReturnValue(result);
}
Also used : VmMacsValidation(org.ovirt.engine.core.bll.network.vm.mac.VmMacsValidation) HashMap(java.util.HashMap) VM(org.ovirt.engine.core.common.businessentities.VM) ReadMacPool(org.ovirt.engine.core.bll.network.macpool.ReadMacPool) ArrayList(java.util.ArrayList) List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ReadMacPool (org.ovirt.engine.core.bll.network.macpool.ReadMacPool)1 VmMacsValidation (org.ovirt.engine.core.bll.network.vm.mac.VmMacsValidation)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 Guid (org.ovirt.engine.core.compat.Guid)1