Bug 1474039 - NetworkManager does not remove newly created connections and devices on CheckpointRollback
NetworkManager does not remove newly created connections and devices on Check...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: sushil kulkarni
Desktop QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-23 06:24 EDT by Petr Horáček
Modified: 2017-07-25 17:17 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-25 17:17:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
[PATCH] checkpoint: document flags availability (1.22 KB, patch)
2017-07-24 08:21 EDT, Beniamino Galvani
no flags Details | Diff

  None (edit)
Description Petr Horáček 2017-07-23 06:24:14 EDT
Description of problem:
CheckpointRollback call does not remove newly created connections and devices even with NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS | NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES flags.

Version-Release number of selected component (if applicable):
CentOS 7.3.1611
NetworkManager-1.4.0-20

How reproducible:
Always

Steps to Reproduce:
1. Create a bridge and attach NIC to it.
2. Create a checkpoint.
3. Create another bridge and reattach NIC to it.
4. Start rollback.

Actual results:
Although NIC was reconnected to the original bridge, new bridge and its connection are still there.

Expected results:
New connection and created device will be removed when CheckpointCreate is called with flags NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS | NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES.

Reproducer script:
import dbus
import subprocess
import time

bus = dbus.SystemBus()
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
manager = dbus.Interface(proxy, 'org.freedesktop.NetworkManager')

# create a bridge and attach NIC to it
subprocess.check_call(['/usr/bin/nmcli', 'con', 'add', 'type', 'bridge', 'ifname', 'br1', 'autoconnect', 'yes', '--', 'connection.autoconnect-slaves', '1'])
subprocess.check_call(['/usr/bin/nmcli', 'con', 'add', 'type', 'ethernet', 'ifname', 'eth0', 'autoconnect', 'yes', '--', 'connection.master', 'br1', 'connection.slave-type', 'bridge'])
subprocess.check_call(['/usr/bin/nmcli', 'con', 'up', 'bridge-br1'])

time.sleep(2)

# create checkpoint
ALL_DEVICES = dbus.Array([], signature=dbus.Signature('ao'))
FOREVER = 0
NM_CHECKPOINT_CREATE_FLAG_DESTROY_ALL = 0x01
NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS = 0x02
NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES = 0x04
checkpoint = manager.CheckpointCreate(
    ALL_DEVICES,
    FOREVER,
    NM_CHECKPOINT_CREATE_FLAG_DESTROY_ALL |
    NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS |
    NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES
)

time.sleep(2)

# create another bridge and reattach NIC to it
subprocess.check_call(['/usr/bin/nmcli', 'con', 'down', 'bridge-br1'])
subprocess.check_call(['/usr/bin/nmcli', 'con', 'add', 'type', 'bridge', 'ifname', 'br2', 'autoconnect', 'yes', '--', 'connection.autoconnect-slaves', '1'])
subprocess.check_call(['/usr/bin/nmcli', 'con', 'modify', 'bridge-slave-eth0', 'connection.master', 'br2', 'connection.slave-type', 'bridge'])
subprocess.check_call(['/usr/bin/nmcli', 'con', 'up', 'bridge-br2'])

time.sleep(2)

# rollback to the checkpoint
manager.CheckpointRollback(checkpoint)


nmcli con show output:
NAME               UUID                                  TYPE            DEVICE 
bridge-br1         955c27cf-6948-43aa-bb82-026b2e798e68  bridge          br1    
bridge-br2         be417a69-1a83-4f4f-8567-0f80e97a9857  bridge          br2    
bridge-slave-eth0  7403cede-e1cb-4138-88dc-dba4f2e6a4ff  802-3-ethernet  eth0   
System eth0        5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  802-3-ethernet  --

ip link output:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br1 state UP mode DEFAULT qlen 1000
    link/ether 52:54:00:55:e6:7c brd ff:ff:ff:ff:ff:ff
41: br2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
42: br1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
    link/ether 52:54:00:55:e6:7c brd ff:ff:ff:ff:ff:ff
Comment 2 Beniamino Galvani 2017-07-24 05:21:53 EDT
Hi,

flags NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS and NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES are only available since NetworkManager version 1.6.

Thus, they are available on RHEL 7.4 (NM 1.8) but not on RHEL 7.3 (NM 1.4).
Comment 3 Petr Horáček 2017-07-24 06:58:13 EDT
Thank you. According to documentation it should be in "Since: 1.4". Does it mean that flag option is there since 1.4, but NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS and NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES only since 1.6?

https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMCheckpointCreateFlags
Comment 4 Beniamino Galvani 2017-07-24 08:18:03 EDT
(In reply to Petr Horáček from comment #3)
> Thank you. According to documentation it should be in "Since: 1.4". Does it
> mean that flag option is there since 1.4, but
> NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS and
> NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES only since 1.6?

Exactly, the "Since: 1.4" refers to the enum itself, but some values were added later.

I don't know if this is standard practice, but it would be better to have "Since" tags for the members too...
Comment 5 Beniamino Galvani 2017-07-24 08:21 EDT
Created attachment 1303619 [details]
[PATCH] checkpoint: document flags availability

... like this.
Comment 6 Petr Horáček 2017-07-24 08:54:20 EDT
Thanks, works for me with NetworkManager-1.8.2-1. We can close this bug or keep it for the documentation "bug".
Comment 7 Beniamino Galvani 2017-07-25 17:17:54 EDT
(In reply to Petr Horáček from comment #6)
> Thanks, works for me with NetworkManager-1.8.2-1. We can close this bug or
> keep it for the documentation "bug".

Documentation patch applied to master:

https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=73824414330138441ea39198134dee24ff4db1ff

and nm-1-8 branches.

Probably there's no value in keeping this open. Let's close it, thanks.

Note You need to log in before you can comment on or make changes to this bug.