Project

General

Profile

Actions

Feature #5464

closed

Delete unamanged compute resource host without deleting the virtual machine.

Added by Trey Ormsbee about 10 years ago. Updated about 10 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
Compute resources
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I create a lot of vmware vm's in foreman that generally end up getting turned off after creation to prep for ova export. Id like to be able to provision them in forman and the delete the host in foreman; without actually deleting the vmware vm.

I found the following article:

https://groups.google.com/forum/#!topic/foreman-users/BES0qnmw9XE

which mentions editing compute.rb. I made edits to actually check if the entry in the database is managed or not before destroying, but it appears the host.destroy function actually deletes the db record before calling delCompute. Im not good enough with rails to follow the destroy chain to figure out where an edit needs to be placed to implement this. Ideally it would be a configurable option.

Thanks.


Related issues 1 (0 open1 closed)

Related to Foreman - Feature #3909: compute resources prevent or disassciate host from VM prevent vm deletionClosed12/18/2013Actions
Actions #1

Updated by Trey Ormsbee about 10 years ago

I meant to post this as a feature request, not a bug report. Sorry.

Actions #2

Updated by Dominic Cleal about 10 years ago

  • Status changed from New to Feedback

Foreman 1.5 has a "disassociate" button on hosts which will unlink it from the VM, allowing you to then delete the host without destroying the VM. Although it's not part of the destroy workflow, maybe it solves this for you?

Actions #3

Updated by Dominic Cleal about 10 years ago

  • Related to Feature #3909: compute resources prevent or disassciate host from VM prevent vm deletion added
Actions #4

Updated by Trey Ormsbee about 10 years ago

Dominic Cleal wrote:

Foreman 1.5 has a "disassociate" button on hosts which will unlink it from the VM, allowing you to then delete the host without destroying the VM. Although it's not part of the destroy workflow, maybe it solves this for you?

That should work perfectly. Thank you!

Actions #5

Updated by Dominic Cleal about 10 years ago

  • Status changed from Feedback to Duplicate

Great, give it a try once 1.5.0-RC2's available as we fixed a bug.

Actions #6

Updated by Trey Ormsbee about 10 years ago

I tried upgrading on a test box, and am having trouble getting it working (lots o DB errors).... but looking at the controller code it will do exactly what I need. Ill keep an eye out and try when rc3 hits and give it a try...

def disassociate
if @host.uuid.nil? && @host.compute_resource_id.nil?
process_error :error_msg => _("Host %s is not associated with a VM") % @host.name, :redirect => :back
else
@host.uuid = nil
@host.compute_resource_id = nil
@host.save!(:validate => false) # don't want to trigger callbacks
msg = _("%s has been disassociated from VM") % (@host.name)
process_success :success_msg => msg, :success_redirect => :back
end
end
Actions #7

Updated by Dominic Cleal about 10 years ago

I'd suggest posting to the -users list or popping on IRC if you're having upgrade problems, I'm not aware of any major DB errors so perhaps we can help you solve them.

Actions #8

Updated by Trey Ormsbee about 10 years ago

I got it working, I installed from rpm's first, then just pulled from git. I think I had other issues such as gem versioning. The functionality I am looking for is attained 100% with the disassociate host function. Thank you!

Actions

Also available in: Atom PDF