Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions daemon/mgr/spec_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ func setupHook(ctx context.Context, c *Container, specWrapper *SpecWrapper) erro
}

// setup diskquota hook, if rootFSQuota not set skip this part.
if err := setRootfsDiskQuota(ctx, c, specWrapper); err != nil {
return errors.Wrap(err, "failed to set rootfs disk")
}

// set volume mount tab
if err := setMountTab(ctx, c, specWrapper); err != nil {
return errors.Wrap(err, "failed to set volume mount tab prestart hook")
}

return nil
}

func setRootfsDiskQuota(ctx context.Context, c *Container, spec *SpecWrapper) error {
rootFSQuota := quota.GetDefaultQuota(c.Config.DiskQuota)
if rootFSQuota == "" {
return nil
Expand All @@ -70,16 +83,11 @@ func setupHook(ctx context.Context, c *Container, specWrapper *SpecWrapper) erro
return err
}

s.Hooks.Prestart = append(s.Hooks.Prestart, specs.Hook{
spec.s.Hooks.Prestart = append(spec.s.Hooks.Prestart, specs.Hook{
Path: target,
Args: []string{"set-diskquota", c.BaseFS, rootFSQuota, qid},
})

// set volume mount tab
if err := setMountTab(ctx, c, specWrapper); err != nil {
return errors.Wrap(err, "failed to set volume mount tab prestart hook")
}

return nil
}

Expand Down