pvc helper to return pvc struct
@@ -59,15 +59,17 @@ func isPVCBlock(pvc *k8sv1.PersistentVolumeClaim) bool {
return pvc.Spec.VolumeMode != nil && *pvc.Spec.VolumeMode == k8sv1.PersistentVolumeBlock
}
-func IsSharedPVCFromClient(client kubecli.KubevirtClient, namespace string, claimName string) (isShared bool, err error) {
- pvc, err := client.CoreV1().PersistentVolumeClaims(namespace).Get(claimName, v1.GetOptions{})
+func IsSharedPVCFromClient(client kubecli.KubevirtClient, namespace string, claimName string) (pvc *k8sv1.PersistentVolumeClaim, isShared bool, err error) {
+ pvc, err = client.CoreV1().PersistentVolumeClaims(namespace).Get(claimName, v1.GetOptions{})
+ //if errors.IsNotFound(err) {
if err != nil {
- return false, err
+ return nil, false, err
}
+
for _, accessMode := range pvc.Spec.AccessModes {
if accessMode == k8sv1.ReadWriteMany {
- return true, nil
+ isShared = true
}
}
- return false, nil
+ return pvc, isShared, nil
}
