Hide Forgot
Created attachment 1212472 [details] the message seen when we submit the New host form Description of problem: 2016-10-20 03:21:05 b14ad3cf [app] [W] Failed to create a compute azure_provider_cr (Azure) instance karin-sadoski.redhat.com: [[31m[[1mFailed to create virtual machine : [[31m[[1mBadRequest : The hosted service name is invalid.^[[0m^[[0m^[[0m^[[0m | | RuntimeError: [[31m[[1mFailed to create virtual machine : [[31m[[1mBadRequest : The hosted service name is invalid.^[[0m^[[0m^[[0m^[[0m | /opt/theforeman/tfm/root/usr/share/gems/gems/azure-core-0.1.1/lib/azure/core/utility.rb:122:in `error_with_exit' | /opt/theforeman/tfm/root/usr/share/gems/gems/azure-0.7.5/lib/azure/virtual_machine_management/virtual_machine_management_service.rb:137:in `rescue in create_virtual_machine' | /opt/theforeman/tfm/root/usr/share/gems/gems/azure-0.7.5/lib/azure/virtual_machine_management/virtual_machine_management_service.rb:96:in `create_virtual_machine' | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-azure-0.0.2/lib/fog/azure/requests/compute/create_virtual_machine.rb:27:in `create_virtual_machine' | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-azure-0.0.2/lib/fog/azure/models/compute/server.rb:182:in `save' | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-core-1.42.0/lib/fog/core/collection.rb:51:in `create' | /usr/share/foreman/app/models/compute_resource.rb:182:in `create_vm' | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_azure-1.0.2/app/models/foreman_azure/azure.rb:45:in `create_vm' | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:82:in `setCompute' | /usr/share/foreman/app/models/concerns/orchestration.rb:191:in `execute' | /usr/share/foreman/app/models/concerns/orchestration.rb:131:in `block in process' | /usr/share/foreman/app/models/concerns/orchestration.rb:123:in `each' | /usr/share/foreman/app/models/concerns/orchestration.rb:123:in `process' | /usr/share/foreman/app/models/concerns/orchestration.rb:35:in `around_save_orchestration' Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. populate all values for Azure Compute Resource 2. and submit the form, which fails with the below message. 3. Actual results: Unable to save Failed to create a compute azure_provider_cr (Azure) instance karin-sadoski.redhat.com: [31m[1mFailed to create virtual machine : [31m[1mBadRequest : The hosted service name is invalid.[0m[0m[0m[0m Expected results: We should be able to create an azure instance successfully. Additional info:
Have also created an upstream issue, http://projects.theforeman.org/issues/17043
Partial notes on findings. It seems there are two issues: The original issue is passing though some empty strings to the azure API that causes the error: after applying this patch https://github.com/adamruzicka/foreman_azure/commit/4b363330082d67406b9e4d2d610a4788484bbe14.patch the error goes away There was additional issue after applying it, where we don't validate the image user at our side, while azure doesn't accept some of them, such as "root", so different user is needed. https://azure.microsoft.com/cs-cz/documentation/articles/virtual-machines-linux-use-root-privileges/ In order to continue successfully, we would probably need to know what is the user on image.
Upstream issue is closed - setting this to POST