Skip to content

Instantly share code, notes, and snippets.

@jruels
Last active December 5, 2024 13:32
Show Gist options
  • Save jruels/a8093cede4bfe7598e14 to your computer and use it in GitHub Desktop.
Save jruels/a8093cede4bfe7598e14 to your computer and use it in GitHub Desktop.
How to launch an OpenStack instance in a specific host aggregate
#Make sure AggregateImagePropertiesIsolation is enabled in nova.conf
scheduler_default_filters=AggregateImagePropertiesIsolation
# Restart all nova services on all controllers
# Create host aggregates
# For example one aggregate for ESX and one for KVM
nova aggregate-create ESX-AZ ESX-AZ
nova aggregate-create KVM-AZ KVM-AZ
# List aggregates so you can find out the number
nova aggregate-list
# Add a host to each aggregate
nova aggregate-add-host <aggregate number for ESX from above> ESX-Host1
nova aggregate-add-host <aggregate number for KVM from above> KVM-Host1
# By default when you create an AZ it adds metadata "availability_zone=<name of AZ>"
# We can use this to update the image metadata so it spins up in the correct AZ.
# Add metadata to spin up vmdk in ESX AZ
glance image-update <VMDK img-uuid> --property availability_zone="ESX-AZ"
# Add metadata to spin up qcow2 in KVM AZ
glance image-update <QCOW2 img-uuid> --property availability_zone="KVM-AZ"
# Now you can test the new image and confirm it spins up on the correct host in the specified aggregate
nova boot --image ubuntu14 --flavor m1.small --nic net-id=<network ID> Test_ESX1
nova list | grep Test_ESX1
nova show <ID from above> |grep zone
# You should see the image is on the correct host aggregate. If not enable debug in /etc/nova/nova.conf
# Restart nova services on all controllers. Then check out /var/log/nova/nova-scheduler.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment