[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH 4/8] v2v: -o rhv-upload: tell whether a SD actually exists



On Mon, Sep 16, 2019 at 07:13:47PM +0200, Pino Toscano wrote:
> If there is no DC with the specified storage domain attached to it, it
> can mean that the SD does not exist.
> ---
>  v2v/rhv-upload-precheck.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/v2v/rhv-upload-precheck.py b/v2v/rhv-upload-precheck.py
> index 9ccfd1fdf..0b8087adb 100644
> --- a/v2v/rhv-upload-precheck.py
> +++ b/v2v/rhv-upload-precheck.py
> @@ -66,6 +66,15 @@ data_centers = system_service.data_centers_service().list(
>      case_sensitive=True,
>  )
>  if len(data_centers) == 0:
> +    storage_domains = system_service.storage_domains_service().list(
> +        search='name=%s' % params['output_storage'],
> +        case_sensitive=True,
> +    )
> +    if len(storage_domains) == 0:
> +        # The storage domain does not even exist.
> +        raise RuntimeError("The storage domain ā€˜%sā€™ does not exist" %
> +                           (params['output_storage']))
> +
>      # The storage domain is not attached to a datacenter
>      # (shouldn't happen, would fail on disk creation).
>      raise RuntimeError("The storage domain ā€˜%sā€™ is not attached to a DC" %
> -- 
> 2.21.0

Looks good, ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]