Bug 1461584 - Provisioning to MS SCVMM Uses host.name instead of host.hostname
Summary: Provisioning to MS SCVMM Uses host.name instead of host.hostname
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Provisioning
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.9.0
Assignee: Daniel Berger
QA Contact: Leo Khomenko
URL:
Whiteboard: provision:scvmm
Depends On:
Blocks: 1479367 1479377
TreeView+ depends on / blocked
 
Reported: 2017-06-14 20:57 UTC by Jeffrey Cutter
Modified: 2020-08-13 09:22 UTC (History)
7 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1479367 1479377 (view as bug list)
Environment:
Last Closed: 2018-03-06 14:40:32 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jeffrey Cutter 2017-06-14 20:57:47 UTC
Description of problem:

Provisioning to Microsoft System Center Virtual Machine Manager runs a New-SCCVirtualMachine command and passes an argument of -VMHost with the value of the VMDB host object .name (host.name).  You can see in the debug log below from scvmm.log that the VMHost is being passed with a " - 4" appended as the host was removed and readded to SCVMM several times and each time gets a new ems_ref.

Jun 14 13:56:23 cfme01 cf_scvmm:      $vm = New-SCVirtualMachine         -Name 'testvm1'         -VMHost hyperv_hostname.example.com - 4         -Path '\\nas.example.com\ShareName'         -VMTemplate (Get-SCVMTemplate -Name '2016');       Set-SCVirtualMachine -VM $vm         -CPUCount 1          -DynamicMemoryEnabled $false        -MemoryMB 4096 | Out-Null;        $adapter = $vm | SCVirtualNetworkAdapter;      Set-SCVirtualNetworkAdapter       -VirtualNetworkAdapter $adapter       -LogicalNetwork (Get-SCLogicalNetwork -Name 'LP 2069 MC vRA Win Dev') | Out-Null;       $vm | Select-Object ID | ConvertTo-Json

This yields the following error:

Jun 14 13:56:23 cfme01 cf_scvmm: [----] D, [2017-06-14T13:56:18.205456 #4091:605130] DEBUG -- : Q-task_id([miq_provision_10000000001416]) MIQ(ManageIQ::Providers::Microsoft::InfraManager#run_powershell_script) Execute Powershell Script...
Jun 14 13:56:23 cfme01 cf_scvmm: [----] E, [2017-06-14T13:56:21.781163 #4091:605130] ERROR -- : Q-task_id([miq_provision_10000000001416]) MIQ(Class#log_dos_error_results) New-SCVirtualMachine : A positional parameter cannot be found that accepts argument '-'.

Version-Release number of selected component (if applicable):

5.7.2

How reproducible:

Every time you provision to a host where the host.name doesn't match the host.hostname.

Steps to Reproduce:
1.  In CloudForms UI, edit a host resource and rename it to have a - 1 in it and then provision to it.

Additional info:

irb(main):003:0> $evm.vmdb(:host).where("name ~ 'hyperv-hostname'").each { |i| puts i.name }
hyperv-hostname.example.com
hyperv-hostname.example.com - 2
hyperv-hostname.example.com - 3
hyperv-hostname.example.com - 4
irb(main):005:0> $evm.vmdb(:host).where("name ~ 'hyperv-hostname'").each { |i| puts i.ems_ref }
d8e310fc-d63f-4603-aba8-33a4ccbbd31d
65c286ce-9f96-4c55-8361-55f7ed36a3d4
62e68605-be94-4a27-a8ee-d0b369431887
8f179946-df85-436a-8a7f-59ab47dbb05c
irb(main):006:0> $evm.vmdb(:host).where("name ~ 'hyperv-hostname'").each { |i| puts i.hostname }
hyperv-hostname.example.com
hyperv-hostname.example.com
hyperv-hostname.example.com
hyperv-hostname.example.com

Comment 5 Jeff Teehan 2017-06-15 20:49:18 UTC
I can test for that.  I'll take a look.

Comment 7 Daniel Berger 2017-07-21 19:10:46 UTC
https://github.com/ManageIQ/manageiq/pull/15632


Note You need to log in before you can comment on or make changes to this bug.