From ee733752854a2071491e5d6daad1d628176b5796 Mon Sep 17 00:00:00 2001 From: Jiawei Wang Date: Wed, 6 Jan 2021 10:44:34 -0800 Subject: [PATCH] Only for testing --- staging/src/k8s.io/csi-translation-lib/plugins/azure_disk.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/staging/src/k8s.io/csi-translation-lib/plugins/azure_disk.go b/staging/src/k8s.io/csi-translation-lib/plugins/azure_disk.go index 8184881de9df..608a6ef97caf 100644 --- a/staging/src/k8s.io/csi-translation-lib/plugins/azure_disk.go +++ b/staging/src/k8s.io/csi-translation-lib/plugins/azure_disk.go @@ -178,6 +178,9 @@ func (t *azureDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.PersistentVolume) // TranslateCSIPVToInTree takes a PV with CSIPersistentVolumeSource set and // translates the Azure Disk CSI source to a AzureDisk source. func (t *azureDiskCSITranslator) TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) { + if pv == nil || pv.Spec.CSI == nil { + return nil, fmt.Errorf("pv is nil or CSI source not defined on pv") + } if pv == nil || pv.Spec.CSI == nil { return nil, fmt.Errorf("pv is nil or CSI source not defined on pv") }