[openstack-dev] [OpenStack-Dev][Nova] - https://launchpad.net/bugs/1667794 Changing hostname not to be treated as a pattern instead exact match will be done.

nidhi.hada at wipro.com nidhi.hada at wipro.com
Wed Jul 26 05:24:19 UTC 2017


Hello All,

This is follow up mail on my y'days mail regarding bug
https://bugs.launchpad.net/python-novaclient/+bug/1667794

It looks like all the cli commands that are related to
http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/servers   api
are expecting exact match.

Commands which are affected if we change
http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/servers api
from pattern match to exact match are as below :
It’s clearly seen that these commands expect exact match only.

Servers = True
==============================================
1.
do_host_meta(cs, args):
    """Set or Delete metadata on all instances of a host."""
    hypervisors = cs.hypervisors.search(args.host, servers=True)

2.
@utils.arg(
    'hostname',
    metavar='<hostname>',
    help=_('The hypervisor hostname (or pattern) to search for.')) def do_hypervisor_servers(cs, args):
    """List servers belonging to specific hypervisors."""
    hypers = cs.hypervisors.search(args.hostname, servers=True)

3.
def do_host_evacuate(cs, args):
    """Evacuate all instances from failed host."""

    hypervisors = cs.hypervisors.search(args.host, servers=True)

4.
def do_host_evacuate_live(cs, args):
    """Live migrate all instances of the specified host
    to other available hosts.
    """
    hypervisors = cs.hypervisors.search(args.host, servers=True)
    response = []

5.
def do_host_servers_migrate(cs, args):
    """Cold migrate all instances off the specified host to other available
    hosts.
    """

    hypervisors = cs.hypervisors.search(args.host, servers=True)
    response = []
    for hyper in hypervisors:

Hence, I am planning to correct/change http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/servers api
to match hostname as exact match “NOT” as a pattern.

Please comment if any other opinion on this.

Thanks
Nidhi









-----Original Message-----
From: Nidhi Mittal Hada (Product Engineering Service)
Sent: Tuesday, July 25, 2017 12:42 PM
To: openstack-dev at lists.openstack.org
Cc: 'mriedemos at gmail.com' <mriedemos at gmail.com>
Subject: RE: [openstack-dev] [OpenStack-Dev][Nova] - https://launchpad.net/bugs/1667794 Changing hostname not to be treated as a pattern instead exact match will be done.

Hello Matt,

Kindly see analysis below and suggest.

When we execute
stack at ubuntu14-OptiPlex-3020:~/openstack_install/devstack$ nova --debug host-evacuate wipro .
.
.
DEBUG (session:347) REQ: curl -g -i -X GET http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/servers -H "OpenStack-API-Version: compute 2.46" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-OpenStack-Nova-API-Version: 2.46" -H "X-Auth-Token: {SHA1}9e9230a54eff2444ac32fa054c6bab3dbe446df9" >>>>>>>>>>>>>>>>>>>>>>>>>>

nova api that's being called is this
https://developer.openstack.org/api-ref/compute/?expanded=search-hypervisor-detail,list-hypervisor-servers-detail#list-hypervisor-servers
Where it clearly states: "List all servers belong to each hypervisor whose host name is matching a given hypervisor host name or portion of it."


Another available api for hostname match is https://developer.openstack.org/api-ref/compute/?expanded=search-hypervisor-detail,list-hypervisor-servers-detail#search-hypervisor
which states: "Search hypervisor by a given hypervisor host name or portion of it."

There is no api available at present where hostname is matched not as a pattern. PCMIIW.

Hence it can't be just fixed in client as it is.

Solution: I thought we can fix it by changing only http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/servers api to match hostname as exact so that https://developer.openstack.org/api-ref/compute/?expanded=search-hypervisor-detail,list-hypervisor-servers-detail#search-hypervisor  remains unaffected.
This I still have to change in nova server code, I will use an additional function parameter to specify if exact match is desired or a pattern match is desired.

But then  http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/servers is being used by many other commands than just host-evacuate.
Which all will be affected.

Listing commands that will be affected are .

Function in novaclient from where we call api
   def search(self, hypervisor_match, servers=False):   >>>>>>>>>>>>>>.servers is False by default
        """
        Get a list of matching hypervisors.
        :param servers: If True, server information is also retrieved.
        """
        target = 'servers' if servers else 'search'
        url = ('/os-hypervisors/%s/%s' %
               (parse.quote(hypervisor_match, safe=''), target))   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
        return self._list(url, 'hypervisors')

we are passing servers as true in these cli commands.

Servers = True
==============================================
1.
do_host_meta(cs, args):
    """Set or Delete metadata on all instances of a host."""
    hypervisors = cs.hypervisors.search(args.host, servers=True)

2.
@utils.arg(
    'hostname',
    metavar='<hostname>',
    help=_('The hypervisor hostname (or pattern) to search for.')) def do_hypervisor_servers(cs, args):
    """List servers belonging to specific hypervisors."""
    hypers = cs.hypervisors.search(args.hostname, servers=True)

3.
def do_host_evacuate(cs, args):
    """Evacuate all instances from failed host."""

    hypervisors = cs.hypervisors.search(args.host, servers=True)

4.
def do_host_evacuate_live(cs, args):
    """Live migrate all instances of the specified host
    to other available hosts.
    """
    hypervisors = cs.hypervisors.search(args.host, servers=True)
    response = []

5.
def do_host_servers_migrate(cs, args):
    """Cold migrate all instances off the specified host to other available
    hosts.
    """

    hypervisors = cs.hypervisors.search(args.host, servers=True)
    response = []
    for hyper in hypervisors:


Servers = false
===============
1.
def _do_hypervisor_list(cs, matching=None, limit=None, marker=None):
    columns = ['ID', 'Hypervisor hostname', 'State', 'Status']
    if matching:
        utils.print_list(cs.hypervisors.search(matching), columns)



Please suggest what is better solution?

1)Modifying http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/servers api code in nova server side code - to match hostname as exact not as a pattern
We can code so that http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/search remains unaffected.

2)We should introduce a new parameter in servers api which from cli which directs that exact match is to be
done in url.
http://10.141.67.190:8774/v2.1/os-hypervisors/wipro/servers?exact_match=true
and query parameter then interpreted in server side code and behave as desired.
In this case we will have choice to not affect at undesired commands.

Thanks
Nidhi
































-----Original Message-----
From: Matt Riedemann [mailto:mriedemos at gmail.com]
Sent: Friday, July 14, 2017 7:22 PM
To: openstack-dev at lists.openstack.org<mailto:openstack-dev at lists.openstack.org>
Subject: Re: [openstack-dev] [OpenStack-Dev][Nova] - https://launchpad.net/bugs/1667794 Changing hostname not to be treated as a pattern instead exact match will be done.

** This mail has been sent from an external source. Treat hyperlinks and attachments in this email with caution**

On 7/14/2017 6:49 AM, nidhi.hada at wipro.com<mailto:nidhi.hada at wipro.com> wrote:
> Hello all,
>
> This is regarding bug 1667794 as mentioned in subject.
>
> Its review is going on here.
>
> https://clicktime.symantec.com/a/1/49nJvSe1Be7H66fNyloEH0VFJQ88tUzr9ao
> 8kyFM3jc=?d=huhMONMwyIvPyR_TNVFVFEoKBc2izoSPlzhtdZ1egR7bwY3hW0n6gBw5Pf
> _aKziBo_pOhFqtNZ7hwc696PKDDY0ern8LIG6XT0Pa5GnYDhIM8xtNkatqd6_xu-fn6091
> KREiE5rxafexQfe-rJ7RZKU7RWnI0BMsnrkU7NWqJOLUlJi9hKN2qxzIp-n8ZnSkjcNzp9
> 81ZLIMs7MJ--gOKTl4pZEsfb_MBwDbeOUcZA5mm8WANpU0XMEUHdqhphAf2QXPUL8oHD6l
> RCzrptg5Fi9_L4e2YX6ZA28AUqup5WAH1B4OT_E4mbfcaZxfm9sIXtUyWvbaKBRG-syj4W
> eDNjzAvxku3u9xfD1HWy1MUp36GMU4z7N3BJGZuiIu4YmCjmsKdXb_m0i5CkmgPB0jOfuP
> 6fjyr9PfbBEtvQYMIQLTIoOCFWag30Q5VqPVnfh-Nzv_T1kbO3TCFZqoZktPT8Vo6wAk45
> hsiX0HknkBnNqR21E7Fb5t2hG0HjqNSxgld9NIXGZng7JR&u=https%3A%2F%2Freview.
> openstack.org%2F%23%2Fc%2F474949%2F
>
> *_Bug is - _**_Nova treats hostname as pattern_*
>
> *_Description_*
>
> Nova commands such as "hypervisor-list --matching <substring>",
>
> host-evacuate-live and host-evacuate and few more, treat the
>
> user-specified "host-name" as the input to the HTTP
>
> /os-hypervisors/{hypervisor_hostname_pattern}/search API.
>
> *Nova checks "host-name" as a pattern instead of exact match,*
>
> *which causes problem with some commands such as*
>
> *nova host-evacuate-live compute-1 where in host-evacuate*
>
> *action will apply to all "compute-1", "compute-10".*
>
> *That is not right.*
>
> Correcting it by using exact match.
>
> We have fixed it and put it for review. We need your opinion on this.
>
> *_Kindly share your opinion in case this does not seem to be an
> acceptable fix to anyone._*
>
> Thanks
>
> Nidhi
>
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> addressee(s) and may contain proprietary, confidential or privileged
> information. If you are not the intended recipient, you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately and destroy all copies of this message and any attachments. WARNING:
> Computer viruses can be transmitted via email. The recipient should
> check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus
> transmitted by this email. www.wipro.com<http://www.wipro.com>
>
>
> ______________________________________________________________________
> ____ OpenStack Development Mailing List (not for usage questions)
> Unsubscribe:
> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe<mailto:OpenStack-dev-request at lists.openstack.org?subject:unsubscribe>
> https://clicktime.symantec.com/a/1/9RX_Q306kvu_hhDcIzBL0WNsDUY3rwoCi9T
> 8g25S6fc=?d=huhMONMwyIvPyR_TNVFVFEoKBc2izoSPlzhtdZ1egR7bwY3hW0n6gBw5Pf
> _aKziBo_pOhFqtNZ7hwc696PKDDY0ern8LIG6XT0Pa5GnYDhIM8xtNkatqd6_xu-fn6091
> KREiE5rxafexQfe-rJ7RZKU7RWnI0BMsnrkU7NWqJOLUlJi9hKN2qxzIp-n8ZnSkjcNzp9
> 81ZLIMs7MJ--gOKTl4pZEsfb_MBwDbeOUcZA5mm8WANpU0XMEUHdqhphAf2QXPUL8oHD6l
> RCzrptg5Fi9_L4e2YX6ZA28AUqup5WAH1B4OT_E4mbfcaZxfm9sIXtUyWvbaKBRG-syj4W
> eDNjzAvxku3u9xfD1HWy1MUp36GMU4z7N3BJGZuiIu4YmCjmsKdXb_m0i5CkmgPB0jOfuP
> 6fjyr9PfbBEtvQYMIQLTIoOCFWag30Q5VqPVnfh-Nzv_T1kbO3TCFZqoZktPT8Vo6wAk45
> hsiX0HknkBnNqR21E7Fb5t2hG0HjqNSxgld9NIXGZng7JR&u=http%3A%2F%2Flists.op
> enstack.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fopenstack-dev
>

Thanks for bringing this up. Your fix is in the wrong place, see the comments in the patch.

--

Thanks,

Matt

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe<mailto:OpenStack-dev-request at lists.openstack.org?subject:unsubscribe>
https://clicktime.symantec.com/a/1/9RX_Q306kvu_hhDcIzBL0WNsDUY3rwoCi9T8g25S6fc=?d=huhMONMwyIvPyR_TNVFVFEoKBc2izoSPlzhtdZ1egR7bwY3hW0n6gBw5Pf_aKziBo_pOhFqtNZ7hwc696PKDDY0ern8LIG6XT0Pa5GnYDhIM8xtNkatqd6_xu-fn6091KREiE5rxafexQfe-rJ7RZKU7RWnI0BMsnrkU7NWqJOLUlJi9hKN2qxzIp-n8ZnSkjcNzp981ZLIMs7MJ--gOKTl4pZEsfb_MBwDbeOUcZA5mm8WANpU0XMEUHdqhphAf2QXPUL8oHD6lRCzrptg5Fi9_L4e2YX6ZA28AUqup5WAH1B4OT_E4mbfcaZxfm9sIXtUyWvbaKBRG-syj4WeDNjzAvxku3u9xfD1HWy1MUp36GMU4z7N3BJGZuiIu4YmCjmsKdXb_m0i5CkmgPB0jOfuP6fjyr9PfbBEtvQYMIQLTIoOCFWag30Q5VqPVnfh-Nzv_T1kbO3TCFZqoZktPT8Vo6wAk45hsiX0HknkBnNqR21E7Fb5t2hG0HjqNSxgld9NIXGZng7JR&u=http%3A%2F%2Flists.openstack.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fopenstack-dev

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170726/931b2f56/attachment.html>


More information about the OpenStack-dev mailing list