在进行dv克隆时,通过如下方式:
kind: DataVolume
metadata:
annotations:
cdi.kubevirt.io/storage.deleteAfterCompletion: "false"
name: 7713bb8fdecd462fa0ca726e21cd9fa3-1
namespace: default
spec:
pvc:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 20Gi
storageClassName: nfs-csi
volumeMode: Filesystem
source:
pvc:
name: 7713bb8fdecd462fa0ca726e21cd9fa3
namespace: default
能实现block->block,filesystem->block,filesystem->filesystem之间的克隆,但是当block->filesystem时,克隆出来的pvc会出现如下问题:
显示由于目标pvc容量小于源pvc而无法克隆数据,此时dv将一直处于克隆调度状态:
这时,如果你的kubevirt版本不低于1.0.0,那么可以尝试使用storage字段克隆:
apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
annotations:
cdi.kubevirt.io/storage.deleteAfterCompletion: "false"
name: ec0c020c63129d26d57dbad5fe1c3ea8-1
namespace: default
spec:
storage:
accessModes:
- ReadWriteMany
storageClassName: csi-ceph-pool
volumeMode: Block
source:
pvc:
name: ec0c020c63129d26d57dbad5fe1c3ea8
namespace: default
该方式没有传递容量大小size,目标pvc会根据所需容量自定义大小,可以实现各种类型之间的克隆。