Browse code

Merge pull request #26641 from Microsoft/jjh/aggressivenamespacing

Windows: OCI aggressive namespacing

Tõnis Tiigi authored on 2016/09/21 05:37:41
Showing 2 changed files
... ...
@@ -114,7 +114,7 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
114 114
 		hv = c.HostConfig.Isolation.IsHyperV()
115 115
 	}
116 116
 	if hv {
117
-		hvr := &windowsoci.HvRuntime{}
117
+		hvr := &windowsoci.WindowsHvRuntime{}
118 118
 		if img.RootFS != nil && img.RootFS.Type == image.TypeLayers {
119 119
 			// For TP5, the utility VM is part of the base layer.
120 120
 			// TODO-jstarks: Add support for separate utility VM images
... ...
@@ -158,26 +158,26 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
158 158
 			}
159 159
 		}
160 160
 	}
161
-	s.Windows.Networking = &windowsoci.Networking{
161
+	s.Windows.Networking = &windowsoci.WindowsNetworking{
162 162
 		EndpointList: epList,
163 163
 	}
164 164
 
165 165
 	// In s.Windows.Resources
166 166
 	// @darrenstahlmsft implement these resources
167 167
 	cpuShares := uint64(c.HostConfig.CPUShares)
168
-	s.Windows.Resources = &windowsoci.Resources{
169
-		CPU: &windowsoci.CPU{
168
+	s.Windows.Resources = &windowsoci.WindowsResources{
169
+		CPU: &windowsoci.WindowsCPU{
170 170
 			Percent: &c.HostConfig.CPUPercent,
171 171
 			Shares:  &cpuShares,
172 172
 		},
173
-		Memory: &windowsoci.Memory{
173
+		Memory: &windowsoci.WindowsMemory{
174 174
 			Limit: &c.HostConfig.Memory,
175 175
 			//TODO Reservation: ...,
176 176
 		},
177
-		Network: &windowsoci.Network{
177
+		Network: &windowsoci.WindowsNetwork{
178 178
 		//TODO Bandwidth: ...,
179 179
 		},
180
-		Storage: &windowsoci.Storage{
180
+		Storage: &windowsoci.WindowsStorage{
181 181
 			Bps:  &c.HostConfig.IOMaximumBandwidth,
182 182
 			Iops: &c.HostConfig.IOMaximumIOps,
183 183
 		},
... ...
@@ -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.
... ...
@@ -122,20 +122,20 @@ type Mount struct {
122 122
 	Options []string `json:"options,omitempty"`
123 123
 }
124 124
 
125
-// HvRuntime contains settings specific to Hyper-V containers
126
-type HvRuntime struct {
125
+// WindowsHvRuntime contains settings specific to Hyper-V containers
126
+type WindowsHvRuntime struct {
127 127
 	// ImagePath is the path to the Utility VM image for this container
128 128
 	ImagePath string `json:"image_path,omitempty"`
129 129
 }
130 130
 
131
-// Networking contains the platform specific network settings for the container
132
-type Networking struct {
131
+// WindowsNetworking contains the platform specific network settings for the container
132
+type WindowsNetworking struct {
133 133
 	// List of endpoints to be attached to the container
134 134
 	EndpointList []string `json:"endpoints,omitempty"`
135 135
 }
136 136
 
137
-// Storage contains storage resource management settings
138
-type Storage struct {
137
+// WindowsStorage contains storage resource management settings
138
+type WindowsStorage struct {
139 139
 	// Specifies maximum Iops for the system drive
140 140
 	Iops *uint64 `json:"iops,omitempty"`
141 141
 	// Specifies maximum bytes per second for the system drive
... ...
@@ -144,16 +144,16 @@ type Storage struct {
144 144
 	SandboxSize *uint64 `json:"sandbox_size,omitempty"`
145 145
 }
146 146
 
147
-// Memory contains memory settings for the container
148
-type Memory struct {
147
+// WindowsMemory contains memory settings for the container
148
+type WindowsMemory struct {
149 149
 	// Memory limit (in bytes).
150 150
 	Limit *int64 `json:"limit,omitempty"`
151 151
 	// Memory reservation (in bytes).
152 152
 	Reservation *uint64 `json:"reservation,omitempty"`
153 153
 }
154 154
 
155
-// CPU contains information for cpu resource management
156
-type CPU struct {
155
+// WindowsCPU contains information for cpu resource management
156
+type WindowsCPU struct {
157 157
 	// Number of CPUs available to the container. This is an appoximation for Windows Server Containers.
158 158
 	Count *uint64 `json:"count,omitempty"`
159 159
 	// CPU shares (relative weight (ratio) vs. other containers with cpu shares). Range is from 1 to 10000.
... ...
@@ -162,24 +162,24 @@ type CPU struct {
162 162
 	Percent *int64 `json:"percent,omitempty"`
163 163
 }
164 164
 
165
-// Network contains network resource management information
166
-type Network struct {
165
+// WindowsNetwork contains network resource management information
166
+type WindowsNetwork struct {
167 167
 	// Bandwidth is the maximum egress bandwidth in bytes per second
168 168
 	Bandwidth *uint64 `json:"bandwidth,omitempty"`
169 169
 }
170 170
 
171
-// Resources has container runtime resource constraints
171
+// WindowsResources has container runtime resource constraints
172 172
 // TODO Windows containerd. This structure needs ratifying with the old resources
173 173
 // structure used on Windows and the latest OCI spec.
174
-type Resources struct {
174
+type WindowsResources struct {
175 175
 	// Memory restriction configuration
176
-	Memory *Memory `json:"memory,omitempty"`
176
+	Memory *WindowsMemory `json:"memory,omitempty"`
177 177
 	// CPU resource restriction configuration
178
-	CPU *CPU `json:"cpu,omitempty"`
178
+	CPU *WindowsCPU `json:"cpu,omitempty"`
179 179
 	// Storage restriction configuration
180
-	Storage *Storage `json:"storage,omitempty"`
180
+	Storage *WindowsStorage `json:"storage,omitempty"`
181 181
 	// Network restriction configuration
182
-	Network *Network `json:"network,omitempty"`
182
+	Network *WindowsNetwork `json:"network,omitempty"`
183 183
 }
184 184
 
185 185
 const (