Coverage for manila/share/drivers/dell_emc/plugins/base.py: 86%

35 statements  

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

1# Copyright (c) 2014 EMC Corporation. 

2# All Rights Reserved. 

3# 

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

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

6# a copy of the License at 

7# 

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

9# 

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

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

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

13# License for the specific language governing permissions and limitations 

14# under the License. 

15"""EMC Share Driver Base Plugin API """ 

16 

17import abc 

18 

19 

20class StorageConnection(metaclass=abc.ABCMeta): 

21 """Subclasses should implement storage backend specific functionality.""" 

22 

23 def __init__(self, *args, **kwargs): 

24 # NOTE(vponomaryov): redefine 'driver_handles_share_servers' within 

25 # plugin. 

26 self.driver_handles_share_servers = None 

27 self.dhss_mandatory_security_service_association = {} 

28 

29 @abc.abstractmethod 

30 def create_share(self, context, share, share_server): 

31 """Is called to create share.""" 

32 

33 @abc.abstractmethod 

34 def create_snapshot(self, context, snapshot, share_server): 

35 """Is called to create snapshot.""" 

36 

37 @abc.abstractmethod 

38 def delete_share(self, context, share, share_server): 

39 """Is called to remove share.""" 

40 

41 @abc.abstractmethod 

42 def delete_snapshot(self, context, snapshot, share_server): 

43 """Is called to remove snapshot.""" 

44 

45 @abc.abstractmethod 

46 def ensure_share(self, context, share, share_server): 

47 """Invoked to ensure that share is exported.""" 

48 

49 @abc.abstractmethod 

50 def extend_share(self, share, new_size, share_server): 

51 """Invoked to extend share.""" 

52 

53 @abc.abstractmethod 

54 def allow_access(self, context, share, access, share_server): 

55 """Allow access to the share.""" 

56 

57 @abc.abstractmethod 

58 def deny_access(self, context, share, access, share_server): 

59 """Deny access to the share.""" 

60 

61 def update_access(self, context, share, access_rules, add_rules, 

62 delete_rules, share_server=None): 

63 """Update access rules for given share.""" 

64 raise NotImplementedError() 

65 

66 def raise_connect_error(self): 

67 """Check for setup error.""" 

68 pass 

69 

70 def connect(self, emc_share_driver, context): 

71 """Any initialization the share driver does while starting.""" 

72 pass 

73 

74 def update_share_stats(self, stats_dict): 

75 """Add key/values to stats_dict.""" 

76 pass 

77 

78 def get_network_allocations_number(self): 

79 """Returns number of network allocations for creating VIFs.""" 

80 return 0 

81 

82 @abc.abstractmethod 

83 def setup_server(self, network_info, metadata=None): 

84 """Set up and configure share server with given network parameters.""" 

85 

86 @abc.abstractmethod 

87 def teardown_server(self, server_details, security_services=None): 

88 """Teardown share server."""