本文整理汇总了Golang中github.com/juju/juju/environs/config.Config.LXCUseCloneAUFS方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.LXCUseCloneAUFS方法的具体用法?Golang Config.LXCUseCloneAUFS怎么用?Golang Config.LXCUseCloneAUFS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/environs/config.Config
的用法示例。
在下文中一共展示了Config.LXCUseCloneAUFS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetConfig
// SetConfig is specified in the Environ interface.
func (env *localEnviron) SetConfig(cfg *config.Config) error {
ecfg, err := providerInstance.newConfig(cfg)
if err != nil {
logger.Errorf("failed to create new environ config: %v", err)
return errors.Trace(err)
}
env.localMutex.Lock()
defer env.localMutex.Unlock()
env.config = ecfg
env.name = ecfg.Name()
containerType := ecfg.container()
managerConfig := container.ManagerConfig{
container.ConfigName: env.config.namespace(),
container.ConfigLogDir: env.config.logDir(),
}
var imageURLGetter container.ImageURLGetter
if containerType == instance.LXC {
if useLxcClone, ok := cfg.LXCUseClone(); ok {
managerConfig["use-clone"] = fmt.Sprint(useLxcClone)
}
if useLxcCloneAufs, ok := cfg.LXCUseCloneAUFS(); ok {
managerConfig["use-aufs"] = fmt.Sprint(useLxcCloneAufs)
}
// For lxc containers, we cache image tarballs in the environment storage, so here
// we construct a URL getter.
if uuid, ok := ecfg.UUID(); ok {
var caCert []byte = nil
if cert, ok := cfg.CACert(); ok {
caCert = []byte(cert)
}
baseUrl := ecfg.CloudImageBaseURL()
imageURLGetter = container.NewImageURLGetter(
// Explicitly call the non-named constructor so if anyone
// adds additional fields, this fails.
container.ImageURLGetterConfig{
ecfg.stateServerAddr(), uuid, caCert, baseUrl,
container.ImageDownloadURL,
})
}
}
env.containerManager, err = factory.NewContainerManager(
containerType, managerConfig, imageURLGetter)
if err != nil {
return errors.Trace(err)
}
// When the localEnviron value is created on the client
// side, the bootstrap-ip attribute will not exist,
// because it is only set *within* the running
// environment, not in the configuration created by
// Prepare.
if addr := ecfg.bootstrapIPAddress(); addr != "" {
env.bridgeAddress = addr
return nil
}
// If we get to here, it is because we haven't yet bootstrapped an
// environment, and saved the config in it, or we are running a command
// from the command line, so it is ok to work on the assumption that we
// have direct access to the directories.
if err := env.config.createDirs(); err != nil {
return errors.Trace(err)
}
// Record the network bridge address and create a filestorage.
if err := env.resolveBridgeAddress(cfg); err != nil {
return errors.Trace(err)
}
return nil
}