Bug 1234894

Summary: SCVMM provisioning from template fails for templates with spaces in their name
Product: Red Hat CloudForms Management Engine Reporter: ncatling
Component: ProvisioningAssignee: Bronagh Sorota <bsorota>
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.4.0CC: cpelland, fdewaley, gmccullo, jhardy, obarenbo
Target Milestone: GAKeywords: ZStream
Target Release: 5.5.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.5.0.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1245692 (view as bug list) Environment:
Last Closed: 2015-12-08 13:18:09 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1245692    

Description ncatling 2015-06-23 13:07:34 UTC
Description of problem:
SCVMM provisioning from template fails for templates with spaces in their name.

Version-Release number of selected component (if applicable):
CFME 5.4
SCVMM SP1 and R2

How reproducible:
Attempt to provision from an SCVMM template with a space in the name.

Steps to Reproduce:
1.
2.
3.

Actual results:
PowerShell Get-SCVMTemplate fails owing to missing parameter, which in turn produces a [JSON::ParserError] error on evm.log and provision fails.

Expected results:
Provisioning successful.

Additional info:

Comment 2 Greg McCullough 2015-06-23 17:06:14 UTC
Greg - Please reassign

Comment 3 ncatling 2015-06-24 11:13:43 UTC
Fix is to add single quotes in the following procedures in cloning.rb as follows:

  def template_ps_script
    "(Get-SCVMTemplate -Name '#{source.name}')"
  end

  def build_ps_script
    <<-PS_SCRIPT
      Import-Module VirtualMachineManager; Get-SCVMMServer localhost;\
      $vm = New-SCVirtualMachine \
        -Name '#{dest_name}' \
        -VMHost #{dest_host} \
        -Path '#{dest_mount_point}' \
        -VMTemplate #{template_ps_script}; \
      Set-SCVirtualMachine -VM $vm \
        #{cpu_ps_script} \
        #{memory_ps_script} | Out-Null;  \
      #{network_adapter_ps_script} \
      $vm | Select-Object ID | ConvertTo-Json
    PS_SCRIPT
  end

Comment 5 Oleg Barenboim 2015-07-28 18:08:51 UTC
PR: https://github.com/ManageIQ/manageiq/pull/3631

Comment 6 CFME Bot 2015-07-28 18:16:57 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/747592b11c296e42e082e78b53aa76fa3d0ef671

commit 747592b11c296e42e082e78b53aa76fa3d0ef671
Author:     Bronagh Sorota <bsorota>
AuthorDate: Tue Jul 28 13:18:43 2015 -0400
Commit:     Bronagh Sorota <bsorota>
CommitDate: Tue Jul 28 13:18:43 2015 -0400

    Handles provisioning from a template with spaces in name
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1234894

 app/models/miq_provision_microsoft/cloning.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 7 CFME Bot 2015-07-31 15:26:48 UTC
New commit detected on cfme/5.4.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=1abf868f184d3069149a7741a15d57f714eed5e4

commit 1abf868f184d3069149a7741a15d57f714eed5e4
Author:     Bronagh Sorota <bsorota>
AuthorDate: Tue Jul 28 13:18:43 2015 -0400
Commit:     Bronagh Sorota <bsorota>
CommitDate: Thu Jul 30 13:45:48 2015 -0400

    Handles provisioning from a template with spaces in name
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1234894

 vmdb/app/models/miq_provision_microsoft/cloning.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 8 CFME Bot 2015-07-31 15:26:55 UTC
New commit detected on cfme/5.4.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=3ef8ddcbc7f08eb2769295a2770f88135b0c68cc

commit 3ef8ddcbc7f08eb2769295a2770f88135b0c68cc
Merge: 9402346 1abf868
Author:     Greg Blomquist <gblomqui>
AuthorDate: Fri Jul 31 11:19:06 2015 -0400
Commit:     Greg Blomquist <gblomqui>
CommitDate: Fri Jul 31 11:19:06 2015 -0400

    Merge branch 'scvmm_provisioning_space_in_template_name-5.4.z' into '5.4.z'
    
    SCVMM : Handles provisioning from a template with spaces in name
    
    Clean Cherry pick.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1234894
    
    See merge request !208

 vmdb/app/models/miq_provision_microsoft/cloning.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 9 Milan Falešník 2015-10-26 08:51:24 UTC
Verified in 5.5.0.7

Comment 11 errata-xmlrpc 2015-12-08 13:18:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:2551