Bug 1195754 - Naming method increments VM names by two when ordering through a service
Summary: Naming method increments VM names by two when ordering through a service
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Provisioning
Version: 5.3.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: GA
: 5.4.0
Assignee: mkanoor
QA Contact: Dave Johnson
URL:
Whiteboard:
: 1198604 (view as bug list)
Depends On:
Blocks: 1139277 1200152
TreeView+ depends on / blocked
 
Reported: 2015-02-24 13:55 UTC by Krain Arnold
Modified: 2019-06-13 08:15 UTC (History)
6 users (show)

Fixed In Version: 5.4.0.0.11
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1200152 (view as bug list)
Environment:
Last Closed: 2015-06-16 12:51:22 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1100 0 normal SHIPPED_LIVE CFME 5.4.0 bug fixes, and enhancement update 2015-06-16 16:28:42 UTC

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


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