Removing dead code.
Signed-off-by: John Gossman <johngos@microsoft.com>
| ... | ... |
@@ -2183,7 +2183,7 @@ func (cli *DockerCli) CmdCreate(args ...string) error {
|
| 2183 | 2183 |
flName = cmd.String([]string{"-name"}, "", "Assign a name to the container")
|
| 2184 | 2184 |
) |
| 2185 | 2185 |
|
| 2186 |
- config, hostConfig, cmd, err := runconfig.Parse(cmd, args, nil) |
|
| 2186 |
+ config, hostConfig, cmd, err := runconfig.Parse(cmd, args) |
|
| 2187 | 2187 |
if err != nil {
|
| 2188 | 2188 |
return err |
| 2189 | 2189 |
} |
| ... | ... |
@@ -2219,7 +2219,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
| 2219 | 2219 |
ErrConflictDetachAutoRemove = fmt.Errorf("Conflicting options: --rm and -d")
|
| 2220 | 2220 |
) |
| 2221 | 2221 |
|
| 2222 |
- config, hostConfig, cmd, err := runconfig.Parse(cmd, args, nil) |
|
| 2222 |
+ config, hostConfig, cmd, err := runconfig.Parse(cmd, args) |
|
| 2223 | 2223 |
if err != nil {
|
| 2224 | 2224 |
return err |
| 2225 | 2225 |
} |
| ... | ... |
@@ -183,7 +183,7 @@ func run(b *Builder, args []string, attributes map[string]bool, original string) |
| 183 | 183 |
runCmd.SetOutput(ioutil.Discard) |
| 184 | 184 |
runCmd.Usage = nil |
| 185 | 185 |
|
| 186 |
- config, _, _, err := runconfig.Parse(runCmd, append([]string{b.image}, args...), nil)
|
|
| 186 |
+ config, _, _, err := runconfig.Parse(runCmd, append([]string{b.image}, args...))
|
|
| 187 | 187 |
if err != nil {
|
| 188 | 188 |
return err |
| 189 | 189 |
} |
| ... | ... |
@@ -661,7 +661,7 @@ func TestDefaultContainerName(t *testing.T) {
|
| 661 | 661 |
daemon := mkDaemonFromEngine(eng, t) |
| 662 | 662 |
defer nuke(daemon) |
| 663 | 663 |
|
| 664 |
- config, _, _, err := parseRun([]string{unitTestImageID, "echo test"}, nil)
|
|
| 664 |
+ config, _, _, err := parseRun([]string{unitTestImageID, "echo test"})
|
|
| 665 | 665 |
if err != nil {
|
| 666 | 666 |
t.Fatal(err) |
| 667 | 667 |
} |
| ... | ... |
@@ -685,7 +685,7 @@ func TestRandomContainerName(t *testing.T) {
|
| 685 | 685 |
daemon := mkDaemonFromEngine(eng, t) |
| 686 | 686 |
defer nuke(daemon) |
| 687 | 687 |
|
| 688 |
- config, _, _, err := parseRun([]string{GetTestImage(daemon).ID, "echo test"}, nil)
|
|
| 688 |
+ config, _, _, err := parseRun([]string{GetTestImage(daemon).ID, "echo test"})
|
|
| 689 | 689 |
if err != nil {
|
| 690 | 690 |
t.Fatal(err) |
| 691 | 691 |
} |
| ... | ... |
@@ -716,7 +716,7 @@ func TestContainerNameValidation(t *testing.T) {
|
| 716 | 716 |
{"abc-123_AAA.1", true},
|
| 717 | 717 |
{"\000asdf", false},
|
| 718 | 718 |
} {
|
| 719 |
- config, _, _, err := parseRun([]string{unitTestImageID, "echo test"}, nil)
|
|
| 719 |
+ config, _, _, err := parseRun([]string{unitTestImageID, "echo test"})
|
|
| 720 | 720 |
if err != nil {
|
| 721 | 721 |
if !test.Valid {
|
| 722 | 722 |
continue |
| ... | ... |
@@ -757,7 +757,7 @@ func TestLinkChildContainer(t *testing.T) {
|
| 757 | 757 |
daemon := mkDaemonFromEngine(eng, t) |
| 758 | 758 |
defer nuke(daemon) |
| 759 | 759 |
|
| 760 |
- config, _, _, err := parseRun([]string{unitTestImageID, "echo test"}, nil)
|
|
| 760 |
+ config, _, _, err := parseRun([]string{unitTestImageID, "echo test"})
|
|
| 761 | 761 |
if err != nil {
|
| 762 | 762 |
t.Fatal(err) |
| 763 | 763 |
} |
| ... | ... |
@@ -773,7 +773,7 @@ func TestLinkChildContainer(t *testing.T) {
|
| 773 | 773 |
t.Fatalf("Expect webapp id to match container id: %s != %s", webapp.ID, container.ID)
|
| 774 | 774 |
} |
| 775 | 775 |
|
| 776 |
- config, _, _, err = parseRun([]string{GetTestImage(daemon).ID, "echo test"}, nil)
|
|
| 776 |
+ config, _, _, err = parseRun([]string{GetTestImage(daemon).ID, "echo test"})
|
|
| 777 | 777 |
if err != nil {
|
| 778 | 778 |
t.Fatal(err) |
| 779 | 779 |
} |
| ... | ... |
@@ -799,7 +799,7 @@ func TestGetAllChildren(t *testing.T) {
|
| 799 | 799 |
daemon := mkDaemonFromEngine(eng, t) |
| 800 | 800 |
defer nuke(daemon) |
| 801 | 801 |
|
| 802 |
- config, _, _, err := parseRun([]string{unitTestImageID, "echo test"}, nil)
|
|
| 802 |
+ config, _, _, err := parseRun([]string{unitTestImageID, "echo test"})
|
|
| 803 | 803 |
if err != nil {
|
| 804 | 804 |
t.Fatal(err) |
| 805 | 805 |
} |
| ... | ... |
@@ -815,7 +815,7 @@ func TestGetAllChildren(t *testing.T) {
|
| 815 | 815 |
t.Fatalf("Expect webapp id to match container id: %s != %s", webapp.ID, container.ID)
|
| 816 | 816 |
} |
| 817 | 817 |
|
| 818 |
- config, _, _, err = parseRun([]string{unitTestImageID, "echo test"}, nil)
|
|
| 818 |
+ config, _, _, err = parseRun([]string{unitTestImageID, "echo test"})
|
|
| 819 | 819 |
if err != nil {
|
| 820 | 820 |
t.Fatal(err) |
| 821 | 821 |
} |
| ... | ... |
@@ -12,7 +12,7 @@ func TestCreateNumberHostname(t *testing.T) {
|
| 12 | 12 |
eng := NewTestEngine(t) |
| 13 | 13 |
defer mkDaemonFromEngine(eng, t).Nuke() |
| 14 | 14 |
|
| 15 |
- config, _, _, err := parseRun([]string{"-h", "web.0", unitTestImageID, "echo test"}, nil)
|
|
| 15 |
+ config, _, _, err := parseRun([]string{"-h", "web.0", unitTestImageID, "echo test"})
|
|
| 16 | 16 |
if err != nil {
|
| 17 | 17 |
t.Fatal(err) |
| 18 | 18 |
} |
| ... | ... |
@@ -24,7 +24,7 @@ func TestCommit(t *testing.T) {
|
| 24 | 24 |
eng := NewTestEngine(t) |
| 25 | 25 |
defer mkDaemonFromEngine(eng, t).Nuke() |
| 26 | 26 |
|
| 27 |
- config, _, _, err := parseRun([]string{unitTestImageID, "/bin/cat"}, nil)
|
|
| 27 |
+ config, _, _, err := parseRun([]string{unitTestImageID, "/bin/cat"})
|
|
| 28 | 28 |
if err != nil {
|
| 29 | 29 |
t.Fatal(err) |
| 30 | 30 |
} |
| ... | ... |
@@ -48,7 +48,7 @@ func TestMergeConfigOnCommit(t *testing.T) {
|
| 48 | 48 |
container1, _, _ := mkContainer(runtime, []string{"-e", "FOO=bar", unitTestImageID, "echo test > /tmp/foo"}, t)
|
| 49 | 49 |
defer runtime.Destroy(container1) |
| 50 | 50 |
|
| 51 |
- config, _, _, err := parseRun([]string{container1.ID, "cat /tmp/foo"}, nil)
|
|
| 51 |
+ config, _, _, err := parseRun([]string{container1.ID, "cat /tmp/foo"})
|
|
| 52 | 52 |
if err != nil {
|
| 53 | 53 |
t.Error(err) |
| 54 | 54 |
} |
| ... | ... |
@@ -102,7 +102,7 @@ func TestRestartKillWait(t *testing.T) {
|
| 102 | 102 |
runtime := mkDaemonFromEngine(eng, t) |
| 103 | 103 |
defer runtime.Nuke() |
| 104 | 104 |
|
| 105 |
- config, hostConfig, _, err := parseRun([]string{"-i", unitTestImageID, "/bin/cat"}, nil)
|
|
| 105 |
+ config, hostConfig, _, err := parseRun([]string{"-i", unitTestImageID, "/bin/cat"})
|
|
| 106 | 106 |
if err != nil {
|
| 107 | 107 |
t.Fatal(err) |
| 108 | 108 |
} |
| ... | ... |
@@ -163,7 +163,7 @@ func TestCreateStartRestartStopStartKillRm(t *testing.T) {
|
| 163 | 163 |
eng := NewTestEngine(t) |
| 164 | 164 |
defer mkDaemonFromEngine(eng, t).Nuke() |
| 165 | 165 |
|
| 166 |
- config, hostConfig, _, err := parseRun([]string{"-i", unitTestImageID, "/bin/cat"}, nil)
|
|
| 166 |
+ config, hostConfig, _, err := parseRun([]string{"-i", unitTestImageID, "/bin/cat"})
|
|
| 167 | 167 |
if err != nil {
|
| 168 | 168 |
t.Fatal(err) |
| 169 | 169 |
} |
| ... | ... |
@@ -19,7 +19,6 @@ import ( |
| 19 | 19 |
"github.com/docker/docker/daemon" |
| 20 | 20 |
"github.com/docker/docker/engine" |
| 21 | 21 |
flag "github.com/docker/docker/pkg/mflag" |
| 22 |
- "github.com/docker/docker/pkg/sysinfo" |
|
| 23 | 22 |
"github.com/docker/docker/runconfig" |
| 24 | 23 |
"github.com/docker/docker/utils" |
| 25 | 24 |
) |
| ... | ... |
@@ -250,7 +249,7 @@ func readFile(src string, t *testing.T) (content string) {
|
| 250 | 250 |
// The caller is responsible for destroying the container. |
| 251 | 251 |
// Call t.Fatal() at the first error. |
| 252 | 252 |
func mkContainer(r *daemon.Daemon, args []string, t *testing.T) (*daemon.Container, *runconfig.HostConfig, error) {
|
| 253 |
- config, hc, _, err := parseRun(args, nil) |
|
| 253 |
+ config, hc, _, err := parseRun(args) |
|
| 254 | 254 |
defer func() {
|
| 255 | 255 |
if err != nil && t != nil {
|
| 256 | 256 |
t.Fatal(err) |
| ... | ... |
@@ -351,9 +350,9 @@ func getImages(eng *engine.Engine, t *testing.T, all bool, filter string) *engin |
| 351 | 351 |
|
| 352 | 352 |
} |
| 353 | 353 |
|
| 354 |
-func parseRun(args []string, sysInfo *sysinfo.SysInfo) (*runconfig.Config, *runconfig.HostConfig, *flag.FlagSet, error) {
|
|
| 354 |
+func parseRun(args []string) (*runconfig.Config, *runconfig.HostConfig, *flag.FlagSet, error) {
|
|
| 355 | 355 |
cmd := flag.NewFlagSet("run", flag.ContinueOnError)
|
| 356 | 356 |
cmd.SetOutput(ioutil.Discard) |
| 357 | 357 |
cmd.Usage = nil |
| 358 |
- return runconfig.Parse(cmd, args, sysInfo) |
|
| 358 |
+ return runconfig.Parse(cmd, args) |
|
| 359 | 359 |
} |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 | 11 |
func parse(t *testing.T, args string) (*Config, *HostConfig, error) {
|
| 12 |
- config, hostConfig, _, err := parseRun(strings.Split(args+" ubuntu bash", " "), nil) |
|
| 12 |
+ config, hostConfig, _, err := parseRun(strings.Split(args+" ubuntu bash", " ")) |
|
| 13 | 13 |
return config, hostConfig, err |
| 14 | 14 |
} |
| 15 | 15 |
|
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/opts" |
| 11 | 11 |
flag "github.com/docker/docker/pkg/mflag" |
| 12 | 12 |
"github.com/docker/docker/pkg/parsers" |
| 13 |
- "github.com/docker/docker/pkg/sysinfo" |
|
| 14 | 13 |
"github.com/docker/docker/pkg/units" |
| 15 | 14 |
"github.com/docker/docker/utils" |
| 16 | 15 |
) |
| ... | ... |
@@ -24,7 +23,7 @@ var ( |
| 24 | 24 |
ErrConflictHostNetworkAndLinks = fmt.Errorf("Conflicting options: --net=host can't be used with links. This would result in undefined behavior.")
|
| 25 | 25 |
) |
| 26 | 26 |
|
| 27 |
-func Parse(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Config, *HostConfig, *flag.FlagSet, error) {
|
|
| 27 |
+func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSet, error) {
|
|
| 28 | 28 |
var ( |
| 29 | 29 |
// FIXME: use utils.ListOpts for attach and volumes? |
| 30 | 30 |
flAttach = opts.NewListOpts(opts.ValidateAttach) |
| ... | ... |
@@ -88,11 +87,6 @@ func Parse(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Config, |
| 88 | 88 |
return nil, nil, cmd, err |
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 |
- // Check if the kernel supports memory limit cgroup. |
|
| 92 |
- if sysInfo != nil && *flMemoryString != "" && !sysInfo.MemoryLimit {
|
|
| 93 |
- *flMemoryString = "" |
|
| 94 |
- } |
|
| 95 |
- |
|
| 96 | 91 |
// Validate input params |
| 97 | 92 |
if *flWorkingDir != "" && !path.IsAbs(*flWorkingDir) {
|
| 98 | 93 |
return nil, nil, cmd, ErrInvalidWorkingDirectory |
| ... | ... |
@@ -302,11 +296,6 @@ func Parse(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Config, |
| 302 | 302 |
RestartPolicy: restartPolicy, |
| 303 | 303 |
} |
| 304 | 304 |
|
| 305 |
- if sysInfo != nil && flMemory > 0 && !sysInfo.SwapLimit {
|
|
| 306 |
- //fmt.Fprintf(stdout, "WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.\n") |
|
| 307 |
- config.MemorySwap = -1 |
|
| 308 |
- } |
|
| 309 |
- |
|
| 310 | 305 |
// When allocating stdin in attached mode, close stdin at client disconnect |
| 311 | 306 |
if config.OpenStdin && config.AttachStdin {
|
| 312 | 307 |
config.StdinOnce = true |
| ... | ... |
@@ -6,14 +6,13 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
flag "github.com/docker/docker/pkg/mflag" |
| 8 | 8 |
"github.com/docker/docker/pkg/parsers" |
| 9 |
- "github.com/docker/docker/pkg/sysinfo" |
|
| 10 | 9 |
) |
| 11 | 10 |
|
| 12 |
-func parseRun(args []string, sysInfo *sysinfo.SysInfo) (*Config, *HostConfig, *flag.FlagSet, error) {
|
|
| 11 |
+func parseRun(args []string) (*Config, *HostConfig, *flag.FlagSet, error) {
|
|
| 13 | 12 |
cmd := flag.NewFlagSet("run", flag.ContinueOnError)
|
| 14 | 13 |
cmd.SetOutput(ioutil.Discard) |
| 15 | 14 |
cmd.Usage = nil |
| 16 |
- return Parse(cmd, args, sysInfo) |
|
| 15 |
+ return Parse(cmd, args) |
|
| 17 | 16 |
} |
| 18 | 17 |
|
| 19 | 18 |
func TestParseLxcConfOpt(t *testing.T) {
|
| ... | ... |
@@ -34,27 +33,27 @@ func TestParseLxcConfOpt(t *testing.T) {
|
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 | 36 |
func TestNetHostname(t *testing.T) {
|
| 37 |
- if _, _, _, err := parseRun([]string{"-h=name", "img", "cmd"}, nil); err != nil {
|
|
| 37 |
+ if _, _, _, err := parseRun([]string{"-h=name", "img", "cmd"}); err != nil {
|
|
| 38 | 38 |
t.Fatalf("Unexpected error: %s", err)
|
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 |
- if _, _, _, err := parseRun([]string{"--net=host", "img", "cmd"}, nil); err != nil {
|
|
| 41 |
+ if _, _, _, err := parseRun([]string{"--net=host", "img", "cmd"}); err != nil {
|
|
| 42 | 42 |
t.Fatalf("Unexpected error: %s", err)
|
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 |
- if _, _, _, err := parseRun([]string{"-h=name", "--net=bridge", "img", "cmd"}, nil); err != nil {
|
|
| 45 |
+ if _, _, _, err := parseRun([]string{"-h=name", "--net=bridge", "img", "cmd"}); err != nil {
|
|
| 46 | 46 |
t.Fatalf("Unexpected error: %s", err)
|
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 |
- if _, _, _, err := parseRun([]string{"-h=name", "--net=none", "img", "cmd"}, nil); err != nil {
|
|
| 49 |
+ if _, _, _, err := parseRun([]string{"-h=name", "--net=none", "img", "cmd"}); err != nil {
|
|
| 50 | 50 |
t.Fatalf("Unexpected error: %s", err)
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 |
- if _, _, _, err := parseRun([]string{"-h=name", "--net=host", "img", "cmd"}, nil); err != ErrConflictNetworkHostname {
|
|
| 53 |
+ if _, _, _, err := parseRun([]string{"-h=name", "--net=host", "img", "cmd"}); err != ErrConflictNetworkHostname {
|
|
| 54 | 54 |
t.Fatalf("Expected error ErrConflictNetworkHostname, got: %s", err)
|
| 55 | 55 |
} |
| 56 | 56 |
|
| 57 |
- if _, _, _, err := parseRun([]string{"-h=name", "--net=container:other", "img", "cmd"}, nil); err != ErrConflictNetworkHostname {
|
|
| 57 |
+ if _, _, _, err := parseRun([]string{"-h=name", "--net=container:other", "img", "cmd"}); err != ErrConflictNetworkHostname {
|
|
| 58 | 58 |
t.Fatalf("Expected error ErrConflictNetworkHostname, got: %s", err)
|
| 59 | 59 |
} |
| 60 | 60 |
} |