Fix bug: Overlay property not updated

This commit is contained in:
Faruk Kasumovic 2018-04-12 11:27:31 +02:00
parent b1b9ae5efc
commit 44a53fa2e4
4 changed files with 33 additions and 2 deletions

View File

@ -24,6 +24,7 @@ func Test(t *testing.T) {
zfsTestDatasetOpen(t) zfsTestDatasetOpen(t)
zfsTestDatasetSnapshot(t) zfsTestDatasetSnapshot(t)
zfsTestDatasetOpenAll(t) zfsTestDatasetOpenAll(t)
zfsTestDatasetSetProperty(t)
zfsTestDatasetDestroy(t) zfsTestDatasetDestroy(t)

View File

@ -246,6 +246,10 @@ const (
DatasetPropLogicalused DatasetPropLogicalused
DatasetPropLogicalreferenced DatasetPropLogicalreferenced
DatasetPropInconsistent /* not exposed to the user */ DatasetPropInconsistent /* not exposed to the user */
DatasetPropFilesystemLimit
DatasetPropSnapshotLimit
DatasetPropFilesystemCount
DatasetPropSnapshotCount
DatasetPropSnapdev DatasetPropSnapdev
DatasetPropAcltype DatasetPropAcltype
DatasetPropSelinuxContext DatasetPropSelinuxContext

View File

@ -93,6 +93,32 @@ func zfsTestDatasetOpen(t *testing.T) {
print("PASS\n\n") print("PASS\n\n")
} }
func zfsTestDatasetSetProperty(t *testing.T) {
println("TEST Dataset SetProp(", TSTDatasetPath, ") ... ")
d, err := zfs.DatasetOpen(TSTDatasetPath)
if err != nil {
t.Error(err)
return
}
defer d.Close()
if err = d.SetProperty(zfs.DatasetPropOverlay, "on"); err != nil {
t.Error(err)
return
}
if prop, err := d.GetProperty(zfs.DatasetPropOverlay); err != nil {
t.Error(err)
return
} else {
println(prop.Value)
if prop.Value != "on" {
t.Error(fmt.Errorf("Update of dataset property failed"))
return
}
}
print("PASS\n\n")
return
}
func zfsTestDatasetOpenAll(t *testing.T) { func zfsTestDatasetOpenAll(t *testing.T) {
println("TEST DatasetOpenAll()/DatasetCloseAll() ... ") println("TEST DatasetOpenAll()/DatasetCloseAll() ... ")
ds, err := zfs.DatasetOpenAll() ds, err := zfs.DatasetOpenAll()

View File

@ -274,9 +274,9 @@ func zpoolTestPoolProp(t *testing.T) {
if pool, err := zfs.PoolOpen(TSTPoolName); err == nil { if pool, err := zfs.PoolOpen(TSTPoolName); err == nil {
defer pool.Close() defer pool.Close()
// Turn on snapshot listing for pool // Turn on snapshot listing for pool
pool.SetProperty(zfs.PoolPropListsnaps, "on") pool.SetProperty(zfs.PoolPropListsnaps, "off")
// Verify change is succesfull // Verify change is succesfull
if pool.Properties[zfs.PoolPropListsnaps].Value != "on" { if pool.Properties[zfs.PoolPropListsnaps].Value != "off" {
t.Error(fmt.Errorf("Update of pool property failed")) t.Error(fmt.Errorf("Update of pool property failed"))
return return
} }