rbd: run schedule during promote operation

Moved to add scheduling to the promote
operation as scheduling need to be added
when the image is promoted and this is
the correct method of adding the scheduling
to make the scheduling take place.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2021-11-15 11:30:13 +05:30
committed by Madhu Rajanna
parent 7125df23c1
commit e4e0f397a6
3 changed files with 110 additions and 101 deletions

View File

@ -2050,28 +2050,6 @@ func (ri *rbdImage) addSnapshotScheduling(
return err
}
adminConn := ra.MirrorSnashotSchedule()
// list all the snapshot scheduling and check at least one image scheduling
// exists with specified interval.
ssList, err := adminConn.List(ls)
if err != nil {
return err
}
for _, ss := range ssList {
// make sure we are matching image level scheduling. The
// `adminConn.List` lists the global level scheduling also.
if ss.Name == ri.String() {
for _, s := range ss.Schedule {
// TODO: Add support to check start time also.
// The start time is currently stored with different format
// in ceph. Comparison is not possible unless we know in
// which format ceph is storing it.
if s.Interval == interval {
return err
}
}
}
}
err = adminConn.Add(ls, interval, startTime)
if err != nil {
return err