Windows: Remove osversion from OCI
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
b72c7f74a6
commit
72de562943
6 changed files with 1 additions and 68 deletions
|
@ -35,8 +35,6 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
|
|||
return nil, fmt.Errorf("Failed to graph.Get on ImageID %s - %s", c.ImageID, err)
|
||||
}
|
||||
|
||||
s.Platform.OSVersion = img.OSVersion
|
||||
|
||||
// In base spec
|
||||
s.Hostname = c.FullHostname()
|
||||
|
||||
|
|
|
@ -84,13 +84,6 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir
|
|||
configuration.HvRuntime = &hcsshim.HvRuntime{
|
||||
ImagePath: spec.Windows.HvRuntime.ImagePath,
|
||||
}
|
||||
|
||||
// Images with build version < 14350 don't support running with clone, but
|
||||
// Windows cannot automatically detect this. Explicitly block cloning in this
|
||||
// case.
|
||||
if build := buildFromVersion(spec.Platform.OSVersion); build > 0 && build < 14350 {
|
||||
configuration.HvRuntime.SkipTemplate = true
|
||||
}
|
||||
}
|
||||
|
||||
if configuration.HvPartition {
|
||||
|
@ -236,9 +229,6 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
|
|||
iopipe := &IOPipe{Terminal: procToAdd.Terminal}
|
||||
iopipe.Stdin = createStdInCloser(stdin, newProcess)
|
||||
|
||||
// TEMP: Work around Windows BS/DEL behavior.
|
||||
iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, container.ociSpec.Platform.OSVersion, procToAdd.Terminal)
|
||||
|
||||
// Convert io.ReadClosers to io.Readers
|
||||
if stdout != nil {
|
||||
iopipe.Stdout = openReaderFromPipe(stdout)
|
||||
|
|
|
@ -122,9 +122,6 @@ func (ctr *container) start() error {
|
|||
|
||||
iopipe.Stdin = createStdInCloser(stdin, hcsProcess)
|
||||
|
||||
// TEMP: Work around Windows BS/DEL behavior.
|
||||
iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, ctr.ociSpec.Platform.OSVersion, ctr.ociSpec.Process.Terminal)
|
||||
|
||||
// Convert io.ReadClosers to io.Readers
|
||||
if stdout != nil {
|
||||
iopipe.Stdout = openReaderFromPipe(stdout)
|
||||
|
|
|
@ -29,40 +29,6 @@ func openReaderFromPipe(p io.ReadCloser) io.Reader {
|
|||
return r
|
||||
}
|
||||
|
||||
// fixStdinBackspaceBehavior works around a bug in Windows before build 14350
|
||||
// where it interpreted DEL as VK_DELETE instead of as VK_BACK. This replaces
|
||||
// DEL with BS to work around this.
|
||||
func fixStdinBackspaceBehavior(w io.WriteCloser, osversion string, tty bool) io.WriteCloser {
|
||||
if !tty {
|
||||
return w
|
||||
}
|
||||
if build := buildFromVersion(osversion); build == 0 || build >= 14350 {
|
||||
return w
|
||||
}
|
||||
|
||||
return &delToBsWriter{w}
|
||||
}
|
||||
|
||||
type delToBsWriter struct {
|
||||
io.WriteCloser
|
||||
}
|
||||
|
||||
func (w *delToBsWriter) Write(b []byte) (int, error) {
|
||||
const (
|
||||
backspace = 0x8
|
||||
del = 0x7f
|
||||
)
|
||||
bc := make([]byte, len(b))
|
||||
for i, c := range b {
|
||||
if c == del {
|
||||
bc[i] = backspace
|
||||
} else {
|
||||
bc[i] = c
|
||||
}
|
||||
}
|
||||
return w.WriteCloser.Write(bc)
|
||||
}
|
||||
|
||||
type stdInCloser struct {
|
||||
io.WriteCloser
|
||||
hcsshim.Process
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package libcontainerd
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
import "strings"
|
||||
|
||||
// setupEnvironmentVariables converts a string array of environment variables
|
||||
// into a map as required by the HCS. Source array is in format [v1=k1] [v2=k2] etc.
|
||||
|
@ -27,16 +24,3 @@ func (s *ServicingOption) Apply(interface{}) error {
|
|||
func (s *FlushOption) Apply(interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// buildFromVersion takes an image version string and returns the Windows build
|
||||
// number. It returns 0 if the build number is not present.
|
||||
func buildFromVersion(osver string) int {
|
||||
v := strings.Split(osver, ".")
|
||||
if len(v) < 3 {
|
||||
return 0
|
||||
}
|
||||
if build, err := strconv.Atoi(v[2]); err == nil {
|
||||
return build
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -91,8 +91,6 @@ type Platform struct {
|
|||
OS string `json:"os"`
|
||||
// Arch is the architecture
|
||||
Arch string `json:"arch"`
|
||||
// OSVersion is the version of the operating system.
|
||||
OSVersion string `json:"os.version,omitempty"`
|
||||
}
|
||||
|
||||
// Mount specifies a mount for a container.
|
||||
|
|
Loading…
Reference in a new issue