RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1496739 - [RFE] Add support for checkpoint/rollback functionality to libnm
Summary: [RFE] Add support for checkpoint/rollback functionality to libnm
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager
Version: 7.5
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Beniamino Galvani
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-28 09:15 UTC by Beniamino Galvani
Modified: 2018-10-30 11:12 UTC (History)
10 users (show)

Fixed In Version: NetworkManager-1.12.0-0.1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 11:11:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3207 0 None None None 2018-10-30 11:12:20 UTC

Description Beniamino Galvani 2017-09-28 09:15:50 UTC
Checkpoint/rollback is only available through the D-Bus API, which makes it difficult to use for shell scripting.

Add support for this functionality to nmcli, for example with the following syntax:

 $ nmcli general checkpoint create [ifname <name>] [ifname <name>] [flags <f>] [timeout <t>]
 /org/freedesktop/NetworkManager/Checkpoint/0

 $ nmcli general checkpoint rollback {all | <path>}

 $ nmcli general checkpoint destroy <path>

Comment 3 Beniamino Galvani 2017-11-08 08:11:17 UTC
Added checkpoint support to libnm in branch bg/libnm-checkpoint-rh1496739.

If needed, nmcli support can be added later, but at the moment it does not seem necessary as the checkpoint functionality is likely to be used programmatically rather than from command line. In the branch there is a short python example that  can be used to manage checkpoints from command line.

Comment 4 Thomas Haller 2017-11-08 14:12:41 UTC
> core: turn NMCheckpointManager into a GObject

I am not convinced about GObject. GObject make sense for stuff we export on D-Bus (because our D-Bus glue is GObject based).
Otherwise, it's often overkill: more lines of code, slower, and provides for flexibility/use-cases that are never used.

Note how NMManager is really strongly related to NMCheckpointManager. The point is not to have both types used independently (there is no need for that). The raison d'etre of NMCheckpointManager is to move a portion of the code out of nm-manager.c.
Yes, NMManager and NMCheckpointManager are tightly coupled, but is that wrong? Their interface between each other is still small and contained.

E.g. nobody except NMManager is ever going to subscribe to "notifiy::checkpoints". If all you want is to get a notification _checkpoint_mgr_changed(), you could just as well pass a callback

  priv->checkpoint_mgr = nm_checkpoint_manager_new (self,
                                                    _checkpoint_mgr_changed);

You a bit more coupled, even just do

  priv->checkpoint_mgr = \
         nm_checkpoint_manager_new (self,                                                                 
                                    obj_properties[PROP_CHECKPOINTS]);

and then in checkpoint-manager, do

void _notify_checkpoints(NMCheckpointManager *self) {
  g_object_notify_by_pspec (_GET_MANAGER (self), self->_checkpoint_pspec);
}



> checkpoint: track checkpoints in a list
    
     g_hash_table_iter_init (&iter, priv->checkpoints);
-    while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &checkpoint)) {
-         ts = nm_checkpoint_get_rollback_ts (checkpoint);
+    while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &item)) {
+         ts = nm_checkpoint_get_rollback_ts (item->checkpoint);

now, that you have a CList, let's iterate the CList instead of the GHashTable.

Comment 5 Thomas Haller 2017-11-09 08:40:16 UTC
pushed two fixups.

lgtm now

Comment 6 Beniamino Galvani 2017-11-09 15:37:09 UTC
(In reply to Thomas Haller from comment #5)
> pushed two fixups.

Thanks, merged to master:

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

Comment 8 Vladimir Benes 2018-08-21 15:41:54 UTC
Beniamino, do we have some sample script anywhere in the examples or so?

Comment 9 Beniamino Galvani 2018-08-21 16:09:50 UTC
(In reply to Vladimir Benes from comment #8)
> Beniamino, do we have some sample script anywhere in the examples or so?

Hi, this uses libnm through gobject-introspection:

https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/gi/checkpoint.py?id=cd79a22d186e2bd465a84bd9340a8971f4542090

Comment 11 errata-xmlrpc 2018-10-30 11:11:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3207


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