I create an instance with the availability zone named 'test_az' and host named 'compute', and then shelve the instance, then delete the availability zone test_az.
But the instance availability zone is still 'test_az',and unshelve the instance failed with the message "No valid host found for unshelve instance"
[root@controller ~(admin)]$ nova show test3
+--------------------------------------+---------------------------------------------------+
| Property | Value |
+--------------------------------------+---------------------------------------------------+
| OS-DCF:diskConfig | AUTO |
| OS-EXT-AZ:availability_zone | test_az |
| OS-EXT-SRV-ATTR:host | - |
| OS-EXT-SRV-ATTR:hostname | test3 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | - |
| OS-EXT-SRV-ATTR:instance_name | instance-00000004 |
| OS-EXT-SRV-ATTR:kernel_id | |
| OS-EXT-SRV-ATTR:launch_index | 0 |
| OS-EXT-SRV-ATTR:ramdisk_id | |
| OS-EXT-SRV-ATTR:reservation_id | r-3i45u68y |
| OS-EXT-SRV-ATTR:root_device_name | /dev/vda |
| OS-EXT-SRV-ATTR:user_data | - |
| OS-EXT-STS:power_state | 4 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | shelved_offloaded |
| OS-SRV-USG:launched_at | 2017-10-16T07:05:18.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2017-10-16T07:05:12Z |
| description | test3 |
| flavor | m1.small (2) |
| hostId | |
| host_status | |
| id | 8cf627b7-fe67-405b-92b1-a42a6c66f8a6 |
| image | centos_7_2 (090d5564-9c64-459e-8d10-4382f1c72488) |
| key_name | - |
| locked | False |
| metadata | {} |
| name | test3 |
| os-extended-volumes:volumes_attached | [] |
| security_groups | default |
| status | SHELVED_OFFLOADED |
| tenant_id | 764169e694474ba0a40030e6c8531704 |
| test network | 192.168.0.5 |
| updated | 2017-10-16T07:07:33Z |
| user_id | 2ccb44e4ce2e42d5b805b898f2c10243 |
+--------------------------------------+---------------------------------------------------+
Hmm, sounds legitimate. The question would be what we should do about this. Should a user expect that if they created an instance in a specific AZ and shelve offload it, that when unshelving it the instance will go back into that same AZ? We don't allow overriding an AZ on unshelve, so we'd have to use what was in the original request spec and if that AZ is now gone, do we just ignore the AZ - some might consider that an error too.
This probably wouldn't happen in a normal production stable cloud since the AZs shouldn't be changing like this without at least migrating the instances out of those AZs first.