Revision 34e54ebc lib/config.py
b/lib/config.py | ||
---|---|---|
149 | 149 |
raise errors.ConfigurationError("Can't generate unique DRBD secret") |
150 | 150 |
return secret |
151 | 151 |
|
152 |
def _ComputeAllLVs(self):
|
|
152 |
def _AllLVs(self): |
|
153 | 153 |
"""Compute the list of all LVs. |
154 | 154 |
|
155 | 155 |
""" |
... | ... | |
160 | 160 |
lvnames.update(lv_list) |
161 | 161 |
return lvnames |
162 | 162 |
|
163 |
def _AllIDs(self, include_temporary): |
|
164 |
"""Compute the list of all UUIDs and names we have. |
|
165 |
|
|
166 |
@type include_temporary: boolean |
|
167 |
@param include_temporary: whether to include the _temporary_ids set |
|
168 |
@rtype: set |
|
169 |
@return: a set of IDs |
|
170 |
|
|
171 |
""" |
|
172 |
existing = set() |
|
173 |
if include_temporary: |
|
174 |
existing.update(self._temporary_ids) |
|
175 |
existing.update(self._AllLVs()) |
|
176 |
existing.update(self._config_data.instances.keys()) |
|
177 |
existing.update(self._config_data.nodes.keys()) |
|
178 |
return existing |
|
179 |
|
|
163 | 180 |
@locking.ssynchronized(_config_lock, shared=1) |
164 | 181 |
def GenerateUniqueID(self, exceptions=None): |
165 | 182 |
"""Generate an unique disk name. |
... | ... | |
176 | 193 |
@return: the unique id |
177 | 194 |
|
178 | 195 |
""" |
179 |
existing = set() |
|
180 |
existing.update(self._temporary_ids) |
|
181 |
existing.update(self._ComputeAllLVs()) |
|
182 |
existing.update(self._config_data.instances.keys()) |
|
183 |
existing.update(self._config_data.nodes.keys()) |
|
196 |
existing = self._AllIDs(include_temporary=True) |
|
184 | 197 |
if exceptions is not None: |
185 | 198 |
existing.update(exceptions) |
186 | 199 |
retries = 64 |
Also available in: Unified diff