Skip to content

Comments

Add OCPVComputeResource entity to validate foreman_kubevirt#1402

Merged
shubhamsg199 merged 1 commit intoSatelliteQE:masterfrom
Gauravtalreja1:add-ocp-v
Feb 11, 2026
Merged

Add OCPVComputeResource entity to validate foreman_kubevirt#1402
shubhamsg199 merged 1 commit intoSatelliteQE:masterfrom
Gauravtalreja1:add-ocp-v

Conversation

@Gauravtalreja1
Copy link
Member

Adding new OCPVComputeResource entity and tests to validate foreman_kubevirt as per SAT-41368

@Gauravtalreja1 Gauravtalreja1 self-assigned this Feb 2, 2026
@Gauravtalreja1 Gauravtalreja1 added the No-CherryPick PR doesnt need CherryPick to previous branches label Feb 2, 2026
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The OCPVComputeResource docstring still refers to a Libvirt compute resource, which is misleading here and should be updated to describe the KubeVirt/OpenShift Virtualization resource.
  • Consider using a more appropriate field type (e.g., an integer or constrained type) for api_port instead of a generic StringField to better reflect its expected value and catch invalid input earlier.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `OCPVComputeResource` docstring still refers to a Libvirt compute resource, which is misleading here and should be updated to describe the KubeVirt/OpenShift Virtualization resource.
- Consider using a more appropriate field type (e.g., an integer or constrained type) for `api_port` instead of a generic `StringField` to better reflect its expected value and catch invalid input earlier.

## Individual Comments

### Comment 1
<location> `nailgun/entities.py:1723-1724` </location>
<code_context>
         ignore.add('password')
         return super().read(entity, attrs, ignore, params)

+class OCPVComputeResource(AbstractComputeResource):
+    """A representation of a Libvirt Compute Resource entity."""
+
+    def __init__(self, server_config=None, **kwargs):
</code_context>

<issue_to_address>
**issue (typo):** Docstring mentions Libvirt, but this resource is configured as a Kubevirt/OpenShift Virtualization provider.

Please update the docstring to describe this as a Kubevirt/OpenShift Virtualization compute resource so it matches the default provider configuration and avoids confusion.

```suggestion
class OCPVComputeResource(AbstractComputeResource):
    """A representation of a Kubevirt/OpenShift Virtualization compute resource."""
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

'api_port': entity_fields.StringField(required=True),
'namespace': entity_fields.StringField(required=True),
'token': entity_fields.StringField(required=True),
'ca_cert': entity_fields.StringField(required=True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this field is not required

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently if we don't pass this field, we get following error

Could not create the compute resource:
  SSL_connect returned=1 errno=0 state=error: certificate verify failed (self-signed certificate in certificate chain)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, but that doesn't mean it's required by the API, which is what I was after.

If your OS trusts the CA, you don't need to pass ca_cert. In most cases it won't, so you have to pass it, but that doesn't make the field required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I get you, so technically its not required, but for our tests we don't have OS trusts the CA, so it becomes required anyway and we can revisit this in future if we cover that case

Signed-off-by: Gaurav Talreja <gtalreja@redhat.com>
Copy link
Member

@evgeni evgeni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer that ca_cert would not be marked as required, but won't block on that.

Copy link
Contributor

@shubhamsg199 shubhamsg199 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack

@shubhamsg199 shubhamsg199 merged commit 86506ef into SatelliteQE:master Feb 11, 2026
11 checks passed
@Gauravtalreja1 Gauravtalreja1 deleted the add-ocp-v branch February 11, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No-CherryPick PR doesnt need CherryPick to previous branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants