Browse code

Windows: OCI aggressive namespacing

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/09/17 02:48:40
Showing 2 changed files
... ...
@@ -115,7 +115,7 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
115 115
 		hv = c.HostConfig.Isolation.IsHyperV()
116 116
 	}
117 117
 	if hv {
118
-		hvr := &windowsoci.HvRuntime{}
118
+		hvr := &windowsoci.WindowsHvRuntime{}
119 119
 		if img.RootFS != nil && img.RootFS.Type == image.TypeLayers {
120 120
 			// For TP5, the utility VM is part of the base layer.
121 121
 			// TODO-jstarks: Add support for separate utility VM images
... ...
@@ -159,26 +159,26 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
159 159
 			}
160 160
 		}
161 161
 	}
162
-	s.Windows.Networking = &windowsoci.Networking{
162
+	s.Windows.Networking = &windowsoci.WindowsNetworking{
163 163
 		EndpointList: epList,
164 164
 	}
165 165
 
166 166
 	// In s.Windows.Resources
167 167
 	// @darrenstahlmsft implement these resources
168 168
 	cpuShares := uint64(c.HostConfig.CPUShares)
169
-	s.Windows.Resources = &windowsoci.Resources{
170
-		CPU: &windowsoci.CPU{
169
+	s.Windows.Resources = &windowsoci.WindowsResources{
170
+		CPU: &windowsoci.WindowsCPU{
171 171
 			Percent: &c.HostConfig.CPUPercent,
172 172
 			Shares:  &cpuShares,
173 173
 		},
174
-		Memory: &windowsoci.Memory{
174
+		Memory: &windowsoci.WindowsMemory{
175 175
 			Limit: &c.HostConfig.Memory,
176 176
 			//TODO Reservation: ...,
177 177
 		},
178
-		Network: &windowsoci.Network{
178
+		Network: &windowsoci.WindowsNetwork{
179 179
 		//TODO Bandwidth: ...,
180 180
 		},
181
-		Storage: &windowsoci.Storage{
181
+		Storage: &windowsoci.WindowsStorage{
182 182
 			Bps:  &c.HostConfig.IOMaximumBandwidth,
183 183
 			Iops: &c.HostConfig.IOMaximumIOps,
184 184
 		},
... ...
@@ -36,15 +36,15 @@ type Spec struct {
36 36
 // Windows contains platform specific configuration for Windows based containers.
37 37
 type Windows struct {
38 38
 	// Resources contains information for handling resource constraints for the container
39
-	Resources *Resources `json:"resources,omitempty"`
39
+	Resources *WindowsResources `json:"resources,omitempty"`
40 40
 	// Networking contains the platform specific network settings for the container.
41
-	Networking *Networking `json:"networking,omitempty"`
41
+	Networking *WindowsNetworking `json:"networking,omitempty"`
42 42
 	// LayerFolder is the path to the current layer folder
43 43
 	LayerFolder string `json:"layer_folder,omitempty"`
44 44
 	// Layer paths of the parent layers
45 45
 	LayerPaths []string `json:"layer_paths,omitempty"`
46 46
 	// HvRuntime contains settings specific to Hyper-V containers, omitted if not using Hyper-V isolation
47
-	HvRuntime *HvRuntime `json:"hv_runtime,omitempty"`
47
+	HvRuntime *WindowsHvRuntime `json:"hv_runtime,omitempty"`
48 48
 }
49 49
 
50 50
 // Process contains information to start a specific application inside the container.
... ...
@@ -108,20 +108,20 @@ type Mount struct {
108 108
 	Options []string `json:"options,omitempty"`
109 109
 }
110 110
 
111
-// HvRuntime contains settings specific to Hyper-V containers
112
-type HvRuntime struct {
111
+// WindowsHvRuntime contains settings specific to Hyper-V containers
112
+type WindowsHvRuntime struct {
113 113
 	// ImagePath is the path to the Utility VM image for this container
114 114
 	ImagePath string `json:"image_path,omitempty"`
115 115
 }
116 116
 
117
-// Networking contains the platform specific network settings for the container
118
-type Networking struct {
117
+// WindowsNetworking contains the platform specific network settings for the container
118
+type WindowsNetworking struct {
119 119
 	// List of endpoints to be attached to the container
120 120
 	EndpointList []string `json:"endpoints,omitempty"`
121 121
 }
122 122
 
123
-// Storage contains storage resource management settings
124
-type Storage struct {
123
+// WindowsStorage contains storage resource management settings
124
+type WindowsStorage struct {
125 125
 	// Specifies maximum Iops for the system drive
126 126
 	Iops *uint64 `json:"iops,omitempty"`
127 127
 	// Specifies maximum bytes per second for the system drive
... ...
@@ -130,16 +130,16 @@ type Storage struct {
130 130
 	SandboxSize *uint64 `json:"sandbox_size,omitempty"`
131 131
 }
132 132
 
133
-// Memory contains memory settings for the container
134
-type Memory struct {
133
+// WindowsMemory contains memory settings for the container
134
+type WindowsMemory struct {
135 135
 	// Memory limit (in bytes).
136 136
 	Limit *int64 `json:"limit,omitempty"`
137 137
 	// Memory reservation (in bytes).
138 138
 	Reservation *uint64 `json:"reservation,omitempty"`
139 139
 }
140 140
 
141
-// CPU contains information for cpu resource management
142
-type CPU struct {
141
+// WindowsCPU contains information for cpu resource management
142
+type WindowsCPU struct {
143 143
 	// Number of CPUs available to the container. This is an appoximation for Windows Server Containers.
144 144
 	Count *uint64 `json:"count,omitempty"`
145 145
 	// CPU shares (relative weight (ratio) vs. other containers with cpu shares). Range is from 1 to 10000.
... ...
@@ -148,24 +148,24 @@ type CPU struct {
148 148
 	Percent *int64 `json:"percent,omitempty"`
149 149
 }
150 150
 
151
-// Network contains network resource management information
152
-type Network struct {
151
+// WindowsNetwork contains network resource management information
152
+type WindowsNetwork struct {
153 153
 	// Bandwidth is the maximum egress bandwidth in bytes per second
154 154
 	Bandwidth *uint64 `json:"bandwidth,omitempty"`
155 155
 }
156 156
 
157
-// Resources has container runtime resource constraints
157
+// WindowsResources has container runtime resource constraints
158 158
 // TODO Windows containerd. This structure needs ratifying with the old resources
159 159
 // structure used on Windows and the latest OCI spec.
160
-type Resources struct {
160
+type WindowsResources struct {
161 161
 	// Memory restriction configuration
162
-	Memory *Memory `json:"memory,omitempty"`
162
+	Memory *WindowsMemory `json:"memory,omitempty"`
163 163
 	// CPU resource restriction configuration
164
-	CPU *CPU `json:"cpu,omitempty"`
164
+	CPU *WindowsCPU `json:"cpu,omitempty"`
165 165
 	// Storage restriction configuration
166
-	Storage *Storage `json:"storage,omitempty"`
166
+	Storage *WindowsStorage `json:"storage,omitempty"`
167 167
 	// Network restriction configuration
168
-	Network *Network `json:"network,omitempty"`
168
+	Network *WindowsNetwork `json:"network,omitempty"`
169 169
 }
170 170
 
171 171
 const (