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

lvmd: fix Watch RPC to notify VG info periodically when embedded #843

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

daichimukai
Copy link
Contributor

@daichimukai daichimukai commented Feb 26, 2024

The Watch RPC of lvmd's VGService is expected to notify VG information periodically to its watchers. However, when lvmd is embedded into topolvm-node, Watch RPC sends VG info only once on startup time and does nothing after that unless LVService invokes LVM commands for RPCs. This commit addresses the issue.

Fixes: c5f17a4 ("feat: implement embed-lvmd")

@daichimukai daichimukai self-assigned this Feb 26, 2024
@daichimukai daichimukai marked this pull request as ready for review February 26, 2024 04:29
@daichimukai daichimukai requested a review from a team as a code owner February 26, 2024 04:29
The Watch RPC of lvmd's VGService is expected to notify VG information
periodically to its watchers. However, when lvmd is embedded into
topolvm-node, Watch RPC sends VG info only once on startup time and does
nothing after that unless LVService invokes LVM commands for RPCs. This
commit addresses the issue.

Fixes: c5f17a4 ("feat: implement embed-lvmd")
Signed-off-by: Daichi Mukai <daichi-mukai@cybozu.co.jp>
@@ -29,6 +31,20 @@ func NewEmbeddedServiceClients(ctx context.Context, dcmapper *DeviceClassManager
log.FromContext(ctx).Error(err, "embedded channel watch error")
}
}()

go func() {
ticker := time.NewTicker(10 * time.Minute)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix idea! QQ: How does the regular trigger for notify work on non-embedded mode? Im wondering how its able to do this refresh in the non-embedded mode

Copy link
Contributor

Choose a reason for hiding this comment

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

NVM, just found

go func() {
ticker := time.NewTicker(10 * time.Minute)
for {
select {
case <-ctx.Done():
ticker.Stop()
grpcServer.GracefulStop()
return
case <-ticker.C:
notifier()
}
}
}()

Should we extract this into a common method and also make the time interval modifiable now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's a great idea. But I would like to leave that as a separate task, as my priority is to merge this fix and include it in next month's release.

@cupnes cupnes merged commit 976abaf into main Feb 27, 2024
24 checks passed
@cupnes cupnes deleted the lvmd/fix-watch-rpc-embedded branch February 27, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants