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

bugfix: don't set mount tab when rootfs diskquota is null #1926

Merged
merged 1 commit into from
Jul 30, 2018
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