Is it possible to move a host to a different compute resource

Problem:
We’re migrating some hosts from on-prem RHEV (ovirt) to EC2. These hosts were provisioned by foreman and have since been moved into EC2 via cloud endure migration. Is it possible to edit the db and change the compute resource/uuid so that we get proper power state? Puppet and agent check-in are still working properly of course.

Thanks

1 Like

In the db here are two host records, host A was provisioned on RHEV, and host B was provisioned on EC2:

foreman=# select compute_resource_id,uuid from hosts where certname = 'A';
 compute_resource_id |                 uuid                 
---------------------+--------------------------------------
                   3 | 9ec1d332-60af-47bc-a33b-4281d3ddbe90
(1 row)

foreman=# select compute_resource_id,uuid from hosts where certname = 'B';
 compute_resource_id |        uuid         
---------------------+---------------------
                   4 | i-0610eb0c9ccdc3ba6
(1 row)

It seems like I could just modify these fields on host A, settings the compute_resource_id to 4 and the uuid to the EC2 instance ID, does anyone have any feedback? Potential breakage?

@Stevedd

You should be able to goto the host under all hosts, do unmanage host. See if that clears the compute_resource_id column. If it does then on the host, do manage. Then goto the EC2 compute resource and click associate VM’s

1 Like

I tried this, including changing the location to the location with the EC2 compute resource.

Unfortunately it doesn’t clear the Deploy On field, I can unclick inherit, change to the EC2 compute resource, but that starts a spinning icon which never stops. When I save it just reverts Deploy On to rhev.

Updating these fields in the hosts table seems to have worked for us:

compute_resource_id | uuid | location_id | hostgroup_id

‘Worked’ as in power state and location are accurate - haven’t tried to delete anything yet.

The IP address shown on the host is incorrect, and updating the interface to match ec2 settings didn’t populate the IP but thats a minor issue for us.

Glad you were able to move forward. I was going to suggest creating a rake task for you but how you did it works as well. Keep us posted if you have any issues from the change.

1 Like