summaryrefslogtreecommitdiff
path: root/usr/src/lib/pyzfs/common/dataset.py
diff options
context:
space:
mode:
authorChris Kirby <chris.kirby@sun.com>2009-08-01 15:09:50 -0600
committerChris Kirby <chris.kirby@sun.com>2009-08-01 15:09:50 -0600
commit842727c2f41f01b380de4f5e787d905702870f23 (patch)
treec0143417f1cb9c4385e0191a0d90682a98e6d81e /usr/src/lib/pyzfs/common/dataset.py
parent592106a23e99a1790d339bab84de7fa3474964a4 (diff)
downloadillumos-gate-842727c2f41f01b380de4f5e787d905702870f23.tar.gz
PSARC/2009/297 zfs snapshot holds
6803121 want user-settable refcounts on snapshots 6851824 zfs_ioc_rename() can be called with a NULL zc_name
Diffstat (limited to 'usr/src/lib/pyzfs/common/dataset.py')
-rw-r--r--usr/src/lib/pyzfs/common/dataset.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/usr/src/lib/pyzfs/common/dataset.py b/usr/src/lib/pyzfs/common/dataset.py
index b45173e01f..f3adc5c364 100644
--- a/usr/src/lib/pyzfs/common/dataset.py
+++ b/usr/src/lib/pyzfs/common/dataset.py
@@ -109,7 +109,7 @@ class Dataset(object):
types is an iterable of strings specifying which types
of datasets are permitted. Accepted strings are
- "filesystem" and "volume". Defaults to acceptying all
+ "filesystem" and "volume". Defaults to accepting all
types.
snaps is a boolean specifying if snapshots are acceptable.
@@ -203,3 +203,29 @@ class Dataset(object):
Return a dict("whostr": { "perm" -> None })."""
return zfs.ioctl.get_fsacl(self.name)
+
+ def get_holds(self):
+ """Get the user holds on this Dataset.
+
+ Return a dict("tag": timestamp)."""
+
+ return zfs.ioctl.get_holds(self.name)
+
+def snapshots_fromcmdline(dsnames, recursive):
+ for dsname in dsnames:
+ ds = Dataset(dsname)
+ if not "@" in dsname:
+ raise zfs.util.ZFSError(errno.EINVAL,
+ _("cannot open %s") % dsname,
+ _("operation only applies to snapshots"))
+ yield ds
+ if recursive:
+ (base, snapname) = dsname.split('@')
+ parent = Dataset(base)
+ for child in parent.descendents():
+ try:
+ yield Dataset(child.name + "@" +
+ snapname)
+ except zfs.util.ZFSError, e:
+ if e.errno != errno.ENOENT:
+ raise