Revision 26b316d0 lib/config.py

b/lib/config.py
148 148
      raise errors.ConfigurationError("Can't generate unique DRBD secret")
149 149
    return secret
150 150

  
151
  def _ComputeAllLVs(self):
151
  def _AllLVs(self):
152 152
    """Compute the list of all LVs.
153 153

  
154 154
    """
......
159 159
        lvnames.update(lv_list)
160 160
    return lvnames
161 161

  
162
  def _AllIDs(self, include_temporary):
163
    """Compute the list of all UUIDs and names we have.
164

  
165
    @type include_temporary: boolean
166
    @param include_temporary: whether to include the _temporary_ids set
167
    @rtype: set
168
    @return: a set of IDs
169

  
170
    """
171
    existing = set()
172
    if include_temporary:
173
      existing.update(self._temporary_ids)
174
    existing.update(self._AllLVs())
175
    existing.update(self._config_data.instances.keys())
176
    existing.update(self._config_data.nodes.keys())
177
    return existing
178

  
162 179
  @locking.ssynchronized(_config_lock, shared=1)
163 180
  def GenerateUniqueID(self, exceptions=None):
164 181
    """Generate an unique disk name.
......
175 192
    @return: the unique id
176 193

  
177 194
    """
178
    existing = set()
179
    existing.update(self._temporary_ids)
180
    existing.update(self._ComputeAllLVs())
181
    existing.update(self._config_data.instances.keys())
182
    existing.update(self._config_data.nodes.keys())
195
    existing = self._AllIDs(include_temporary=True)
183 196
    if exceptions is not None:
184 197
      existing.update(exceptions)
185 198
    retries = 64

Also available in: Unified diff