← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1419115] Re: IndexError adding host to availability zone

 

** Also affects: nova/kilo
   Importance: Undecided
       Status: New

** Changed in: nova/kilo
     Assignee: (unassigned) => Gonzalo De La Torre (gonzalo-delatorre)

** Changed in: nova/kilo
       Status: New => In Progress

** Changed in: nova/kilo
   Importance: Undecided => Low

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1419115

Title:
  IndexError adding host to availability zone

Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) kilo series:
  In Progress

Bug description:
  There appears to be a bug in the code dealing with adding a disabled
  host to an aggregate that is exported as an availability zone.

  I disable the nova-compute service on a host and then tried to add it
  to an aggregate that is exported as an availabilty zone. This resulted
  in the following error.

  
     File "/usr/lib64/python2.7/site-packages/oslo/utils/excutils.py", line 82, in __exit__
       six.reraise(self.type_, self.value, self.tb)
     File "/usr/lib64/python2.7/site-packages/nova/exception.py", line 71, in wrapped
       return f(self, context, *args, **kw)
     File "/usr/lib64/python2.7/site-packages/nova/compute/api.py", line 3673, in add_host_to_aggregate
       aggregate=aggregate)
     File "/usr/lib64/python2.7/site-packages/nova/compute/api.py", line 3591, in is_safe_to_update_az
       host_az = host_azs.pop()
   IndexError: pop from empty list
   

  The code looks like this:

          if 'availability_zone' in metadata:
              _hosts = hosts or aggregate.hosts
              zones, not_zones = availability_zones.get_availability_zones(
                  context, with_hosts=True)
              for host in _hosts:
                  # NOTE(sbauza): Host can only be in one AZ, so let's take only
                  #               the first element
                  host_azs = [az for (az, az_hosts) in zones
                              if host in az_hosts
                              and az != CONF.internal_service_availability_zone]
                  host_az = host_azs.pop()

  It appears that for a disabled host, host_azs can be empty, resulting
  in an error when we try to pop() from it.

  It works fine if the service is enabled on the host, and it works fine
  if the service is diabled and I try to add the host to an aggregate
  that is not exported as an availability zone.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1419115/+subscriptions


References