usr/src/lib/pyzfs/common/dataset.py
changeset 10242 c40d075fbca6
parent 9396 f41cf682d0d3
child 10268 cb380b2e9410
equal deleted inserted replaced
10241:356a64b58ebc 10242:c40d075fbca6
   107 
   107 
   108 		props is the property settings dict from zfs.ioctl.next_dataset.
   108 		props is the property settings dict from zfs.ioctl.next_dataset.
   109 
   109 
   110 		types is an iterable of strings specifying which types
   110 		types is an iterable of strings specifying which types
   111 		of datasets are permitted.  Accepted strings are
   111 		of datasets are permitted.  Accepted strings are
   112 		"filesystem" and "volume".  Defaults to acceptying all
   112 		"filesystem" and "volume".  Defaults to accepting all
   113 		types.
   113 		types.
   114 
   114 
   115 		snaps is a boolean specifying if snapshots are acceptable.
   115 		snaps is a boolean specifying if snapshots are acceptable.
   116 
   116 
   117 		Raises a ZFSError if the dataset can't be accessed (eg
   117 		Raises a ZFSError if the dataset can't be accessed (eg
   201 		"""Get the "zfs allow"-ed permissions on the Dataset.
   201 		"""Get the "zfs allow"-ed permissions on the Dataset.
   202 
   202 
   203 		Return a dict("whostr": { "perm" -> None })."""
   203 		Return a dict("whostr": { "perm" -> None })."""
   204 
   204 
   205 		return zfs.ioctl.get_fsacl(self.name)
   205 		return zfs.ioctl.get_fsacl(self.name)
       
   206 
       
   207 	def get_holds(self):
       
   208 		"""Get the user holds on this Dataset.
       
   209 
       
   210 		Return a dict("tag": timestamp)."""
       
   211 
       
   212 		return zfs.ioctl.get_holds(self.name)
       
   213 
       
   214 def snapshots_fromcmdline(dsnames, recursive):
       
   215 	for dsname in dsnames:
       
   216 		ds = Dataset(dsname)
       
   217 		if not "@" in dsname:
       
   218 			raise zfs.util.ZFSError(errno.EINVAL,
       
   219 			    _("cannot open %s") % dsname,
       
   220 			    _("operation only applies to snapshots"))
       
   221 		yield ds
       
   222 		if recursive:
       
   223 			(base, snapname) = dsname.split('@')
       
   224 			parent = Dataset(base)
       
   225 			for child in parent.descendents():
       
   226 				try:
       
   227 					yield Dataset(child.name + "@" +
       
   228 					    snapname)
       
   229 				except zfs.util.ZFSError, e:
       
   230 					if e.errno != errno.ENOENT:
       
   231 						raise