Project

General

Profile

Bug #15306

Updated by Dominic Cleal almost 8 years ago

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: 

 <pre> 
 # 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 
 </pre> 

 


 Expected results: 

 The second request succeeds.

Back