Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions internal/hcsoci/hcsdoc_lcow.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func createLCOWSpec(coi *createOptionsInternal) (*specs.Spec, error) {
spec.Windows = nil
if coi.Spec.Windows != nil {
setWindowsNetworkNamespace(coi, spec)
spec.Windows.Devices = coi.Spec.Windows.Devices
setWindowsDevices(coi, spec)
}

// Hooks are not supported (they should be run in the host)
Expand All @@ -52,14 +52,24 @@ func createLCOWSpec(coi *createOptionsInternal) (*specs.Spec, error) {
func setWindowsNetworkNamespace(coi *createOptionsInternal, spec *specs.Spec) {
if coi.Spec.Windows.Network != nil &&
coi.Spec.Windows.Network.NetworkNamespace != "" {
spec.Windows = &specs.Windows{
Network: &specs.WindowsNetwork{
NetworkNamespace: coi.Spec.Windows.Network.NetworkNamespace,
},
if spec.Windows == nil {
spec.Windows = &specs.Windows{}
}
spec.Windows.Network = &specs.WindowsNetwork{
NetworkNamespace: coi.Spec.Windows.Network.NetworkNamespace,
}
}
}

func setWindowsDevices(coi *createOptionsInternal, spec *specs.Spec) {
if coi.Spec.Windows.Devices != nil {
if spec.Windows == nil {
spec.Windows = &specs.Windows{}
}
spec.Windows.Devices = coi.Spec.Windows.Devices
}
}

type linuxHostedSystem struct {
SchemaVersion *hcsschema.Version
OciBundlePath string
Expand Down