Project

General

Profile

Actions

Bug #15306

closed

Orchestration does not roll back queued actions if DB error occurs

Added by Shimon Shtein over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Orchestration
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1343058
Description of problem:

If an SQL error occurs upon saving a host, the orchestration actions will still occur.

How reproducible:

Create a host with a missing foreign key (for example environment_id = 999), observe an exception thrown and orchestration leftovers.

Steps to Reproduce:

# hammer host create --name my-cli-host-1 --partition-table-id 61 --domain-id 1 --operatingsystem-id 3 --architecture-id 1 --compute-resource-id 1 --environment-id 999 --puppet-proxy-id 1 --location-id 1 --organization-id 1 --root-password changeme --medium-id 9
[Foreman] Password for admin: 
Could not create the host:
  ERROR:  insert or update on table "hosts" violates foreign key constraint "hosts_environment_id_fk" 
  DETAIL:  Key (environment_id)=(999) is not present in table "environments".
[root@sat6 dhcp]# 
[root@sat6 dhcp]# 
[root@sat6 dhcp]# hammer host create --name my-cli-host-1 --partition-table-id 61 --domain-id 1 --operatingsystem-id 3 --architecture-id 1 --compute-resource-id 1 --environment-id 999 --puppet-proxy-id 1 --location-id 1 --organization-id 1 --root-password changeme --medium-id 9
[Foreman] Password for admin: 
Could not create the host:
  Failed to create a compute my_libvirt_cr_1 (Libvirt) instance my-cli-host-1.domain.com: Error saving the server: Call to virDomainDefineXML failed: operation failed: domain 'my-cli-host-1.domain.com' already exists with uuid 3d1ac10d-fb73-fb16-a3a3-503d7625e042

Expected results:

The second request succeeds.


Related issues 5 (0 open5 closed)

Related to Foreman - Bug #15644: import_facts assumes orchestration is availableClosedDaniel Lobato Garcia07/11/2016Actions
Related to Discovery - Bug #15645: Change in core leads to undefined method `enable_orchestration!'Duplicate07/11/2016Actions
Related to Foreman - Bug #17041: Orchestration not skipped when importing factsClosedTimo Goebel10/20/2016Actions
Related to Foreman - Bug #16866: Facts import doesn't work with unattended=falseClosedDominic Cleal10/11/2016Actions
Related to Foreman - Bug #12425: Fact import triggers ip conflicts checks, which drives cpu utilization to 100% on smart-proxyClosedTimo GoebelActions
Actions

Also available in: Atom PDF