nova aggregate-add-host should limit user to set different availability zone for a host
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
David Jia |
Bug Description
user can use "nova aggregate-add-host" to set different availability zone for a host, then the host will be available for multi availability zone. When user try to boot instance in the host using second or third availability zone, the instance will still be assigned to the first availability zone which set at first time the host added to a host aggregate of the availability zone. It works as design, but it confuse the user, it make user to think that a host can be assigned to multi availability zone. So I think we should add checking to limit user to add host to host aggregates in different availability zone.
Here are steps to recreate the issue:
1) create one AZ
nova aggregate-create test-az test-az
the AZ test-az id is 1
2) add host to AZ
nova aggregate-add-host 1 WIN-UJAK7KN9LRA
3) boot one instance
nova boot --flavor 2 --image 26c6ddd1-
In this steps, it prints | OS-EXT-
4) check test-vm-1
nova show d752aa55-
OS-EXT-
5)
then create another AZ
nova aggregate-create test-az-2 test-az-2
Add host to AZ
nova aggregate-add-host 2 WIN-UJAK7KN9LRA
check AZs
nova availability-
boot one instance
nova boot --flavor 2 --image 26c6ddd1-
still the print is | OS-EXT-
check instance info
| OS-EXT-
The new instance is in test-az, the passed option test-az-2 seems not work. We may should add checking logic to limit users to do operations like " nova aggregate-add-host 2 WIN-UJAK7KN9LRA" in step #5
tags: | added: api |
Changed in nova: | |
milestone: | none → havana-3 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | havana-3 → 2013.2 |
This /opt/stack/ nova/nova/ availability_ zones.py get_host_ availability_ zone method returns the first zone if there are multiple zones for one single host for this:
def get_host_ availability_ zone(context, host, conductor_ api=None) : api.aggregate_ metadata_ get_by_ host(
context, host, key='availabili ty_zone' ) metadata_ get_by_ host(
context, host, key='availabili ty_zone' ) 'availability_ zone']) [0] -- return first one availability_ zone
if conductor_api:
metadata = conductor_
else:
metadata = db.aggregate_
if 'availability_zone' in metadata:
return list(metadata[
else:
return CONF.default_
But our "nova aggregate-add-host" command supports to add one same host into multi-zones, this should be conflict between the 'add host to zone' and 'get host zone' two actions.