summaryrefslogtreecommitdiff
path: root/cmd/podman/parse.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-05-16 12:38:17 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-21 19:26:56 +0000
commit82feafecdda8040432c008d9b79e4f973009adfc (patch)
tree8edffbe531bcf47c40b34cd003e4063142fbc84f /cmd/podman/parse.go
parent687b165a737742e1f1930cd9782002d857e07aaf (diff)
downloadpodman-82feafecdda8040432c008d9b79e4f973009adfc.tar.gz
podman-82feafecdda8040432c008d9b79e4f973009adfc.tar.bz2
podman-82feafecdda8040432c008d9b79e4f973009adfc.zip
podman create, start, getattachsocket
First pass at implement API endpoints for create and start. Signed-off-by: baude <bbaude@redhat.com> Closes: #805 Approved by: baude
Diffstat (limited to 'cmd/podman/parse.go')
-rw-r--r--cmd/podman/parse.go105
1 files changed, 0 insertions, 105 deletions
diff --git a/cmd/podman/parse.go b/cmd/podman/parse.go
index 484b9723f..22197ba20 100644
--- a/cmd/podman/parse.go
+++ b/cmd/podman/parse.go
@@ -16,7 +16,6 @@ import (
"strconv"
"strings"
- units "github.com/docker/go-units"
"github.com/pkg/errors"
)
@@ -107,40 +106,6 @@ func validateBlkioWeight(val int64) (int64, error) { //nolint
return -1, errors.Errorf("invalid blkio weight %q, should be between 10 and 1000", val)
}
-// weightDevice is a structure that holds device:weight pair
-type weightDevice struct {
- path string
- weight uint16
-}
-
-func (w *weightDevice) String() string {
- return fmt.Sprintf("%s:%d", w.path, w.weight)
-}
-
-// validateweightDevice validates that the specified string has a valid device-weight format
-// for blkio-weight-device flag
-func validateweightDevice(val string) (*weightDevice, error) {
- split := strings.SplitN(val, ":", 2)
- if len(split) != 2 {
- return nil, fmt.Errorf("bad format: %s", val)
- }
- if !strings.HasPrefix(split[0], "/dev/") {
- return nil, fmt.Errorf("bad format for device path: %s", val)
- }
- weight, err := strconv.ParseUint(split[1], 10, 0)
- if err != nil {
- return nil, fmt.Errorf("invalid weight for device: %s", val)
- }
- if weight > 0 && (weight < 10 || weight > 1000) {
- return nil, fmt.Errorf("invalid weight for device: %s", val)
- }
-
- return &weightDevice{
- path: split[0],
- weight: uint16(weight),
- }, nil
-}
-
// parseDevice parses a device mapping string to a container.DeviceMapping struct
// for device flag
func parseDevice(device string) (*HostDevice, error) { //nolint
@@ -250,64 +215,6 @@ func validatePath(val string, validator func(string) bool) (string, error) {
return val, nil
}
-// throttleDevice is a structure that holds device:rate_per_second pair
-type throttleDevice struct {
- path string
- rate uint64
-}
-
-func (t *throttleDevice) String() string {
- return fmt.Sprintf("%s:%d", t.path, t.rate)
-}
-
-// validateBpsDevice validates that the specified string has a valid device-rate format
-// for device-read-bps and device-write-bps flags
-func validateBpsDevice(val string) (*throttleDevice, error) {
- split := strings.SplitN(val, ":", 2)
- if len(split) != 2 {
- return nil, fmt.Errorf("bad format: %s", val)
- }
- if !strings.HasPrefix(split[0], "/dev/") {
- return nil, fmt.Errorf("bad format for device path: %s", val)
- }
- rate, err := units.RAMInBytes(split[1])
- if err != nil {
- return nil, fmt.Errorf("invalid rate for device: %s. The correct format is <device-path>:<number>[<unit>]. Number must be a positive integer. Unit is optional and can be kb, mb, or gb", val)
- }
- if rate < 0 {
- return nil, fmt.Errorf("invalid rate for device: %s. The correct format is <device-path>:<number>[<unit>]. Number must be a positive integer. Unit is optional and can be kb, mb, or gb", val)
- }
-
- return &throttleDevice{
- path: split[0],
- rate: uint64(rate),
- }, nil
-}
-
-// validateIOpsDevice validates that the specified string has a valid device-rate format
-// for device-write-iops and device-read-iops flags
-func validateIOpsDevice(val string) (*throttleDevice, error) { //nolint
- split := strings.SplitN(val, ":", 2)
- if len(split) != 2 {
- return nil, fmt.Errorf("bad format: %s", val)
- }
- if !strings.HasPrefix(split[0], "/dev/") {
- return nil, fmt.Errorf("bad format for device path: %s", val)
- }
- rate, err := strconv.ParseUint(split[1], 10, 64)
- if err != nil {
- return nil, fmt.Errorf("invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer", val)
- }
- if rate < 0 {
- return nil, fmt.Errorf("invalid rate for device: %s. The correct format is <device-path>:<number>. Number must be a positive integer", val)
- }
-
- return &throttleDevice{
- path: split[0],
- rate: uint64(rate),
- }, nil
-}
-
// validateDNSSearch validates domain for resolvconf search configuration.
// A zero length domain is represented by a dot (.).
// for dns-search flag
@@ -805,18 +712,6 @@ func stringSlicetoUint32Slice(inputSlice []string) ([]uint32, error) {
return outputSlice, nil
}
-func getLoggingPath(opts []string) string {
- for _, opt := range opts {
- arr := strings.SplitN(opt, "=", 2)
- if len(arr) == 2 {
- if strings.TrimSpace(arr[0]) == "path" {
- return strings.TrimSpace(arr[1])
- }
- }
- }
- return ""
-}
-
// validateFileName returns an error if filename contains ":"
// as it is currently not supported
func validateFileName(filename string) error {