utils_windows.go 1.1 KB

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