From 1d6e6a86cba23c8932d1a8d4a006d980471ef1db Mon Sep 17 00:00:00 2001 From: Faruk Kasumovic Date: Mon, 8 Jun 2015 23:53:06 +0200 Subject: [PATCH] - Export and import pool examples --- zpool_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/zpool_test.go b/zpool_test.go index 2f2e5e0..d08678b 100644 --- a/zpool_test.go +++ b/zpool_test.go @@ -319,3 +319,33 @@ func ExamplePool_Destroy() { 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) + } +}