Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbd: VolumeGroupSnapshot support #4502

Open
wants to merge 16 commits into
base: devel
Choose a base branch
from

Commits on Nov 5, 2024

  1. rbd: close the RBD-image after adding it to a VolumeGroup

    When the image is not closed, it keeps a watch open. This prevents the
    CSI Controller to delete the Volume, as there is still a user of it.
    
    Fixes: f9ab14e "rbd: check if an image is part of a group before adding it"
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    073365b View commit details
    Browse the repository at this point in the history
  2. journal: store csi.groupid for snapshots

    Commit 95733b3 introduced the `StoreGroupID()` function, but that
    unfortunately set an empty key in the journal.
    
    Passing the `csiGroupIDKey` key (with value `csi.groupid`) caused
    setting `csi.csi.groupid` as a key. Reading the value back with the
    right `csi.groupid` key always returned an empty value.
    
    Fixes: 95733b3 "journal: add option to store the groupID"
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    713e11c View commit details
    Browse the repository at this point in the history
  3. rbd: have GetVolumeGroup() return an empty volume group if it was n…

    …ot found
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    f24e824 View commit details
    Browse the repository at this point in the history
  4. rbd: add .requestName to the commonVolumeGroup struct

    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    b07a6ee View commit details
    Browse the repository at this point in the history
  5. rbd: pass CSI-drivername to volume group instead of journal instance

    Each object is responsible for maintaining a connection to the journal.
    
    By sharing a single journal, cleanup of objects becomes more complex as
    the journal is used in deferred functions and only the last should
    destroy the journal connection resources.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    aaaa738 View commit details
    Browse the repository at this point in the history
  6. rbd: add rbdVolume.NewSnapshotByID to clone images by RBD snapshot-id

    The NewSnapshotByID() function makes it possible to clone a new Snapshot
    from an existing RBD-image and the ID of an RBD-snapshot on that image.
    
    This will be used by the VolumeGroupSnapshot feature, where the ID of an
    RBD-snapshot is obtained for the RBD-snapshot on the RBD-images.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    f19ae0d View commit details
    Browse the repository at this point in the history
  7. rbd: add VolumeGroup.CreateSnapshots() implementation

    When the rbd.Manager creates a VolumeGroupSnapshot, each RBD-snapshot
    that is created as part of the RBD-group needs to be cloned into its own
    RBD-image that will be used as a CSI Snapshot.
    
    The VolumeGroup.CreateSnapshots() creates the RBD-group snapshot and
    returns a list of the Snapshot structs.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    d31cdc3 View commit details
    Browse the repository at this point in the history
  8. rbd: add VolumeGroupSnapshot type

    The VolumeGroupSnapshot type will be used by the rbd.Manager to create,
    inspect and delete VolumeGroupSnapshos.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    89aa6bd View commit details
    Browse the repository at this point in the history
  9. rbd: add manager GetSnapshotByID and SnapshotResolver interface

    A (CSI) VolumeGroupSnapshot object contains references to Snapshot IDs
    (or CSI Snapshot handles). In order to work with a VolumeGroupSnapshot
    struct, the Snapshot IDs need to be resolved into rbdSnapshot structs.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    5e1abec View commit details
    Browse the repository at this point in the history
  10. rbd: add manager.CreateVolumeGroupSnapshot()

    Implement the CreateVolumeGroupSnapshot for the rbd.Manager. A Group
    Controller Server can use the rbd.Manager to create VolumeGroupSnapshots
    in an easy an idempotent way.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    e88ae78 View commit details
    Browse the repository at this point in the history
  11. rbd: implement Manager.GetVolumeGroupSnapshotByID

    The GetVolumeGroupSnapshotByID function makes it possible to get a
    VolumeGroupSnapshot object from the Manager by passing a request-id.
    This makes it simple for the Group Controller Server to check if a
    VolumeGroupSnapshot already exists, so it is not needed to try and
    re-create an existing one.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    c606c6b View commit details
    Browse the repository at this point in the history
  12. rbd: add Manager.GetVolumeGroupSnapshotByName

    The Group Controller Server may need to fetch a VolumeGroupSnapshot that
    was statically provisioned. In that case, only the name of the
    VolumeGroupSnapshot is known and should be resolved to an object.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    aca0307 View commit details
    Browse the repository at this point in the history
  13. rbd: fix snapshot deletion by resolving image names correctly

    When creating a Snapshot with the new NewSnapshotByID() function, the
    name of the RBD-image that is created is the same as the name of the
    Snapshot. The `RbdImageName` points to the name of parent image, which
    causes deleting the Snapshot to delete the parent image instead.
    
    Correcting the `RbdImageName` and setting it to the `RbdSnapName` makes
    sure that upon deletion, the Snapshot RBD-image is removed, and not the
    parent image.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    108e937 View commit details
    Browse the repository at this point in the history
  14. rbd: implement CSI Group Controller Server

    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    5793120 View commit details
    Browse the repository at this point in the history
  15. rbd: expose the GroupControllerService

    When the GroupSnapGetInfo go-ceph function is supported by librbd, the
    Group Controller Servive and VolumeGroupSnapshot capabilities can be
    exposed to the Container Orchestrator.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    9f6a0db View commit details
    Browse the repository at this point in the history
  16. rbd: set SnapshotGroupID on each Snapshot of a VolumeGroupSnapshot

    Without the SnapshotGroupID in the Snapshot object, Kubernetes CSI does
    not know that the Snapshot belongs to a group. In that case, it allows
    the deletion of the Snapshot, which should be denied.
    
    Signed-off-by: Niels de Vos <ndevos@ibm.com>
    nixpanic committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    4d68022 View commit details
    Browse the repository at this point in the history