dashboard: buildlet client, server, and gomote enhancements

- get tarballs out of buildlets
- gomote can pass arguments to buildlet's exec handler
- buildlet's exec handler can run system-level commands
- hard-code GOROOT_BOOTSTRAP to be "go1.4" under the workdir
- adjust MTU size on GCE

etc

Change-Id: I73e18b7a5e395a889f5ee93ba9850d331ffb7812
Reviewed-on: https://go-review.googlesource.com/3052
Reviewed-by: Andrew Gerrand <adg@golang.org>
diff --git a/buildlet/buildletclient.go b/buildlet/buildletclient.go
index ef9c0a2..53b2c6a 100644
--- a/buildlet/buildletclient.go
+++ b/buildlet/buildletclient.go
@@ -102,12 +102,38 @@
 	return c.doOK(req)
 }
 
+// GetTar returns a .tar.gz stream of the given directory, relative to the buildlet's work dir.
+// The provided dir may be empty to get everything.
+func (c *Client) GetTar(dir string) (tgz io.ReadCloser, err error) {
+	req, err := http.NewRequest("GET", c.URL()+"/tgz?dir="+url.QueryEscape(dir), nil)
+	if err != nil {
+		return nil, err
+	}
+	res, err := c.do(req)
+	if err != nil {
+		return nil, err
+	}
+	if res.StatusCode != http.StatusOK {
+		slurp, _ := ioutil.ReadAll(io.LimitReader(res.Body, 4<<10))
+		res.Body.Close()
+		return nil, fmt.Errorf("%v; body: %s", res.Status, slurp)
+	}
+	return res.Body, nil
+}
+
 // ExecOpts are options for a remote command invocation.
 type ExecOpts struct {
 	// Output is the output of stdout and stderr.
 	// If nil, the output is discarded.
 	Output io.Writer
 
+	// Args are the arguments to pass to the cmd given to Client.Exec.
+	Args []string
+
+	// SystemLevel controls whether the command is run outside of
+	// the buildlet's environment.
+	SystemLevel bool
+
 	// OnStartExec is an optional hook that runs after the 200 OK
 	// response from the buildlet, but before the output begins
 	// writing to Output.
@@ -122,8 +148,14 @@
 // seen to completition. If execErr is non-nil, the remoteErr is
 // meaningless.
 func (c *Client) Exec(cmd string, opts ExecOpts) (remoteErr, execErr error) {
+	var mode string
+	if opts.SystemLevel {
+		mode = "sys"
+	}
 	form := url.Values{
-		"cmd": {cmd},
+		"cmd":    {cmd},
+		"mode":   {mode},
+		"cmdArg": opts.Args,
 	}
 	req, err := http.NewRequest("POST", c.URL()+"/exec", strings.NewReader(form.Encode()))
 	if err != nil {