Description of problem: AWS EC2 supports VMs with no names, only keying off the "instance ID" field. CloudForms requires that all VMs have a name, and fails validation during EMS refresh if a blank VM name is encountered. Version-Release number of selected component (if applicable): cfme-5.6.0.13-1.el7cf.x86_64 How reproducible: trivial Steps to Reproduce: 1. create a new VM on AWS with no name 2. add AWS to CloudForms 3. trigger EMS refresh Actual results: EMS refresh never completes, attached loglines can be found. Expected results: EMS refresh finishes. Additional info: (logs pending)
@Colin would you expect the name to be the instance-id? Or should we make the name optional for aws instances? I'm not sure about the implications of the latter solution
I do not really have a strong preference for the solution, as I see the collection of the VM information to the paramount. I also agree that allowing the name field to be optional is problematic, due to the current UI design, but as you key off an internal id (i.e. 20000000000017), it should be technically possible. Using the instance-id could be a good stop-gap measure, but as the name field is blank in AWS, a 'null', 'nil' or 'empty' value may be more representative of the ground truth. My vote would be to use nil, but this may confuse non-technical users.
PR https://github.com/ManageIQ/manageiq-providers-amazon/pull/35 is merged
Verified in 5.7.0.10. No errors and refresh passes.
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-2017-0012.html
*** Bug 1425057 has been marked as a duplicate of this bug. ***
Reopening bug, looks like we have a regression as customer is hitting this on 5.7.2.1 [----] E, [2017-07-14T05:35:06.715936 #2770:8a712c] ERROR -- : MIQ(EmsRefresh.save_vms_inventory) EMS: [AWS TEST], id: [1000000000006] Processing Vm: [] failed with error [Validation failed: Name can't be blank]. Skipping Vm. [----] E, [2017-07-14T05:35:06.716400 #2770:8a712c] ERROR -- : [ActiveRecord::RecordInvalid]: Validation failed: Name can't be blank Method:[rescue in block (2 levels) in save_vms_inventory] [----] E, [2017-07-14T05:35:06.716795 #2770:8a712c] ERROR -- : /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/validations.rb:78:in `raise_validation_error' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/validations.rb:50:in `save!' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/attribute_methods/dirty.rb:30:in `save!' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/transactions.rb:324:in `block in save!' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/transactions.rb:211:in `transaction' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/transactions.rb:392:in `with_transaction_returning_status' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/transactions.rb:324:in `save!' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/suppressor.rb:45:in `save!' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory.rb:187:in `save_hardware_inventory' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory_helper.rb:109:in `block in save_child_inventory' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory_helper.rb:109:in `each' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory_helper.rb:109:in `save_child_inventory' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory.rb:114:in `block (2 levels) in save_vms_inventory' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory.rb:58:in `each' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory.rb:58:in `block in save_vms_inventory' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction' /opt/rh/cfme-gemset/gems/activerecord-5.0.2/lib/active_record/transactions.rb:211:in `transaction' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory.rb:57:in `save_vms_inventory' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory_helper.rb:109:in `block in save_child_inventory' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory_helper.rb:109:in `each' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory_helper.rb:109:in `save_child_inventory' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory_cloud.rb:69:in `save_ems_cloud_inventory' /var/www/miq/vmdb/app/models/ems_refresh/save_inventory.rb:4:in `save_ems_inventory' /opt/rh/cfme-gemset/bundler/gems/manageiq-providers-amazon-1b78b94636be/app/models/manageiq/providers/amazon/cloud_manager/refresher.rb:11:in `save_inventory' /var/www/miq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:91:in `block in refresh_targets_for_ems' /var/www/miq/vmdb/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store' /var/www/miq/vmdb/gems/pending/util/extensions/miq-benchmark.rb:30:in `realtime_block' /var/www/miq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:91:in `refresh_targets_for_ems' /var/www/miq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:24:in `block (2 levels) in refresh' /var/www/miq/vmdb/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store' /var/www/miq/vmdb/gems/pending/util/extensions/miq-benchmark.rb:30:in `realtime_block' /var/www/miq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:24:in `block in refresh' /var/www/miq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:14:in `each' /var/www/miq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:14:in `refresh' /var/www/miq/vmdb/app/models/manageiq/providers/base_manager/refresher.rb:10:in `refresh' /var/www/miq/vmdb/app/models/ems_refresh.rb:91:in `block in refresh' /var/www/miq/vmdb/app/models/ems_refresh.rb:90:in `each' /var/www/miq/vmdb/app/models/ems_refresh.rb:90:in `refresh' /var/www/miq/vmdb/app/models/miq_queue.rb:347:in `block in deliver' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:91:in `block in timeout' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `block in catch' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch' /opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:106:in `timeout' /var/www/miq/vmdb/app/models/miq_queue.rb:343:in `deliver' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:107:in `deliver_queue_message' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:135:in `deliver_message' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:153:in `block in do_work' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:147:in `loop' /var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:147:in `do_work' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:336:in `block in do_work_loop' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:333:in `loop' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:333:in `do_work_loop' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:155:in `run' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:130:in `start' /var/www/miq/vmdb/app/models/miq_worker/runner.rb:21:in `start_worker' /var/www/miq/vmdb/app/models/miq_worker.rb:343:in `block in start' /opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork' /opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork' /var/www/miq/vmdb/app/models/miq_worker.rb:341:in `start' /var/www/miq/vmdb/app/models/miq_worker.rb:270:in `start_worker' /var/www/miq/vmdb/app/models/mixins/per_ems_worker_mixin.rb:68:in `start_worker_for_ems' /var/www/miq/vmdb/app/models/mixins/per_ems_worker_mixin.rb:46:in `block in sync_workers' /var/www/miq/vmdb/app/models/mixins/per_ems_worker_mixin.rb:45:in `each' /var/www/miq/vmdb/app/models/mixins/per_ems_worker_mixin.rb:45:in `sync_workers' /var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:53:in `block in sync_workers' /var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `each' /var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `sync_workers' /var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:22:in `monitor_workers' /var/www/miq/vmdb/app/models/miq_server.rb:346:in `block in monitor' /var/www/miq/vmdb/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store' /var/www/miq/vmdb/gems/pending/util/extensions/miq-benchmark.rb:30:in `realtime_block' /var/www/miq/vmdb/app/models/miq_server.rb:346:in `monitor' /var/www/miq/vmdb/app/models/miq_server.rb:368:in `block (2 levels) in monitor_loop' /var/www/miq/vmdb/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store' /var/www/miq/vmdb/gems/pending/util/extensions/miq-benchmark.rb:30:in `realtime_block' /var/www/miq/vmdb/app/models/miq_server.rb:368:in `block in monitor_loop' /var/www/miq/vmdb/app/models/miq_server.rb:367:in `loop' /var/www/miq/vmdb/app/models/miq_server.rb:367:in `monitor_loop' /var/www/miq/vmdb/app/models/miq_server.rb:250:in `start' /var/www/miq/vmdb/lib/workers/evm_server.rb:65:in `start' /var/www/miq/vmdb/lib/workers/evm_server.rb:92:in `start' /var/www/miq/vmdb/lib/workers/bin/evm_server.rb:4:in `<main>'
I was able to generate this error by creating a Tag in AWS that has key but no value. Looks to be the same thing. [----] E, [2017-07-14T18:33:01.620906 #4941:3f9134] ERROR -- : MIQ(EmsRefresh.save_vms_inventory) EMS: [awsdave], id: [2] Processing Vm: [] failed with error [Validation failed: Name can't be blank]. Skipping Vm. [----] E, [2017-07-14T18:33:01.621331 #4941:3f9134] ERROR -- : [ActiveRecord::RecordInvalid]: Validation failed: Name can't be blank Method:[rescue in block (2 levels) in save_vms_inventory] [----] E, [2017-07-14T18:33:01.621708 #4941:3f9134] ERROR -- : /opt/rh/cfme-gemset/gems/activerecord-5.0.3/lib/active_record/validations.rb:78:in `raise_validation_error' Will test patch when it's ready to merge.
The tag is on the image, not the instance
https://github.com/ManageIQ/manageiq-providers-amazon/pull/273
Applied above PR manually using 5.7.3 appliance and could not reproduce the error.
Putting back to CLOSED - the new issue which PR 273 was created for is tracked under bug 1471297.