Coverage for manila/exception.py: 99%

578 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2026-02-18 22:19 +0000

1# Copyright 2010 United States Government as represented by the 

2# Administrator of the National Aeronautics and Space Administration. 

3# All Rights Reserved. 

4# 

5# Licensed under the Apache License, Version 2.0 (the "License"); you may 

6# not use this file except in compliance with the License. You may obtain 

7# a copy of the License at 

8# 

9# http://www.apache.org/licenses/LICENSE-2.0 

10# 

11# Unless required by applicable law or agreed to in writing, software 

12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

14# License for the specific language governing permissions and limitations 

15# under the License. 

16 

17"""Manila base exception handling. 

18 

19Includes decorator for re-raising Manila-type exceptions. 

20 

21SHOULD include dedicated exception logging. 

22 

23""" 

24import re 

25 

26from oslo_concurrency import processutils 

27from oslo_config import cfg 

28from oslo_log import log 

29import webob.exc 

30 

31from manila.i18n import _ 

32 

33LOG = log.getLogger(__name__) 

34 

35exc_log_opts = [ 

36 cfg.BoolOpt('fatal_exception_format_errors', 

37 default=False, 

38 help='Whether to make exception message format errors fatal.'), 

39] 

40 

41CONF = cfg.CONF 

42CONF.register_opts(exc_log_opts) 

43 

44 

45ProcessExecutionError = processutils.ProcessExecutionError 

46 

47 

48class ConvertedException(webob.exc.WSGIHTTPException): 

49 def __init__(self, code=400, title="", explanation=""): 

50 self.code = code 

51 self.title = title 

52 self.explanation = explanation 

53 super(ConvertedException, self).__init__() 

54 

55 

56class Error(Exception): 

57 pass 

58 

59 

60class ManilaException(Exception): 

61 """Base Manila Exception 

62 

63 To correctly use this class, inherit from it and define 

64 a 'message' property. That message will get printf'd 

65 with the keyword arguments provided to the constructor. 

66 

67 """ 

68 message = _("An unknown exception occurred.") 

69 code = 500 

70 headers = {} 

71 safe = False 

72 

73 def __init__(self, message=None, detail_data={}, **kwargs): 

74 self.kwargs = kwargs 

75 self.detail_data = detail_data 

76 

77 if 'code' not in self.kwargs: 

78 try: 

79 self.kwargs['code'] = self.code 

80 except AttributeError: 

81 pass 

82 for k, v in self.kwargs.items(): 

83 if isinstance(v, Exception): 

84 self.kwargs[k] = str(v) 

85 

86 if not message: 

87 try: 

88 message = self.message % kwargs 

89 

90 except Exception: 

91 # kwargs doesn't match a variable in the message 

92 # log the issue and the kwargs 

93 LOG.exception('Exception in string format operation.') 

94 for name, value in kwargs.items(): 

95 LOG.error("%(name)s: %(value)s", { 

96 'name': name, 'value': value}) 

97 if CONF.fatal_exception_format_errors: 97 ↛ 98line 97 didn't jump to line 98 because the condition on line 97 was never true

98 raise 

99 else: 

100 # at least get the core message out if something happened 

101 message = self.message 

102 elif isinstance(message, Exception): 

103 message = str(message) 

104 

105 if re.match(r'.*[^\.]\.\.$', message): 

106 message = message[:-1] 

107 self.msg = message 

108 super(ManilaException, self).__init__(message) 

109 

110 

111class NetworkException(ManilaException): 

112 message = _("Exception due to network failure.") 

113 

114 

115class NetworkBindException(ManilaException): 

116 message = _("Exception due to failed port status in binding.") 

117 

118 

119class NetworkBadConfigurationException(NetworkException): 

120 message = _("Bad network configuration: %(reason)s.") 

121 

122 

123class BadConfigurationException(ManilaException): 

124 message = _("Bad configuration: %(reason)s.") 

125 

126 

127class NotAuthorized(ManilaException): 

128 message = _("Not authorized.") 

129 code = 403 

130 

131 

132class AdminRequired(NotAuthorized): 

133 message = _("User does not have admin privileges.") 

134 

135 

136class PolicyNotAuthorized(NotAuthorized): 

137 message = _("Policy doesn't allow %(action)s to be performed.") 

138 

139 

140class Conflict(ManilaException): 

141 message = _("%(err)s") 

142 code = 409 

143 

144 

145class Invalid(ManilaException): 

146 message = _("Unacceptable parameters.") 

147 code = 400 

148 

149 

150class InvalidRequest(Invalid): 

151 message = _("The request is invalid.") 

152 

153 

154class InvalidResults(Invalid): 

155 message = _("The results are invalid.") 

156 

157 

158class InvalidInput(Invalid): 

159 message = _("Invalid input received: %(reason)s.") 

160 

161 

162class InvalidContentType(Invalid): 

163 message = _("Invalid content type %(content_type)s.") 

164 

165 

166class InvalidHost(Invalid): 

167 message = _("Invalid host: %(reason)s") 

168 

169 

170# Cannot be templated as the error syntax varies. 

171# msg needs to be constructed when raised. 

172class InvalidParameterValue(Invalid): 

173 message = _("%(err)s") 

174 

175 

176class InvalidUUID(Invalid): 

177 message = _("%(uuid)s is not a valid uuid.") 

178 

179 

180class InvalidDriverMode(Invalid): 

181 message = _("Invalid driver mode: %(driver_mode)s.") 

182 

183 

184class InvalidAPIVersionString(Invalid): 

185 message = _("API Version String %(version)s is of invalid format. Must " 

186 "be of format MajorNum.MinorNum.") 

187 

188 

189class VersionNotFoundForAPIMethod(Invalid): 

190 message = _("API version %(version)s is not supported on this method.") 

191 

192 

193class InvalidGlobalAPIVersion(Invalid): 

194 message = _("Version %(req_ver)s is not supported by the API. Minimum " 

195 "is %(min_ver)s and maximum is %(max_ver)s.") 

196 

197 

198class InvalidCapacity(Invalid): 

199 message = _("Invalid capacity: %(name)s = %(value)s.") 

200 

201 

202class ValidationError(Invalid): 

203 message = "%(detail)s" 

204 

205 

206class NotFound(ManilaException): 

207 message = _("Resource could not be found.") 

208 code = 404 

209 safe = True 

210 

211 

212class MessageNotFound(NotFound): 

213 message = _("Message %(message_id)s could not be found.") 

214 

215 

216class ResourceLockNotFound(NotFound): 

217 message = _("Resource lock %(lock_id)s could not be found.") 

218 

219 

220class ResourceVisibilityLockExists(ManilaException): 

221 message = _("Resource %(resource_id)s is already locked.") 

222 

223 

224class Found(ManilaException): 

225 message = _("Resource was found.") 

226 code = 302 

227 safe = True 

228 

229 

230class InUse(ManilaException): 

231 message = _("Resource is in use.") 

232 

233 

234class AvailabilityZoneNotFound(NotFound): 

235 message = _("Availability zone %(id)s could not be found.") 

236 

237 

238class ShareNetworkNotFound(NotFound): 

239 message = _("Share network %(share_network_id)s could not be found.") 

240 

241 

242class ShareNetworkSubnetNotFound(NotFound): 

243 message = _("Share network subnet %(share_network_subnet_id)s could not be" 

244 " found.") 

245 

246 

247class ShareNetworkSubnetNotFoundByShareServer(NotFound): 

248 message = _("Share network subnet could not be found by " 

249 "%(share_server_id)s.") 

250 

251 

252class ShareServerNotFound(NotFound): 

253 message = _("Share server %(share_server_id)s could not be found.") 

254 

255 

256class ShareServerNotFoundByFilters(ShareServerNotFound): 

257 message = _("Share server could not be found by " 

258 "filters: %(filters_description)s.") 

259 

260 

261class AllocationsNotFoundForShareServer(NotFound): 

262 message = _("No allocations found for the share server " 

263 "%(share_server_id)s on the subnet.") 

264 

265 

266class InvalidShareNetwork(Invalid): 

267 message = _("Invalid share network: %(reason)s") 

268 

269 

270class ShareServerInUse(InUse): 

271 message = _("Share server %(share_server_id)s is in use.") 

272 

273 

274class ShareServerMigrationError(ManilaException): 

275 message = _("Error in share server migration: %(reason)s") 

276 

277 

278class ShareServerMigrationFailed(ManilaException): 

279 message = _("Share server migration failed: %(reason)s") 

280 

281 

282class InvalidShareServer(Invalid): 

283 message = _("Invalid share server: %(reason)s") 

284 

285 

286class ShareMigrationError(ManilaException): 

287 message = _("Error in share migration: %(reason)s") 

288 

289 

290class ShareMigrationFailed(ManilaException): 

291 message = _("Share migration failed: %(reason)s") 

292 

293 

294class ShareDataCopyFailed(ManilaException): 

295 message = _("Share Data copy failed: %(reason)s") 

296 

297 

298class ShareDataCopyCancelled(ManilaException): 

299 message = _("Copy of contents from source to destination was cancelled.") 

300 

301 

302class ServiceIPNotFound(ManilaException): 

303 message = _("Service IP for instance not found: %(reason)s") 

304 

305 

306class AdminIPNotFound(ManilaException): 

307 message = _("Admin port IP for service instance not found: %(reason)s") 

308 

309 

310class ShareServerNotCreated(ManilaException): 

311 message = _("Share server %(share_server_id)s failed on creation.") 

312 

313 

314class ShareServerNotReady(ManilaException): 

315 message = _("Share server %(share_server_id)s failed to reach '%(state)s' " 

316 "within %(time)s seconds.") 

317 

318 

319class ShareServerBackendDetailsNotFound(NotFound): 

320 message = _("Share server backend details does not exist.") 

321 

322 

323class ServiceNotFound(NotFound): 

324 message = _("Service %(service_id)s could not be found.") 

325 

326 

327class ServiceIsDown(Invalid): 

328 message = _("Service %(service)s is down.") 

329 

330 

331class HostNotFound(NotFound): 

332 message = _("Host %(host)s could not be found.") 

333 

334 

335class SchedulerHostFilterNotFound(NotFound): 

336 message = _("Scheduler host filter %(filter_name)s could not be found.") 

337 

338 

339class SchedulerHostWeigherNotFound(NotFound): 

340 message = _("Scheduler host weigher %(weigher_name)s could not be found.") 

341 

342 

343class HostBinaryNotFound(NotFound): 

344 message = _("Could not find binary %(binary)s on host %(host)s.") 

345 

346 

347class TransferNotFound(NotFound): 

348 message = _("Transfer %(transfer_id)s could not be found.") 

349 

350 

351class InvalidReservationExpiration(Invalid): 

352 message = _("Invalid reservation expiration %(expire)s.") 

353 

354 

355class InvalidQuotaValue(Invalid): 

356 message = _("Change would make usage less than 0 for the following " 

357 "resources: %(unders)s.") 

358 

359 

360class QuotaNotFound(NotFound): 

361 message = _("Quota could not be found.") 

362 

363 

364class QuotaExists(ManilaException): 

365 message = _("Quota exists for project %(project_id)s, " 

366 "resource %(resource)s.") 

367 

368 

369class QuotaResourceUnknown(QuotaNotFound): 

370 message = _("Unknown quota resources %(unknown)s.") 

371 

372 

373class ProjectUserQuotaNotFound(QuotaNotFound): 

374 message = _("Quota for user %(user_id)s in project %(project_id)s " 

375 "could not be found.") 

376 

377 

378class ProjectShareTypeQuotaNotFound(QuotaNotFound): 

379 message = _("Quota for share_type %(share_type)s in " 

380 "project %(project_id)s could not be found.") 

381 

382 

383class ProjectQuotaNotFound(QuotaNotFound): 

384 message = _("Quota for project %(project_id)s could not be found.") 

385 

386 

387class QuotaClassNotFound(QuotaNotFound): 

388 message = _("Quota class %(class_name)s could not be found.") 

389 

390 

391class QuotaUsageNotFound(QuotaNotFound): 

392 message = _("Quota usage for project %(project_id)s could not be found.") 

393 

394 

395class ReservationNotFound(QuotaNotFound): 

396 message = _("Quota reservation %(uuid)s could not be found.") 

397 

398 

399class OverQuota(ManilaException): 

400 message = _("Quota exceeded for resources: %(overs)s.") 

401 

402 

403class MigrationNotFound(NotFound): 

404 message = _("Migration %(migration_id)s could not be found.") 

405 

406 

407class MigrationNotFoundByStatus(MigrationNotFound): 

408 message = _("Migration not found for instance %(instance_id)s " 

409 "with status %(status)s.") 

410 

411 

412class FileNotFound(NotFound): 

413 message = _("File %(file_path)s could not be found.") 

414 

415 

416class MigrationError(ManilaException): 

417 message = _("Migration error: %(reason)s.") 

418 

419 

420class MalformedRequestBody(ManilaException): 

421 message = _("Malformed message body: %(reason)s.") 

422 

423 

424class ConfigNotFound(NotFound): 

425 message = _("Could not find config at %(path)s.") 

426 

427 

428class PasteAppNotFound(NotFound): 

429 message = _("Could not load paste app '%(name)s' from %(path)s.") 

430 

431 

432class NoValidHost(ManilaException): 

433 message = _("No valid host was found. %(reason)s.") 

434 

435 

436class WillNotSchedule(ManilaException): 

437 message = _("Host %(host)s is not up or doesn't exist.") 

438 

439 

440class QuotaError(ManilaException): 

441 message = _("Quota exceeded: code=%(code)s.") 

442 code = 413 

443 headers = {'Retry-After': '0'} 

444 safe = True 

445 

446 

447class ShareSizeExceedsAvailableQuota(QuotaError): 

448 message = _( 

449 "Requested share exceeds allowed project/user or share type " 

450 "gigabytes quota.") 

451 

452 

453class SnapshotSizeExceedsAvailableQuota(QuotaError): 

454 message = _( 

455 "Requested snapshot exceeds allowed project/user or share type " 

456 "gigabytes quota.") 

457 

458 

459class ShareSizeExceedsLimit(QuotaError): 

460 message = _( 

461 "Requested share size %(size)d is larger than " 

462 "maximum allowed limit %(limit)d.") 

463 

464 

465class ShareLimitExceeded(QuotaError): 

466 message = _( 

467 "Maximum number of shares allowed (%(allowed)d) either per " 

468 "project/user or share type quota is exceeded.") 

469 

470 

471class SnapshotLimitExceeded(QuotaError): 

472 message = _( 

473 "Maximum number of snapshots allowed (%(allowed)d) either per " 

474 "project/user or share type quota is exceeded.") 

475 

476 

477class ShareNetworksLimitExceeded(QuotaError): 

478 message = _("Maximum number of share-networks " 

479 "allowed (%(allowed)d) exceeded.") 

480 

481 

482class ShareGroupsLimitExceeded(QuotaError): 

483 message = _( 

484 "Maximum number of allowed share-groups is exceeded.") 

485 

486 

487class ShareGroupSnapshotsLimitExceeded(QuotaError): 

488 message = _( 

489 "Maximum number of allowed share-group-snapshots is exceeded.") 

490 

491 

492class ShareReplicasLimitExceeded(QuotaError): 

493 message = _( 

494 "Maximum number of allowed share-replicas is exceeded.") 

495 

496 

497class ShareReplicaSizeExceedsAvailableQuota(QuotaError): 

498 message = _( 

499 "Requested share replica exceeds allowed project/user or share type " 

500 "gigabytes quota.") 

501 

502 

503class EncryptionKeysLimitExceeded(QuotaError): 

504 message = _( 

505 "Maximum number of allowed encryption keys is exceeded.") 

506 

507 

508class GlusterfsException(ManilaException): 

509 message = _("Unknown Gluster exception.") 

510 

511 

512class InvalidShare(Invalid): 

513 message = _("Invalid share: %(reason)s.") 

514 

515 

516class InvalidAuthKey(Invalid): 

517 message = _("Invalid auth key: %(reason)s") 

518 

519 

520class ShareBusyException(Invalid): 

521 message = _("Share is busy with an active task: %(reason)s.") 

522 

523 

524class InvalidShareInstance(Invalid): 

525 message = _("Invalid share instance: %(reason)s.") 

526 

527 

528class ManageInvalidShare(InvalidShare): 

529 message = _("Manage existing share failed due to " 

530 "invalid share: %(reason)s") 

531 

532 

533class ManageShareServerError(ManilaException): 

534 message = _("Manage existing share server failed due to: %(reason)s") 

535 

536 

537class UnmanageInvalidShare(InvalidShare): 

538 message = _("Unmanage existing share failed due to " 

539 "invalid share: %(reason)s") 

540 

541 

542class PortLimitExceeded(QuotaError): 

543 message = _("Maximum number of ports exceeded.") 

544 

545 

546class IpAddressGenerationFailureClient(ManilaException): 

547 message = _("No free IP addresses available in neutron subnet.") 

548 

549 

550class ShareAccessExists(ManilaException): 

551 message = _("Share access %(access_type)s:%(access)s exists.") 

552 

553 

554class ShareAccessMetadataNotFound(NotFound): 

555 message = _("Share access rule metadata does not exist.") 

556 

557 

558class ShareSnapshotAccessExists(InvalidInput): 

559 message = _("Share snapshot access %(access_type)s:%(access)s exists.") 

560 

561 

562class InvalidSnapshot(Invalid): 

563 message = _("Invalid snapshot: %(reason)s") 

564 

565 

566class InvalidSnapshotAccess(Invalid): 

567 message = _("Invalid access rule: %(reason)s") 

568 

569 

570class InvalidShareAccess(Invalid): 

571 message = _("Invalid access rule: %(reason)s") 

572 

573 

574class InvalidShareAccessLevel(Invalid): 

575 message = _("Invalid or unsupported share access level: %(level)s.") 

576 

577 

578class InvalidShareAccessType(Invalid): 

579 message = _("Invalid or unsupported share access type: %(type)s.") 

580 

581 

582class DriverCannotTransferShareWithRules(ManilaException): 

583 message = _("Driver failed to transfer share with rules.") 

584 

585 

586class ShareBackendException(ManilaException): 

587 message = _("Share backend error: %(msg)s.") 

588 

589 

590class OperationNotSupportedByDriverMode(ManilaException): 

591 message = _("The share driver mode does not support this operation.") 

592 

593 

594class RequirementMissing(ManilaException): 

595 message = _("Requirement %(req)s is not installed.") 

596 

597 

598class ExportLocationNotFound(NotFound): 

599 message = _("Export location %(uuid)s could not be found.") 

600 

601 

602class ShareNotFound(NotFound): 

603 message = _("Share %(share_id)s could not be found.") 

604 

605 

606class ShareInstanceNotFound(NotFound): 

607 message = _("Share instance %(share_instance_id)s could not be found.") 

608 

609 

610class ShareSnapshotNotFound(NotFound): 

611 message = _("Snapshot %(snapshot_id)s could not be found.") 

612 

613 

614class ShareSnapshotInstanceNotFound(NotFound): 

615 message = _("Snapshot instance %(instance_id)s could not be found.") 

616 

617 

618class ShareSnapshotNotSupported(ManilaException): 

619 message = _("Share %(share_name)s does not support snapshots.") 

620 

621 

622class ShareGroupSnapshotNotSupported(ManilaException): 

623 message = _("Share group %(share_group)s does not support snapshots.") 

624 

625 

626class ShareSnapshotIsBusy(ManilaException): 

627 message = _("Deleting snapshot %(snapshot_name)s that has " 

628 "dependent shares.") 

629 

630 

631class InvalidShareSnapshot(Invalid): 

632 message = _("Invalid share snapshot: %(reason)s.") 

633 

634 

635class InvalidShareSnapshotInstance(Invalid): 

636 message = _("Invalid share snapshot instance: %(reason)s.") 

637 

638 

639class ManageInvalidShareSnapshot(InvalidShareSnapshot): 

640 message = _("Manage existing share snapshot failed due to " 

641 "invalid share snapshot: %(reason)s.") 

642 

643 

644class UnmanageInvalidShareSnapshot(InvalidShareSnapshot): 

645 message = _("Unmanage existing share snapshot failed due to " 

646 "invalid share snapshot: %(reason)s.") 

647 

648 

649class MetadataItemNotFound(NotFound): 

650 message = _("Metadata item is not found.") 

651 

652 

653class InvalidMetadata(Invalid): 

654 message = _("Invalid metadata.") 

655 

656 

657class InvalidMetadataSize(Invalid): 

658 message = _("Invalid metadata size.") 

659 

660 

661class SecurityServiceNotFound(NotFound): 

662 message = _("Security service %(security_service_id)s could not be found.") 

663 

664 

665class InvalidSecurityService(Invalid): 

666 message = _("Invalid security service: %(reason)s") 

667 

668 

669class ShareNetworkSecurityServiceAssociationError(ManilaException): 

670 message = _("Failed to associate share network %(share_network_id)s" 

671 " and security service %(security_service_id)s: %(reason)s.") 

672 

673 

674class ShareNetworkSecurityServiceDissociationError(ManilaException): 

675 message = _("Failed to dissociate share network %(share_network_id)s" 

676 " and security service %(security_service_id)s: %(reason)s.") 

677 

678 

679class SecurityServiceFailedAuth(ManilaException): 

680 message = _("Failed to authenticate user against security service.") 

681 

682 

683class InvalidVolume(Invalid): 

684 message = _("Invalid volume.") 

685 

686 

687class InvalidShareType(Invalid): 

688 message = _("Invalid share type: %(reason)s.") 

689 

690 

691class InvalidShareGroupType(Invalid): 

692 message = _("Invalid share group type: %(reason)s.") 

693 

694 

695class InvalidExtraSpec(Invalid): 

696 message = _("Invalid extra_spec: %(reason)s.") 

697 

698 

699class VolumeNotFound(NotFound): 

700 message = _("Volume %(volume_id)s could not be found.") 

701 

702 

703class VolumeSnapshotNotFound(NotFound): 

704 message = _("Snapshot %(snapshot_id)s could not be found.") 

705 

706 

707class ShareTypeNotFound(NotFound): 

708 message = _("Share type %(share_type_id)s could not be found.") 

709 

710 

711class ShareGroupTypeNotFound(NotFound): 

712 message = _("Share group type %(type_id)s could not be found.") 

713 

714 

715class ShareTypeAccessNotFound(NotFound): 

716 message = _("Share type access not found for %(share_type_id)s / " 

717 "%(project_id)s combination.") 

718 

719 

720class ShareGroupTypeAccessNotFound(NotFound): 

721 message = _("Share group type access not found for %(type_id)s / " 

722 "%(project_id)s combination.") 

723 

724 

725class ShareTypeNotFoundByName(ShareTypeNotFound): 

726 message = _("Share type with name %(share_type_name)s " 

727 "could not be found.") 

728 

729 

730class ShareGroupTypeNotFoundByName(ShareTypeNotFound): 

731 message = _("Share group type with name %(type_name)s " 

732 "could not be found.") 

733 

734 

735class ShareTypeExtraSpecsNotFound(NotFound): 

736 message = _("Share Type %(share_type_id)s has no extra specs with " 

737 "key %(extra_specs_key)s.") 

738 

739 

740class ShareGroupTypeSpecsNotFound(NotFound): 

741 message = _("Share group type %(type_id)s has no group specs with " 

742 "key %(specs_key)s.") 

743 

744 

745class ShareTypeInUse(ManilaException): 

746 message = _("Share Type %(share_type_id)s deletion is not allowed while " 

747 "shares or share group types are associated with the type.") 

748 

749 

750class IPAddressInUse(InUse): 

751 message = _("IP address %(ip)s is already used.") 

752 

753 

754class ShareGroupTypeInUse(ManilaException): 

755 message = _("Share group Type %(type_id)s deletion is not allowed " 

756 "with groups present with the type.") 

757 

758 

759class ShareTypeExists(ManilaException): 

760 message = _("Share Type %(id)s already exists.") 

761 

762 

763class ShareTypeDoesNotExist(NotFound): 

764 message = _("Share Type %(share_type)s does not exist.") 

765 

766 

767class DefaultShareTypeNotConfigured(NotFound): 

768 message = _("No default share type is configured. Either configure a " 

769 "default share type or explicitly specify a share type.") 

770 

771 

772class ShareGroupTypeExists(ManilaException): 

773 message = _("Share group type %(type_id)s already exists.") 

774 

775 

776class ShareTypeAccessExists(ManilaException): 

777 message = _("Share type access for %(share_type_id)s / " 

778 "%(project_id)s combination already exists.") 

779 

780 

781class ShareGroupTypeAccessExists(ManilaException): 

782 message = _("Share group type access for %(type_id)s / " 

783 "%(project_id)s combination already exists.") 

784 

785 

786class ShareTypeCreateFailed(ManilaException): 

787 message = _("Cannot create share_type with " 

788 "name %(name)s and specs %(extra_specs)s.") 

789 

790 

791class ShareTypeUpdateFailed(ManilaException): 

792 message = _("Cannot update share_type %(id)s.") 

793 

794 

795class ManilaBarbicanACLError(ManilaException): 

796 message = _("Failed while communicating to Barbican. " 

797 "Please check the provided credentials .") 

798 

799 

800class ManilaBarbicanAppCredsError(ManilaException): 

801 message = _("Error occured while dealing with barbican for App Creds.") 

802 

803 

804class ShareGroupTypeCreateFailed(ManilaException): 

805 message = _("Cannot create share group type with " 

806 "name %(name)s and specs %(group_specs)s.") 

807 

808 

809class ManageExistingShareTypeMismatch(ManilaException): 

810 message = _("Manage existing share failed due to share type mismatch: " 

811 "%(reason)s") 

812 

813 

814class ShareExtendingError(ManilaException): 

815 message = _("Share %(share_id)s could not be extended due to error " 

816 "in the driver: %(reason)s") 

817 

818 

819class ShareShrinkingError(ManilaException): 

820 message = _("Share %(share_id)s could not be shrunk due to error " 

821 "in the driver: %(reason)s") 

822 

823 

824class ShareShrinkingPossibleDataLoss(ManilaException): 

825 message = _("Share %(share_id)s could not be shrunk due to " 

826 "possible data loss") 

827 

828 

829class InstanceNotFound(NotFound): 

830 message = _("Instance %(instance_id)s could not be found.") 

831 

832 

833class BridgeDoesNotExist(ManilaException): 

834 message = _("Bridge %(bridge)s does not exist.") 

835 

836 

837class ServiceInstanceException(ManilaException): 

838 message = _("Exception in service instance manager occurred.") 

839 

840 

841class ServiceInstanceUnavailable(ServiceInstanceException): 

842 message = _("Service instance is not available.") 

843 

844 

845class StorageResourceException(ManilaException): 

846 message = _("Storage resource exception.") 

847 

848 

849class StorageResourceNotFound(StorageResourceException): 

850 message = _("Storage resource %(name)s not found.") 

851 code = 404 

852 

853 

854class SnapshotResourceNotFound(StorageResourceNotFound): 

855 message = _("Snapshot %(name)s not found.") 

856 

857 

858class SnapshotUnavailable(StorageResourceException): 

859 message = _("Snapshot %(name)s info not available.") 

860 

861 

862class NetAppException(ManilaException): 

863 message = _("Exception due to NetApp failure.") 

864 

865 

866class NetAppBusyAggregateForFlexGroupException(ManilaException): 

867 message = _("Exception due to an aggregate being busy while trying to " 

868 "provision the FlexGroup.") 

869 

870 

871class VserverNotFound(NetAppException): 

872 message = _("Vserver %(vserver)s not found.") 

873 

874 

875class VserverNotSpecified(NetAppException): 

876 message = _("Vserver not specified.") 

877 

878 

879class VserverNotReady(NetAppException): 

880 message = _("Vserver %(vserver)s is not ready yet.") 

881 

882 

883class EMCPowerMaxXMLAPIError(Invalid): 

884 message = _("%(err)s") 

885 

886 

887class EMCPowerMaxLockRequiredException(ManilaException): 

888 message = _("Unable to acquire lock(s).") 

889 

890 

891class EMCPowerMaxInvalidMoverID(ManilaException): 

892 message = _("Invalid mover or vdm %(id)s.") 

893 

894 

895class EMCVnxXMLAPIError(Invalid): 

896 message = _("%(err)s") 

897 

898 

899class EMCVnxLockRequiredException(ManilaException): 

900 message = _("Unable to acquire lock(s).") 

901 

902 

903class EMCVnxInvalidMoverID(ManilaException): 

904 message = _("Invalid mover or vdm %(id)s.") 

905 

906 

907class EMCUnityError(ShareBackendException): 

908 message = _("%(err)s") 

909 

910 

911class HPE3ParInvalidClient(Invalid): 

912 message = _("%(err)s") 

913 

914 

915class HPE3ParInvalid(Invalid): 

916 message = _("%(err)s") 

917 

918 

919class HPE3ParUnexpectedError(ManilaException): 

920 message = _("%(err)s") 

921 

922 

923class GPFSException(ManilaException): 

924 message = _("GPFS exception occurred.") 

925 

926 

927class GPFSGaneshaException(ManilaException): 

928 message = _("GPFS Ganesha exception occurred.") 

929 

930 

931class GaneshaCommandFailure(ProcessExecutionError): 

932 _description = _("Ganesha management command failed.") 

933 

934 def __init__(self, **kw): 

935 if 'description' not in kw: 935 ↛ 937line 935 didn't jump to line 937 because the condition on line 935 was always true

936 kw['description'] = self._description 

937 super(GaneshaCommandFailure, self).__init__(**kw) 

938 

939 

940class InvalidSqliteDB(Invalid): 

941 message = _("Invalid Sqlite database.") 

942 

943 

944class SSHException(ManilaException): 

945 message = _("Exception in SSH protocol negotiation or logic.") 

946 

947 

948class HDFSException(ManilaException): 

949 message = _("HDFS exception occurred!") 

950 

951 

952class MapRFSException(ManilaException): 

953 message = _("MapRFS exception occurred: %(msg)s") 

954 

955 

956class ZFSonLinuxException(ManilaException): 

957 message = _("ZFSonLinux exception occurred: %(msg)s") 

958 

959 

960class QBException(ManilaException): 

961 message = _("Quobyte exception occurred: %(msg)s") 

962 

963 

964class QBRpcException(ManilaException): 

965 """Quobyte backend specific exception.""" 

966 message = _("Quobyte JsonRpc call to backend raised " 

967 "an exception: %(result)s, Quobyte error" 

968 " code %(qbcode)s") 

969 

970 

971class SSHInjectionThreat(ManilaException): 

972 message = _("SSH command injection detected: %(command)s") 

973 

974 

975class HNASBackendException(ManilaException): 

976 message = _("HNAS Backend Exception: %(msg)s") 

977 

978 

979class HNASConnException(ManilaException): 

980 message = _("HNAS Connection Exception: %(msg)s") 

981 

982 

983class HNASSSCIsBusy(ManilaException): 

984 message = _("HNAS SSC is busy and cannot execute the command: %(msg)s") 

985 

986 

987class HNASSSCContextChange(ManilaException): 

988 message = _("HNAS SSC Context has been changed unexpectedly: %(msg)s") 

989 

990 

991class HNASDirectoryNotEmpty(ManilaException): 

992 message = _("HNAS Directory is not empty: %(msg)s") 

993 

994 

995class HNASItemNotFoundException(StorageResourceNotFound): 

996 message = _("HNAS Item Not Found Exception: %(msg)s") 

997 

998 

999class HNASNothingToCloneException(ManilaException): 

1000 message = _("HNAS Nothing To Clone Exception: %(msg)s") 

1001 

1002 

1003# ShareGroup 

1004class ShareGroupNotFound(NotFound): 

1005 message = _("Share group %(share_group_id)s could not be found.") 

1006 

1007 

1008class ShareGroupSnapshotNotFound(NotFound): 

1009 message = _( 

1010 "Share group snapshot %(share_group_snapshot_id)s could not be found.") 

1011 

1012 

1013class ShareGroupSnapshotMemberNotFound(NotFound): 

1014 message = _("Share group snapshot member %(member_id)s could not be " 

1015 "found.") 

1016 

1017 

1018class InvalidShareGroup(Invalid): 

1019 message = _("Invalid share group: %(reason)s") 

1020 

1021 

1022class InvalidShareGroupSnapshot(Invalid): 

1023 message = _("Invalid share group snapshot: %(reason)s") 

1024 

1025 

1026class DriverNotInitialized(ManilaException): 

1027 message = _("Share driver '%(driver)s' not initialized.") 

1028 

1029 

1030class ShareResourceNotFound(StorageResourceNotFound): 

1031 message = _("Share id %(share_id)s could not be found " 

1032 "in storage backend.") 

1033 

1034 

1035class ShareUmountException(ManilaException): 

1036 message = _("Failed to unmount share: %(reason)s") 

1037 

1038 

1039class ShareMountException(ManilaException): 

1040 message = _("Failed to mount share: %(reason)s") 

1041 

1042 

1043class ShareCopyDataException(ManilaException): 

1044 message = _("Failed to copy data: %(reason)s") 

1045 

1046 

1047# Replication 

1048class ReplicationException(ManilaException): 

1049 message = _("Unable to perform a replication action: %(reason)s.") 

1050 

1051 

1052class ShareReplicaNotFound(NotFound): 

1053 message = _("Share Replica %(replica_id)s could not be found.") 

1054 

1055 

1056# Tegile Storage drivers 

1057class TegileAPIException(ShareBackendException): 

1058 message = _("Unexpected response from Tegile IntelliFlash API: " 

1059 "%(response)s") 

1060 

1061 

1062class StorageCommunicationException(ShareBackendException): 

1063 message = _("Could not communicate with storage array.") 

1064 

1065 

1066class EvaluatorParseException(ManilaException): 

1067 message = _("Error during evaluator parsing: %(reason)s") 

1068 

1069 

1070# Hitachi Scaleout Platform driver 

1071class HSPBackendException(ShareBackendException): 

1072 message = _("HSP Backend Exception: %(msg)s") 

1073 

1074 

1075class HSPTimeoutException(ShareBackendException): 

1076 message = _("HSP Timeout Exception: %(msg)s") 

1077 

1078 

1079class HSPItemNotFoundException(ShareBackendException): 

1080 message = _("HSP Item Not Found Exception: %(msg)s") 

1081 

1082 

1083class NexentaException(ShareBackendException): 

1084 message = _("Exception due to Nexenta failure. %(reason)s") 

1085 

1086 

1087# Tooz locking 

1088class LockCreationFailed(ManilaException): 

1089 message = _('Unable to create lock. Coordination backend not started.') 

1090 

1091 

1092class LockingFailed(ManilaException): 

1093 message = _('Lock acquisition failed.') 

1094 

1095 

1096# Ganesha library 

1097class GaneshaException(ManilaException): 

1098 message = _("Unknown NFS-Ganesha library exception.") 

1099 

1100 

1101# Infortrend Storage driver 

1102class InfortrendCLIException(ShareBackendException): 

1103 message = _("Infortrend CLI exception: %(err)s " 

1104 "Return Code: %(rc)s, Output: %(out)s") 

1105 

1106 

1107class InfortrendNASException(ShareBackendException): 

1108 message = _("Infortrend NAS exception: %(err)s") 

1109 

1110 

1111# Zadara storage driver 

1112class ZadaraUnknownCmd(ShareBackendException): 

1113 message = _("Unknown or unsupported command %(cmd)s") 

1114 

1115 

1116class ZadaraSessionRequestException(ShareBackendException): 

1117 message = _("%(msg)s") 

1118 

1119 

1120class ZadaraBadHTTPResponseStatus(ShareBackendException): 

1121 message = _("Bad HTTP response status %(status)s") 

1122 

1123 

1124class ZadaraFailedCmdWithDump(ShareBackendException): 

1125 message = _("Operation failed with status=%(status)s. Full dump: %(data)s") 

1126 

1127 

1128class ZadaraVPSANoActiveController(ShareBackendException): 

1129 message = _("Unable to find any active VPSA controller") 

1130 

1131 

1132class ZadaraServerCreateFailure(ShareBackendException): 

1133 message = _("Unable to create server object for initiator %(name)s") 

1134 

1135 

1136class ZadaraAttachmentsNotFound(ShareBackendException): 

1137 message = _("Failed to retrieve attachments for volume %(name)s") 

1138 

1139 

1140class ZadaraManilaInvalidAccessKey(ShareBackendException): 

1141 message = _("Invalid VPSA access key") 

1142 

1143 

1144class ZadaraVPSAVolumeShareFailed(ShareBackendException): 

1145 message = _("Failed to create VPSA backend share. Error: %(error)s") 

1146 

1147 

1148class ZadaraInvalidShareAccessType(ShareBackendException): 

1149 message = _("Only ip access type allowed for the Zadara manila share.") 

1150 

1151 

1152class ZadaraShareNotFound(ShareBackendException): 

1153 message = _("Share %(name)s could not be found.") 

1154 

1155 

1156class ZadaraExtendShareFailed(ShareBackendException): 

1157 message = _("Failed to extend VPSA backend share. Error: %(error)s") 

1158 

1159 

1160class ZadaraInvalidProtocol(ShareBackendException): 

1161 message = _("The type of protocol %(protocol_type)s for Zadara " 

1162 "manila driver is not supported. Only NFS or CIFS " 

1163 "protocol is supported.") 

1164 

1165 

1166class ZadaraShareNotValid(ShareBackendException): 

1167 message = _("Share %(name)s is not valid.") 

1168 

1169 

1170class ZadaraVPSASnapshotCreateFailed(ShareBackendException): 

1171 message = _("Failed to create VPSA share %(name)s snapshot. " 

1172 "Error: %(error)s") 

1173 

1174 

1175class ZadaraVPSASnapshotManageFailed(ShareBackendException): 

1176 message = _("Failed to manage VPSA share snapshot with id %(snap_id)s. " 

1177 "Error: %(error)s") 

1178 

1179 

1180class ZadaraServerNotFound(NotFound): 

1181 message = _("Unable to find server object for initiator %(name)s") 

1182 

1183 

1184# Macrosan Storage driver 

1185class MacrosanBackendExeption(ShareBackendException): 

1186 message = _("Macrosan backend exception: %(reason)s") 

1187 

1188 

1189# Backup 

1190class BackupException(ManilaException): 

1191 message = _("Unable to perform a backup action: %(reason)s.") 

1192 

1193 

1194class InvalidBackup(Invalid): 

1195 message = _("Invalid backup: %(reason)s.") 

1196 

1197 

1198class BackupLimitExceeded(QuotaError): 

1199 message = _("Maximum number of backups allowed (%(allowed)d) exceeded.") 

1200 

1201 

1202class ShareBackupNotFound(NotFound): 

1203 message = _("Backup %(backup_id)s could not be found.") 

1204 

1205 

1206class ShareBackupSizeExceedsAvailableQuota(QuotaError): 

1207 message = _("Requested backup exceeds allowed Backup gigabytes " 

1208 "quota. Requested %(requested)sG, quota is %(quota)sG and " 

1209 "%(consumed)sG has been consumed.") 

1210 

1211 

1212class NetappActiveIQWeigherRequiredParameter(ManilaException): 

1213 message = _("%(config)s configuration of the NetAppActiveIQ weigher " 

1214 "must be set.") 

1215 

1216 

1217# Vastdata Storage driver 

1218class VastApiException(ManilaException): 

1219 message = _("Rest api error: %(reason)s.") 

1220 

1221 

1222class VastApiRetry(ManilaException): 

1223 message = _("Rest api retry: %(reason)s.") 

1224 

1225 

1226class VastShareNotFound(ShareBackendException): 

1227 message = _("Share %(name)s could not be found.") 

1228 

1229 

1230class VastDriverException(ShareBackendException): 

1231 message = _("Vast driver error: %(reason)s.")