Skip to content

external: add Openshift Virt Storage Class when crd is present#3703

Open
ShravaniVangur wants to merge 1 commit intored-hat-storage:mainfrom
ShravaniVangur:RHSTOR-8247
Open

external: add Openshift Virt Storage Class when crd is present#3703
ShravaniVangur wants to merge 1 commit intored-hat-storage:mainfrom
ShravaniVangur:RHSTOR-8247

Conversation

@ShravaniVangur
Copy link
Contributor

Creates the virtualization storage class when the kubevirt crd is present.Adds the default label based on instance.Spec.ManagedResources.CephBlockPools.DefaultVirtualizationStorageClass.
Resolves: RHSTOR-8594

@ShravaniVangur
Copy link
Contributor Author

/cc @parth-gr

@openshift-ci openshift-ci bot requested a review from parth-gr February 19, 2026 07:47
return err
}
if crd.UID != "" {
scc = StorageClassConfiguration{
Copy link
Member

Choose a reason for hiding this comment

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

This should be done inside the else if d.Name == cephRbdStorageClassName {

either create virt sc or create the rbd normal sc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be an additional RBD storage class and should not replace the existing one right?

Copy link
Member

Choose a reason for hiding this comment

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

I think it should be the only storageclass not a additionla one, check with @eran

@parth-gr
Copy link
Member

/assign @Madhu-1 @travisn

@rewantsoni
Copy link
Member

@ShravaniVangur @parth-gr I had one question here, the virt storageclass that we create should be created on top of the default radosnamespace or the custom radosnamespace?

@parth-gr
Copy link
Member

@ShravaniVangur @parth-gr I had one question here, the virt storageclass that we create should be created on top of the default radosnamespace or the custom radosnamespace?

Should be created directly on top of the pool,
Should we also consider the replica-1 and rados namespace case for this?

instance.Namespace,
"",
"",
instance.Spec.ManagedResources.CephBlockPools.DefaultVirtualizationStorageClass,
Copy link
Member

Choose a reason for hiding this comment

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

What happens if we already have a default virtualization SC for internal mode? dont we need to error out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Users are responsible for ensuring that the default field is marked on only one StorageCluster CR. The system does not perform validation to detect conflicts across multiple StorageCluster CRs.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 2, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 2, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Madhu-1, ShravaniVangur
Once this PR has been reviewed and has the lgtm label, please ask for approval from travisn. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Madhu-1
Copy link
Member

Madhu-1 commented Mar 2, 2026

@ShravaniVangur @parth-gr I had one question here, the virt storageclass that we create should be created on top of the default radosnamespace or the custom radosnamespace?

@parth-gr are we supporting two rados namespace in external mode? it is currently one right. we dont support multiple Radosnamespace in the same ODF cluster.

@parth-gr
Copy link
Member

parth-gr commented Mar 2, 2026

@ShravaniVangur @parth-gr I had one question here, the virt storageclass that we create should be created on top of the default radosnamespace or the custom radosnamespace?

@parth-gr are we supporting two rados namespace in external mode? it is currently one right. we dont support multiple Radosnamespace in the same ODF cluster.

Yes currently we support one per ocp cluster

Creates the virtualization storage class when the kubevirt crd
is present.

Signed-off-by: ShravaniVangur <shravanivangur@gmail.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 2, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 2, 2026

New changes are detected. LGTM label has been removed.

// create virtualization storageclass if VirtualMachineCRD is present
var scc StorageClassConfiguration
crd := &metav1.PartialObjectMetadata{}
crd.SetGroupVersionKind(extv1.SchemeGroupVersion.WithKind("CustomResourceDefinition"))
Copy link
Member

Choose a reason for hiding this comment

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

is getting a crd is sufficient? or we should loook for a cr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The StorageClasses are created based on the availability of a CRD. So the check should be sufficient.

Copy link
Member

@parth-gr parth-gr left a comment

Choose a reason for hiding this comment

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

Overall looks good to me,
Can you do a one round of testing,

Maybe you can just simulate the virt env by creating the crd

@rewantsoni
Copy link
Member

@ShravaniVangur @parth-gr I had one question here, the virt storageclass that we create should be created on top of the default radosnamespace or the custom radosnamespace?

Should be created directly on top of the pool, Should we also consider the replica-1 and rados namespace case for this?

directly on top of the pool -> That means the non-default rns right? This means that a single ocp cluster can have one storage class on a Rados namespace and another one on a non-default RNS (virt storageclass)

@parth-gr
Copy link
Member

parth-gr commented Mar 3, 2026

@ShravaniVangur @parth-gr I had one question here, the virt storageclass that we create should be created on top of the default radosnamespace or the custom radosnamespace?

Should be created directly on top of the pool, Should we also consider the replica-1 and rados namespace case for this?

directly on top of the pool -> That means the non-default rns right? This means that a single ocp cluster can have one storage class on a Rados namespace and another one on a non-default RNS (virt storageclass)

No only for the non-virt class, currently
In case we need it for the virt class, we need to change the implementation.

if crd.UID != "" {
scc = StorageClassConfiguration{
storageClass: util.NewDefaultVirtRbdStorageClass(
instance.Namespace,
Copy link
Member

Choose a reason for hiding this comment

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

@ShravaniVangur @parth-gr I think this is not right, this means that there can be a storageclass with clientProfile as raodsnamespace
and another storageclass virt one with clientProfile as openshift-storage-external.

What we should do is

  • If there is a radosnamespace in externalResources, then we create all rbd classes on top of that radosnamespace client profile.
  • If there is no radosnamespace, then we should create the classes on top of the default client profile.

This should also apply to the topology based storageclass for external mode.
cc: @Madhu-1 @travisn

Copy link
Member

Choose a reason for hiding this comment

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

Yes i discussed with @rewantsoni on this one, looks like we do have bug in the extrernal mode where when topology based provisioning is used its not using the rados namespace , its using detault one.
we have a hacky code that is modifying the clusterID to match the radosnamespace. we should apply for this one as well and we need to fix the topology based SC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants