This PR modifies the execCryptSetupCommand so that
the process is killed in an event of lock timeout.
Useful in cases where the volume lock is released but
the command is still running.
Signed-off-by: Niraj Yadav <niryadav@redhat.com>
This commit adds `GetCephFSRadosNamespace` util method that returns
the `RadosNamespace` specified in ceph-csi-config ConfigMap under
cephFS.radosNamespace.
If not specified, the method returns the default RadosNamespace
i.e, csi.
Signed-off-by: Praveen M <m.praveen@ibm.com>
The rbdSnapshot/rbdImage object implements all functions for a useful
Snapshot interface. The rbd.Manager will be able to use this for
providing VolumeGroupSnapshot support.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
The go-ceph rbd package provides the GroupSnapGetInfo function, but it
may return ErrUnsupported when called. Returning this error after
advertising the support for VolumeGroupSnapshot seems ugly.
In order to advertise support for VolumeGroupSnapshot,
SupportsGroupSnapGetInfo() can be used, which detects the required C
function of librbd.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
`ensureImageCleanup()` can cause a panic when an image was deleted, but
the journal still contained a reference. By opening the IOContext before
using, an error may be returned instead of a panic when using a `nil` or
freed IOContext.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
The go-ceph rbd.GroupCreate() now returns ErrExist in case the group
that is created, already exists. The previous check only ever matched
the string comparison, which is prone to errors in case the contents is
modified by go-ceph.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
Incase of RDR with restricted access the
ceph user will not have access to all the objects
or all the pools where mapping exists
This commits add a check to continue to get
the volume if there is a permission error
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
The `repairImageID()` function is useful for the `rbdSnapshot` objects
as well. Move it to the `rbdImage` struct that is the base for both
`rbdVolume` and `rbdSnapshot`.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
There is no need for the `Manager.DeleteVolumeGroup()` function as
`VolumeGroup.Delete()` should cover everything too.
By moving the `.Delete()` functionality of removing the group from the
journal to the shared `commonVolumeGroup` type, a volume group snaphot
can use it as well.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
When an `.Destroy()` is called on an rbdImage (or rbdVolume or
rbdSnapshot), the IOContext, Connection and other attributes are
invalid. When using a destroyed resource that points to an object that
was allocated through librbd, the process most likely ends with a panic.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit adds a gRPC middleware that logs calls that
keep running after their deadline.
Adds --logslowopinterval cmdline argument to pass the log rate.
Signed-off-by: Robert Vasek <robert.vasek@clyso.com>
When an `rbdVolume` or `rbdSnapshot` is not connected with credentials
to the Ceph cluster, operations may try to get the IOContext which then
causes a panic.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
A function called `setImageOptions()` is expected to set the passed
options on the volume. However, the passed options parameter is only
filled with the options that should get set on the RBD-image at the time
of creation.
The naming of the function, and it's parameter is confusing. Rename the
function to `constructImageOptions()` and return the ImageOptions to
make it easier to understand.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
rbd nodeserver is already setting
volume condition in NodeGetVolumeStats
RPC call but the cap is not updated
for it, This PR advertise the
VOLUME_CONDITION
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
Many functions that are implemented for the volumeGroup type can be
shared with the (coming) volumeGroupSnapshot type. Move these functions
into a commonVolumeGroup type, so that volumeGroup and
volumeGroupSnapshot can inherit them.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
After cloning the RBD snapshot, an rbdVolume is returned for the
CSI.Snapshot object. In order to use the rbdSnapshot.ToCSI() function,
the rbdVolume needs to be converted (back) to an rbdSnaphot.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
There has been some confusion about using different variables for the
InstanceID of the RBD-driver. By removing the global variable
CSIInstanceID, there should be no confusion anymore what variable to
use.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
updated the group stringer method
to have pool and namespace for
proper debugging/logging and to
use it with CLI as agrument as well.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
updating HandleParentImageExistence function
to return more details error which includes
the pool/namespace/image name
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
updated GetVolumeByID to return more
descriptive error so that caller no
need to add more details in
the error message.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit adds locks on reclaimspace operations to
prevent multiple process executing rbd sparsify/fstrim
on same volume.
Signed-off-by: Praveen M <m.praveen@ibm.com>
It seems to be possible that the UUID was found, but the name is not
set. Checking on UUID makes the CreateVolumeGroup operation more
idempotent.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
A RBD image can only be part of a single group. While an image is added
to a group, check if the image is already part of a group, and return an
error in case it is.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
Add extra error checking to make sure trying to create an existing
volume group does not result in a failure. The same counts for deleting
a non-existing volume group, and adding/removing volumes to/from the
volume group.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
A VolumeGroup CSI-Addons object contains a list of CSI Volumes. A
ToCSI() function makes creating such a list much simpler.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
Register the volumegroup controller as part
of rbd controller server to serve the volume
group RPC spec.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>