Bug 1390619

Summary: When running bootstrap with the --force option, it deletes the host AND if it is associated to a virtual machine via a compute resource, the virtual machine also.
Product: Red Hat Satellite Reporter: Rich Jerrido <rjerrido>
Component: BootstrapAssignee: Rich Jerrido <rjerrido>
Status: CLOSED ERRATA QA Contact: Jitendra Yejare <jyejare>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.3CC: bbuckingham, ehelms, jcallaha, jyejare, ktordeur, mmccune, oshtaier
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Rich Jerrido 2016-11-01 14:16:29 UTC
Description of problem:
When running bootstrap with the --force option, it deletes the host AND if it is associated to a virtual machine via a compute resource, the virtual machine also. 

Version-Release number of selected component (if applicable):
katello-client-bootstrap-1.1.0-2.el7sat.noarch

How reproducible:
100%

Steps to reproduce:

- create a host
- associate it with a virtual machine
- register it via bootstrap.py using --force

Actual results
virtual machine is deleted (as bootstrap deletes the foreman host) 

Expected results. 

virtual machine is not deleted and it is disassociated from the foreman host first.

Comment 1 Rich Jerrido 2016-11-01 14:18:27 UTC
This was addressed in upstream commit (https://github.com/Katello/katello-client-bootstrap/commit/dab153ed587f805db8bc82cad75815315d342221). moving to POST

Comment 3 Jitendra Yejare 2017-12-15 07:38:33 UTC
As per discussion with Zhenech on steps to verify this bug:
```
<jyejare> Zhenech, Looking for steps
<Zhenech> jyejare: you'd need a sat6 with a configured compute resource, and a vm running on that said CR
<jyejare> Zhenech, i have internal libvirt running a VM
<Zhenech> jyejare: now if you open the VM in satellite, it should list it as running on the CR (= sat knows where it runs).
<Zhenech> jyejare: now you run bootstrap with --force (because the VM is already registered), before the patch sat6 would actually also delete the VM itself from libvirt
<Zhenech> jyejare: after the patch, only the host in satellite is deleted and re-created
```


AS per above steps:
1. I created VM on internal libvirt CR
2. The VM was registered to satellite using AK
3. I ran bootstrap on VM(content host) with force option


Observation:
1. The host was re-registered but VM was not deleted as expected.

Changing the state to Verified !

Comment 4 Satellite Program 2018-02-21 16:54:37 UTC
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://access.redhat.com/errata/RHSA-2018:0336