Browse code

Windows: Revendor Microsoft/hcsshim

This change supports the importing of layers that contain utility VM
images. This is necessary to support Hyper-V containers running on a
non-centrally-managed image.

Signed-off-by: John Starks <jostarks@microsoft.com>

John Starks authored on 2016/04/07 09:46:19
Showing 2 changed files
... ...
@@ -7,7 +7,7 @@ source 'hack/.vendor-helpers.sh'
7 7
 
8 8
 # the following lines are in sorted order, FYI
9 9
 clone git github.com/Azure/go-ansiterm 70b2c90b260171e829f1ebd7c17f600c11858dbe
10
-clone git github.com/Microsoft/hcsshim v0.2.0
10
+clone git github.com/Microsoft/hcsshim v0.2.1
11 11
 clone git github.com/Microsoft/go-winio v0.3.0
12 12
 clone git github.com/Sirupsen/logrus v0.9.0 # logrus is a common dependency among multiple deps
13 13
 clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
... ...
@@ -10,10 +10,11 @@ import (
10 10
 )
11 11
 
12 12
 type baseLayerWriter struct {
13
-	root string
14
-	f    *os.File
15
-	bw   *winio.BackupFileWriter
16
-	err  error
13
+	root         string
14
+	f            *os.File
15
+	bw           *winio.BackupFileWriter
16
+	err          error
17
+	hasUtilityVM bool
17 18
 }
18 19
 
19 20
 func (w *baseLayerWriter) closeCurrentFile() error {
... ...
@@ -44,6 +45,10 @@ func (w *baseLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) (err e
44 44
 		return err
45 45
 	}
46 46
 
47
+	if filepath.ToSlash(name) == `UtilityVM/Files` {
48
+		w.hasUtilityVM = true
49
+	}
50
+
47 51
 	path := filepath.Join(w.root, name)
48 52
 	path, err = makeLongAbsPath(path)
49 53
 	if err != nil {
... ...
@@ -139,6 +144,13 @@ func (w *baseLayerWriter) Close() error {
139 139
 		if err != nil {
140 140
 			return err
141 141
 		}
142
+
143
+		if w.hasUtilityVM {
144
+			err = ProcessUtilityVMImage(filepath.Join(w.root, "UtilityVM"))
145
+			if err != nil {
146
+				return err
147
+			}
148
+		}
142 149
 	}
143 150
 	return w.err
144 151
 }