Bug 1695804

Summary: Service UI: Full automation code is loaded every time you open a service that was created using dynamic dialogs
Product: Red Hat CloudForms Management Engine Reporter: Ahmed El-Rayess <aelrayes>
Component: AutomateAssignee: Martin Hradil <mhradil>
Status: CLOSED CURRENTRELEASE QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.1CC: bmidwood, dmetzger, gmccullo, greartes, hkataria, lavenel, mhradil, mkanoor, mshriver, obarenbo, simaishi, tfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.11.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 5.11.0.15 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1755393 (view as bug list) Environment:
Last Closed: 2019-12-13 14:58:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1755393    

Description Ahmed El-Rayess 2019-04-03 18:39:31 UTC
Description of problem:
in the service UI, when you click on any of the services that is available, it takes a very long time to load.

these services were requested using dialogs with dynamic lists.
looking at the automation.log, all the dynamic dialog code is being rerun again and that is why the service is very slow to open.

Version-Release number of selected component (if applicable):
cfme-appliance-common-5.10.1.2-1.el7cf.x86_64
cfme-5.10.1.2-3.el7cf.x86_64
cfme-appliance-5.10.1.2-1.el7cf.x86_64
rubygem-redhat_access_cfme-2.0.3-1.el7cf.noarch
cfme-gemset-5.10.1.2-3.el7cf.x86_64


How reproducible:
always

Steps to Reproduce:
1. request a service that uses dynamic dialogs
2. open the service from the Service UI


Actual results:
service is too slow to show the service details due to rerunning all the code that was used during the service request

Expected results:
all the values of the service should be loaded directly from the database and not rerun all the code again every time the provisioned service is opened

Additional info:
same issue was happening in the Classic UI which is now tracked under bug 1663049

Comment 2 drew uhlmann 2019-04-15 16:51:14 UTC
Could I please get this retested on a later 5.10 version?

Comment 3 Tina Fitzgerald 2019-04-16 12:58:37 UTC
I believe this is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1667947
which is waiting for a hammer back port.

Comment 4 Ahmed El-Rayess 2019-04-16 20:43:12 UTC
i could not retest on the newer 5.10.2 as I faced another bug 1700540

has anything changed in the code that would affect the behavior of this issue?

@Tina the bug 1667947 is related to the Classic UI, this is the same issue but on the Self Service UI which uses different pages and it affects all user activities on that service.

Comment 5 Ahmed El-Rayess 2019-04-17 12:54:30 UTC
i did retest it with 5.10.2.2-1 using dynamic drop down instead of the dynamic text box which has the bug 1700540 and CloudForms is still running the code every time I open the service from the self_service interface.

Comment 6 drew uhlmann 2019-04-24 20:37:09 UTC
I don't think that this is a dup of the one in comment 3, actually. But it'd be cool to get a UI person to look at this.

Comment 18 Martin Hradil 2019-06-26 15:27:53 UTC
Steps to reproduce - setup:


1. in Ops UI, create a slow automate method & instance

  go to Automation > Automate > Explorer
  add a new method anywhere, type: inline, method body:

    sleep 20 # wait 20 seconds
    $evm.root['default_value'] = Time.now.to_s
    exit MIQ_OK

  add a new instance in the same place, value = name of the new method


2. in Ops UI, create a dialog, with a dynamic field backed by the slow method

  go to Automation > Automate > Customization
  accordion Service Dialogs
  toolbar Configuration > Add a New Dialog

  add a textbox, edit detail
  tab Field Information
    enable Dynamic
  tab Options
   set entry point to the newly created instance


3. in Ops UI, create a catalog item using the dialog

  go to Service > Catalogs > Catalog Items

  add a new catalog item,
  type Generic,
  select the newly created Dialog,
  enable Display in Catalog,
  select a Catalog


4. in Ops UI, order the catalog item

  go to Service > Catalogs > Service Catalogs
  order the new catalog item,
  (loading the dialog will wait the 20 seconds specified in the method)

  the UI redirects to a list of requests, click the new request,
  approve it (seems to happens by itself when the queue worker is running)


5. in Ops UI, make sure the new service was created,

  go to Service > My Services
  look for the new service (if "bz1695804" was the name of the catalog item, the service gets a name like "bz1695804-20190626-152519")

Comment 19 Martin Hradil 2019-06-26 15:38:45 UTC
Steps to reproduce - Service UI:

1. open Service UI, go to My Services
2. open the newly provisioned service detail screen (url like /services/184)


Actual results:

service takes 20 seconds to open,
manageiq/log/automation.log contains info about the automate method getting instantiated and invoked during that time


Expected results:

all the values of the service should be loaded directly from the database,
no 20 second wait should happen,
no new entries in automation.log


Additional info:

The UI queries the API for the field data, that request takes 20 seconds, and gets repeated periodically when the service detail screen is open:

GET /api/services/184?attributes=name%2Cguid%2Ccreated_at%2Ctype%2Cdescription%2Cpicture%2Cpicture.image_href%2Cevm_owner.name%2Cevm_owner.userid%2Cmiq_group.description%2Caggregate_all_vm_memory%2Caggregate_all_vm_disk_count%2Caggregate_all_vm_disk_space_allocated%2Caggregate_all_vm_disk_space_used%2Caggregate_all_vm_memory_on_disk%2Cretired%2Cretirement_state%2Cretirement_warn%2Cretires_on%2Cactions%2Ccustom_actions%2Cprovision_dialog%2Cservice_resources%2Cchargeback_report%2Cservice_template%2Cparent_service%2Cpower_state%2Cpower_status%2Coptions%2Cvms.ipaddresses%2Cvms.snapshots%2Cvms.v_total_snapshots%2Cvms.v_snapshot_newest_name%2Cvms.v_snapshot_newest_timestamp%2Cvms.max_mem_usage_absolute_average_avg_over_time_period%2Cvms.hardware%2Cvms.hardware.aggregate_cpu_speed%2Cvms.cpu_usagemhz_rate_average_avg_over_time_period%2Cgeneric_objects.picture%2Cgeneric_objects.generic_object_definition%2Cvms.supported_consoles&expand=vms%2Corchestration_stacks%2Cgeneric_objects

Comment 24 CFME Bot 2019-07-11 15:57:10 UTC
New commits detected on ManageIQ/manageiq-ui-service/master:

https://github.com/ManageIQ/manageiq-ui-self_service/commit/6df0bea68910a689a9a958fc57703d4dce28ca48
commit 6df0bea68910a689a9a958fc57703d4dce28ca48
Author:     Martin Hradil <mhradil>
AuthorDate: Fri Jun 28 07:30:49 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Fri Jun 28 07:30:49 2019 -0400

    Services.getService - add runAutomate parameter, defaults to true

    Asking the API for `provision_dialog` evaluates any automate methods it needs to populate the dialog data.
    That's not always desirable, parametrizing.

    https://bugzilla.redhat.com/show_bug.cgi?id=1695804

 client/app/services/services-state.service.js | 6 +-
 client/app/services/services-state.service.spec.js | 2 +-
 docs/howto.md | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)


https://github.com/ManageIQ/manageiq-ui-self_service/commit/1466c421ea4d9ddc35927024392ff5e7ff6d345d
commit 1466c421ea4d9ddc35927024392ff5e7ff6d345d
Author:     Martin Hradil <mhradil>
AuthorDate: Fri Jun 28 08:14:15 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Fri Jun 28 08:14:15 2019 -0400

    Service detail - don't run automate when displaying service detail screen

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1695804

 client/app/services/service-details/service-details.component.js | 2 +
 1 file changed, 2 insertions(+)