- Constants for feature enabled/disabled

This commit is contained in:
Faruk Kasumovic 2017-01-16 14:05:04 +01:00
parent a6fba76e81
commit 5411c35d4b
2 changed files with 19 additions and 3 deletions

View File

@ -18,6 +18,12 @@ const (
msgPoolIsNil = "Pool handle not initialized or its closed" msgPoolIsNil = "Pool handle not initialized or its closed"
) )
// Enable or disable pool feature with this constants
const (
FENABLED = "enabled"
FDISABLED = "disabled"
)
// PoolProperties type is map of pool properties name -> value // PoolProperties type is map of pool properties name -> value
type PoolProperties map[Prop]string type PoolProperties map[Prop]string
@ -826,6 +832,16 @@ func PoolCreate(name string, vdevs []VDevTree, features map[string]string,
return return
} }
// Enable 0.6.5 features per default
features["spacemap_histogram"] = FENABLED
features["enabled_txg"] = FENABLED
features["hole_birth"] = FENABLED
features["extensible_dataset"] = FENABLED
features["embedded_data"] = FENABLED
features["bookmarks"] = FENABLED
features["filesystem_limits"] = FENABLED
features["large_blocks"] = FENABLED
// convert properties // convert properties
cprops := toCPoolProperties(props) cprops := toCPoolProperties(props)
if cprops != nil { if cprops != nil {

View File

@ -100,9 +100,9 @@ func zpoolTestPoolCreate(t *testing.T) {
fsprops := make(map[zfs.Prop]string) fsprops := make(map[zfs.Prop]string)
features := make(map[string]string) features := make(map[string]string)
fsprops[zfs.DatasetPropMountpoint] = "none" fsprops[zfs.DatasetPropMountpoint] = "none"
features["async_destroy"] = "enabled" features["async_destroy"] = zfs.FENABLED
features["empty_bpobj"] = "enabled" features["empty_bpobj"] = zfs.FENABLED
features["lz4_compress"] = "enabled" features["lz4_compress"] = zfs.FENABLED
pool, err := zfs.PoolCreate(TSTPoolName, vdevs, features, props, fsprops) pool, err := zfs.PoolCreate(TSTPoolName, vdevs, features, props, fsprops)
if err != nil { if err != nil {