Skip to content
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

PVC clone: the size of underlying volume does not match the PVC #48

Open
cumirror opened this issue Nov 26, 2020 · 3 comments
Open

PVC clone: the size of underlying volume does not match the PVC #48

cumirror opened this issue Nov 26, 2020 · 3 comments
Assignees

Comments

@cumirror
Copy link

cumirror commented Nov 26, 2020

source pvc's size is 4Gi:

# kubectl get pvc -o wide -n test
NAME                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE     VOLUMEMODE
ubuntu-tmpl               Bound    pvc-4c1174d0-acf4-49a6-b264-bbdd3ddf6209   4Gi        RWX            csi-neonsan    6d22h   Block

clone pvc's size is 6Gi:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
    name: clone-of-ubuntu-tmpl
    namespace: test
spec:
  accessModes:
  - ReadWriteMany
  volumeMode: Block
  resources:
    requests:
      storage: 6Gi
  dataSource:
    kind: PersistentVolumeClaim
    name: ubuntu-tmpl

after clone, pvc info:

# kubectl get pvc -o wide -n test
NAME                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE     VOLUMEMODE
clone-of-ubuntu-tmpl      Bound    pvc-27f06c3f-ea0b-47a8-b637-7adba49845ca   6Gi        RWX            csi-neonsan    19m     Block
ubuntu-tmpl               Bound    pvc-4c1174d0-acf4-49a6-b264-bbdd3ddf6209   4Gi        RWX            csi-neonsan    6d22h   Block

after clone, clone volume size is 4Gi not 6Gi:

# neonsan list_volume -pool kube -detail
+------------+------------------------------------------+-------------+------+---------+-----------+---------------+-------+---------+--------+------------------+-----------+---------------------+---------------------+
|     ID     |                   NAME                   |    SIZE     | POOL | RG NAME | REP COUNT | MIN REP COUNT | ROLE  | POLICY  | STATUS | VOLUME ALLOCATED | ENCRYPTED |     STATUS TIME     |    CREATED TIME     |
+------------+------------------------------------------+-------------+------+---------+-----------+---------------+-------+---------+--------+------------------+-----------+---------------------+---------------------+
| 1543503872 | pvc-27f06c3f-ea0b-47a8-b637-7adba49845ca |  4294967296 | kube | SSD0    |         1 |             1 | alone | default | OK     |       2617245696 | no        | 2020-11-26 15:22:08 | 2020-11-26 15:22:08 |
|  402653184 | pvc-4c1174d0-acf4-49a6-b264-bbdd3ddf6209 |  4294967296 | kube | SSD0    |         1 |             1 | alone | default | OK     |       2617245696 | no        | 2020-11-26 15:22:08 | 2020-11-19 17:04:25 |
+------------+------------------------------------------+-------------+------+---------+-----------+---------------+-------+---------+--------+------------------+-----------+---------------------+---------------------+

After cloning is complete, the size of underlying storage volume should be consistent with the requested PVC.

@stoneshi-yunify stoneshi-yunify self-assigned this Dec 10, 2020
@stoneshi-yunify
Copy link
Contributor

stoneshi-yunify commented Dec 14, 2020

I have managed to resize the volume in call CreateVolume when it's a block volume, but this still has issue when it's a filesystem volume: the filesystem can not be resized in call CreateVolume, it should be done by kubelet calling the NodeExpandVolume, which I can not do that in the CSI driver code.

I have submitted a issue to community to address this issue kubernetes-csi/external-resizer#131

And I also looked at other open source CSI drivers, they don't have a solution for such case either. For example, ceph. They will force user to specify an exact same size for the new PVC, otherwise an size mismatch error will be threw. After the clone volume done, user can expand the volume as usual. Maybe we should do that too, in that way we make sure the resize is on purpose and can be done successfully, for both block volume and filesystem volume.

@stoneshi-yunify
Copy link
Contributor

stoneshi-yunify commented Dec 15, 2020

This is a very general and popular problem, not only neonsan-csi, but also qingcloud-csi and many other csi drivers have this problem too. See the comments in kubernetes-csi/external-resizer#131, a discussion is ongoing about this with the K8S SIG-STORAGE team and CSI SPEC team. Currently there is no conclusion/decision and ETA.

I will NOT fix this issue or change any code util the above discussion has a closure. We will keep current behaviour.

@stoneshi-yunify
Copy link
Contributor

Please check latest csi spec and the progress of kubernetes-csi/external-resizer#131. Regarding this issue, the decision is NOT allow cloning a volume to large size. User must start a new resize request after cloning done if expansion is needed.

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

No branches or pull requests

2 participants