2016-05-23 17:49:50 -04:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
2017-08-08 17:21:56 -04:00
|
|
|
"github.com/Microsoft/opengcs/client"
|
2016-05-23 17:49:50 -04:00
|
|
|
"github.com/docker/docker/container"
|
|
|
|
)
|
|
|
|
|
2017-09-22 09:52:41 -04:00
|
|
|
func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Container) (interface{}, error) {
|
2017-08-01 14:57:50 -04:00
|
|
|
// LCOW options.
|
2017-08-08 15:43:48 -04:00
|
|
|
if container.OS == "linux" {
|
2017-08-01 14:57:50 -04: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 09:52:41 -04:00
|
|
|
|
|
|
|
return config, nil
|
2017-08-01 14:57:50 -04:00
|
|
|
}
|
|
|
|
|
2017-09-22 09:52:41 -04:00
|
|
|
return nil, nil
|
2016-05-23 17:49:50 -04:00
|
|
|
}
|