@@ -377,7 +377,7 @@ class DiffRecord(object):
377
377
def __repr__ (self ):
378
378
return str (self )
379
379
380
- def __getstate__ (self ):
380
+ def asdict (self ):
381
381
return {
382
382
' timestamp' : self .timestamp,
383
383
' cmd' : self .cmd.name,
@@ -474,8 +474,8 @@ cdef class ZFS(object):
474
474
def __dealloc__ (self ):
475
475
ZFS.__libzfs_fini(self )
476
476
477
- def __getstate__ (self ):
478
- return [p.__getstate__ () for p in self .pools]
477
+ def asdict (self ):
478
+ return [p.asdict () for p in self .pools]
479
479
480
480
IF HAVE_ZPOOL_EVENTS_NEXT:
481
481
def zpool_events (self , blocking = True , skip_existing_events = False ):
@@ -1695,7 +1695,7 @@ cdef class ZPoolProperty(object):
1695
1695
def __init__ (self ):
1696
1696
raise RuntimeError (' ZPoolProperty cannot be instantiated by the user' )
1697
1697
1698
- def __getstate__ (self ):
1698
+ def asdict (self ):
1699
1699
return {
1700
1700
' value' : self .value,
1701
1701
' rawvalue' : self .rawvalue,
@@ -1785,7 +1785,7 @@ cdef class ZPoolFeature(object):
1785
1785
cdef NVList nvlist
1786
1786
cdef zfs.zfeature_info_t * feature
1787
1787
1788
- def __getstate__ (self ):
1788
+ def asdict (self ):
1789
1789
return {
1790
1790
' name' : self .name,
1791
1791
' guid' : self .guid,
@@ -1844,7 +1844,7 @@ cdef class ZFSProperty(object):
1844
1844
def __init__ (self ):
1845
1845
raise RuntimeError (' ZFSProperty cannot be instantiated by the user' )
1846
1846
1847
- def __getstate__ (self ):
1847
+ def asdict (self ):
1848
1848
return {
1849
1849
' value' : self .value,
1850
1850
' rawvalue' : self .rawvalue,
@@ -2033,7 +2033,7 @@ cdef class ZFSVdevStats(object):
2033
2033
cdef zfs.vdev_stat_t * vs;
2034
2034
cdef uint_t total
2035
2035
2036
- def __getstate__ (self ):
2036
+ def asdict (self ):
2037
2037
state = {
2038
2038
' timestamp' : self .timestamp,
2039
2039
' read_errors' : self .read_errors,
@@ -2143,18 +2143,18 @@ cdef class ZFSVdev(object):
2143
2143
def __repr__ (self ):
2144
2144
return str (self )
2145
2145
2146
- def __getstate__ (self , recursive = True ):
2146
+ def asdict (self , recursive = True ):
2147
2147
ret = {
2148
2148
' name' : self .name,
2149
2149
' type' : self .type,
2150
2150
' path' : self .path,
2151
2151
' guid' : str (self .guid),
2152
2152
' status' : self .status,
2153
- ' stats' : self .stats.__getstate__ ()
2153
+ ' stats' : self .stats.asdict ()
2154
2154
}
2155
2155
2156
2156
if recursive:
2157
- ret[' children' ] = [i.__getstate__ () for i in self .children]
2157
+ ret[' children' ] = [i.asdict () for i in self .children]
2158
2158
2159
2159
return ret
2160
2160
@@ -2541,7 +2541,7 @@ cdef class ZPoolScrub(object):
2541
2541
2542
2542
return (< float > self .bytes_issued / < float > self .bytes_to_scan) * 100
2543
2543
2544
- def __getstate__ (self ):
2544
+ def asdict (self ):
2545
2545
return {
2546
2546
' function' : self .function.name if self .function else None ,
2547
2547
' state' : self .state.name if self .stats != NULL else None ,
@@ -2581,9 +2581,9 @@ cdef class ZFSPool(object):
2581
2581
def __repr__ (self ):
2582
2582
return str (self )
2583
2583
2584
- def __getstate__ (self , datasets_recursive = True ):
2584
+ def asdict (self , datasets_recursive = True ):
2585
2585
try :
2586
- root_ds = self .root_dataset.__getstate__ (datasets_recursive)
2586
+ root_ds = self .root_dataset.asdict (datasets_recursive)
2587
2587
except (ZFSException, AttributeError ):
2588
2588
root_ds = None
2589
2589
@@ -2599,21 +2599,21 @@ cdef class ZFSPool(object):
2599
2599
' warning' : self .warning,
2600
2600
' error_count' : self .error_count,
2601
2601
' root_dataset' : root_ds,
2602
- ' properties' : {k: p.__getstate__ () for k, p in self .properties.items()} if self .properties else None ,
2603
- ' features' : [i.__getstate__ () for i in self .features] if self .features else None ,
2604
- ' scan' : self .scrub.__getstate__ (),
2605
- ' root_vdev' : self .root_vdev.__getstate__ (False ),
2602
+ ' properties' : {k: p.asdict () for k, p in self .properties.items()} if self .properties else None ,
2603
+ ' features' : [i.asdict () for i in self .features] if self .features else None ,
2604
+ ' scan' : self .scrub.asdict (),
2605
+ ' root_vdev' : self .root_vdev.asdict (False ),
2606
2606
' groups' : {
2607
- ' data' : [i.__getstate__ () for i in self .data_vdevs if i.type not in filter_vdevs],
2608
- ' log' : [i.__getstate__ () for i in self .log_vdevs if i.type not in filter_vdevs],
2609
- ' cache' : [i.__getstate__ () for i in self .cache_vdevs if i.type not in filter_vdevs],
2610
- ' spare' : [i.__getstate__ () for i in self .spare_vdevs if i.type not in filter_vdevs],
2607
+ ' data' : [i.asdict () for i in self .data_vdevs if i.type not in filter_vdevs],
2608
+ ' log' : [i.asdict () for i in self .log_vdevs if i.type not in filter_vdevs],
2609
+ ' cache' : [i.asdict () for i in self .cache_vdevs if i.type not in filter_vdevs],
2610
+ ' spare' : [i.asdict () for i in self .spare_vdevs if i.type not in filter_vdevs],
2611
2611
},
2612
2612
}
2613
2613
IF HAVE_ZPOOL_CONFIG_ALLOCATION_BIAS:
2614
2614
state[' groups' ].update({
2615
- ' special' : [i.__getstate__ () for i in self .special_vdevs if i.type not in filter_vdevs],
2616
- ' dedup' : [i.__getstate__ () for i in self .dedup_vdevs if i.type not in filter_vdevs],
2615
+ ' special' : [i.asdict () for i in self .special_vdevs if i.type not in filter_vdevs],
2616
+ ' dedup' : [i.asdict () for i in self .dedup_vdevs if i.type not in filter_vdevs],
2617
2617
})
2618
2618
2619
2619
if self .handle != NULL :
@@ -3328,13 +3328,13 @@ cdef class ZFSObject(object):
3328
3328
def __repr__ (self ):
3329
3329
return str (self )
3330
3330
3331
- def __getstate__ (self ):
3331
+ def asdict (self ):
3332
3332
return {
3333
3333
' id' : self .name,
3334
3334
' name' : self .name,
3335
3335
' pool' : self .pool.name,
3336
3336
' type' : self .type.name,
3337
- ' properties' : {k: p.__getstate__ () for k, p in self .properties.items()},
3337
+ ' properties' : {k: p.asdict () for k, p in self .properties.items()},
3338
3338
}
3339
3339
3340
3340
property name :
@@ -3535,18 +3535,18 @@ cdef class ZFSResource(ZFSObject):
3535
3535
3536
3536
3537
3537
cdef class ZFSDataset(ZFSResource):
3538
- def __getstate__ (self , recursive = True , snapshots = False , snapshots_recursive = False ):
3539
- ret = super (ZFSDataset, self ).__getstate__ ()
3538
+ def asdict (self , recursive = True , snapshots = False , snapshots_recursive = False ):
3539
+ ret = super (ZFSDataset, self ).asdict ()
3540
3540
ret[' mountpoint' ] = self .mountpoint
3541
3541
3542
3542
if recursive:
3543
- ret[' children' ] = [i.__getstate__ () for i in self .children]
3543
+ ret[' children' ] = [i.asdict () for i in self .children]
3544
3544
3545
3545
if snapshots:
3546
- ret[' snapshots' ] = [s.__getstate__ () for s in self .snapshots]
3546
+ ret[' snapshots' ] = [s.asdict () for s in self .snapshots]
3547
3547
3548
3548
if snapshots_recursive:
3549
- ret[' snapshots_recursive' ] = [s.__getstate__ () for s in self .snapshots_recursive]
3549
+ ret[' snapshots_recursive' ] = [s.asdict () for s in self .snapshots_recursive]
3550
3550
3551
3551
IF HAVE_ZFS_ENCRYPTION:
3552
3552
root = self .encryption_root
@@ -4125,8 +4125,8 @@ cdef class ZFSDataset(ZFSResource):
4125
4125
4126
4126
4127
4127
cdef class ZFSSnapshot(ZFSResource):
4128
- def __getstate__ (self ):
4129
- ret = super (ZFSSnapshot, self ).__getstate__ ()
4128
+ def asdict (self ):
4129
+ ret = super (ZFSSnapshot, self ).asdict ()
4130
4130
ret.update({
4131
4131
' holds' : self .holds,
4132
4132
' dataset' : self .parent.name,
@@ -4321,8 +4321,8 @@ cdef class ZFSSnapshot(ZFSResource):
4321
4321
raise NotImplementedError ()
4322
4322
4323
4323
cdef class ZFSBookmark(ZFSObject):
4324
- def __getstate__ (self ):
4325
- ret = super (ZFSBookmark, self ).__getstate__ ()
4324
+ def asdict (self ):
4325
+ ret = super (ZFSBookmark, self ).asdict ()
4326
4326
ret.update({
4327
4327
' dataset' : self .parent.name,
4328
4328
' bookmark_name' : self .bookmark_name
0 commit comments