mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
ci: extra commit will be dropped
This is extra commit will be dropped Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
e4d6e19554
commit
2ac83b6e73
62
vendor/github.com/ceph/go-ceph/rbd/mirror_group.go
generated
vendored
62
vendor/github.com/ceph/go-ceph/rbd/mirror_group.go
generated
vendored
@ -279,31 +279,40 @@ func GetGlobalMirrorGroupStatus(ioctx *rados.IOContext, groupName string) (Globa
|
|||||||
s := C.rbd_mirror_group_global_status_t{}
|
s := C.rbd_mirror_group_global_status_t{}
|
||||||
cGroupName := C.CString(groupName)
|
cGroupName := C.CString(groupName)
|
||||||
defer C.free(unsafe.Pointer(cGroupName))
|
defer C.free(unsafe.Pointer(cGroupName))
|
||||||
// ret := C.rbd_mirror_group_get_global_status(
|
ret := C.rbd_mirror_group_get_global_status(
|
||||||
// cephIoctx(ioctx),
|
cephIoctx(ioctx),
|
||||||
// (*C.char)(cGroupName),
|
(*C.char)(cGroupName),
|
||||||
// &s,
|
&s,
|
||||||
// C.sizeof_rbd_mirror_group_global_status_t)
|
C.sizeof_rbd_mirror_group_global_status_t)
|
||||||
// if err := getError(ret); err != nil {
|
if err := getError(ret); err != nil {
|
||||||
// return GlobalMirrorGroupStatus{}, err
|
return GlobalMirrorGroupStatus{}, err
|
||||||
// }
|
}
|
||||||
|
|
||||||
status := newGlobalMirrorGroupStatus(&s)
|
status := newGlobalMirrorGroupStatus(&s)
|
||||||
return status, nil
|
return status, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newGlobalMirrorGroupStatus(
|
func newGlobalMirrorGroupStatus(s *C.rbd_mirror_group_global_status_t) GlobalMirrorGroupStatus {
|
||||||
s *C.rbd_mirror_group_global_status_t) GlobalMirrorGroupStatus {
|
// Initializing the status object
|
||||||
|
|
||||||
status := GlobalMirrorGroupStatus{
|
status := GlobalMirrorGroupStatus{
|
||||||
Name: C.GoString(s.name),
|
Name: C.GoString(s.name),
|
||||||
Info: convertMirrorGroupInfo(&s.info),
|
Info: convertMirrorGroupInfo(&s.info),
|
||||||
SiteStatusesCount: int(s.site_statuses_count),
|
SiteStatusesCount: int(s.site_statuses_count),
|
||||||
SiteStatuses: make([]SiteMirrorGroupStatus, s.site_statuses_count),
|
SiteStatuses: make([]SiteMirrorGroupStatus, s.site_statuses_count),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print the count of site statuses for debugging
|
||||||
|
fmt.Println("status.SiteStatusesCount: ", s.site_statuses_count)
|
||||||
|
|
||||||
|
fmt.Printf("s.site_statuses: %+v\n", s.site_statuses)
|
||||||
|
// Check if site statuses are not null before using them
|
||||||
|
if s.site_statuses != nil && s.site_statuses_count > 0 {
|
||||||
gsscs := (*groupSiteArray)(unsafe.Pointer(s.site_statuses))[:s.site_statuses_count:s.site_statuses_count]
|
gsscs := (*groupSiteArray)(unsafe.Pointer(s.site_statuses))[:s.site_statuses_count:s.site_statuses_count]
|
||||||
for i := C.uint32_t(0); i < s.site_statuses_count; i++ {
|
for i := C.uint32_t(0); i < s.site_statuses_count; i++ {
|
||||||
gss := gsscs[i]
|
gss := gsscs[i]
|
||||||
|
fmt.Printf("gss.groupSiteArray: %+v\n", gss)
|
||||||
|
// Ensure that fields are valid before using them
|
||||||
|
if gss.mirror_uuid != nil && gss.mirror_image_global_ids != nil {
|
||||||
status.SiteStatuses[i] = SiteMirrorGroupStatus{
|
status.SiteStatuses[i] = SiteMirrorGroupStatus{
|
||||||
MirrorUUID: C.GoString(gss.mirror_uuid),
|
MirrorUUID: C.GoString(gss.mirror_uuid),
|
||||||
MirrorImageGlobalIDs: C.GoString(*gss.mirror_image_global_ids),
|
MirrorImageGlobalIDs: C.GoString(*gss.mirror_image_global_ids),
|
||||||
@ -316,17 +325,42 @@ func newGlobalMirrorGroupStatus(
|
|||||||
Up: bool(gss.up),
|
Up: bool(gss.up),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the mirror_images pointer is valid
|
||||||
|
if gss.mirror_images != nil && gss.mirror_image_count > 0 {
|
||||||
|
|
||||||
sscs := (*siteArray)(unsafe.Pointer(gss.mirror_images))[:gss.mirror_image_count:gss.mirror_image_count]
|
sscs := (*siteArray)(unsafe.Pointer(gss.mirror_images))[:gss.mirror_image_count:gss.mirror_image_count]
|
||||||
for i := C.uint32_t(0); i < gss.mirror_image_count; i++ {
|
fmt.Printf("sscs: siteArray %+v\n", sscs)
|
||||||
ss := sscs[i]
|
for j := C.uint32_t(0); j < gss.mirror_image_count; j++ {
|
||||||
status.SiteStatuses[i].MirrorImages[i] = SiteMirrorImageStatus{
|
ss := sscs[j]
|
||||||
|
|
||||||
|
// Ensure that fields are valid before using them
|
||||||
|
if ss.mirror_uuid != nil {
|
||||||
|
status.SiteStatuses[i].MirrorImages[j] = SiteMirrorImageStatus{
|
||||||
MirrorUUID: C.GoString(ss.mirror_uuid),
|
MirrorUUID: C.GoString(ss.mirror_uuid),
|
||||||
State: MirrorImageStatusState(ss.state),
|
State: MirrorImageStatusState(ss.state),
|
||||||
Description: C.GoString(ss.description),
|
Description: C.GoString(ss.description),
|
||||||
LastUpdate: int64(ss.last_update),
|
LastUpdate: int64(ss.last_update),
|
||||||
Up: bool(ss.up),
|
Up: bool(ss.up),
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Log if a field is invalid
|
||||||
|
fmt.Println("Warning: mirror_uuid is nil at index", i, j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Handle case where mirror_images is nil or mirror_image_count is 0
|
||||||
|
fmt.Println("Warning: mirror_images is nil or mirror_image_count is 0 at index", i)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle case where mirror_uuid or mirror_image_global_ids is nil
|
||||||
|
fmt.Println("Warning: mirror_uuid or mirror_image_global_ids is nil at index", i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle case where site statuses are nil or count is 0
|
||||||
|
fmt.Println("Warning: site_statuses is nil or site_statuses_count is 0")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the populated status
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user