libct: add/use configs.HasHook

This allows to omit a call to c.currentOCIState (which can be somewhat
costly when there are many annotations) when the hooks of a given kind
won't be run.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2024-10-09 11:00:48 -07:00
parent 2e906e292e
commit 8afeb58398
4 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -740,7 +740,7 @@ func (p *initProcess) start() (retErr error) {
return fmt.Errorf("error setting Intel RDT config for procHooks process: %w", err)
}
}
if len(p.config.Config.Hooks) != 0 {
if p.config.Config.HasHook(configs.Prestart, configs.CreateRuntime) {
s, err := p.container.currentOCIState()
if err != nil {
return err