Revision fc95f88f
b/lib/config.py | ||
---|---|---|
329 | 329 |
del self._config_data.instances[instance_name] |
330 | 330 |
self._WriteConfig() |
331 | 331 |
|
332 |
def RenameInstance(self, old_name, new_name): |
|
333 |
"""Rename an instance. |
|
334 |
|
|
335 |
This needs to be done in ConfigWriter and not by RemoveInstance |
|
336 |
combined with AddInstance as only we can guarantee an atomic |
|
337 |
rename. |
|
338 |
|
|
339 |
""" |
|
340 |
self._OpenConfig() |
|
341 |
if old_name not in self._config_data.instances: |
|
342 |
raise errors.ConfigurationError("Unknown instance '%s'" % old_name) |
|
343 |
inst = self._config_data.instances[old_name] |
|
344 |
del self._config_data.instances[old_name] |
|
345 |
inst.name = new_name |
|
346 |
self._config_data.instances[inst.name] = inst |
|
347 |
self._WriteConfig() |
|
348 |
|
|
332 | 349 |
def MarkInstanceDown(self, instance_name): |
333 | 350 |
"""Mark the status of an instance to down in the configuration. |
334 | 351 |
|
Also available in: Unified diff