SIGN IN SIGN UP

nm hsr: do not deactivate undesired HSR port

When undesired HSR port interface been marked as changed due to its
controller requested, if this interface's current state is
`state: down`, then nmstate will deactivate this port after activated.

This is caused by `mark_as_changed()` function does not change
`interface.state`, the `merged` Interface is still holding current down
state.

In nm `prepare_nm_conns()` function, any changed interface holding
`state: down` in merged state will be stored into
`nm_devs_to_deactivate` which will be deactivated as final state of
apply action. Hence nmstate deactivate previous down state HSR port even
its controller request its attachment.

This only happen on HSR ports, because:
 1. The `MergedInterfaces.handle_changed_ports()` will invoke
    `apply_ctrller_change()` to properly setup interface state if not
    desired or changed.
 2. The `MergedInterfaces.copy_hsr_mac()` was invoked before
    `MergedInterfaces.handle_changed_ports()` which mark the interface
    as changed but still have merged interface as `state: down`.
 3. The HSR port information is stored in HSR interface itself, so even
    hsr port NM connection deactivated, the verification stage still
    pass because port list matches even NM deactivated the NM
    connection.

To fix the issue:
 1. The `MergedInterfaces.copy_hsr_mac()` should mark HSR port as up to
    make the MAC address change effective.
 2. The NM `prepare_nm_conns()` function should always check `for_apply`
    interface instead of merged in case other function forgot to update
    merged state.

Integration test case updated to reflect the reproducer.

Signed-off-by: Gris Ge <fge@redhat.com>
G
Gris Ge committed
0896bd901680ba4d8ce12aafbda967886387e76e
Parent: 2ef162a