2 -- This file and its contents are supplied under the terms of the
3 -- Common Development and Distribution License ("CDDL"), version 1.0.
4 -- You may only use this file in accordance with the terms of version
7 -- A full copy of the text of the CDDL should have accompanied this
8 -- source. A copy of the CDDL is also available via the Internet at
9 -- http://www.illumos.org/license/CDDL.
13 -- Copyright (c) 2016 by Delphix. All rights reserved.
23 -- The values indicate whether or not a property should be returned,
24 -- not the value of the property. A better approach might be to compare
25 -- their values to the output of 'zfs get <prop>'
27 -- prop filesystem snapshot volume
28 props['used'] = {{true, nil}, {true, nil}, {true, nil}}
29 props['available'] = {{true, nil}, {nil, nil}, {true, nil}}
30 props['referenced'] = {{true, nil}, {true, nil}, {true, nil}}
31 props['compressratio'] = {{true, nil}, {true, nil}, {true, nil}}
32 props['refcompressratio'] = {{true, nil}, {true, nil}, {true, nil}}
33 props['volblocksize'] = {{nil, nil}, {nil, nil}, {true, nil}}
34 props['usedbysnapshots'] = {{true, nil}, {nil, nil}, {true, nil}}
35 props['usedbydataset'] = {{true, nil}, {nil, nil}, {true, nil}}
36 props['usedbychildren'] = {{true, nil}, {nil, nil}, {true, nil}}
37 props['usedbyrefreservation'] = {{true, nil}, {nil, nil}, {true, nil}}
38 props['userrefs'] = {{nil, nil}, {true, nil}, {nil, nil}}
39 props['written'] = {{true, nil}, {true, nil}, {true, nil}}
40 props['logicalused'] = {{true, nil}, {nil, nil}, {true, nil}}
41 props['logicalreferenced'] = {{true, nil}, {true, nil}, {true, nil}}
42 props['quota'] = {{true, 'default'}, {nil, nil}, {nil, nil}}
43 props['reservation'] = {{true, 'default'}, {nil, nil}, {true, 'default'}}
44 -- Note that OpenZFS allows volsize for snapshot
45 -- props['volsize'] = {{nil, nil}, {nil, nil}, {true, vol}}
46 props['refquota'] = {{true, 'default'}, {nil, nil}, {nil, nil}}
47 props['refreservation'] = {{true, 'default'}, {nil, nil}, {true, vol}}
48 props['filesystem_limit'] = {{true, fs}, {nil, nil}, {nil, nil}}
49 props['snapshot_limit'] = {{true, fs}, {nil, nil}, {true, vol}}
50 props['filesystem_count'] = {{true, nil}, {nil, nil}, {nil, nil}}
51 props['snapshot_count'] = {{true, nil}, {nil, nil}, {true, nil}}
52 props['recordsize'] = {{true, 'default'}, {nil, nil}, {nil, nil}}
53 props['creation'] = {{true, nil}, {true, nil}, {true, nil}}
55 props['createtxg'] = {{true, nil}, {true, nil}, {true, nil}}
56 props['numclones'] = {{nil, nil}, {true, nil}, {nil, nil}}
57 props['guid'] = {{true, nil}, {true, nil}, {true, nil}}
58 props['useraccounting'] = {{true, nil}, {true, nil}, {true, nil}}
59 props['unique'] = {{true, nil}, {true, nil}, {true, nil}}
60 props['objsetid'] = {{true, nil}, {true, nil}, {true, nil}}
61 props['inconsistent'] = {{true, nil}, {true, nil}, {true, nil}}
68 function match(n, ans, src, expected)
69 if ((expected[n][1] == nil) and (ans ~= nil)) then
73 if ((expected[n][1] == true) and (ans == nil)) then
77 if (expected[n][2] ~= src) then
84 for prop, expected in pairs(props) do
85 ans, src = zfs.get_prop(fs, prop)
86 if not (match(1, ans, src, expected)) then
87 fs_fails[prop] = {ans, src}
90 ans, src = zfs.get_prop(snap, prop)
91 if not (match(2, ans, src, expected)) then
92 snap_fails[prop] = {ans, src}
95 ans, src = zfs.get_prop(vol, prop)
96 if not (match(3, ans, src, expected)) then
97 vol_fails[prop] = {ans, src}
101 return {fs_fails, snap_fails, vol_fails}