Bug 1195754

Summary: Naming method increments VM names by two when ordering through a service
Product: Red Hat CloudForms Management Engine Reporter: Krain Arnold <krain>
Component: ProvisioningAssignee: mkanoor
Status: CLOSED ERRATA QA Contact: Dave Johnson <dajohnso>
Severity: medium Docs Contact:
Priority: high    
Version: 5.3.0CC: jhardy, jocarter, mfeifer, obarenbo, sshveta, xlecauch
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.4.0.0.11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1200152 (view as bug list) Environment:
Last Closed: 2015-06-16 12:51:22 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: 1139277, 1200152    

Description Krain Arnold 2015-02-24 13:55:53 UTC
Description of problem:
When provisioning a VM through a service and using the functionality of the default naming method, server names are incremented by 2.

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

How reproducible:
100%

Steps to Reproduce:
1.Create a RHEV service catalog using changeme as the vm_name
2.Provision a service

Actual results:
Each time a vm is provisioned through the service catalog, the numerical suffix will increment by two. For example, if $evm.object['vm_prefix'] is 'test', then the VMs provisioned through the service will be, in order, test002, test004, test006, etc. 

Expected results:
The VMs provisioned through services should increment by 1 (one).
Additional info:

Comment 1 Krain Arnold 2015-02-24 15:54:07 UTC
It seems this is happening because the naming method is being called twice. See the conversation here:


Since the method only sets the evm.object[vmname] to derived_name, the :vm_name option is still 'changeme' the second time around. 

It can be avoided by adding:
prov.set_option(:vm_name, derived_name)
prov.set_option(:vm_target_name, derived_name)

At the bottom of the method. This keeps the process from running the second time and results in VM names that increment by one.

Comment 2 Krain Arnold 2015-02-24 15:55:27 UTC
adding conversation referenced in above comment: http://post-office.corp.redhat.com/archives/cf-tech/2015-January/msg00073.html

Comment 4 Greg McCullough 2015-03-05 14:40:21 UTC
*** Bug 1198604 has been marked as a duplicate of this bug. ***

Comment 5 CFME Bot 2015-03-06 15:31:27 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/0414a970b68ee5747b08362989990ad24b129df0

commit 0414a970b68ee5747b08362989990ad24b129df0
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Thu Mar 5 16:02:29 2015 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Thu Mar 5 16:02:29 2015 -0500

    Removed an extra call to after_request_task_create
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1195754
    
    Removed an extra call to after_request_task_create since
    create_request_task already calls after_request_task_create.
    after_request_task_create was responsible for setting the vmname.
    Since it got called twice it increments in even increments, so
    the vms created via services with $n{x} notation would always start
    as 002 and then increment by 2.

 vmdb/app/models/miq_provision_request_template.rb | 1 -
 1 file changed, 1 deletion(-)

Comment 6 CFME Bot 2015-03-09 20:51:00 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=8fbf08db965e139ee6979c9980deb887ffaaa10c

commit 8fbf08db965e139ee6979c9980deb887ffaaa10c
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Thu Mar 5 16:02:29 2015 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Mon Mar 9 16:50:26 2015 -0400

    Removed an extra call to after_request_task_create
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1195754
    
    Removed an extra call to after_request_task_create since
    create_request_task already calls after_request_task_create.
    after_request_task_create was responsible for setting the vmname.
    Since it got called twice it increments in even increments, so
    the vms created via services with $n{x} notation would always start
    as 002 and then increment by 2.

 vmdb/app/models/miq_provision_request_template.rb | 1 -
 1 file changed, 1 deletion(-)

Comment 8 Shveta 2015-03-12 17:38:42 UTC
Verified in 5.4.0.0.11.20150309201930_8b6a235 ,increments by one.

Comment 10 errata-xmlrpc 2015-06-16 12:51:22 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://rhn.redhat.com/errata/RHBA-2015-1100.html