Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2212630 - Virtual machine goes in re-provisioning mode while registration host using Global registration template.
Summary: Virtual machine goes in re-provisioning mode while registration host using Gl...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 6.14.0
Assignee: Ewoud Kohl van Wijngaarden
QA Contact: sganar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-06 04:22 UTC by Satyajit Das
Modified: 2024-01-04 15:16 UTC (History)
11 users (show)

Fixed In Version: foreman-3.7.0.5-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2238350 (view as bug list)
Environment:
Last Closed: 2023-11-08 14:19:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36393 0 Normal Closed global registration should not create hosts as "managed" or "to be built" 2023-08-03 17:58:03 UTC
Red Hat Issue Tracker SAT-18273 0 None None None 2023-06-12 12:24:24 UTC
Red Hat Knowledge Base (Solution) 7022101 0 None None None 2023-06-29 14:47:26 UTC
Red Hat Product Errata RHSA-2023:6818 0 None None None 2023-11-08 14:19:41 UTC

Description Satyajit Das 2023-06-06 04:22:34 UTC
Description of problem:

Provisioned virtual machines in the VMware platform via satellite using the auto-attach Bootdisk method. when we re-register the same VM using the Global registration template to the RedHat Satellite, this VM goes into re-provisioning mode.


Version-Release number of selected component (if applicable):

6.11 

How reproducible:

100% (Customer's env)



Steps to Reproduce:
1. Provision a host from the satellite.
2. Host is provisioned successfully. Next, try to re-register the host using the Global registration template.

Actual results:

The server is getting into build mode when reregistering the same host using the global registration template.

==> /var/log/foreman/production.log <==
2023-04-28T11:48:32 [W|app|4ca3dd29] Failed to detach ISO image from CDROM drive of instance client.example.com: GenericVmConfigFault: Connection control operation failed for disk 'ide0:0'.
2023-04-28T11:48:32 [I|app|4ca3dd29] Backtrace for 'Failed to detach ISO image from CDROM drive of instance client.example.com: GenericVmConfigFault: Connection control operation failed for disk 'ide0:0'.' error (RbVmomi::Fault): GenericVmConfigFault: Connection control operation failed for disk 'ide0:0'.
 4ca3dd29 | /usr/share/gems/gems/rbvmomi-2.2.0/lib/rbvmomi/vim/Task.rb:14:in `wait_for_completion'
 4ca3dd29 | /usr/share/gems/gems/fog-vsphere-3.5.2/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb:10:in `vm_reconfig_hardware'
 4ca3dd29 | /usr/share/gems/gems/fog-vsphere-3.5.2/lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb:32:in `vm_reconfig_cdrom'
 4ca3dd29 | /usr/share/gems/gems/foreman_bootdisk-19.0.4.1/app/models/concerns/foreman_bootdisk/compute_resources/vmware.rb:52:in `iso_detach'
 4ca3dd29 | /usr/share/gems/gems/foreman_bootdisk-19.0.4.1/app/models/concerns/foreman_bootdisk/orchestration/compute.rb:67:in `bootdisk_detach_iso'
 4ca3dd29 | /usr/share/gems/gems/foreman_bootdisk-19.0.4.1/app/models/concerns/foreman_bootdisk/orchestration/compute.rb:98:in `setDetachIsoImage'

=================================================
 Due to the above error in the logs, the host build mode remains in pending installation mode, so if the customer reboots the host then the host is getting rebuilt.




Expected results:

Registering hosts using the Global registration template should not go into the built mode, regardless the host is provisioned from the satellite.

Additional info:

Upstream BZ is reported for the same concerns.

https://projects.theforeman.org/issues/36393

Comment 3 Leos Stejskal 2023-06-13 11:37:49 UTC
> Host is provisioned successfully. Next, try to re-register the host using the Global registration template.

Why do you re-register managed host provisioned from Satellite?

Comment 4 Afeef Ghannam 2023-06-13 11:50:04 UTC
(In reply to Leos Stejskal from comment #3)
> > Host is provisioned successfully. Next, try to re-register the host using the Global registration template.
> 
> Why do you re-register managed host provisioned from Satellite?

Why should we not do that? What is the goal to build a host when it is re-registered to its satellite? The users can do build host from the UI when they want that. We are using Ansible to migrate hosts from one "old" satellite to the new one. Maybe one of us or another customer re-registers a host to its satellite mistakenly, should this host loss all its data through this mandatory and automatically build?

Comment 5 Leos Stejskal 2023-06-13 12:12:41 UTC
> Why should we not do that?

Because registration is not for hosts that are managed and provisioned from the Satellite.
(IMO we should clearly state that in the docs).

Managed hosts are created by Satellite, why register them again?

Hosts provisioned from Satellite have their own registration methods,
for RHEL 9 it's the rhsm command [0], for RHEL 6,7,8 it's the subscription manager [1]

[0] https://github.com/theforeman/foreman/blob/develop/app/views/unattended/provisioning_templates/snippet/kickstart_rhsm.erb#L26
[1] https://github.com/theforeman/foreman/blob/develop/app/views/unattended/provisioning_templates/snippet/redhat_register.erb

Comment 6 Evgeni Golov 2023-06-13 12:24:06 UTC
But doesn't this also happen when you just try to register a (non managed, not Satellite provisioned) VM to a Hostgroup that has provisioning enabled (= a CR is set)?

Comment 7 Leos Stejskal 2023-06-13 13:17:17 UTC
> But doesn't this also happen when you just try to register a (non managed, not Satellite provisioned) VM to a Hostgroup that has provisioning enabled (= a CR is set)

Yes, when we are updating the registered host in DB (setting host parameters) we update the build status,
which for managed hosts means the behavior described in the BZ.

[0] https://github.com/theforeman/foreman/blob/develop/app/controllers/api/v2/registration_controller.rb#L95

From my perspective this is correct behavior and global registration should not be used for registering managed hosts.

Comment 8 Afeef Ghannam 2023-06-13 13:39:56 UTC
When the global registration should not register a manged hosts, why you enable this?

Comment 9 Afeef Ghannam 2023-06-13 13:43:28 UTC
Why do you let the global registration template register hosts, which are manged from the Satellite? I do not think that this practical.

Comment 10 Leos Stejskal 2023-06-13 14:31:07 UTC
> Why do you let the global registration template register hosts, which are managed from the Satellite? I do not think that this is practical.

Well, it was never intended for this use case, the same way as we didn't block registering managed hosts in bootsrap.py or katello-ca-consumer.rpm*.
If you want to have this kind of check, please raise an RFE, otherwise I suggest closing this BZ as not a bug.

---
* AFAIK there wasn't any check for managed hosts, but maybe it changed.

Comment 11 Evgeni Golov 2023-06-19 08:46:07 UTC
> Well, it was never intended for this use case, the same way as we didn't block registering managed hosts in bootsrap.py or katello-ca-consumer.rpm*.

That's why bootstrap.py explicitly passes `build=false` so that the host is not getting rebuilt.

BTW, GR also sets `build=false` for non-Katello scenarios, just not for Katello/Satellite ones. Why the difference?

Comment 12 Satyajit Das 2023-06-20 03:28:27 UTC
@Leos Stejskal , I would like to add the below scenario to the BZ too,

Re-registering the host using Global Registration Template automatically runs Ansible roles associated with the host, the Ansible roles are triggered in the same manner as it happens after deploying a system using a satellite and there is no way to skip this.


Moreover while troubleshooting subscription / yum  related issues, we suggest customer to re-register the host to the satellite and most of the customer now uses GR to register the host and if for some reason the host remains in the pending installation state and the server got rebooted, the client will lose all the data, so I would suggest reconsidering this as a bug.

Comment 13 Leos Stejskal 2023-06-20 11:35:09 UTC
> BTW, GR also sets `build=false` for non-Katello scenarios, just not for Katello/Satellite ones. Why the difference?

AFAIK there shouldn't be a difference, need to investigate

> Re-registering the host using Global Registration Template automatically runs Ansible roles associated with the host, the Ansible roles are triggered in the same manner as it happens after deploying a system using a satellite and there is no way to skip this.

Agree that this can be a problem

> Moreover while troubleshooting subscription / yum  related issues, we suggest customer to re-register the host to the satellite and most of the customer now uses GR to register the host and if for some reason the host remains in the pending installation state and the server got rebooted, the client will lose all the data, so I would suggest reconsidering this as a bug.

I will do the investigation, if it's a valid use case for our CUs then we need to handle it.

Comment 14 Leos Stejskal 2023-06-22 07:30:20 UTC
Hi,
can you try this patch to check the fix: https://patch-diff.githubusercontent.com/raw/theforeman/foreman/pull/9746.patch

Comment 17 Bryan Kearney 2023-08-03 12:03:04 UTC
Upstream bug assigned to ekohlvan

Comment 18 Bryan Kearney 2023-08-03 12:03:06 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36393 has been resolved.

Comment 20 sganar 2023-08-22 13:45:45 UTC
Verified.

Tested on Satellite 6.14.0 Snap 12.0

Steps followed: 
1. Provision a host from the satellite on VMware
2. After successfully provisioned, re-register the host using the Global registration.

Observation: 
The host was provisioned successfully. 
After re-registering, the host build status remained `Installed`.

Comment 23 errata-xmlrpc 2023-11-08 14:19:28 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 (Important: Satellite 6.14 security and bug fix update), 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-2023:6818


Note You need to log in before you can comment on or make changes to this bug.