ceph: rehydrate the osd CRUSH location for PVCs
The OSDs on PVCs were changing location in the CRUSH hierarchy after an operator restart due to the location property not being re-discovered on the OSD daemon. Since OSDs on PVCs do not run the prepare pod again to discover this property, the operator must read it off the existing osd deployment. The operator was reading other properties, but now will read the location as well. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
2 files changed
+9
-3
No files matched your search
@@ -719,9 +719,14 @@ func getOSDInfo(d *apps.Deployment) ([]OSDInfo, error) {
|
||||
if strings.HasPrefix(a, "--setuser-match-path") {
|
||||
if len(container.Args) >= i+1 {
|
||||
osd.DataPath = container.Args[i+1]
|
||||
break
|
||||
}
|
||||
}
|
||||
locationPrefix := "--crush-location="
|
||||
if strings.HasPrefix(a, locationPrefix) {
|
||||
// Extract the same CRUSH location as originally determined by the OSD prepare pod
|
||||
// by cutting off the prefix: --crush-location=
|
||||
osd.Location = a[len(locationPrefix):]
|
||||
}
|
||||
}
|
||||
|
||||
osd.CephVolumeInitiated = true
|
||||
|
||||
@@ -385,7 +385,8 @@ func TestGetOSDInfo(t *testing.T) {
|
||||
v1.ResourceRequirements{}, v1.ResourceRequirements{}, "my-priority-class", metav1.OwnerReference{}, false, false)
|
||||
|
||||
node := "n1"
|
||||
osd1 := OSDInfo{ID: 3, UUID: "osd-uuid", LVPath: "dev/logical-volume-path", DataPath: "/rook/path", CephVolumeInitiated: true}
|
||||
location := "root=default host=myhost zone=myzone"
|
||||
osd1 := OSDInfo{ID: 3, UUID: "osd-uuid", LVPath: "dev/logical-volume-path", DataPath: "/rook/path", CephVolumeInitiated: true, Location: location}
|
||||
osd2 := OSDInfo{ID: 3, UUID: "osd-uuid", LVPath: "", DataPath: "/rook/path", CephVolumeInitiated: true}
|
||||
osdProp := osdProperties{
|
||||
crushHostname: node,
|
||||
@@ -402,10 +403,10 @@ func TestGetOSDInfo(t *testing.T) {
|
||||
assert.Equal(t, 1, len(osds1))
|
||||
assert.Equal(t, osd1.ID, osds1[0].ID)
|
||||
assert.Equal(t, osd1.LVPath, osds1[0].LVPath)
|
||||
assert.Equal(t, location, osds1[0].Location)
|
||||
|
||||
d2, _ := c.makeDeployment(osdProp, osd2, dataPathMap)
|
||||
osds2, err := getOSDInfo(d2)
|
||||
assert.Equal(t, 0, len(osds2))
|
||||
assert.NotNil(t, err)
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user