fix(region): init NextSyncTimeiwhen create snapshotpolicydisks

This commit is contained in:
rainzm
2020-10-22 19:34:45 +08:00
parent 92d862b17d
commit a2d221685e
+10
View File
@@ -494,6 +494,16 @@ func (self *SSnapshotPolicyDiskManager) ValidateCreateData(ctx context.Context,
return data, nil
}
func (sd *SSnapshotPolicyDisk) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) error {
sp, err := SnapshotPolicyManager.FetchSnapshotPolicyById(sd.SnapshotpolicyId)
if err != nil {
return err
}
now := time.Now()
sd.NextSyncTime = sp.ComputeNextSyncTime(now, now)
return nil
}
func (sd *SSnapshotPolicyDisk) PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.
IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) {