OpenStack - The requested availability zone is not available


#1

Hello,

We are getting an error when provisioning VMs in RedHat OpenStack (Juno) with MIQ (darga-3 updated up to 4fe9d6660b977c18ac2e5e083d43d54c18205ed0).

It seems that MIQ is setting an incorrect value for the “AvailabilityZone” parameter in the request:

[----] E, [2016-10-20T17:16:08.747955 #3022:733980] ERROR -- : Q-task_id([miq_provision_11000000000003]) excon.error     #<Excon::Error::BadRequest: Expected([200, 202]) <=> Actual(400 Bad Request)
excon.error.response
  :body          => "{\"badRequest\": {\"message\": \"The requested availability zone is not available\", \"code\": 400}}"

This is the list of Availability Zones from this provider:

irb(main):056:0> $evm.vmdb(:ems).find_by_id(11000000000001).availability_zones.each {|a| pp a.attributes}
{"id"=>11000000000001,
 "ems_id"=>11000000000001,
 "name"=>"BOAE-1",
 "ems_ref"=>"compute-BOAE-1",
 "type"=>"ManageIQ::Providers::Openstack::CloudManager::AvailabilityZone"}
{"id"=>11000000000002,
 "ems_id"=>11000000000001,
 "name"=>"BOAE-2",
 "ems_ref"=>"compute-BOAE-2",
 "type"=>"ManageIQ::Providers::Openstack::CloudManager::AvailabilityZone"}
{"id"=>11000000000003,
 "ems_id"=>11000000000001,
 "name"=>"BOAE-3",
 "ems_ref"=>"compute-BOAE-3",
 "type"=>"ManageIQ::Providers::Openstack::CloudManager::AvailabilityZone"}
{"id"=>11000000000004,
 "ems_id"=>11000000000001,
 "name"=>"nova",
 "ems_ref"=>"compute-nova",
 "type"=>"ManageIQ::Providers::Openstack::CloudManager::AvailabilityZone"}
{"id"=>11000000000005,
 "ems_id"=>11000000000001,
 "name"=>"No Availability Zone",
 "ems_ref"=>"null_az",
 "type"=>"ManageIQ::Providers::Openstack::CloudManager::AvailabilityZoneNull"}
{"id"=>11000000000006,
 "ems_id"=>11000000000001,
 "name"=>"BOAE-2",
 "ems_ref"=>"volume-BOAE-2",
 "type"=>"ManageIQ::Providers::Openstack::CloudManager::AvailabilityZone"}
{"id"=>11000000000007,
 "ems_id"=>11000000000001,
 "name"=>"BOAE-3",
 "ems_ref"=>"volume-BOAE-3",
 "type"=>"ManageIQ::Providers::Openstack::CloudManager::AvailabilityZone"}
{"id"=>11000000000008,
 "ems_id"=>11000000000001,
 "name"=>"BOAE-1",
 "ems_ref"=>"volume-BOAE-1",
 "type"=>"ManageIQ::Providers::Openstack::CloudManager::AvailabilityZone"}

All of these have a prefix “volume-” or “compute-”, which doesn’t match its name in OpenStack:

# nova availability-zone-list
+--------+---------------+
| Name   | Status        |
+--------+---------------+
| BOAE-1 | available     |
| BOAE-2 | available     |
| BOAE-3 | available     |
| nova   | not available |
+--------+---------------+

If I remove these “prefixes” with the following change, provision works properly:

diff --git a/app/models/manageiq/providers/openstack/cloud_manager/provision/cloning.rb b/app/models/manageiq/providers/openstack/cloud_manager/provision/cloning
index f3a70a1..61b1a5a 100644
--- a/app/models/manageiq/providers/openstack/cloud_manager/provision/cloning.rb
+++ b/app/models/manageiq/providers/openstack/cloud_manager/provision/cloning.rb
@@ -40,6 +40,7 @@ module ManageIQ::Providers::Openstack::CloudManager::Provision::Cloning
   def start_clone(clone_options)
     connection_options = {:tenant_name => options[:cloud_tenant][1]} if options[:cloud_tenant].kind_of? Array
     source.with_provider_connection(connection_options) do |openstack|
+      clone_options[:availability_zone] = clone_options[:availability_zone].gsub(/compute-|volume-/,"")
       instance = openstack.servers.create(clone_options)
       return instance.id
     end

Also, could be possible to solve this issue by using “name” parameter instead of “ems_ref”.

I would like to know if this could be some kind of bug or if we are doing something wrong.

Thanks a lot,
Regards


#2

@ProdubanEscan can you open this as an issue here: https://github.com/ManageIQ/manageiq/issues


#3

Opened: https://github.com/ManageIQ/manageiq/issues/12194
Thanks