Skip to content

Commit 15d4137

Browse files
chore: added logs to all hooks
Signed-off-by: Utkarsh Bhatt <utkarsh.bhatt@canonical.com>
1 parent e64b6ab commit 15d4137

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

microceph/ceph/remove.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import (
1515

1616
// PreRemove cleans up the underlying ceph services before the node is removed from the dqlite cluster.
1717
func PreRemove(m *microcluster.MicroCluster) func(ctx context.Context, s state.State, force bool) error {
18+
logger.Debug("Setting up PreRemove hook")
1819
return func(ctx context.Context, s state.State, force bool) error {
20+
logger.Infof("Executing PreRemove hook for node %s (force=%v)", s.Name(), force)
1921
cli, err := m.LocalClient()
2022
if err != nil {
2123
return err
@@ -50,7 +52,6 @@ func EnsureNonOsdSvcEnough(services types.Services, nodeName string, minMon int,
5052
}
5153

5254
func removeNode(cli *microCli.Client, node string, force bool) error {
53-
5455
logger.Debugf("Removing cluster member %v, force: %v", node, force)
5556

5657
// check prerquisites unless we're forcing
@@ -137,5 +138,4 @@ func deleteNodeServices(cli *microCli.Client, name string) error {
137138
}
138139
}
139140
return nil
140-
141141
}

microceph/cmd/microcephd/hooks.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
// PreInit is run before the daemon is initialized on bootstrap and join.
1414
func PreInit(ctx context.Context, s state.State, bootstrap bool, initConfig map[string]string) error {
15+
logger.Debugf("Executed Hook: PreInit (bootstrap=%v)", bootstrap)
1516
if bootstrap {
1617
logger.Debugf("PreInit for bootstrap: %v", initConfig)
1718
// Parse Bootstrap API parameters
@@ -32,6 +33,7 @@ func PreInit(ctx context.Context, s state.State, bootstrap bool, initConfig map[
3233

3334
// PostBootstrap is run after the daemon is initialized and bootstrapped.
3435
func PostBootstrap(ctx context.Context, s state.State, initConfig map[string]string) error {
36+
logger.Debug("Executed Hook: PostBootstrap")
3537
// Parse Bootstrap API parameters
3638
bd := common.BootstrapConfig{}
3739
common.DecodeBootstrapConfig(initConfig, &bd)
@@ -46,11 +48,13 @@ func PostBootstrap(ctx context.Context, s state.State, initConfig map[string]str
4648
}
4749

4850
func PostJoin(ctx context.Context, s state.State, initConfig map[string]string) error {
51+
logger.Debug("Executed Hook: PostJoin")
4952
interf := interfaces.CephState{State: s}
5053
return ceph.Join(ctx, interf)
5154
}
5255

5356
func OnStart(ctx context.Context, s state.State) error {
57+
logger.Debug("Executed Hook: OnStart")
5458
interf := interfaces.CephState{State: s}
5559
return ceph.Start(ctx, interf)
5660
}

0 commit comments

Comments
 (0)