1eda14cbcSMatt Macy# 2eda14cbcSMatt Macy# Copyright 2015 ClusterHQ 3eda14cbcSMatt Macy# 4eda14cbcSMatt Macy# Licensed under the Apache License, Version 2.0 (the "License"); 5eda14cbcSMatt Macy# you may not use this file except in compliance with the License. 6eda14cbcSMatt Macy# You may obtain a copy of the License at 7eda14cbcSMatt Macy# 8eda14cbcSMatt Macy# http://www.apache.org/licenses/LICENSE-2.0 9eda14cbcSMatt Macy# 10eda14cbcSMatt Macy# Unless required by applicable law or agreed to in writing, software 11eda14cbcSMatt Macy# distributed under the License is distributed on an "AS IS" BASIS, 12eda14cbcSMatt Macy# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13eda14cbcSMatt Macy# See the License for the specific language governing permissions and 14eda14cbcSMatt Macy# limitations under the License. 15eda14cbcSMatt Macy# 16eda14cbcSMatt Macy 17eda14cbcSMatt Macy""" 18eda14cbcSMatt MacyExceptions that can be raised by libzfs_core operations. 19eda14cbcSMatt Macy""" 20eda14cbcSMatt Macyfrom __future__ import absolute_import, division, print_function 21eda14cbcSMatt Macy 22eda14cbcSMatt Macyimport errno 23eda14cbcSMatt Macyfrom ._constants import ( 24eda14cbcSMatt Macy ECHRNG, 25eda14cbcSMatt Macy ECKSUM, 26eda14cbcSMatt Macy ETIME, 27eda14cbcSMatt Macy ZFS_ERR_CHECKPOINT_EXISTS, 28eda14cbcSMatt Macy ZFS_ERR_DISCARDING_CHECKPOINT, 29eda14cbcSMatt Macy ZFS_ERR_NO_CHECKPOINT, 30eda14cbcSMatt Macy ZFS_ERR_DEVRM_IN_PROGRESS, 31eda14cbcSMatt Macy ZFS_ERR_VDEV_TOO_BIG, 32eda14cbcSMatt Macy ZFS_ERR_WRONG_PARENT, 33*e716630dSMartin Matuska ZFS_ERR_RAIDZ_EXPAND_IN_PROGRESS, 34eda14cbcSMatt Macy zfs_errno 35eda14cbcSMatt Macy) 36eda14cbcSMatt Macy 37eda14cbcSMatt Macy 38eda14cbcSMatt Macyclass ZFSError(Exception): 39eda14cbcSMatt Macy errno = None 40eda14cbcSMatt Macy message = None 41eda14cbcSMatt Macy name = None 42eda14cbcSMatt Macy 43eda14cbcSMatt Macy def __str__(self): 44eda14cbcSMatt Macy if self.name is not None: 45eda14cbcSMatt Macy return "[Errno %d] %s: '%s'" % ( 46eda14cbcSMatt Macy self.errno, self.message, self.name) 47eda14cbcSMatt Macy else: 48eda14cbcSMatt Macy return "[Errno %d] %s" % (self.errno, self.message) 49eda14cbcSMatt Macy 50eda14cbcSMatt Macy def __repr__(self): 51eda14cbcSMatt Macy return "%s(%r, %r)" % ( 52eda14cbcSMatt Macy self.__class__.__name__, self.errno, self.message) 53eda14cbcSMatt Macy 54eda14cbcSMatt Macy 55eda14cbcSMatt Macyclass ZFSGenericError(ZFSError): 56eda14cbcSMatt Macy 57eda14cbcSMatt Macy def __init__(self, errno, name, message): 58eda14cbcSMatt Macy self.errno = errno 59eda14cbcSMatt Macy self.message = message 60eda14cbcSMatt Macy self.name = name 61eda14cbcSMatt Macy 62eda14cbcSMatt Macy 63eda14cbcSMatt Macyclass ZFSInitializationFailed(ZFSError): 64eda14cbcSMatt Macy message = "Failed to initialize libzfs_core" 65eda14cbcSMatt Macy 66eda14cbcSMatt Macy def __init__(self, errno): 67eda14cbcSMatt Macy self.errno = errno 68eda14cbcSMatt Macy 69eda14cbcSMatt Macy 70eda14cbcSMatt Macyclass MultipleOperationsFailure(ZFSError): 71eda14cbcSMatt Macy 72eda14cbcSMatt Macy def __init__(self, errors, suppressed_count): 73eda14cbcSMatt Macy # Use first of the individual error codes 74eda14cbcSMatt Macy # as an overall error code. This is more consistent. 75eda14cbcSMatt Macy self.errno = errors[0].errno 76eda14cbcSMatt Macy self.errors = errors 77eda14cbcSMatt Macy # this many errors were encountered but not placed on the `errors` list 78eda14cbcSMatt Macy self.suppressed_count = suppressed_count 79eda14cbcSMatt Macy 80eda14cbcSMatt Macy def __str__(self): 81eda14cbcSMatt Macy return "%s, %d errors included, %d suppressed" % ( 82eda14cbcSMatt Macy ZFSError.__str__(self), len(self.errors), self.suppressed_count) 83eda14cbcSMatt Macy 84eda14cbcSMatt Macy def __repr__(self): 85eda14cbcSMatt Macy return "%s(%r, %r, errors=%r, suppressed=%r)" % ( 86eda14cbcSMatt Macy self.__class__.__name__, self.errno, self.message, self.errors, 87eda14cbcSMatt Macy self.suppressed_count) 88eda14cbcSMatt Macy 89eda14cbcSMatt Macy 90eda14cbcSMatt Macyclass DatasetNotFound(ZFSError): 91eda14cbcSMatt Macy 92eda14cbcSMatt Macy """ 93eda14cbcSMatt Macy This exception is raised when an operation failure can be caused by a 94eda14cbcSMatt Macy missing snapshot or a missing filesystem and it is impossible to 95eda14cbcSMatt Macy distinguish between the causes. 96eda14cbcSMatt Macy """ 97eda14cbcSMatt Macy errno = errno.ENOENT 98eda14cbcSMatt Macy message = "Dataset not found" 99eda14cbcSMatt Macy 100eda14cbcSMatt Macy def __init__(self, name): 101eda14cbcSMatt Macy self.name = name 102eda14cbcSMatt Macy 103eda14cbcSMatt Macy 104eda14cbcSMatt Macyclass DatasetExists(ZFSError): 105eda14cbcSMatt Macy 106eda14cbcSMatt Macy """ 107eda14cbcSMatt Macy This exception is raised when an operation failure can be caused by an 108eda14cbcSMatt Macy existing snapshot or filesystem and it is impossible to distinguish between 109eda14cbcSMatt Macy the causes. 110eda14cbcSMatt Macy """ 111eda14cbcSMatt Macy errno = errno.EEXIST 112eda14cbcSMatt Macy message = "Dataset already exists" 113eda14cbcSMatt Macy 114eda14cbcSMatt Macy def __init__(self, name): 115eda14cbcSMatt Macy self.name = name 116eda14cbcSMatt Macy 117eda14cbcSMatt Macy 118eda14cbcSMatt Macyclass NotClone(ZFSError): 119eda14cbcSMatt Macy errno = errno.EINVAL 120eda14cbcSMatt Macy message = "Filesystem is not a clone, can not promote" 121eda14cbcSMatt Macy 122eda14cbcSMatt Macy def __init__(self, name): 123eda14cbcSMatt Macy self.name = name 124eda14cbcSMatt Macy 125eda14cbcSMatt Macy 126eda14cbcSMatt Macyclass FilesystemExists(DatasetExists): 127eda14cbcSMatt Macy message = "Filesystem already exists" 128eda14cbcSMatt Macy 129eda14cbcSMatt Macy def __init__(self, name): 130eda14cbcSMatt Macy self.name = name 131eda14cbcSMatt Macy 132eda14cbcSMatt Macy 133eda14cbcSMatt Macyclass FilesystemNotFound(DatasetNotFound): 134eda14cbcSMatt Macy message = "Filesystem not found" 135eda14cbcSMatt Macy 136eda14cbcSMatt Macy def __init__(self, name): 137eda14cbcSMatt Macy self.name = name 138eda14cbcSMatt Macy 139eda14cbcSMatt Macy 140eda14cbcSMatt Macyclass ParentNotFound(ZFSError): 141eda14cbcSMatt Macy errno = errno.ENOENT 142eda14cbcSMatt Macy message = "Parent not found" 143eda14cbcSMatt Macy 144eda14cbcSMatt Macy def __init__(self, name): 145eda14cbcSMatt Macy self.name = name 146eda14cbcSMatt Macy 147eda14cbcSMatt Macy 148eda14cbcSMatt Macyclass WrongParent(ZFSError): 149eda14cbcSMatt Macy errno = ZFS_ERR_WRONG_PARENT 150eda14cbcSMatt Macy message = "Parent dataset is not a filesystem" 151eda14cbcSMatt Macy 152eda14cbcSMatt Macy def __init__(self, name): 153eda14cbcSMatt Macy self.name = name 154eda14cbcSMatt Macy 155eda14cbcSMatt Macy 156eda14cbcSMatt Macyclass SnapshotExists(DatasetExists): 157eda14cbcSMatt Macy message = "Snapshot already exists" 158eda14cbcSMatt Macy 159eda14cbcSMatt Macy def __init__(self, name): 160eda14cbcSMatt Macy self.name = name 161eda14cbcSMatt Macy 162eda14cbcSMatt Macy 163eda14cbcSMatt Macyclass SnapshotNotFound(DatasetNotFound): 164eda14cbcSMatt Macy message = "Snapshot not found" 165eda14cbcSMatt Macy 166eda14cbcSMatt Macy def __init__(self, name): 167eda14cbcSMatt Macy self.name = name 168eda14cbcSMatt Macy 169eda14cbcSMatt Macy 170eda14cbcSMatt Macyclass SnapshotNotLatest(ZFSError): 171eda14cbcSMatt Macy errno = errno.EEXIST 172eda14cbcSMatt Macy message = "Snapshot is not the latest" 173eda14cbcSMatt Macy 174eda14cbcSMatt Macy def __init__(self, name): 175eda14cbcSMatt Macy self.name = name 176eda14cbcSMatt Macy 177eda14cbcSMatt Macy 178eda14cbcSMatt Macyclass SnapshotIsCloned(ZFSError): 179eda14cbcSMatt Macy errno = errno.EEXIST 180eda14cbcSMatt Macy message = "Snapshot is cloned" 181eda14cbcSMatt Macy 182eda14cbcSMatt Macy def __init__(self, name): 183eda14cbcSMatt Macy self.name = name 184eda14cbcSMatt Macy 185eda14cbcSMatt Macy 186eda14cbcSMatt Macyclass SnapshotIsHeld(ZFSError): 187eda14cbcSMatt Macy errno = errno.EBUSY 188eda14cbcSMatt Macy message = "Snapshot is held" 189eda14cbcSMatt Macy 190eda14cbcSMatt Macy def __init__(self, name): 191eda14cbcSMatt Macy self.name = name 192eda14cbcSMatt Macy 193eda14cbcSMatt Macy 194eda14cbcSMatt Macyclass DuplicateSnapshots(ZFSError): 195eda14cbcSMatt Macy errno = errno.EXDEV 196eda14cbcSMatt Macy message = "Requested multiple snapshots of the same filesystem" 197eda14cbcSMatt Macy 198eda14cbcSMatt Macy def __init__(self, name): 199eda14cbcSMatt Macy self.name = name 200eda14cbcSMatt Macy 201eda14cbcSMatt Macy 202eda14cbcSMatt Macyclass SnapshotFailure(MultipleOperationsFailure): 203eda14cbcSMatt Macy message = "Creation of snapshot(s) failed for one or more reasons" 204eda14cbcSMatt Macy 205eda14cbcSMatt Macy def __init__(self, errors, suppressed_count): 206eda14cbcSMatt Macy super(SnapshotFailure, self).__init__(errors, suppressed_count) 207eda14cbcSMatt Macy 208eda14cbcSMatt Macy 209eda14cbcSMatt Macyclass SnapshotDestructionFailure(MultipleOperationsFailure): 210eda14cbcSMatt Macy message = "Destruction of snapshot(s) failed for one or more reasons" 211eda14cbcSMatt Macy 212eda14cbcSMatt Macy def __init__(self, errors, suppressed_count): 213eda14cbcSMatt Macy super(SnapshotDestructionFailure, self).__init__( 214eda14cbcSMatt Macy errors, suppressed_count) 215eda14cbcSMatt Macy 216eda14cbcSMatt Macy 217eda14cbcSMatt Macyclass BookmarkExists(ZFSError): 218eda14cbcSMatt Macy errno = errno.EEXIST 219eda14cbcSMatt Macy message = "Bookmark already exists" 220eda14cbcSMatt Macy 221eda14cbcSMatt Macy def __init__(self, name): 222eda14cbcSMatt Macy self.name = name 223eda14cbcSMatt Macy 224eda14cbcSMatt Macy 225eda14cbcSMatt Macyclass BookmarkNotFound(ZFSError): 226eda14cbcSMatt Macy errno = errno.ENOENT 227eda14cbcSMatt Macy message = "Bookmark not found" 228eda14cbcSMatt Macy 229eda14cbcSMatt Macy def __init__(self, name): 230eda14cbcSMatt Macy self.name = name 231eda14cbcSMatt Macy 232eda14cbcSMatt Macy 233eda14cbcSMatt Macyclass BookmarkMismatch(ZFSError): 234eda14cbcSMatt Macy errno = errno.EINVAL 235eda14cbcSMatt Macy message = "source is not an ancestor of the new bookmark's dataset" 236eda14cbcSMatt Macy 237eda14cbcSMatt Macy def __init__(self, name): 238eda14cbcSMatt Macy self.name = name 239eda14cbcSMatt Macy 240eda14cbcSMatt Macy 241eda14cbcSMatt Macyclass BookmarkSourceInvalid(ZFSError): 242eda14cbcSMatt Macy errno = errno.EINVAL 243eda14cbcSMatt Macy message = "Bookmark source is not a valid snapshot or existing bookmark" 244eda14cbcSMatt Macy 245eda14cbcSMatt Macy def __init__(self, name): 246eda14cbcSMatt Macy self.name = name 247eda14cbcSMatt Macy 248eda14cbcSMatt Macy 249eda14cbcSMatt Macyclass BookmarkNotSupported(ZFSError): 250eda14cbcSMatt Macy errno = errno.ENOTSUP 251eda14cbcSMatt Macy message = "Bookmark feature is not supported" 252eda14cbcSMatt Macy 253eda14cbcSMatt Macy def __init__(self, name): 254eda14cbcSMatt Macy self.name = name 255eda14cbcSMatt Macy 256eda14cbcSMatt Macy 257eda14cbcSMatt Macyclass BookmarkFailure(MultipleOperationsFailure): 258eda14cbcSMatt Macy message = "Creation of bookmark(s) failed for one or more reasons" 259eda14cbcSMatt Macy 260eda14cbcSMatt Macy def __init__(self, errors, suppressed_count): 261eda14cbcSMatt Macy super(BookmarkFailure, self).__init__(errors, suppressed_count) 262eda14cbcSMatt Macy 263eda14cbcSMatt Macy 264eda14cbcSMatt Macyclass BookmarkDestructionFailure(MultipleOperationsFailure): 265eda14cbcSMatt Macy message = "Destruction of bookmark(s) failed for one or more reasons" 266eda14cbcSMatt Macy 267eda14cbcSMatt Macy def __init__(self, errors, suppressed_count): 268eda14cbcSMatt Macy super(BookmarkDestructionFailure, self).__init__( 269eda14cbcSMatt Macy errors, suppressed_count) 270eda14cbcSMatt Macy 271eda14cbcSMatt Macy 272eda14cbcSMatt Macyclass BadHoldCleanupFD(ZFSError): 273eda14cbcSMatt Macy errno = errno.EBADF 274eda14cbcSMatt Macy message = "Bad file descriptor as cleanup file descriptor" 275eda14cbcSMatt Macy 276eda14cbcSMatt Macy 277eda14cbcSMatt Macyclass HoldExists(ZFSError): 278eda14cbcSMatt Macy errno = errno.EEXIST 279eda14cbcSMatt Macy message = "Hold with a given tag already exists on snapshot" 280eda14cbcSMatt Macy 281eda14cbcSMatt Macy def __init__(self, name): 282eda14cbcSMatt Macy self.name = name 283eda14cbcSMatt Macy 284eda14cbcSMatt Macy 285eda14cbcSMatt Macyclass HoldNotFound(ZFSError): 286eda14cbcSMatt Macy errno = errno.ENOENT 287eda14cbcSMatt Macy message = "Hold with a given tag does not exist on snapshot" 288eda14cbcSMatt Macy 289eda14cbcSMatt Macy def __init__(self, name): 290eda14cbcSMatt Macy self.name = name 291eda14cbcSMatt Macy 292eda14cbcSMatt Macy 293eda14cbcSMatt Macyclass HoldFailure(MultipleOperationsFailure): 294eda14cbcSMatt Macy message = "Placement of hold(s) failed for one or more reasons" 295eda14cbcSMatt Macy 296eda14cbcSMatt Macy def __init__(self, errors, suppressed_count): 297eda14cbcSMatt Macy super(HoldFailure, self).__init__(errors, suppressed_count) 298eda14cbcSMatt Macy 299eda14cbcSMatt Macy 300eda14cbcSMatt Macyclass HoldReleaseFailure(MultipleOperationsFailure): 301eda14cbcSMatt Macy message = "Release of hold(s) failed for one or more reasons" 302eda14cbcSMatt Macy 303eda14cbcSMatt Macy def __init__(self, errors, suppressed_count): 304eda14cbcSMatt Macy super(HoldReleaseFailure, self).__init__(errors, suppressed_count) 305eda14cbcSMatt Macy 306eda14cbcSMatt Macy 307eda14cbcSMatt Macyclass SnapshotMismatch(ZFSError): 308eda14cbcSMatt Macy errno = errno.ENODEV 309eda14cbcSMatt Macy message = "Snapshot is not descendant of source snapshot" 310eda14cbcSMatt Macy 311eda14cbcSMatt Macy def __init__(self, name): 312eda14cbcSMatt Macy self.name = name 313eda14cbcSMatt Macy 314eda14cbcSMatt Macy 315eda14cbcSMatt Macyclass StreamMismatch(ZFSError): 316eda14cbcSMatt Macy errno = errno.ENODEV 317eda14cbcSMatt Macy message = "Stream is not applicable to destination dataset" 318eda14cbcSMatt Macy 319eda14cbcSMatt Macy def __init__(self, name): 320eda14cbcSMatt Macy self.name = name 321eda14cbcSMatt Macy 322eda14cbcSMatt Macy 323eda14cbcSMatt Macyclass DestinationModified(ZFSError): 324eda14cbcSMatt Macy errno = errno.ETXTBSY 325eda14cbcSMatt Macy message = "Destination dataset has modifications that can not be undone" 326eda14cbcSMatt Macy 327eda14cbcSMatt Macy def __init__(self, name): 328eda14cbcSMatt Macy self.name = name 329eda14cbcSMatt Macy 330eda14cbcSMatt Macy 331eda14cbcSMatt Macyclass BadStream(ZFSError): 332eda14cbcSMatt Macy errno = ECKSUM 333eda14cbcSMatt Macy message = "Bad backup stream" 334eda14cbcSMatt Macy 335eda14cbcSMatt Macy 336eda14cbcSMatt Macyclass StreamFeatureNotSupported(ZFSError): 337eda14cbcSMatt Macy errno = errno.ENOTSUP 338eda14cbcSMatt Macy message = "Stream contains unsupported feature" 339eda14cbcSMatt Macy 340eda14cbcSMatt Macy 341eda14cbcSMatt Macyclass UnknownStreamFeature(ZFSError): 342eda14cbcSMatt Macy errno = errno.ENOTSUP 343eda14cbcSMatt Macy message = "Unknown feature requested for stream" 344eda14cbcSMatt Macy 345eda14cbcSMatt Macy 346eda14cbcSMatt Macyclass StreamFeatureInvalid(ZFSError): 347eda14cbcSMatt Macy errno = errno.EINVAL 348eda14cbcSMatt Macy message = "Kernel modules must be upgraded to receive this stream" 349eda14cbcSMatt Macy 350eda14cbcSMatt Macy 351eda14cbcSMatt Macyclass StreamFeatureIncompatible(ZFSError): 352eda14cbcSMatt Macy errno = errno.EINVAL 353eda14cbcSMatt Macy message = "Incompatible embedded feature with encrypted receive" 354eda14cbcSMatt Macy 355eda14cbcSMatt Macy 356eda14cbcSMatt Macyclass StreamTruncated(ZFSError): 357eda14cbcSMatt Macy errno = zfs_errno.ZFS_ERR_STREAM_TRUNCATED 358eda14cbcSMatt Macy message = "incomplete stream" 359eda14cbcSMatt Macy 360eda14cbcSMatt Macy 361eda14cbcSMatt Macyclass ReceivePropertyFailure(MultipleOperationsFailure): 362eda14cbcSMatt Macy message = "Receiving of properties failed for one or more reasons" 363eda14cbcSMatt Macy 364eda14cbcSMatt Macy def __init__(self, errors, suppressed_count): 365eda14cbcSMatt Macy super(ReceivePropertyFailure, self).__init__(errors, suppressed_count) 366eda14cbcSMatt Macy 367eda14cbcSMatt Macy 368eda14cbcSMatt Macyclass StreamIOError(ZFSError): 369eda14cbcSMatt Macy message = "I/O error while writing or reading stream" 370eda14cbcSMatt Macy 371eda14cbcSMatt Macy def __init__(self, errno): 372eda14cbcSMatt Macy self.errno = errno 373eda14cbcSMatt Macy 374eda14cbcSMatt Macy 375eda14cbcSMatt Macyclass ZIOError(ZFSError): 376eda14cbcSMatt Macy errno = errno.EIO 377eda14cbcSMatt Macy message = "I/O error" 378eda14cbcSMatt Macy 379eda14cbcSMatt Macy def __init__(self, name): 380eda14cbcSMatt Macy self.name = name 381eda14cbcSMatt Macy 382eda14cbcSMatt Macy 383eda14cbcSMatt Macyclass NoSpace(ZFSError): 384eda14cbcSMatt Macy errno = errno.ENOSPC 385eda14cbcSMatt Macy message = "No space left" 386eda14cbcSMatt Macy 387eda14cbcSMatt Macy def __init__(self, name): 388eda14cbcSMatt Macy self.name = name 389eda14cbcSMatt Macy 390eda14cbcSMatt Macy 391eda14cbcSMatt Macyclass QuotaExceeded(ZFSError): 392eda14cbcSMatt Macy errno = errno.EDQUOT 393eda14cbcSMatt Macy message = "Quota exceeded" 394eda14cbcSMatt Macy 395eda14cbcSMatt Macy def __init__(self, name): 396eda14cbcSMatt Macy self.name = name 397eda14cbcSMatt Macy 398eda14cbcSMatt Macy 399eda14cbcSMatt Macyclass DatasetBusy(ZFSError): 400eda14cbcSMatt Macy errno = errno.EBUSY 401eda14cbcSMatt Macy message = "Dataset is busy" 402eda14cbcSMatt Macy 403eda14cbcSMatt Macy def __init__(self, name): 404eda14cbcSMatt Macy self.name = name 405eda14cbcSMatt Macy 406eda14cbcSMatt Macy 407eda14cbcSMatt Macyclass NameTooLong(ZFSError): 408eda14cbcSMatt Macy errno = errno.ENAMETOOLONG 409eda14cbcSMatt Macy message = "Dataset name is too long" 410eda14cbcSMatt Macy 411eda14cbcSMatt Macy def __init__(self, name): 412eda14cbcSMatt Macy self.name = name 413eda14cbcSMatt Macy 414eda14cbcSMatt Macy 415eda14cbcSMatt Macyclass NameInvalid(ZFSError): 416eda14cbcSMatt Macy errno = errno.EINVAL 417eda14cbcSMatt Macy message = "Invalid name" 418eda14cbcSMatt Macy 419eda14cbcSMatt Macy def __init__(self, name): 420eda14cbcSMatt Macy self.name = name 421eda14cbcSMatt Macy 422eda14cbcSMatt Macy 423eda14cbcSMatt Macyclass SnapshotNameInvalid(NameInvalid): 424eda14cbcSMatt Macy message = "Invalid name for snapshot" 425eda14cbcSMatt Macy 426eda14cbcSMatt Macy def __init__(self, name): 427eda14cbcSMatt Macy self.name = name 428eda14cbcSMatt Macy 429eda14cbcSMatt Macy 430eda14cbcSMatt Macyclass FilesystemNameInvalid(NameInvalid): 431eda14cbcSMatt Macy message = "Invalid name for filesystem or volume" 432eda14cbcSMatt Macy 433eda14cbcSMatt Macy def __init__(self, name): 434eda14cbcSMatt Macy self.name = name 435eda14cbcSMatt Macy 436eda14cbcSMatt Macy 437eda14cbcSMatt Macyclass BookmarkNameInvalid(NameInvalid): 438eda14cbcSMatt Macy message = "Invalid name for bookmark" 439eda14cbcSMatt Macy 440eda14cbcSMatt Macy def __init__(self, name): 441eda14cbcSMatt Macy self.name = name 442eda14cbcSMatt Macy 443eda14cbcSMatt Macy 444eda14cbcSMatt Macyclass ReadOnlyPool(ZFSError): 445eda14cbcSMatt Macy errno = errno.EROFS 446eda14cbcSMatt Macy message = "Pool is read-only" 447eda14cbcSMatt Macy 448eda14cbcSMatt Macy def __init__(self, name): 449eda14cbcSMatt Macy self.name = name 450eda14cbcSMatt Macy 451eda14cbcSMatt Macy 452eda14cbcSMatt Macyclass SuspendedPool(ZFSError): 453eda14cbcSMatt Macy errno = errno.EAGAIN 454eda14cbcSMatt Macy message = "Pool is suspended" 455eda14cbcSMatt Macy 456eda14cbcSMatt Macy def __init__(self, name): 457eda14cbcSMatt Macy self.name = name 458eda14cbcSMatt Macy 459eda14cbcSMatt Macy 460eda14cbcSMatt Macyclass PoolNotFound(ZFSError): 461eda14cbcSMatt Macy errno = errno.EXDEV 462eda14cbcSMatt Macy message = "No such pool" 463eda14cbcSMatt Macy 464eda14cbcSMatt Macy def __init__(self, name): 465eda14cbcSMatt Macy self.name = name 466eda14cbcSMatt Macy 467eda14cbcSMatt Macy 468eda14cbcSMatt Macyclass PoolsDiffer(ZFSError): 469eda14cbcSMatt Macy errno = errno.EXDEV 470eda14cbcSMatt Macy message = "Source and target belong to different pools" 471eda14cbcSMatt Macy 472eda14cbcSMatt Macy def __init__(self, name): 473eda14cbcSMatt Macy self.name = name 474eda14cbcSMatt Macy 475eda14cbcSMatt Macy 476eda14cbcSMatt Macyclass FeatureNotSupported(ZFSError): 477eda14cbcSMatt Macy errno = errno.ENOTSUP 478eda14cbcSMatt Macy message = "Feature is not supported in this version" 479eda14cbcSMatt Macy 480eda14cbcSMatt Macy def __init__(self, name): 481eda14cbcSMatt Macy self.name = name 482eda14cbcSMatt Macy 483eda14cbcSMatt Macy 484eda14cbcSMatt Macyclass PropertyNotSupported(ZFSError): 485eda14cbcSMatt Macy errno = errno.ENOTSUP 486eda14cbcSMatt Macy message = "Property is not supported in this version" 487eda14cbcSMatt Macy 488eda14cbcSMatt Macy def __init__(self, name): 489eda14cbcSMatt Macy self.name = name 490eda14cbcSMatt Macy 491eda14cbcSMatt Macy 492eda14cbcSMatt Macyclass PropertyInvalid(ZFSError): 493eda14cbcSMatt Macy errno = errno.EINVAL 494eda14cbcSMatt Macy message = "Invalid property or property value" 495eda14cbcSMatt Macy 496eda14cbcSMatt Macy def __init__(self, name): 497eda14cbcSMatt Macy self.name = name 498eda14cbcSMatt Macy 499eda14cbcSMatt Macy 500eda14cbcSMatt Macyclass DatasetTypeInvalid(ZFSError): 501eda14cbcSMatt Macy errno = errno.EINVAL 502eda14cbcSMatt Macy message = "Specified dataset type is unknown" 503eda14cbcSMatt Macy 504eda14cbcSMatt Macy def __init__(self, name): 505eda14cbcSMatt Macy self.name = name 506eda14cbcSMatt Macy 507eda14cbcSMatt Macy 508eda14cbcSMatt Macyclass UnknownCryptCommand(ZFSError): 509eda14cbcSMatt Macy errno = errno.EINVAL 510eda14cbcSMatt Macy message = "Specified crypt command is invalid" 511eda14cbcSMatt Macy 512eda14cbcSMatt Macy def __init__(self, name): 513eda14cbcSMatt Macy self.name = name 514eda14cbcSMatt Macy 515eda14cbcSMatt Macy 516eda14cbcSMatt Macyclass EncryptionKeyNotLoaded(ZFSError): 517eda14cbcSMatt Macy errno = errno.EACCES 518eda14cbcSMatt Macy message = "Encryption key is not currently loaded" 519eda14cbcSMatt Macy 520eda14cbcSMatt Macy 521eda14cbcSMatt Macyclass EncryptionKeyAlreadyLoaded(ZFSError): 522eda14cbcSMatt Macy errno = errno.EEXIST 523eda14cbcSMatt Macy message = "Encryption key is already loaded" 524eda14cbcSMatt Macy 525eda14cbcSMatt Macy 526eda14cbcSMatt Macyclass EncryptionKeyInvalid(ZFSError): 527eda14cbcSMatt Macy errno = errno.EACCES 528eda14cbcSMatt Macy message = "Incorrect encryption key provided" 529eda14cbcSMatt Macy 530eda14cbcSMatt Macy 531eda14cbcSMatt Macyclass ZCPError(ZFSError): 532eda14cbcSMatt Macy errno = None 533eda14cbcSMatt Macy message = None 534eda14cbcSMatt Macy 535eda14cbcSMatt Macy 536eda14cbcSMatt Macyclass ZCPSyntaxError(ZCPError): 537eda14cbcSMatt Macy errno = errno.EINVAL 538eda14cbcSMatt Macy message = "Channel program contains syntax errors" 539eda14cbcSMatt Macy 540eda14cbcSMatt Macy def __init__(self, details): 541eda14cbcSMatt Macy self.details = details 542eda14cbcSMatt Macy 543eda14cbcSMatt Macy 544eda14cbcSMatt Macyclass ZCPRuntimeError(ZCPError): 545eda14cbcSMatt Macy errno = ECHRNG 546eda14cbcSMatt Macy message = "Channel programs encountered a runtime error" 547eda14cbcSMatt Macy 548eda14cbcSMatt Macy def __init__(self, details): 549eda14cbcSMatt Macy self.details = details 550eda14cbcSMatt Macy 551eda14cbcSMatt Macy 552eda14cbcSMatt Macyclass ZCPLimitInvalid(ZCPError): 553eda14cbcSMatt Macy errno = errno.EINVAL 554eda14cbcSMatt Macy message = "Channel program called with invalid limits" 555eda14cbcSMatt Macy 556eda14cbcSMatt Macy 557eda14cbcSMatt Macyclass ZCPTimeout(ZCPError): 558eda14cbcSMatt Macy errno = ETIME 559eda14cbcSMatt Macy message = "Channel program timed out" 560eda14cbcSMatt Macy 561eda14cbcSMatt Macy 562eda14cbcSMatt Macyclass ZCPSpaceError(ZCPError): 563eda14cbcSMatt Macy errno = errno.ENOSPC 564eda14cbcSMatt Macy message = "Channel program exhausted the memory limit" 565eda14cbcSMatt Macy 566eda14cbcSMatt Macy 567eda14cbcSMatt Macyclass ZCPMemoryError(ZCPError): 568eda14cbcSMatt Macy errno = errno.ENOMEM 569eda14cbcSMatt Macy message = "Channel program return value too large" 570eda14cbcSMatt Macy 571eda14cbcSMatt Macy 572eda14cbcSMatt Macyclass ZCPPermissionError(ZCPError): 573eda14cbcSMatt Macy errno = errno.EPERM 574eda14cbcSMatt Macy message = "Channel programs must be run as root" 575eda14cbcSMatt Macy 576eda14cbcSMatt Macy 577eda14cbcSMatt Macyclass CheckpointExists(ZFSError): 578eda14cbcSMatt Macy errno = ZFS_ERR_CHECKPOINT_EXISTS 579eda14cbcSMatt Macy message = "Pool already has a checkpoint" 580eda14cbcSMatt Macy 581eda14cbcSMatt Macy 582eda14cbcSMatt Macyclass CheckpointNotFound(ZFSError): 583eda14cbcSMatt Macy errno = ZFS_ERR_NO_CHECKPOINT 584eda14cbcSMatt Macy message = "Pool does not have a checkpoint" 585eda14cbcSMatt Macy 586eda14cbcSMatt Macy 587eda14cbcSMatt Macyclass CheckpointDiscarding(ZFSError): 588eda14cbcSMatt Macy errno = ZFS_ERR_DISCARDING_CHECKPOINT 589eda14cbcSMatt Macy message = "Pool checkpoint is being discarded" 590eda14cbcSMatt Macy 591eda14cbcSMatt Macy 592eda14cbcSMatt Macyclass DeviceRemovalRunning(ZFSError): 593eda14cbcSMatt Macy errno = ZFS_ERR_DEVRM_IN_PROGRESS 594eda14cbcSMatt Macy message = "A vdev is currently being removed" 595eda14cbcSMatt Macy 596eda14cbcSMatt Macy 597eda14cbcSMatt Macyclass DeviceTooBig(ZFSError): 598eda14cbcSMatt Macy errno = ZFS_ERR_VDEV_TOO_BIG 599eda14cbcSMatt Macy message = "One or more top-level vdevs exceed the maximum vdev size" 600eda14cbcSMatt Macy 601eda14cbcSMatt Macy 602*e716630dSMartin Matuskaclass RaidzExpansionRunning(ZFSError): 603*e716630dSMartin Matuska errno = ZFS_ERR_RAIDZ_EXPAND_IN_PROGRESS 604*e716630dSMartin Matuska message = "A raidz device is currently expanding" 605*e716630dSMartin Matuska 606*e716630dSMartin Matuska 607eda14cbcSMatt Macy# vim: softtabstop=4 tabstop=4 expandtab shiftwidth=4 608