-
Couldn't load subscription status.
- Fork 59
🌱 Patch device spec with data from PVCs #1258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
🌱 Patch device spec with data from PVCs #1258
Conversation
bffc97f to
4bae3eb
Compare
This commit implements the vmCreateGenConfigSpecImagePVCDataSourceRefs
method as part of the AllDisksArePVCs initiative.
For each of the disks in createArgs.ConfigSpec, the
following is done:
1. Iterates over spec.volumes and looks for an entry with an
unmanagedVolumeSource with a type of "FromImage" and name set to
the value that identifies the current disk. If no such entry exists,
then continues to the next disk.
3. Gets the referred PVC. If no such PVC exists, then an error is thrown
indicating the PVC for the specified claim is missing and VM creation
may not proceed.
4. Gets the PVC's specified storage class and requested capacity.
a. Updates the disk device's specified storage class using the value
from the PVC.
b. Updates the disk device's specified capacity using the value from
the PVC *if* it is larger than the disk's current requested size.
Signed-off-by: Nabarun Pal <[email protected]>
4bae3eb to
e0d78da
Compare
Minimum allowed line rate is |
| storageClassName := pvc.Spec.StorageClassName | ||
|
|
||
| if storageClassName == nil || | ||
| storageClassToPolicyID == nil || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need nil check
Consider assign profileId var here so it is clear that's what's used later one
| Name: claimName, | ||
| } | ||
|
|
||
| if err := vs.k8sClient.Get(vmCtx, key, pvc); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A todo for later is that we'll later fetch the PVCs for placement that we should consolidate
What does this PR do, and why is it needed?
This commit implements the vmCreateGenConfigSpecImagePVCDataSourceRefs method as part of the AllDisksArePVCs initiative.
For each of the disks in createArgs.ConfigSpec, the following is done:
Iterates over spec.volumes and looks for an entry with an unmanagedVolumeSource with a type of "FromImage" and name set to the value that identifies the current disk. If no such entry exists, then continues to the next disk.
Gets the referred PVC. If no such PVC exists, then an error is thrown indicating the PVC for the specified claim is missing and VM creation may not proceed.
Gets the PVC's specified storage class and requested capacity. a. Updates the disk device's specified storage class using the value from the PVC. b. Updates the disk device's specified capacity using the value from the PVC if it is larger than the disk's current requested size.
Which issue(s) is/are addressed by this PR? (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Are there any special notes for your reviewer:
Please add a release note if necessary: