Host for ESXI hypervisors not created due to error Validation failed: Name has already been taken
Environment
- Red Hat Satellite 6.3.5
Issue
- Create host for esxi hypervisor fails with below error
Validation failed: Name has already been taken error.
Resolution
- This is a known issue and handled in this This content is not included.bugzilla.
For more KB articles/solutions related to Virt-who and Virtual Datacenter (VDC) Subscriptions Issues, please refer to the Consolidated Troubleshooting Article for Virt-who and Virtual Datacenter (VDC) Subscriptions Issues
Root Cause
- If
virt-whomapping shows that the hypervisor names are same e.g.
{
"hypervisorId": {
"hypervisorId": "<uuid>"
},
"name": "localhost",
"guestIds": [
{
"guestId": "<uuid>",
"state": 5,
"attributes": {
"active": 0,
"virtWhoType": "esx"
}
},##guests object truncated
],
"facts": {
"hypervisor.type": "VMware ESXi",
"cpu.cpu_socket(s)": "2",
"hypervisor.cluster": "Public",
"hypervisor.version": "6.0.0"
}
},
{
"hypervisorId": {
"hypervisorId": "<uuid>"
},
"name": "localhost",
"guestIds": [
{
"guestId": "<uuid>",
"state": 1,
"attributes": {
"active": 1,
"virtWhoType": "esx"
}
}##guests object truncated
],
"facts": {
"hypervisor.type": "VMware ESXi",
"cpu.cpu_socket(s)": "2",
"hypervisor.cluster": "Shared",
"hypervisor.version": "6.0.0"
}
}
- Above mapping shows all the hypervisor have same name i.e. locahost. Due to the same name, Satellite is not allowing to create a new record hence reporting the validation error.
- Currently in Sat 6.3 changing the hypervisor_id=uuid in virt-who config is not forcing Satellite to register the systems to use the virt-who-
names
Diagnostic Steps
- On the webUI, check for the task with the label
Actions::Katello::Host::HypervisorsUpdate, it fails with below error/trace
Validation failed: Name has already been taken
""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:79:in `raise_record_invalid'"",""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'"",""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'"",""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'"",""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'"",""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'"",""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'"",""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'"",""/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.6.10/app/models/foreman_tasks/concerns/action_triggering.rb:29:in `block in save!'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.6.10/app/models/foreman_tasks/concerns/action_triggering.rb:121:in `dynflow_task_wrap'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.6.10/app/models/foreman_tasks/concerns/action_triggering.rb:29:in `save!'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/lib/actions/katello/host/hypervisors_update.rb:102:in `create_host_for_hypervisor'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/lib/actions/katello/host/hypervisors_update.rb:63:in `block in create_missing_hosts'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/lib/actions/katello/host/hypervisors_update.rb:60:in `each'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/lib/actions/katello/host/hypervisors_update.rb:60
<lines omitted>
create_worker'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-1.0.3/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `loop'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-1.0.3/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `block (2 levels) in create_worker'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-1.0.3/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `catch'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/concurrent-ruby-1.0.3/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `block in create_worker'"",""/opt/theforeman/tfm/root/usr/share/gems/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'""
SBR
Product(s)
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.