Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add refresh after creating manager #181

Conversation

Lauferin
Copy link
Contributor

Until now, when adding a storage manager sometimes it took a long time until an automatic refresh happened, and this caused that the user wasn't able to add the type system of a new physical storage until a manual refresh.

MicrosoftTeams-image (1)

So a refresh was added directly after connecting to the storage manager.

Screen Shot 2022-09-22 at 10 55 14

@miq-bot
Copy link
Member

miq-bot commented Sep 22, 2022

Checked commit Autosde@91f2fda with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint
1 file checked, 0 offenses detected
Everything looks fine. 🍰

Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lauferin were you running with rails s + simulate_queue_worker or the full appliance when you saw refresh taking forever?

When a refresh worker is started (which will happen on a real appliance or podified install) a refresh is queued right away before processing any work: https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/base_manager/refresh_worker/runner.rb#L14

This should be within a few seconds of adding the provider.

@@ -184,6 +184,7 @@ def connect(options = {})
host = options[:host] || address
port = options[:port] || self.port
self.class.raw_connect(username, password, host, port).login
EmsRefresh.queue_refresh(ext_management_system)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a great place for this, connect is called in a lot of places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I paid attention to that, but I thought maybe for all those cases a refresh would fit well.

But if not, would it be preferable to do it 'after_save'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I understand that after_save is not option (I tried and saw an infinite loop...). Where would you recommend it then? I don't see anywhere else in the file where this could fit.

@agrare agrare self-assigned this Sep 22, 2022
@Lauferin
Copy link
Contributor Author

@Lauferin were you running with rails s + simulate_queue_worker or the full appliance when you saw refresh taking forever?

When a refresh worker is started (which will happen on a real appliance or podified install) a refresh is queued right away before processing any work: https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/base_manager/refresh_worker/runner.rb#L14

This should be within a few seconds of adding the provider.

It happens with rails and queue worker and also when not stopping the server at all. It doesn't take forever, but it can take up to one minute approximately.

@Fryguy Fryguy added the bug Something isn't working label Sep 28, 2022
@Lauferin
Copy link
Contributor Author

@Lauferin were you running with rails s + simulate_queue_worker or the full appliance when you saw refresh taking forever?
When a refresh worker is started (which will happen on a real appliance or podified install) a refresh is queued right away before processing any work: https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/base_manager/refresh_worker/runner.rb#L14
This should be within a few seconds of adding the provider.

It happens with rails and queue worker and also when not stopping the server at all. It doesn't take forever, but it can take up to one minute approximately.

I tried again in both ways and I insist, it usually takes more or less a minute... I'll be happy to show you on live if you want :-) (have you checked?)

@agrare
Copy link
Member

agrare commented Sep 29, 2022

@Lauferin so just so I understand, if you run on an appliance or with lib/workers/bin/run_single_worker.rb you do see an initial refresh being queued via https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/base_manager/refresh_worker/runner.rb#L14 ?

I tried running this locally with lib/workers/bin/run_single_worker.rb --ems-id=4 --role=ems_inventory ManageIQ::Providers::Autosde::StorageManager::RefreshWorker and I see an initial refresh queued right away on startup and it is run right away

[----] I, [2022-09-29T15:36:17.783156 #84125:97b8]  INFO -- evm: MIQ(ManageIQ::Providers::Autosde::StorageManager::RefreshWorker::Runner#do_before_work_loop) EMS [autosde.local] as [root] Queueing initial refresh for EMS 4.
[----] I, [2022-09-29T15:36:17.816920 #84125:97b8]  INFO -- evm: MIQ(MiqQueue.put) Message id: [119], Zone: [default], Role: [ems_inventory], Server: [], MiqTask id: [], Handler id: [], Ident: [ems_4], Target id: [], Instance id: [], Task id: [], Command: [EmsRefresh.refresh], Timeout: [7200], Priority: [100], State: [ready], Deliver On: [], Data: [1 bytes], Args: []
[----] I, [2022-09-29T15:36:17.828397 #84125:97b8]  INFO -- evm: MIQ(MiqQueue.get) Message id: [119], Zone: [default], Role: [ems_inventory], Server: [], MiqTask id: [], Handler id: [MiqWorker 32], Ident: [ems_4], Target id: [], Instance id: [], Task id: [], Command: [EmsRefresh.refresh], Timeout: [7200], Priority: [100], State: [dequeue], Deliver On: [], Data: [1 bytes], Args: [], Dequeued in: [0.016824348] seconds
[----] I, [2022-09-29T15:36:17.828615 #84125:97b8]  INFO -- evm: MIQ(MiqQueue#deliver) Message id: [119], Delivering...
[----] I, [2022-09-29T15:36:17.875350 #84125:97b8]  INFO -- evm: MIQ(ManageIQ::Providers::Autosde::StorageManager::Refresher#refresh) Refreshing all targets...

It might take the first refresh more than a minute to finish but once the worker is started the first refresh should be queued and started in seconds. If the issue is that the first refresh takes a bit to complete, queueing another isn't going to do anything to help that.

@Lauferin Lauferin closed this Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants