-
Notifications
You must be signed in to change notification settings - Fork 553
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
create a bigger size volume from existing data source #258
Conversation
if the newly requested volume is cloned from the existing snapshot, we need to check the request volume size is greater then the snapshot/parent-volume or not, if it is greater than the snapshot we need to resize the requested volume to a new size. Fixes: ceph#257 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
Fixes #257 |
cc @j-griffith |
imo, the snap restore size is totally up to the storage backend, external provisioner does not need to revalidate the size. @xing-yang any input? thanks |
@j-griffith can you please review this PR? |
@@ -240,6 +240,10 @@ func (cs *ControllerServer) checkSnapshot(req *csi.CreateVolumeRequest, rbdVol * | |||
return status.Error(codes.NotFound, err.Error()) | |||
} | |||
|
|||
if (rbdVol.VolSize * util.MiB) < rbdSnap.SizeBytes { |
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.
This check is not necessary in the CSI driver because it is already handled by the external-provisioner:
https://github.com/kubernetes-csi/external-provisioner/blob/master/pkg/controller/controller.go#L626
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.
@xing-yang Thanks for the review, the intention of adding this check is am not sure all the CO will do this validation or not, to safeguard the failure I have added this check
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.
@xing-yang is correct, it's not necessary in the Kubernetes context, the only thing I would mentoin however is that it is possible that at some point a different provisioner consumes the plugin. The check is redundant and unnecessary, but at the same time it doesn't really hurt either. Best case, it's never even hit, worst case we have a different CSI Provisioner some day and we miss this check somehow. Not a huge deal, just an observation.
@xing-yang would really happy to get your input on this one. |
@Madhu-1 In the provisioner check, we did say that the CSI plugin needs to handle expansion if volume size is bigger than snapshot size. So it depends on whether the plugin supports resize or not. @gnufied can you take a look of the resize part? |
I'd like to see what @gnufied says on this, but my opinion is that we should create the volume and then do the expansion for the user. It looks like we can do the expansion so we should just implement it that way. |
@j-griffith Is it enough to resize RBD volume? Is the volume's file system also expanded to accommodate new size or that must happen separately? And |
@gnufied this is Volume resize of a cloned volume from the snapshot which is not mounted yet, yeah as this is just a PVC creation is should be enough I think @j-griffith any comments? |
Let me summarize this effort with a better summary: First of all, this PR may be better titled to "create a bigger size volume from existing data source' instead of 'resize rbd volume'. What the code do here is this *) Clone/ create a volume from an existing source
Hope this clear some dust. :) @xing-yang @gnufied @j-griffith As a second thing, the question comes in, ie do we need "fs" expansion while we expand the volume? My understanding is that, If the volume is mounted and used in pod, the expansion has to be performed on FS level. This need to be considered here @Madhu-1 . @Madhu-1 , from code review pov, the check of the size can be outside snapshot function and it can be performed for any data source ie volume or snapshot and rest of the code can fall in. |
if the requested volume size is less than the parent volume we should reject the request to avoid data loss. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
@humblec updated PR PTAL |
@Madhu-1 can you correct the Travis ? |
So, who does file system resizing in this case? The file system resizing still needs to happen and without that, expanded space won't be available to pod/workload. I don't see it being addressed. Kubelet will not automatically expand the volume... |
@gnufied there are 2 choices, either we can address both data source (snapshot and volume ) here or address one which is snapshot data source. You are correct that we need fs expansion, but if we are only addressing |
@humblec okay but what is the point of expanding the volume here when it won't be expanded when used by a pod? I think, we may have to handle this when a snapshot is restored to a larger volume. This can be done by setting Above condition will automatically trigger expansion on the node. cc @xing-yang |
@Madhu-1 please remove this from the v2.1.0 project and set the correct milestone (if any). |
closing this one as its already addressed in #1244 |
Syncing latest changes from devel for ceph-csi
if the newly requested volume is cloned from the existing snapshot, we need to check the request volume size is greater then the snapshot/parent-volume or not, if it is greater than the snapshot we need to
resize the requested volume to a new size.
Signed-off-by: Madhu Rajanna madhupr007@gmail.com
Logs after resizing the volume info