From c271101ef19064c20762e3ede430889051ac6958 Mon Sep 17 00:00:00 2001 From: Alexander Pivkin Date: Fri, 5 Sep 2025 16:08:08 +0300 Subject: [PATCH] sdf --- ceph/ceph.go | 17 +++++++++++------ ceph/types.go | 14 +++++++------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ceph/ceph.go b/ceph/ceph.go index 4f7f08d..1f9e4e9 100644 --- a/ceph/ceph.go +++ b/ceph/ceph.go @@ -9,14 +9,19 @@ import ( func main() { - params := params{"ceph","admin","/etc/ceph/ceph.conf"} - connection,err := rados.NewConnWithClusterAndUser(params.cluster,params.user) + fmt.Println("Creating connection object") + conn,err := rados.NewConn() if err != nil { - fmt.Println(err) + log.Fatal("Cannot create Connection object\n") } - fmt.Printf("%#v", connection) + conn.ReadConfigFile("/etc/ceph/ceph.conf") + conn.Connect() + defer conn.Shutdown() - if err = connection.ReadConfigFile(params.config); err != nil { - log.Fatalln("Cannot read config file\n") + poolnames,err := conn.ListPools() + if err != nil { + log.Fatal("Cannot list pools") } + + fmt.Printf("Pools: %v\n",poolnames) } diff --git a/ceph/types.go b/ceph/types.go index b07ef64..428f2ed 100644 --- a/ceph/types.go +++ b/ceph/types.go @@ -1,9 +1,9 @@ -package main +// package main -const config = "/etc/ceph/ceph.conf" +// const config = "/etc/ceph/ceph.conf" -type params struct { - cluster string - user string - config string -} +// type params struct { +// cluster string +// user string +// config string +// }