On Thu, Nov 06, 2014 at 12:30:41AM +0200, Alex Pyrgiotis wrote:
> The _UnlockedAttachInstanceDisk and _UnlockedDetachInstanceDisk
> functions are already used in the add and remove operations. Create
> wrappers that can be used by attach and detach operations in order to
> call only these functions.
>
> Signed-off-by: Alex Pyrgiotis <[email protected]>
>
> diff --git a/lib/config.py b/lib/config.py
> index cd4400b..d47ee22 100644
> --- a/lib/config.py
> +++ b/lib/config.py
> @@ -503,6 +503,15 @@ class ConfigWriter(object):
>      self._UnlockedAddDisk(disk)
>      self._UnlockedAttachInstanceDisk(inst_uuid, disk.uuid, idx)
>
> +  @_ConfigSync()
> +  def AttachInstanceDisk(self, inst_uuid, disk, idx=None):
> +    """Attach an existing disk to an instance.
> +
> +    This is a simple wrapper over L{_UnlockedAttachInstanceDisk}.
> +
> +    """
> +    self._UnlockedAttachInstanceDisk(inst_uuid, disk.uuid, idx)
> +

Here you pass the disk info

>    def _UnlockedDetachInstanceDisk(self, inst_uuid, disk_uuid):
>      """Detach a disk from an instance.
>
> @@ -563,6 +572,14 @@ class ConfigWriter(object):
>      self._UnlockedDetachInstanceDisk(inst_uuid, disk_uuid)
>      self._UnlockedRemoveDisk(disk_uuid)
>
> +  @_ConfigSync()
> +  def DetachInstanceDisk(self, inst_uuid, disk_uuid):
> +    """Detach a disk from an instance.
> +
> +    This is a simple wrapper over L{_UnlockedDetachInstanceDisk}.
> +    """
> +    self._UnlockedDetachInstanceDisk(inst_uuid, disk_uuid)
> +

and here you pass the disk uuid. This should be consistent.

>    def _UnlockedGetDiskInfo(self, disk_uuid):
>      """Returns information about a disk.
>
> --
> 1.7.10.4
>

--
Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to