2N/A# The contents of this file are subject to the terms of the 2N/A# Common Development and Distribution License (the "License"). 2N/A# You may not use this file except in compliance with the License. 2N/A# See the License for the specific language governing permissions 2N/A# and limitations under the License. 2N/A# When distributing Covered Code, include this CDDL HEADER in each 2N/A# If applicable, add the following below this CDDL HEADER, with the 2N/A# fields enclosed by brackets "[]" replaced with your own identifying 2N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2N/A# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 2N/A"""Implements the Dataset class, providing methods for manipulating ZFS 2N/Adatasets. Also implements the Property class, which describes ZFS 2N/A """This class represents a ZFS property. It contains 2N/A information about the property -- if it's readonly, a number vs 2N/A string vs index, etc. Only native properties are represented by 2N/A this class -- not user properties (eg "user:prop") or userspace 2N/A properties (eg "userquota@joe").""" 2N/A __slots__ =
"name",
"number",
"type",
"default",
"attr",
"validtypes", \
2N/A "values",
"colname",
"rightalign",
"visible",
"indextable" 2N/A """t is the tuple of information about this property 2N/A from zfs.ioctl.get_proptable, which should match the 2N/A members of zprop_desc_t (see zfs_prop.h).""" 2N/A """Return True if this property can be delegated with 2N/A """Return the Property object that is identified by the given 2N/A name string. It can be the full name, or the column name.""" 2N/A """Represents a ZFS dataset (filesystem, snapshot, zvol, clone, etc). 2N/A Generally, this class provides interfaces to the C functions in 2N/A zfs.ioctl which actually interface with the kernel to manipulate 2N/A Unless otherwise noted, any method can raise a ZFSError to 2N/A indicate failure.""" 2N/A """Open the named dataset, checking that it exists and 2N/A is of the specified type. 2N/A name is the string name of this dataset. 2N/A props is the property settings dict from zfs.ioctl.next_dataset. 2N/A types is an iterable of strings specifying which types 2N/A of datasets are permitted. Accepted strings are 2N/A "filesystem" and "volume". Defaults to accepting all 2N/A snaps is a boolean specifying if snapshots are acceptable. 2N/A Raises a ZFSError if the dataset can't be accessed (eg 2N/A doesn't exist) or is not of the specified type. 2N/A _(
"operation not applicable to datasets of this type"))
2N/A """Return the value of the given property for this dataset. 2N/A Currently only works for native properties (those with a 2N/A Raises KeyError if propname does not specify a native property. 2N/A Does not raise ZFSError. 2N/A """Return a Dataset representing the parent of this one.""" 2N/A """A generator function which iterates over all 2N/A descendent Datasets (not including snapshots.""" 2N/A # next_dataset raises StopIteration when done 2N/A """A generator function which iterates over a 2N/A userspace-type property. 2N/A prop specifies which property ("userused@", 2N/A "userquota@", "groupused@", or "groupquota@"). 2N/A returns 3-tuple of domain (string), rid (int), and space (int). 2N/A """Initialize the accounting information for 2N/A userused@... and groupused@... properties.""" 2N/A """Add to the "zfs allow"-ed permissions on this Dataset. 2N/A un is True if the specified permissions should be removed. 2N/A { "whostr" -> None # remove all perms for this entity 2N/A """Get the "zfs allow"-ed permissions on the Dataset. 2N/A Return a dict("whostr": { "perm" -> None }).""" 2N/A """Get the user holds on this Dataset. 2N/A Return a dict("tag": timestamp).""" 2N/A _(
"operation only applies to snapshots"))