github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/libcontainerd/local/utils_windows.go (about)

     1  package local // import "github.com/demonoid81/moby/libcontainerd/local"
     2  
     3  import (
     4  	"strings"
     5  
     6  	opengcs "github.com/Microsoft/opengcs/client"
     7  )
     8  
     9  // setupEnvironmentVariables converts a string array of environment variables
    10  // into a map as required by the HCS. Source array is in format [v1=k1] [v2=k2] etc.
    11  func setupEnvironmentVariables(a []string) map[string]string {
    12  	r := make(map[string]string)
    13  	for _, s := range a {
    14  		arr := strings.SplitN(s, "=", 2)
    15  		if len(arr) == 2 {
    16  			r[arr[0]] = arr[1]
    17  		}
    18  	}
    19  	return r
    20  }
    21  
    22  // LCOWOption is a CreateOption required for LCOW configuration
    23  type LCOWOption struct {
    24  	Config *opengcs.Config
    25  }
    26  
    27  // Apply for the LCOW option is a no-op.
    28  func (s *LCOWOption) Apply(interface{}) error {
    29  	return nil
    30  }
    31  
    32  // debugGCS is a dirty hack for debugging for Linux Utility VMs. It simply
    33  // runs a bunch of commands inside the UVM, but seriously aides in advanced debugging.
    34  func (c *container) debugGCS() {
    35  	if c == nil || c.isWindows || c.hcsContainer == nil {
    36  		return
    37  	}
    38  	cfg := opengcs.Config{
    39  		Uvm:               c.hcsContainer,
    40  		UvmTimeoutSeconds: 600,
    41  	}
    42  	cfg.DebugGCS()
    43  }