Uploaded image for project: 'RHEL Conversions'
  1. RHEL Conversions
  2. RHELC-1153

Port remaining rollback items to BackupController

XMLWordPrintable

    • Icon: Epic Epic
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • Port to BackupController
    • False
    • False
    • Hide

      None

      Show
      None
    • 5
    • 0% To Do, 0% In Progress, 100% Done
    • Testable

      We have ported many of the things we need to backup and restore on rollback into the BackupController framework (by making a RestorableChange subclass to handle them) but there are some left:

      • backup.changed_pkgs_control.restore_pkgs()
      • repo.restore_varsdir()
      • repo.restore_yum_repos()
      • redhatrelease.system_release_file.restore()
      • redhatrelease.os_release_file.restore()
      • pkghandler.versionlock_file.restore()

       

      It has become more important to port these because we have reached a point where we need to restore some of the things managed by the BackupController before or after the things managed manually.

      In 1.4.0 we implemented an ugly hack to make that work (adding a partition to the Changes that BackupController manages so that Changes before the partition were restored first, then the unported changes, and finally, the rest of the changes managed by BackupController).  Once everything is ported, we should get rid of this hack as well (It is ugly because it is fragile.  Any Action can add a partition but  [1]Actions don't have a set order so the partition might end up in a different place between releases [2] more than one Action adding partitions might cause the wrong set of Actions to be run before the manual rollback items.

      Notes:

      • BackupController is a stack.  When going through the Actions in pre_ponr_changes we add new RestorableChanges to the stack.  The act of adding the Change to the stack changes the system in a way that allows us to restore it during rollback (usually by making a backup.  But it can be implemented in other ways as well (for instance, the Rpm GPG Keys)  On rollback, the Changes are restored in reverse order.
      • I implemented RestorableRpmKey in the backup.py file but I think it makes more sense to put these in the files for the subsystems they belong to.  For instance, RestorableRpmKey should be moved to pkghandler.py.
      • RestorableFile is used for three of the Changes that need to be ported: system_release_file, os_release_file, and versionlock_file
      • Two others, restore_yum_repos and restore_varsdir are also file backup and restore with some extra logic to determine which files need to be handled.
      • backup.changed_pkgs_control.restore_pkgs() (which is implemented in ChangedRPMPackagesController) is likely the most complicated on to port.  At this time, it is only used for packages which we remove during pre_ponr_changes and have to reinstall during rollback.  Installation during pre_ponr_changes is handled by pkghandler.RestorablePackageSet You will have to evaluate whether this port belongs in a separate class or as part of RestorablePackageSet.
      • The Legacy backup and restore items above are ported into the backup controller.
      • Rollback becomes just a matter of calling backup.backup_control.pop_all()
      • The partition code is being removed (https://github.com/oamg/convert2rhel/pull/869, https://github.com/oamg/convert2rhel/pull/912)

      Acceptance Criteria

      • All the legacy backup classes are ported to the BackupController
      • A refactor is done to make the backup API easier to work and more understandable

          There are no Sub-Tasks for this issue.

              rolivier@redhat.com Rodolfo Olivieri
              tkuratom@redhat.com Toshio Kuratomi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: