summaryrefslogtreecommitdiff
path: root/usr/src/lib/pyzfs/common/dataset.py
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2018-10-13 21:12:19 +0000
committerDan McDonald <danmcd@joyent.com>2018-10-24 15:27:58 -0400
commite8921a52c53ee69f7b65f054d9b2e886139daa59 (patch)
tree47ff09b2c3cf4a36bb54f09c2f24debb5f5f513a /usr/src/lib/pyzfs/common/dataset.py
parente24b44e5c3120c9b5c8e9b7440bc10c8b7413bfb (diff)
downloadillumos-gate-e8921a52c53ee69f7b65f054d9b2e886139daa59.tar.gz
9894 Deliver python3 modules
9904 Split python modules out into separate packages 5571 Provide 64-bit python modules Reviewed by: Alexander Pyhalov <apyhalov@gmail.com> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/lib/pyzfs/common/dataset.py')
-rw-r--r--usr/src/lib/pyzfs/common/dataset.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/usr/src/lib/pyzfs/common/dataset.py b/usr/src/lib/pyzfs/common/dataset.py
index 9d4652235a..752449486f 100644
--- a/usr/src/lib/pyzfs/common/dataset.py
+++ b/usr/src/lib/pyzfs/common/dataset.py
@@ -20,6 +20,7 @@
# CDDL HEADER END
#
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
#
"""Implements the Dataset class, providing methods for manipulating ZFS
@@ -69,7 +70,7 @@ class Property(object):
return self.attr != "readonly"
proptable = dict()
-for name, t in zfs.ioctl.get_proptable().iteritems():
+for name, t in zfs.ioctl.get_proptable().items():
proptable[name] = Property(t)
del name, t
@@ -79,7 +80,7 @@ def getpropobj(name):
try:
return proptable[name]
except KeyError:
- for p in proptable.itervalues():
+ for p in proptable.values():
if p.colname and p.colname.lower() == name:
return p
raise
@@ -90,7 +91,7 @@ class Dataset(object):
Generally, this class provides interfaces to the C functions in
zfs.ioctl which actually interface with the kernel to manipulate
datasets.
-
+
Unless otherwise noted, any method can raise a ZFSError to
indicate failure."""
@@ -101,7 +102,7 @@ class Dataset(object):
types=("filesystem", "volume"), snaps=True):
"""Open the named dataset, checking that it exists and
is of the specified type.
-
+
name is the string name of this dataset.
props is the property settings dict from zfs.ioctl.next_dataset.
@@ -137,7 +138,7 @@ class Dataset(object):
Currently only works for native properties (those with a
Property object.)
-
+
Raises KeyError if propname does not specify a native property.
Does not raise ZFSError.
"""
@@ -165,7 +166,7 @@ class Dataset(object):
yield ds
for child in ds.descendents():
yield child
-
+
def userspace(self, prop):
"""A generator function which iterates over a
userspace-type property.
@@ -177,14 +178,14 @@ class Dataset(object):
"""
d = zfs.ioctl.userspace_many(self.name, prop)
- for ((domain, rid), space) in d.iteritems():
+ for ((domain, rid), space) in d.items():
yield (domain, rid, space)
def userspace_upgrade(self):
"""Initialize the accounting information for
userused@... and groupused@... properties."""
return zfs.ioctl.userspace_upgrade(self.name)
-
+
def set_fsacl(self, un, d):
"""Add to the "zfs allow"-ed permissions on this Dataset.
@@ -219,7 +220,7 @@ def snapshots_fromcmdline(dsnames, recursive):
try:
ds = Dataset(dsname)
yield ds
- except zfs.util.ZFSError, e:
+ except zfs.util.ZFSError as e:
if not recursive or e.errno != errno.ENOENT:
raise
if recursive:
@@ -229,6 +230,6 @@ def snapshots_fromcmdline(dsnames, recursive):
try:
yield Dataset(child.name + "@" +
snapname)
- except zfs.util.ZFSError, e:
+ except zfs.util.ZFSError as e:
if e.errno != errno.ENOENT:
raise