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

ceph: skip osd prepare job creation if osd daemon exists for the pvc #4277

Merged
merged 1 commit into from Nov 8, 2019
Merged

ceph: skip osd prepare job creation if osd daemon exists for the pvc #4277

merged 1 commit into from Nov 8, 2019

Conversation

sp98
Copy link
Contributor

@sp98 sp98 commented Nov 7, 2019

When an orchestration is restarted or retriggered and starts new osd prepare pods, they are unable to start because the device is already in use by the osd daemon pods.
This fix skips the osd prepare pod creation if the daemon is already running.

Signed-off-by: Santosh Pillai sapillai@redhat.com

Description of your changes:

  • Checks if OSD daemon is already present before creating OSD prepare pod for that PVC.
  • If OSD daemon is present, the skip osd prepare pod creation and update the config map.

Which issue is resolved by this Pull Request:
Resolves #

Checklist:

  • Reviewed the developer guide on Submitting a Pull Request
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.
  • Pending release notes updated with breaking and/or notable changes, if necessary.
  • Upgrade from previous release is tested and upgrade user guide is updated, if necessary.
  • Code generation (make codegen) has been run to update object specifications, if necessary.
  • Comments have been added or updated based on the standards set in CONTRIBUTING.md
  • Add the flag for skipping the CI if this PR does not require a build. See here for more details.

@sp98 sp98 requested a review from travisn November 7, 2019 13:38
pkg/operator/ceph/cluster/osd/osd.go Outdated Show resolved Hide resolved
//Skip OSD prepare if deployement already exists for the PVC
listOpts := metav1.ListOptions{LabelSelector: fmt.Sprintf("%s=%s,%s=%s",
k8sutil.AppAttr, AppName,
pvcLabelKey, osdProps.crushHostname,
Copy link
Member

Choose a reason for hiding this comment

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

I see the crushHostName set above as the PVC name above on line 253, but I'd suggest we set this to volume.PersistentVolumeClaimSource.ClaimName just to be clear that we want the pvc name and not the host name, just for code readability. The crushHostname is actually not the pvc name if the osd is not portable, this must be updated somewhere else.

return osds, fmt.Errorf("failed to get required osdInfo. %+v", osd)
}

osds = append(osds, osd)
Copy link
Member

Choose a reason for hiding this comment

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

nit: instead of appending, you could do this: return []OSDInfo{osd}, nil

@@ -828,3 +856,38 @@ func (c *Cluster) getPVCHostName(pvcName string) (string, error) {
}
return "", err
}

func getOSDInfo(d *apps.Deployment) ([]OSDInfo, error) {
Copy link
Member

Choose a reason for hiding this comment

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

how about a unit test for this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added unit test.

@sp98 sp98 changed the title [WIP]ceph: skip osd prepare job creation if osd daemon exists for the pvc ceph: skip osd prepare job creation if osd daemon exists for the pvc Nov 8, 2019
pkg/operator/ceph/cluster/osd/osd.go Outdated Show resolved Hide resolved
When an orchestration is restarted or retriggered and starts new osd prepare pods, they are unable to start because the device is already in use by the osd daemon pods.
This fix simple skips the osd prepare pod creation if the daemon is already running.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
@leseb leseb added this to ToDo in v1.1 via automation Nov 8, 2019
@leseb leseb added this to the 1.1 milestone Nov 8, 2019
@leseb leseb merged commit ccb9f6e into rook:master Nov 8, 2019
v1.1 automation moved this from ToDo to Done Nov 8, 2019
mergify bot added a commit that referenced this pull request Nov 8, 2019
ceph: skip osd prepare job creation if osd daemon exists for the pvc (bp #4277)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ceph main ceph tag
Projects
No open projects
v1.1
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants