On Fri, Jun 12, 2015 at 03:50:44PM +0200, 'BSRK Aditya' via ganeti-devel wrote:
> Removes config lock usage.
> 
> Also add a mock implementation of RemoveInstanceDisk
> for the python tests.
> 
> Signed-off-by: BSRK Aditya <b...@google.com>
> ---
>  lib/config/__init__.py           |   13 ++++---------
>  test/py/testutils/config_mock.py |    4 ++++
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/config/__init__.py b/lib/config/__init__.py
> index ed6d1b0..73efd63 100644
> --- a/lib/config/__init__.py
> +++ b/lib/config/__init__.py
> @@ -378,16 +378,11 @@ class ConfigWriter(object):
>      del self._ConfigData().disks[disk_uuid]
>      self._ConfigData().cluster.serial_no += 1
>  
> -  @ConfigSync()
>    def RemoveInstanceDisk(self, inst_uuid, disk_uuid):
> -    """Detach a disk from an instance and remove it from the config.
> -
> -    This is a simple wrapper over L{_UnlockedDetachInstanceDisk} and
> -    L{_UnlockedRemoveDisk}.
> -
> -    """
> -    self._UnlockedDetachInstanceDisk(inst_uuid, disk_uuid)
> -    self._UnlockedRemoveDisk(disk_uuid)
> +    """Detach a disk from an instance and remove it from the config."""
> +    utils.SimpleRetry(True, self._wconfd.RemoveInstanceDisk, 0.1, 30,
> +                      args=[inst_uuid, disk_uuid])
> +    self.OutDate()

This patch removes the last use of _UnlockedDetachInstnaceDisk outside
the tests. Therefore, please move this function also to the tests to
have the actual non-test code cleaned up.

-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to