Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LimitCommand = cli.Command{ Name: "limit", Usage: "limit --disk-limit-bytes 102400 --image-path <path>", Description: "Add disk limits to the volume.", Flags: []cli.Flag{ cli.StringFlag{ Name: "image-path", Usage: "Path to the volume", }, cli.Int64Flag{ Name: "disk-limit-bytes", Usage: "Disk limit in bytes", }, }, Action: func(ctx *cli.Context) error { logger := lager.NewLogger("tardis") logger.RegisterSink(lager.NewWriterSink(os.Stderr, lager.DEBUG)) logger.Info("staring") defer logger.Info("ending") imagePath := ctx.String("image-path") imagesPath := filepath.Dir(imagePath) quotaControl, err := quotapkg.NewControl(imagesPath) if err != nil { logger.Error("creating-quota-control-failed", err, lager.Data{"imagesPath": imagesPath}) return errorspkg.Wrapf(err, "creating xfs quota control %s", imagesPath) } diskLimit := ctx.Int64("disk-limit-bytes") quota := quotapkg.Quota{ Size: uint64(diskLimit), } if err := quotaControl.SetQuota(imagePath, quota); err != nil { logger.Error("setting-quota-failed", err) return errorspkg.Wrapf(err, "setting quota to %s", imagePath) } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.