steigrandFaruk Kasumovic b16d96b1a8 zfs 0.8 support (#15)
* Rename Rewind-Policy to Load-Policy

See https://github.com/zfsonlinux/zfs/commit/8a393be353c3bfffbfbe0f4d2bc57210b658dcde#diff-f29552ad5ed97006cc80fc2b453cbe39R726 for details.

Signed-off-by: steigr <me@stei.gr>

* Use threadpool for zpool_search_import.

See https://github.com/zfsonlinux/zfs/commit/e89f1295d4faa88bb05a62c8dd5f781657db5955#diff-24bf46767aadc66215cb194bdba266e7 for details.

Signed-off-by: steigr <me@stei.gr>

* Use sendflags struct.

See https://github.com/zfsonlinux/zfs/commit/835db58592d7d947e5818eb7281882e2a46073e0 for details.

Signed-off-by: steigr <me@stei.gr>

* Added new pool properties `Checkpoint` and `LoadGuid`

OpenZFS 9166 - zfs storage pool checkpoint: https://github.com/zfsonlinux/zfs/commit/d2734cce68cf740e015312314415f9034c67851c
read/write kstats per dataset: https://github.com/zfsonlinux/zfs/commit/a448a2557ec4938ed6944c7766fe0b8e6e5f6456

Signed-off-by: steigr <me@stei.gr>
2019-06-20 21:17:31 +02:00
2018-11-15 21:58:33 +01:00
2019-06-20 21:17:31 +02:00
2018-11-15 21:58:33 +01:00
2015-06-04 00:05:13 +02:00
2018-11-09 19:41:37 +01:00
2019-06-20 21:17:31 +02:00
2018-08-06 10:35:39 +02:00
2017-12-07 09:54:07 +01:00
2018-11-15 21:58:33 +01:00
2019-06-20 21:17:31 +02:00
2018-11-09 16:24:46 +01:00
2019-06-20 21:17:31 +02:00

Introduction

go-libzfs currently implements basic manipulation of ZFS pools and data sets. Plan is to add more in further development, improve documentation with more examples, and add more tests. go-libzfs use libzfs C library and does not wrap OpenZFS CLI tools. Goal is to let easy using and manipulating OpenZFS form with in go, and tries to map libzfs C library in to go style package respecting golang common practice.

Note

This golang package is only used and tested on Linux.

  • Version tagged as v0.1 is latest used and compatible with ZFS On Linux version 0.6.5.x
  • Version tagged as v0.2 is latest used and compatible with ZFS On Linux version 0.7.x

GoDoc

Main features

  • Creating, destroying, importing and exporting pools.
  • Reading and modifying pool properties.
  • Creating, destroying and renaming of filesystem datasets and volumes.
  • Creating, destroying and rollback of snapshots.
  • Cloning datasets and volumes.
  • Reading and modifying dataset and volume properties.
  • Send and receive snapshot streams

Requirements:

  • OpenZFS on Linux and libzfs with development headers installed.
  • Developed using go1.9

Installing

go get github.com/bicomsystems/go-libzfs

Testing

# On command line shell run
cd $GOPATH/src/github.com/bicomsystems/go-libzfs
go test

Usage example

// Create map to represent ZFS dataset properties. This is equivalent to
// list of properties you can get from ZFS CLI tool, and some more
// internally used by libzfs.
props := make(map[ZFSProp]Property)

// I choose to create (block) volume 1GiB in size. Size is just ZFS dataset
// property and this is done as map of strings. So, You have to either
// specify size as base 10 number in string, or use strconv package or
// similar to convert in to string (base 10) from numeric type.
strSize := "1073741824"

props[DatasetPropVolsize] = Property{Value: strSize}
// In addition I explicitly choose some more properties to be set.
props[DatasetPropVolblocksize] = Property{Value: "4096"}
props[DatasetPropReservation] = Property{Value: strSize}

// Lets create desired volume
d, err := DatasetCreate("TESTPOOL/VOLUME1", DatasetTypeVolume, props)
if err != nil {
	println(err.Error())
	return
}
// Dataset have to be closed for memory cleanup
defer d.Close()

println("Created zfs volume TESTPOOL/VOLUME1")

Special thanks to

  • Bicom Systems for supporting this little project and that way making it possible.
  • OpenZFS as the main ZFS software collective.
S
Description
No description provided
Readme
129 KiB
Languages
Go 75.8%
C 24.2%