utils_windows.go 945 B

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