Bug 1387224

Summary: unable to provision a new host using Azure as compute resource
Product: Red Hat Satellite Reporter: Kedar Bidarkar <kbidarka>
Component: Compute Resources - AzureAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Kedar Bidarkar <kbidarka>
Severity: high Docs Contact:
Priority: high    
Version: 6.3.0CC: bbuckingham, bkearney, dlobatog, ehelms, kbidarka, ktordeur
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-05 13:58:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
the message seen when we submit the New host form none

Description Kedar Bidarkar 2016-10-20 11:40:08 UTC
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:

Comment 2 Kedar Bidarkar 2016-10-20 11:47:50 UTC
Have also created an upstream issue, http://projects.theforeman.org/issues/17043

Comment 5 Ivan Necas 2016-10-27 12:21:49 UTC
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.

Comment 9 Daniel Lobato Garcia 2016-11-12 10:04:07 UTC
Upstream issue is closed - setting this to POST