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: add support to create clone in different pools #2105

Merged
merged 13 commits into from Jun 10, 2021
Merged

rbd: add support to create clone in different pools #2105

merged 13 commits into from Jun 10, 2021

Conversation

Yuggupta27
Copy link
Contributor

@Yuggupta27 Yuggupta27 commented May 28, 2021

Add support to restore a pvc into a different pool.

Assuming there are 2 pools namely "replicapool" and "testpool"
Workflow:

  1. Create a PVC in a replicapool.
  2. For cloning, a snapshot gets created in replicapool.
  3. PVC restore operation can be done in a new pool named testpool.

Co-authored-by: Madhu Rajanna madhupr007@gmail.com

Updates: #1838

@mergify mergify bot added the component/rbd Issues related to RBD label May 28, 2021
@Yuggupta27
Copy link
Contributor Author

/retest ci/centos/mini-e2e-helm/k8s-1.19

@Yuggupta27
Copy link
Contributor Author

/retest ci/centos/mini-e2e-helm/k8s-1.19

rook deployment failed with

X Exiting due to GUEST_PROVISION: Failed to start host: creating host: create: Error creating machine: Error in driver during machine creation: IP not available after waiting: machine minikube didn't return IP after 1 minute

@Yuggupta27 Yuggupta27 marked this pull request as ready for review May 31, 2021 03:07
@Madhu-1 Madhu-1 requested review from nixpanic and humblec May 31, 2021 06:07
@Madhu-1 Madhu-1 added this to the release-3.4.0 milestone May 31, 2021
humblec
humblec previously approved these changes Jun 1, 2021
@Madhu-1 Madhu-1 added the Priority-0 highest priority issue label Jun 2, 2021
internal/rbd/rbd_util.go Outdated Show resolved Hide resolved
internal/rbd/rbd_util.go Outdated Show resolved Hide resolved
internal/rbd/rbd_util.go Outdated Show resolved Hide resolved
internal/rbd/rbd_util.go Outdated Show resolved Hide resolved
internal/rbd/rbd_util.go Show resolved Hide resolved
@@ -566,6 +566,7 @@ func (rv *rbdVolume) getCloneDepth(ctx context.Context) (uint, error) {
depth++
}
vol.RbdImageName = vol.ParentName
vol.Pool = vol.ParentPool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as before, re-using a rbdVolume with different attributes is quite wrong. Needs cleanup urgently.

e2e/rbd_helper.go Outdated Show resolved Hide resolved
e2e/rbd_helper.go Outdated Show resolved Hide resolved
e2e/rbd.go Outdated Show resolved Hide resolved
@mergify mergify bot dismissed humblec’s stale review June 8, 2021 06:19

Pull request has been modified.

@Yuggupta27
Copy link
Contributor Author

CI failure due to #2146

@@ -114,8 +114,10 @@ type rbdVolume struct {
Topology map[string]string
// DataPool is where the data for images in `Pool` are stored, this is used as the `--data-pool`
// argument when the pool is created, and is not used anywhere else
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yuggupta27 not introduced with this patch, but please feel free to correct the DataPool explanation intendation.

Copy link
Contributor Author

@Yuggupta27 Yuggupta27 Jun 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll send a seperate PR to fix the same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here #2154

scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "storageclass.yaml")
sc, err := getStorageClass(scPath)
if err != nil {
return nil
}
if name != "" {
sc.Name = name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yuggupta27 also keep sc.Name in proper spacing compared to outer condition check

@Yuggupta27
Copy link
Contributor Author

/retest all

@humblec
Copy link
Collaborator

humblec commented Jun 8, 2021

@Yuggupta27 As discussed please get the comments addressed in other PR . will get this in for now! Thanks 👍

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Jun 10, 2021

/retest all

@Yuggupta27
Copy link
Contributor Author

/retest ci/centos/mini-e2e/k8s-1.19

@Yuggupta27
Copy link
Contributor Author

/retest ci/centos/mini-e2e/k8s-1.19

rook deployment failure

@Yuggupta27
Copy link
Contributor Author

/retest all

@humblec
Copy link
Collaborator

humblec commented Jun 10, 2021

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Jun 10, 2021

Command rebase: success

Branch has been successfully rebased

Yuggupta27 and others added 4 commits June 10, 2021 16:45
added support to create image in different pool.
if the snapshot/rbd image exists in one pool we
can create a clone the clone of the rbd image to
a different pool.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
as we are supporting the creation of clone to a new
pool we need to pass the correct parent volume
to cleanup the snapshot on parent volume.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
when clones are created in different pool,we
need to retrieve the parent pool to get the
information of the parent image.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
if the parent and child clones are in
different namespaces we need to open a new
ioctx for pools.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
Yuggupta27 and others added 9 commits June 10, 2021 16:45
Validate Snapshot request to check if the
passed pool name is not empty.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
While traversing image chain, the parent
image can be present in a different pool
that the one child is in. So, updating
pool name in the next itteration to
that of the Parent.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
made pool as a argument of listRBDImages to support
listing of rbd images in different pools.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
added a new function to create rbd pool
in e2e.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
added an option to set storageclass name.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
declared yaml filepath in gobal for reusing.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
added a helper function to test clone creation
in a different pool.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
added a e2e to test clones in different
pool.

Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
logErr function logs all the ocured errors
with a message that is passed for occurence
of each error.

Co-authored-by: Niels de Vos <ndevos@redhat.com>
Co-authored-by: Madhu Rajanna <madhupr007@gmail.com>
Signed-off-by: Yug <yuggupta27@gmail.com>
@Yuggupta27
Copy link
Contributor Author

/retest ci/centos/upgrade-tests-cephfs

@Yuggupta27
Copy link
Contributor Author

/retest ci/centos/mini-e2e/k8s-1.19

@mergify mergify bot merged commit 33bf3fa into ceph:devel Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/rbd Issues related to RBD Priority-0 highest priority issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants