Encountered undefined: rados.ErrNotConnected error #893
-
I create a demo prjoect package main
import (
"fmt"
"github.com/ceph/go-ceph/cephfs/admin"
)
func main() {
fsAdmin, err := admin.New()
if err != nil {
fmt.Println(err)
}
subVolumes, err := fsAdmin.ListSubVolumes("volume_name", "group_name")
if err != nil {
fmt.Println(err)
}
for _, subVolume := range subVolumes {
fmt.Printf("subVolume: %v", subVolume)
}
} When i run this program i get the following error
Does anyone know how to fix it |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Errors are defined from rados package. You can import Even then you may encounter the real |
Beta Was this translation helpful? Give feedback.
-
This is not directly related to your question but I'd like to point out that |
Beta Was this translation helpful? Give feedback.
-
I created this project in image 1.20rc2-alpine3.17. I installed libcephfs, librbd, librados, and then I created this project in /root/ceph-demo with the following information in my go environment variables
|
Beta Was this translation helpful? Give feedback.
-
I modified my code to look like the following, but it looks like my project just doesn't recognize the rados package |
Beta Was this translation helpful? Give feedback.
In a way, this is good, because it means your original problem and this issue are probably related. Debugging one may end up debugging both.
Somehow your environment is missing or disabling the rados package. Are you doing anything to forcibly disable cgo? The rados, rbd, and cephfs subpackages all require cgo and only the "admin" packages don't require cgo (and rgw but it's unique anyway). Could that be why your system can import cephfs/admin but not rados?