2016-05-23 21:49:50 +00:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
2017-08-08 21:21:56 +00:00
|
|
|
"github.com/Microsoft/opengcs/client"
|
2016-05-23 21:49:50 +00:00
|
|
|
"github.com/docker/docker/container"
|
|
|
|
)
|
|
|
|
|
2017-09-22 13:52:41 +00:00
|
|
|
func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Container) (interface{}, error) {
|
2017-08-01 18:57:50 +00:00
|
|
|
// LCOW options.
|
2017-08-08 19:43:48 +00:00
|
|
|
if container.OS == "linux" {
|
2017-08-01 18:57:50 +00:00
|
|
|
config := &client.Config{}
|
|
|
|
if err := config.GenerateDefault(daemon.configStore.GraphOptions); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
// Override from user-supplied options.
|
|
|
|
for k, v := range container.HostConfig.StorageOpt {
|
|
|
|
switch k {
|
|
|
|
case "lcow.kirdpath":
|
|
|
|
config.KirdPath = v
|
|
|
|
case "lcow.kernel":
|
|
|
|
config.KernelFile = v
|
|
|
|
case "lcow.initrd":
|
|
|
|
config.InitrdFile = v
|
|
|
|
case "lcow.vhdx":
|
|
|
|
config.Vhdx = v
|
|
|
|
case "lcow.bootparameters":
|
|
|
|
config.BootParameters = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := config.Validate(); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2017-09-22 13:52:41 +00:00
|
|
|
|
|
|
|
return config, nil
|
2017-08-01 18:57:50 +00:00
|
|
|
}
|
|
|
|
|
2017-09-22 13:52:41 +00:00
|
|
|
return nil, nil
|
2016-05-23 21:49:50 +00:00
|
|
|
}
|