本文整理匯總了Golang中github.com/juju/juju/storage.FilesystemSource.DetachFilesystems方法的典型用法代碼示例。如果您正苦於以下問題:Golang FilesystemSource.DetachFilesystems方法的具體用法?Golang FilesystemSource.DetachFilesystems怎麽用?Golang FilesystemSource.DetachFilesystems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/storage.FilesystemSource
的用法示例。
在下文中一共展示了FilesystemSource.DetachFilesystems方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: testDetachFilesystems
// testDetachFilesystems is a test-case for detaching filesystems that use
// the common "maybeUnmount" method.
func testDetachFilesystems(c *gc.C, commands *mockRunCommand, source storage.FilesystemSource, mounted bool) {
const testMountPoint = "/in/the/place"
cmd := commands.expect("df", "--output=source", filepath.Dir(testMountPoint))
cmd.respond("headers\n/same/as/rootfs", nil)
cmd = commands.expect("df", "--output=source", testMountPoint)
if mounted {
cmd.respond("headers\n/different/to/rootfs", nil)
commands.expect("umount", testMountPoint)
} else {
cmd.respond("headers\n/same/as/rootfs", nil)
}
results, err := source.DetachFilesystems([]storage.FilesystemAttachmentParams{{
Filesystem: names.NewFilesystemTag("0/0"),
FilesystemId: "filesystem-0-0",
AttachmentParams: storage.AttachmentParams{
Machine: names.NewMachineTag("0"),
InstanceId: "inst-id",
},
Path: testMountPoint,
}})
c.Assert(err, jc.ErrorIsNil)
c.Assert(results, gc.HasLen, 1)
c.Assert(results[0], jc.ErrorIsNil)
}