Daniel Erez
2018-Jul-24 16:16 UTC
[Libguestfs] [PATCH] v2v: rhv plugin - fix DC search string
Search for DC by 'storage.name=' to make it explicit. I.e. "storage=" uses regex, so similar names can be found in the search query. For example, searching for a domain named FCSD, will find FCSD1 as well. --- v2v/rhv-upload-plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py index c72f5e181..c6ba1962f 100644 --- a/v2v/rhv-upload-plugin.py +++ b/v2v/rhv-upload-plugin.py @@ -70,7 +70,7 @@ def find_host(connection): system_service = connection.system_service() storage_name = params['output_storage'] data_centers = system_service.data_centers_service().list( - search='storage=%s' % storage_name, + search='storage.name=%s' % storage_name, case_sensitive=False, ) if len(data_centers) == 0: -- 2.17.1
Richard W.M. Jones
2018-Jul-24 16:26 UTC
Re: [Libguestfs] [PATCH] v2v: rhv plugin - fix DC search string
On Tue, Jul 24, 2018 at 07:16:10PM +0300, Daniel Erez wrote:> Search for DC by 'storage.name=' to make it explicit. > I.e. "storage=" uses regex, so similar names can be > found in the search query. For example, searching for > a domain named FCSD, will find FCSD1 as well. > --- > v2v/rhv-upload-plugin.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py > index c72f5e181..c6ba1962f 100644 > --- a/v2v/rhv-upload-plugin.py > +++ b/v2v/rhv-upload-plugin.py > @@ -70,7 +70,7 @@ def find_host(connection): > system_service = connection.system_service() > storage_name = params['output_storage'] > data_centers = system_service.data_centers_service().list( > - search='storage=%s' % storage_name, > + search='storage.name=%s' % storage_name, > case_sensitive=False,Thanks, pushed (commit 2547df8a0de46bb1447396e07ee0989bc3f8f31e). Do we need this in RHEL 7.6? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Nir Soffer
2018-Jul-24 16:29 UTC
Re: [Libguestfs] [PATCH] v2v: rhv plugin - fix DC search string
On Tue, Jul 24, 2018 at 7:16 PM Daniel Erez <derez@redhat.com> wrote:> Search for DC by 'storage.name=' to make it explicit. > I.e. "storage=" uses regex, so similar names can be > found in the search query. For example, searching for > a domain named FCSD, will find FCSD1 as well. > --- > v2v/rhv-upload-plugin.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py > index c72f5e181..c6ba1962f 100644 > --- a/v2v/rhv-upload-plugin.py > +++ b/v2v/rhv-upload-plugin.py > @@ -70,7 +70,7 @@ def find_host(connection): > system_service = connection.system_service() > storage_name = params['output_storage'] > data_centers = system_service.data_centers_service().list( > - search='storage=%s' % storage_name, > + search='storage.name=%s' % storage_name, >Looks good, but> case_sensitive=False, > ) > if len(data_centers) == 0: >We need to be more defensive here. We expect exactly one result. len == 0 means there there is no dc with this name (impossible?) len > 1 means we have a bug - we need to log a detailed error message and return None. Nir
Nir Soffer
2018-Jul-24 16:32 UTC
Re: [Libguestfs] [PATCH] v2v: rhv plugin - fix DC search string
On Tue, Jul 24, 2018 at 7:27 PM Richard W.M. Jones <rjones@redhat.com> wrote:> On Tue, Jul 24, 2018 at 07:16:10PM +0300, Daniel Erez wrote: > > Search for DC by 'storage.name=' to make it explicit. > > I.e. "storage=" uses regex, so similar names can be > > found in the search query. For example, searching for > > a domain named FCSD, will find FCSD1 as well. > > --- > > v2v/rhv-upload-plugin.py | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/v2v/rhv-upload-plugin.py b/v2v/rhv-upload-plugin.py > > index c72f5e181..c6ba1962f 100644 > > --- a/v2v/rhv-upload-plugin.py > > +++ b/v2v/rhv-upload-plugin.py > > @@ -70,7 +70,7 @@ def find_host(connection): > > system_service = connection.system_service() > > storage_name = params['output_storage'] > > data_centers = system_service.data_centers_service().list( > > - search='storage=%s' % storage_name, > > + search='storage.name=%s' % storage_name, > > case_sensitive=False, > > Thanks, pushed (commit 2547df8a0de46bb1447396e07ee0989bc3f8f31e). >> > Do we need this in RHEL 7.6? >Sure, should we reopen one of (RHBZ#1596810) (RHBZ#1596851)?