Fix bug: Overlay property not updated
This commit is contained in:
		
							parent
							
								
									b1b9ae5efc
								
							
						
					
					
						commit
						44a53fa2e4
					
				| 
						 | 
				
			
			@ -24,6 +24,7 @@ func Test(t *testing.T) {
 | 
			
		|||
	zfsTestDatasetOpen(t)
 | 
			
		||||
	zfsTestDatasetSnapshot(t)
 | 
			
		||||
	zfsTestDatasetOpenAll(t)
 | 
			
		||||
	zfsTestDatasetSetProperty(t)
 | 
			
		||||
 | 
			
		||||
	zfsTestDatasetDestroy(t)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -246,6 +246,10 @@ const (
 | 
			
		|||
	DatasetPropLogicalused
 | 
			
		||||
	DatasetPropLogicalreferenced
 | 
			
		||||
	DatasetPropInconsistent /* not exposed to the user */
 | 
			
		||||
	DatasetPropFilesystemLimit
 | 
			
		||||
	DatasetPropSnapshotLimit
 | 
			
		||||
	DatasetPropFilesystemCount
 | 
			
		||||
	DatasetPropSnapshotCount
 | 
			
		||||
	DatasetPropSnapdev
 | 
			
		||||
	DatasetPropAcltype
 | 
			
		||||
	DatasetPropSelinuxContext
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										26
									
								
								zfs_test.go
								
								
								
								
							
							
						
						
									
										26
									
								
								zfs_test.go
								
								
								
								
							| 
						 | 
				
			
			@ -93,6 +93,32 @@ func zfsTestDatasetOpen(t *testing.T) {
 | 
			
		|||
	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) {
 | 
			
		||||
	println("TEST DatasetOpenAll()/DatasetCloseAll() ... ")
 | 
			
		||||
	ds, err := zfs.DatasetOpenAll()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -274,9 +274,9 @@ func zpoolTestPoolProp(t *testing.T) {
 | 
			
		|||
	if pool, err := zfs.PoolOpen(TSTPoolName); err == nil {
 | 
			
		||||
		defer pool.Close()
 | 
			
		||||
		// Turn on snapshot listing for pool
 | 
			
		||||
		pool.SetProperty(zfs.PoolPropListsnaps, "on")
 | 
			
		||||
		pool.SetProperty(zfs.PoolPropListsnaps, "off")
 | 
			
		||||
		// 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"))
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue