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

AutomationEngine mutex methods #6577

Closed
wants to merge 600 commits into from
Closed

AutomationEngine mutex methods #6577

wants to merge 600 commits into from

Conversation

dtrieu80
Copy link
Contributor

@dtrieu80 dtrieu80 commented Feb 9, 2016

New methods introduced:
$evm.with_acquired_lock(lock_name)
$evm.acquire_lock(lock_name)
$evm.release_lock(lock_name)
$evm.has_lock?(lock_name)

Need to consider deadlock solutions (lock ordering, no-nested or one-lock at a time, etc).

@chessbyte
Copy link
Member

@dtrieu80 Please rebase and push again

@chessbyte
Copy link
Member

@gmcculloug @mkanoor Please review

ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Rails.env])
end
unless @connection
@connection = ActiveRecord::Base.connection
Copy link
Contributor

Choose a reason for hiding this comment

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

@dtrieu80
@connection ||= ActiveRecord::Base.connection

@mkanoor
Copy link
Contributor

mkanoor commented Feb 9, 2016

@dtrieu80
Can you please add a spec for this

@Fryguy
Copy link
Member

Fryguy commented Feb 9, 2016

@matthewd Can you review...particularly the PgConcurrency bit?

while Time.now < give_up_at do
if MiqConcurrency::PGMutex.try_advisory_lock(lock_name)
begin
yield
Copy link
Contributor

Choose a reason for hiding this comment

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

return yield; it's good form for a with_... method to return its block's result

jrafanie and others added 17 commits February 15, 2016 07:36
Callers of collect_children expect arrays.

Fixes:

```
undefined method `empty?' for #<Host:0x007f9dbdbd9dd8>
  /~/.gem/ruby/2.2.4/gems/activemodel-4.2.5.1/lib/active_model/attribute_methods.rb:433:in `method_missing'
  ./app/models/condition.rb:165:in `_subst_find'
```
…chkconfig`

LinuxAdmin::Service will detect if it should call `service` or `systemctl` commands
when an instance is created. This makes it more portable than unconditionally
using `service` and `chkconfig`.
Also, specify the source_type as rails requests.

Note, we specify VmOrTemplate here because VmOrTemplate is where this
has_many is located.  It seems like this has_many may belong in MiqTemplate.

Fixes the following error:
```
ActiveRecord::HasManyThroughSourceAssociationNotFoundError:
  Could not find the source association(s) :vm in model MiqProvision.
  Try 'has_many :miq_provision_vms, :through => :miq_provisions_from_template, :source => <name>'.
  Is it one of miq_request, source, destination, miq_request_tasks, miq_request_task, or tenant?
```

This resolves the model bug reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=1303074

We still need to see if we can generate reports based on this now fixed
has_many :through.
@miq-bot
Copy link
Member

miq-bot commented Feb 15, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Feb 15, 2016

<github_pr_commenter_batch />Some comments on commits https://github.com/dtrieu80/manageiq/compare/e2ed2f4fec3f122095b65b10c934746fd1dcaf1d~...5654aedaa530ba5b8f648aea663233be9273e2b2

@miq-bot
Copy link
Member

miq-bot commented Feb 15, 2016

Checked commits https://github.com/dtrieu80/manageiq/compare/e2ed2f4fec3f122095b65b10c934746fd1dcaf1d~...5654aedaa530ba5b8f648aea663233be9273e2b2 with ruby 2.2.3, rubocop 0.34.2, and haml-lint 0.13.0
396 files checked, 203 offenses detected

Gemfile

app/controllers/application_controller.rb

app/controllers/application_controller/ci_processing.rb

app/controllers/application_controller/compare.rb

app/controllers/application_controller/filter.rb

app/controllers/auth_key_pair_cloud_controller.rb

app/controllers/ems_common.rb

  • 🔹 - Line 101, Col 3 - Metrics/AbcSize - Assignment Branch Condition size for view_setup_helper is too high. [26.02/15]

app/controllers/miq_policy_controller/rsop.rb

app/controllers/miq_request_controller.rb

app/controllers/provider_foreman_controller.rb

app/controllers/report_controller.rb

app/controllers/report_controller/reports/editor.rb

app/controllers/vm_common.rb

app/helpers/application_helper.rb

app/helpers/persistent_volume_helper/textual_summary.rb

app/models/cloud_volume/operations.rb

app/models/ems_cluster.rb

app/models/ems_refresh/save_inventory_configuration.rb

app/models/host.rb

app/models/import_file_upload.rb

  • 🔹 - Line 25, Col 3 - Metrics/AbcSize - Assignment Branch Condition size for widget_list is too high. [15.33/15]

app/models/manageiq/providers/ansible_tower/configuration_manager/refresh_parser.rb

app/models/manageiq/providers/azure/cloud_manager/provision/cloning.rb

app/models/manageiq/providers/azure/cloud_manager/refresh_parser.rb

app/models/manageiq/providers/google/cloud_manager/provision/cloning.rb

  • 🔹 - Line 32, Col 3 - Metrics/AbcSize - Assignment Branch Condition size for log_clone_options is too high. [21/15]

app/models/manageiq/providers/openstack/cloud_manager/provision_workflow.rb

app/models/manageiq/providers/openstack/cloud_manager/refresh_parser.rb

app/models/manageiq/providers/openstack/cloud_manager/vm/operations/relocation.rb

app/models/miq_action.rb

app/models/orchestration_template.rb

app/models/rbac.rb

app/models/service.rb

app/models/storage.rb

app/models/vm_or_template.rb

app/presenters/menu/default_menu.rb

app/services/container_dashboard_service.rb

app/services/container_topology_service.rb

app/views/configuration/_ui_2.html.haml

  • 🔴 Warn - Line 42, Col - - Line is too long. [338/160]

app/views/layouts/_content.html.haml

  • 🔴 Warn - Line 75, Col - - Metrics/BlockNesting: Avoid more than 3 levels of block nesting.

app/views/shared/views/_prov_dialog.html.haml

  • 🔴 Warn - Line 134, Col - - Line is too long. [177/160]

config/initializers/rack_ruby_prof.rb

  • 🔶 - Line 3, Col 3 - Rails/Output - Do not write to stdout. Use Rails' logger if you want to log.
  • 🔶 - Line 4, Col 3 - Rails/Output - Do not write to stdout. Use Rails' logger if you want to log.
  • 🔶 - Line 9, Col 5 - Rails/Output - Do not write to stdout. Use Rails' logger if you want to log.

config/initializers/sprockets-es6.rb

config/routes.rb

db/fixtures/ae_datastore/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/VMProvision_Template.class/methods/update_provision_status.rb

db/migrate/20150914202922_correct_user_created_role_feature_sets.rb

gems/pending/Gemfile

gems/pending/OpenStackExtract/MiqOpenStackVm/MiqOpenStackCommon.rb

gems/pending/OpenStackExtract/MiqOpenStackVm/MiqOpenStackImage.rb

gems/pending/OpenStackExtract/MiqOpenStackVm/MiqOpenStackInstance.rb

gems/pending/VMwareWebService/MiqVimInventory.rb

gems/pending/VMwareWebService/VimPropMaps.rb

gems/pending/VMwareWebService/wsdl41/vimws25MappingRegistry.rb

gems/pending/VolumeManager/MiqLvm.rb

gems/pending/appliance_console/internal_database_configuration.rb

gems/pending/spec/util/miq_logger_processor_spec.rb

lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-azure-cloud_manager-provision.rb

lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-google-cloud_manager-provision.rb

lib/miq_concurrency.rb

lib/token_manager.rb

spec/automation/unit/method_validation/update_provision_status_vm_cloud_spec.rb

spec/automation/unit/method_validation/update_provision_status_vm_infra_spec.rb

spec/automation/unit/method_validation/update_provision_status_vm_template_infra_spec.rb

spec/automation/unit/method_validation/update_service_provision_status_orchestration_spec.rb

spec/factories/availability_zone.rb

spec/factories/ext_management_system.rb

spec/factories/security_group.rb

spec/factories/template_google.rb

spec/factories/vm_or_template.rb

spec/helpers/application_helper/toolbar_builder_spec.rb

spec/lib/miq_automation_engine/miq_ae_collect_spec.rb

spec/lib/miq_automation_engine/miq_ae_provision_spec.rb

spec/lib/miq_automation_engine/miq_ae_service_spec.rb

spec/lib/miq_automation_engine/service_methods/miq_ae_service_manageiq-providers-cloud_manager-provision_spec.rb

spec/lib/miq_automation_engine/service_methods/miq_ae_service_manageiq-providers-cloud_manager-vm_spec.rb

spec/lib/miq_automation_engine/service_methods/miq_ae_service_manageiq-providers-google-cloud_manager_spec.rb

spec/lib/vmdb/configuration_encoder_spec.rb

spec/migrations/20150604154825_rename_container_node_conditions_to_container_conditions_spec.rb

spec/migrations/20151204143045_set_correct_sti_type_on_openstack_cloud_volume_spec.rb

@miq-bot
Copy link
Member

miq-bot commented Feb 15, 2016

...continued

spec/models/condition_spec.rb

spec/models/host_spec.rb

  • 🔶 - Line 40, Col 7 - Style/IndentHash - Use 2 spaces for indentation in a hash, relative to the first position after the preceding left parenthesis.

spec/models/manageiq/providers/amazon/aws_helper.rb

  • 🔹 - Line 3, Col 1 - Metrics/AbcSize - Assignment Branch Condition size for with_aws_stubbed is too high. [15.07/15]

spec/models/manageiq/providers/amazon/cloud_manager_spec.rb

  • 🔶 - Line 71, Col 11 - Style/AlignHash - Align the elements of a hash literal if they span more than one line.

spec/models/manageiq/providers/ansible_tower/configuration_manager/refresh_parser_spec.rb

spec/models/manageiq/providers/azure/cloud_manager/provision_spec.rb

spec/models/manageiq/providers/azure/cloud_manager/refresher_spec.rb

  • 🔹 - Line 93, Col 3 - Metrics/AbcSize - Assignment Branch Condition size for assert_specific_security_group is too high. [17.12/15]

spec/models/manageiq/providers/openshift/container_manager/refresher_spec.rb

  • 🔹 - Line 102, Col 3 - Metrics/AbcSize - Assignment Branch Condition size for assert_specific_container_services is too high. [23.02/15]

spec/models/manageiq/providers/openstack/cloud_manager/provision_workflow_spec.rb

spec/models/miq_report_spec.rb

spec/models/miq_storage_metric_spec.rb

spec/support/automation_spec_helper.rb

  • 🔹 - Line 95, Col 3 - Metrics/AbcSize - Assignment Branch Condition size for add_call_method is too high. [16.88/15]

tools/log_processing/ems_refresh_timings.rb

@dtrieu80
Copy link
Contributor Author

I messed up this branch somehow. I'll need to close it and reapply a new PR.

@dtrieu80 dtrieu80 closed this Feb 15, 2016
@jrafanie
Copy link
Member

@dtrieu80 ping us in https://gitter.im/ManageIQ/manageiq if you need help. Thanks!

@miq-bot
Copy link
Member

miq-bot commented Feb 15, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet