本文整理汇总了Golang中github.com/juju/juju/container/lxc.NewContainerManager函数的典型用法代码示例。如果您正苦于以下问题:Golang NewContainerManager函数的具体用法?Golang NewContainerManager怎么用?Golang NewContainerManager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewContainerManager函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestContainerManagerLXCClone
func (s *LxcSuite) TestContainerManagerLXCClone(c *gc.C) {
type test struct {
releaseVersion string
useClone string
expectClone bool
}
tests := []test{{
releaseVersion: "12.04",
useClone: "true",
expectClone: true,
}, {
releaseVersion: "14.04",
expectClone: true,
}, {
releaseVersion: "12.04",
useClone: "false",
}, {
releaseVersion: "14.04",
useClone: "false",
}}
for i, test := range tests {
c.Logf("test %d: %v", i, test)
s.PatchValue(lxc.ReleaseVersion, func() string { return test.releaseVersion })
mgr, err := lxc.NewContainerManager(container.ManagerConfig{
container.ConfigName: "juju",
"use-clone": test.useClone,
})
c.Assert(err, gc.IsNil)
c.Check(lxc.GetCreateWithCloneValue(mgr), gc.Equals, test.expectClone)
}
}
开发者ID:kapilt,项目名称:juju,代码行数:33,代码来源:lxc_test.go
示例2: TestManagerWarnsAboutUnknownOption
func (*LxcSuite) TestManagerWarnsAboutUnknownOption(c *gc.C) {
_, err := lxc.NewContainerManager(container.ManagerConfig{
container.ConfigName: "BillyBatson",
"shazam": "Captain Marvel",
})
c.Assert(err, gc.IsNil)
c.Assert(c.GetTestLog(), jc.Contains, `WARNING juju.container unused config option: "shazam" -> "Captain Marvel"`)
}
开发者ID:kapilt,项目名称:juju,代码行数:8,代码来源:lxc_test.go
示例3: NewContainerManager
// NewContainerManager creates the appropriate container.Manager for the
// specified container type.
func NewContainerManager(forType instance.ContainerType, conf container.ManagerConfig, imageURLGetter container.ImageURLGetter) (container.Manager, error) {
switch forType {
case instance.LXC:
return lxc.NewContainerManager(conf, imageURLGetter, looputil.NewLoopDeviceManager())
case instance.KVM:
return kvm.NewContainerManager(conf)
}
return nil, errors.Errorf("unknown container type: %q", forType)
}
开发者ID:imoapps,项目名称:juju,代码行数:11,代码来源:factory.go
示例4: NewContainerManager
// NewContainerManager creates the appropriate container.Manager for the
// specified container type.
func NewContainerManager(forType instance.ContainerType, conf container.ManagerConfig) (container.Manager, error) {
switch forType {
case instance.LXC:
return lxc.NewContainerManager(conf)
case instance.KVM:
return kvm.NewContainerManager(conf)
}
return nil, fmt.Errorf("unknown container type: %q", forType)
}
开发者ID:jiasir,项目名称:juju,代码行数:11,代码来源:factory.go
示例5: NewLxcBroker
func NewLxcBroker(api APICalls, agentConfig agent.Config, managerConfig container.ManagerConfig) (environs.InstanceBroker, error) {
manager, err := lxc.NewContainerManager(managerConfig)
if err != nil {
return nil, err
}
return &lxcBroker{
manager: manager,
api: api,
agentConfig: agentConfig,
}, nil
}
开发者ID:kapilt,项目名称:juju,代码行数:11,代码来源:lxc-broker.go
示例6: makeManager
func (s *LxcSuite) makeManager(c *gc.C, name string) container.Manager {
params := container.ManagerConfig{
container.ConfigName: name,
}
// Need to ensure use-clone is explicitly set to avoid it
// being set based on the OS version.
params["use-clone"] = fmt.Sprintf("%v", s.useClone)
if s.useAUFS {
params["use-aufs"] = "true"
}
manager, err := lxc.NewContainerManager(params)
c.Assert(err, gc.IsNil)
return manager
}
开发者ID:kapilt,项目名称:juju,代码行数:14,代码来源:lxc_test.go
示例7: makeManager
func (s *LxcSuite) makeManager(c *gc.C, name string) container.Manager {
params := container.ManagerConfig{
container.ConfigName: name,
}
// Need to ensure use-clone is explicitly set to avoid it
// being set based on the OS version.
params["use-clone"] = fmt.Sprintf("%v", s.useClone)
params["log-dir"] = s.logDir
if s.useAUFS {
params["use-aufs"] = "true"
}
manager, err := lxc.NewContainerManager(
params, &containertesting.MockURLGetter{},
&s.loopDeviceManager,
)
c.Assert(err, jc.ErrorIsNil)
return manager
}
开发者ID:frankban,项目名称:juju-tmp,代码行数:18,代码来源:lxc_test.go
示例8: newLxcBroker
func newLxcBroker(
api APICalls,
agentConfig agent.Config,
managerConfig container.ManagerConfig,
imageURLGetter container.ImageURLGetter,
enableNAT bool,
defaultMTU int,
) (environs.InstanceBroker, error) {
manager, err := lxc.NewContainerManager(managerConfig, imageURLGetter)
if err != nil {
return nil, err
}
return &lxcBroker{
manager: manager,
api: api,
agentConfig: agentConfig,
enableNAT: enableNAT,
defaultMTU: defaultMTU,
}, nil
}
开发者ID:Pankov404,项目名称:juju,代码行数:20,代码来源:lxc-broker.go
示例9: TestDestroyRemovesContainers
func (s *localJujuTestSuite) TestDestroyRemovesContainers(c *gc.C) {
env := s.testBootstrap(c, minimalConfig(c))
s.makeAgentsDir(c, env)
s.PatchValue(local.CheckIfRoot, func() bool { return true })
namespace := env.Config().AllAttrs()["namespace"].(string)
manager, err := lxc.NewContainerManager(container.ManagerConfig{
container.ConfigName: namespace,
container.ConfigLogDir: "logdir",
"use-clone": "false",
}, nil, nil)
c.Assert(err, jc.ErrorIsNil)
machine1 := containertesting.CreateContainer(c, manager, "1")
err = env.Destroy()
c.Assert(err, jc.ErrorIsNil)
container := s.ContainerFactory.New(string(machine1.Id()))
c.Assert(container.IsConstructed(), jc.IsFalse)
}
开发者ID:pmatulis,项目名称:juju,代码行数:21,代码来源:environ_test.go
示例10: newLxcBroker
func newLxcBroker(
api APICalls,
agentConfig agent.Config,
managerConfig container.ManagerConfig,
imageURLGetter container.ImageURLGetter,
enableNAT bool,
defaultMTU int,
) (environs.InstanceBroker, error) {
namespace := maybeGetManagerConfigNamespaces(managerConfig)
manager, err := lxc.NewContainerManager(
managerConfig, imageURLGetter, looputil.NewLoopDeviceManager(),
)
if err != nil {
return nil, err
}
return &lxcBroker{
manager: manager,
namespace: namespace,
api: api,
agentConfig: agentConfig,
enableNAT: enableNAT,
defaultMTU: defaultMTU,
}, nil
}
开发者ID:imoapps,项目名称:juju,代码行数:24,代码来源:lxc-broker.go
注:本文中的github.com/juju/juju/container/lxc.NewContainerManager函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论