Skip to content

Can not restore PVC from snapshot if original volume is deleted #50

@stoneshi-yunify

Description

@stoneshi-yunify

csi-neonsan: v1.2.1

To recreate:

  • create pvc1
  • create volumesnapshot1 with pvc1
  • delete pvc1 (and the binding pv because deletionpolicy is set to Delete)
  • create pvc2 with volumesnapshot1, and it failed

�Confirmed with neonsan team, this is expected. Deleting the PVC will delete all of things (including its snapshots), so the snapshot in neonsan has been removed as well.

Well, this might not meet k8s snapshot's purpose, which does not reply on the original pvc.

Possible solutions:

  • in neonsan, create snapshot with full-data, and it can not be removed when deleting the volume.
  • in neonsan or csi, when deleting volume, check if it has snapshots. If it has, do not delete the underlying volume (a fake delete).

log:

I1218 08:02:57.129644       1 interceptor.go:42] GRPC /csi.v1.Controller/CreateVolume request: {"capacity_range":{"required_bytes":2147483648},"name":"pvc-499efce1-1363-49ed-af58-a1f9e120e3b9","parameters":{"fsType":"ext4","pool_name":"kube","rep_count":"1"},"volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4"}},"access_mode":{"mode":1}}],"volume_content_source":{"Type":{"Snapshot":{"snapshot_id":"kube/pvc-d2129965-8b58-46e9-95ab-e278d7aa3bd6@snapshot-1fcbac51-b9f0-4965-9b86-1b812308ea07"}}}} 516d1d5f
I1218 08:02:57.134390       1 controller.go:42] Get required creating volume size 2147483648(2Gi)
I1218 08:02:57.143835       1 api.go:268] NeonsanApi request:http://192.168.0.25:2600/qfa?pool_name=kube&name=pvc-499efce1-1363-49ed-af58-a1f9e120e3b9&op=list_volume&
I1218 08:02:57.159127       1 api.go:287] NeonsanApi response:{"op":"list_volume_reply","ret_code":0,"reason":"","count":0,"volumes":[]}, request:http://192.168.0.25:2600/qfa?pool_name=kube&name=pvc-499efce1-1363-49ed-af58-a1f9e120e3b9&op=list_volume&
I1218 08:02:57.179146       1 api.go:268] NeonsanApi request:http://192.168.0.25:2600/qfa?op=list_snapshot&pool_name=kube&volume_name=pvc-d2129965-8b58-46e9-95ab-e278d7aa3bd6&snapshot_name=snapshot-1fcbac51-b9f0-4965-9b86-1b812308ea07&
I1218 08:02:57.183079       1 api.go:287] NeonsanApi response:{"op":"list_snapshot_reply","ret_code":-102,"reason":"Volume not exists"}, request:http://192.168.0.25:2600/qfa?op=list_snapshot&pool_name=kube&volume_name=pvc-d2129965-8b58-46e9-95ab-e278d7aa3bd6&snapshot_name=snapshot-1fcbac51-b9f0-4965-9b86-1b812308ea07&
E1218 08:02:57.183158       1 interceptor.go:58] GRPC /csi.v1.Controller/CreateVolume error: rpc error: code = Internal desc = list snapshot error:Volume not exists req:{"capacity_range":{"required_bytes":2147483648},"name":"pvc-499efce1-1363-49ed-af58-a1f9e120e3b9","parameters":{"fsType":"ext4","pool_name":"kube","rep_count":"1"},"volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4"}},"access_mode":{"mode":1}}],"volume_content_source":{"Type":{"Snapshot":{"snapshot_id":"kube/pvc-d2129965-8b58-46e9-95ab-e278d7aa3bd6@snapshot-1fcbac51-b9f0-4965-9b86-1b812308ea07"}}}} 516d1d5f

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions