- Export and import pool examples

This commit is contained in:
Faruk Kasumovic 2015-06-08 23:53:06 +02:00
parent 507abac683
commit 1d6e6a86cb
1 changed files with 30 additions and 0 deletions

View File

@ -319,3 +319,33 @@ func ExamplePool_Destroy() {
return return
} }
} }
func ExamplePoolImport() {
p, err := zfs.PoolImport("TESTPOOL", []string{"/dev/disk/by-id"})
if err != nil {
panic(err)
}
p.Close()
}
func ExamplePool_Export() {
p, err := zfs.PoolOpen("TESTPOOL")
if err != nil {
panic(err)
}
defer p.Close()
if err = p.Export(false, "Example exporting pool"); err != nil {
panic(err)
}
}
func ExamplePool_ExportForce() {
p, err := zfs.PoolOpen("TESTPOOL")
if err != nil {
panic(err)
}
defer p.Close()
if err = p.ExportForce("Example exporting pool"); err != nil {
panic(err)
}
}