Bug 1348681 - provision_requests call with a request_type "clone_to_vm" fails with undefined method datacenter_name
Summary: provision_requests call with a request_type "clone_to_vm" fails with undefine...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Provisioning
Version: 5.5.0
Hardware: All
OS: All
high
high
Target Milestone: GA
: 5.7.0
Assignee: Drew Bomhof
QA Contact: Shveta
URL:
Whiteboard: service
Depends On:
Blocks: 1353288
TreeView+ depends on / blocked
 
Reported: 2016-06-21 18:39 UTC by Josh Carter
Modified: 2020-04-15 14:32 UTC (History)
6 users (show)

Fixed In Version: 5.7.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1353288 (view as bug list)
Environment:
Last Closed: 2017-01-11 20:23:28 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Josh Carter 2016-06-21 18:39:28 UTC
Description of problem:

Return message 
<Fault xmlns="https://yellowstone.usersys.redhat.com/api/vms">
   <error>
      <kind>internal_server_error</kind>
      <klass>NoMethodError</klass>
      <message>undefined method `datacenter_name' for #&lt;ManageIQ::Providers::Vmware::InfraManager::Vm:0x00000006e0d700></message>
   </error>
</Fault>

Evm.log error 

[----] I, [2016-06-21T14:29:00.141415 #3518:114b990]  INFO -- : <AutomationEngine> Followed  Relationship [miqaedb:/unknown/VM/Provisioning/Profile/EvmGroup-super_administrator#get_dialog_name]
[----] I, [2016-06-21T14:29:00.141784 #3518:114b990]  INFO -- : <AutomationEngine> Followed  Relationship [miqaedb:/System/Request/UI_PROVISION_INFO#create]
[----] I, [2016-06-21T14:29:00.142270 #3518:114b990]  INFO -- : MIQ(MiqProvisionVirtWorkflow#get_dialogs) Loading dialogs <miq_provision_dialogs> for user <admin>
[----] I, [2016-06-21T14:29:00.325133 #3518:114b990]  INFO -- : MIQ(MiqProvisionVirtWorkflow#ws_template_fields) data:<{:guid=>"ab76030c-328c-11e6-a956-001a4aa47711", :request_type=>"clone_to_vm"}>
[----] I, [2016-06-21T14:29:00.325256 #3518:114b990]  INFO -- : MIQ(MiqProvisionVirtWorkflow#ws_template_fields) VM Passed: <> <ab76030c-328c-11e6-a956-001a4aa47711> <> Datacenters:<nil>
[----] I, [2016-06-21T14:29:00.330538 #3518:114b990]  INFO -- : MIQ(MiqProvisionVirtWorkflow#source_vm_rbac_filter) Checking for allowed templates for User: <admin> Role: <EvmRole-super_administrator>  Group: <EvmGroup-super_administrator>  VM Filter: <nil>  Passing ini
tal template IDs: <[12000000001703]>
[----] E, [2016-06-21T14:29:00.344133 #3518:114b990] ERROR -- : MIQ(MiqProvisionVirtWorkflow.from_ws_ver_1_x) <undefined method `datacenter_name' for #<ManageIQ::Providers::Vmware::InfraManager::Vm:0x00000006b6b150>>
[----] E, [2016-06-21T14:29:00.345825 #3518:114b990] ERROR -- : <API> MIQ(ApiController.api_error) API Error
[----] E, [2016-06-21T14:29:00.345954 #3518:114b990] ERROR -- : <API> MIQ(ApiController.api_error) NoMethodError: undefined method `datacenter_name' for #<ManageIQ::Providers::Vmware::InfraManager::Vm:0x00000006b6b150>
[----] E, [2016-06-21T14:29:00.346154 #3518:114b990] ERROR -- : <API> MIQ(ApiController.api_error) API Error
[----] E, [2016-06-21T14:29:00.346934 #3518:114b990] ERROR -- : <API> MIQ(ApiController.api_error)
[----] E, [2016-06-21T14:29:00.347028 #3518:114b990] ERROR -- : <API> MIQ(ApiController.api_error)


Provision_requests

{
  "version" : "1.1",
  "template_fields" : {
    "guid" : "ab76030c-328c-11e6-a956-001a4aa47711",
    "request_type" : "clone_to_vm"
  },
  "vm_fields" : {
    "number_of_cpus" : 1,
    "vm_name" : "aab_rest_vm1",
    "vm_memory" : "1024",
    "vlan" : "rhevm"
  },
  "requester" : {
    "user_name" : "admin",
    "owner_first_name" : "John",
    "owner_last_name" : "Doe",
    "owner_email" : "jdoe",
    "auto_approve" : true
  },
  "tags" : {
    "network_location" : "Internal",
    "cc" : "001"
  },
  "additional_values" : {
    "request_id" : "1001"
  },
  "ems_custom_attributes" : { },
  "miq_custom_attributes" : { }
}





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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Greg McCullough 2016-06-22 13:00:36 UTC
Josh - Is this a result of http://talk.manageiq.org/t/how-to-clone-vm-not-template-via-rest-api/1545 ?

The description is missing some details.  Is the idea here that the user is the template_fields guid referencing a template or VM?

Comment 5 CFME Bot 2016-07-06 11:26:16 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/4faf4c231cad146bd8dc6e2ef96ac80f2e31fc1f

commit 4faf4c231cad146bd8dc6e2ef96ac80f2e31fc1f
Author:     Drew Bomhof <dbomhof>
AuthorDate: Thu Jun 30 14:01:21 2016 -0400
Commit:     Drew Bomhof <dbomhof>
CommitDate: Thu Jun 30 15:04:27 2016 -0400

    clone_to_vm provision requests no longer fail
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1348681
    
    Using the :clone_to_vm request_type was causing
    a failure when looking up the datacenter name
    and failing while attempting to run the dialog method :allowed_templates.
    
    This PR moves up setting the hash key :src_vm_id into the init_options
    hash, while returning a miq_hash_struct from the ws_find_template_or_vm method
    if it returns an RBAC object.

 app/models/miq_provision_virt_workflow.rb       |  8 +++++---
 spec/models/miq_provision_virt_workflow_spec.rb | 23 +++++++++++++++++++++--
 2 files changed, 26 insertions(+), 5 deletions(-)

Comment 7 Shveta 2016-09-21 19:55:51 UTC
Fixed.
Verified in 5.7.0.0.20160906172503_12f65cb


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