本文整理汇总了Golang中github.com/juju/juju/container.RemoveDirectory函数的典型用法代码示例。如果您正苦于以下问题:Golang RemoveDirectory函数的具体用法?Golang RemoveDirectory怎么用?Golang RemoveDirectory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RemoveDirectory函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: DestroyContainer
func (manager *containerManager) DestroyContainer(id instance.Id) error {
start := time.Now()
name := string(id)
lxcContainer := LxcObjectFactory.New(name)
if useRestartDir() {
// Remove the autostart link.
if err := os.Remove(restartSymlink(name)); err != nil {
logger.Errorf("failed to remove restart symlink: %v", err)
return err
}
}
// Detach loop devices backed by files inside the container's rootfs.
rootfs := filepath.Join(LxcContainerDir, name, "rootfs")
if err := manager.loopDeviceManager.DetachLoopDevices(rootfs, "/"); err != nil {
logger.Errorf("failed to detach loop devices from lxc container: %v", err)
return err
}
if err := lxcContainer.Destroy(); err != nil {
logger.Errorf("failed to destroy lxc container: %v", err)
return err
}
err := container.RemoveDirectory(name)
logger.Tracef("container %q stopped: %v", name, time.Now().Sub(start))
return err
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:28,代码来源:lxc.go
示例2: TestRemoveContainerDir
func (s *DirectorySuite) TestRemoveContainerDir(c *gc.C) {
dir, err := container.NewDirectory("testing")
c.Assert(err, jc.ErrorIsNil)
err = container.RemoveDirectory("testing")
c.Assert(err, jc.ErrorIsNil)
c.Assert(dir, jc.DoesNotExist)
c.Assert(filepath.Join(s.removedDir, "testing"), jc.IsDirectory)
}
开发者ID:howbazaar,项目名称:juju,代码行数:8,代码来源:directory_test.go
示例3: DestroyContainer
func (manager *containerManager) DestroyContainer(id instance.Id) error {
name := string(id)
kvmContainer := KvmObjectFactory.New(name)
if err := kvmContainer.Stop(); err != nil {
logger.Errorf("failed to stop kvm container: %v", err)
return err
}
return container.RemoveDirectory(name)
}
开发者ID:klyachin,项目名称:juju,代码行数:9,代码来源:kvm.go
示例4: TestRemoveContainerDirWithClash
func (s *DirectorySuite) TestRemoveContainerDirWithClash(c *gc.C) {
dir, err := container.NewDirectory("testing")
c.Assert(err, jc.ErrorIsNil)
clash := filepath.Join(s.removedDir, "testing")
err = os.MkdirAll(clash, 0755)
c.Assert(err, jc.ErrorIsNil)
err = container.RemoveDirectory("testing")
c.Assert(err, jc.ErrorIsNil)
c.Assert(dir, jc.DoesNotExist)
c.Assert(filepath.Join(s.removedDir, "testing.1"), jc.IsDirectory)
}
开发者ID:howbazaar,项目名称:juju,代码行数:13,代码来源:directory_test.go
注:本文中的github.com/juju/juju/container.RemoveDirectory函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论