Coverage for manila/share/drivers/huawei/base.py: 100%

49 statements  

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

1# Copyright (c) 2015 Huawei Technologies Co., Ltd. 

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 

16"""Abstract base class to work with share.""" 

17import abc 

18 

19 

20class HuaweiBase(metaclass=abc.ABCMeta): 

21 """Interface to work with share.""" 

22 

23 def __init__(self, configuration): 

24 """Do initialization.""" 

25 self.configuration = configuration 

26 

27 @abc.abstractmethod 

28 def create_share(self, share, share_server): 

29 """Is called to create share.""" 

30 

31 @abc.abstractmethod 

32 def create_snapshot(self, snapshot, share_server): 

33 """Is called to create snapshot.""" 

34 

35 @abc.abstractmethod 

36 def delete_share(self, share, share_server): 

37 """Is called to remove share.""" 

38 

39 @abc.abstractmethod 

40 def delete_snapshot(self, snapshot, share_server): 

41 """Is called to remove snapshot.""" 

42 

43 @abc.abstractmethod 

44 def allow_access(self, share, access, share_server): 

45 """Allow access to the share.""" 

46 

47 @abc.abstractmethod 

48 def deny_access(self, share, access, share_server): 

49 """Deny access to the share.""" 

50 

51 @abc.abstractmethod 

52 def ensure_share(self, share, share_server=None): 

53 """Ensure that share is exported.""" 

54 

55 @abc.abstractmethod 

56 def update_access(self, share, access_rules, add_rules, 

57 delete_rules, update_rules, share_server): 

58 """Update access rules list.""" 

59 

60 @abc.abstractmethod 

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

62 """Extends size of existing share.""" 

63 

64 @abc.abstractmethod 

65 def create_share_from_snapshot(self, share, snapshot, 

66 share_server=None, parent_share=None): 

67 """Create share from snapshot.""" 

68 

69 @abc.abstractmethod 

70 def shrink_share(self, share, new_size, share_server): 

71 """Shrinks size of existing share.""" 

72 

73 @abc.abstractmethod 

74 def manage_existing(self, share, driver_options): 

75 """Manage existing share.""" 

76 

77 @abc.abstractmethod 

78 def manage_existing_snapshot(self, snapshot, driver_options): 

79 """Manage existing snapshot.""" 

80 

81 @abc.abstractmethod 

82 def get_network_allocations_number(self): 

83 """Get number of network interfaces to be created.""" 

84 

85 @abc.abstractmethod 

86 def get_pool(self, share): 

87 """Return pool name where the share resides on.""" 

88 

89 def update_share_stats(self, stats_dict): 

90 """Retrieve stats info from share group.""" 

91 

92 @abc.abstractmethod 

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

94 """Set up share server with given network parameters.""" 

95 

96 @abc.abstractmethod 

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

98 """Teardown share server.""" 

99 

100 @abc.abstractmethod 

101 def create_replica(self, context, replica_list, new_replica, 

102 access_rules, replica_snapshots, share_server=None): 

103 """Replicate the active replica to a new replica on this backend.""" 

104 

105 @abc.abstractmethod 

106 def update_replica_state(self, context, replica_list, replica, 

107 access_rules, replica_snapshots, 

108 share_server=None): 

109 """Update the replica_state of a replica.""" 

110 

111 @abc.abstractmethod 

112 def promote_replica(self, context, replica_list, replica, access_rules, 

113 share_server=None, quiesce_wait_time=None): 

114 """Promote a replica to 'active' replica state.""" 

115 

116 @abc.abstractmethod 

117 def delete_replica(self, context, replica_list, replica_snapshots, 

118 replica, share_server=None): 

119 """Delete a replica.""" 

120 

121 @abc.abstractmethod 

122 def revert_to_snapshot(self, context, snapshot, share_access_rules, 

123 snapshot_access_rules, share_server=None): 

124 """Revert a snapshot."""