1 Star 0 Fork 0

liucxer/ceph-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ceph_cluster_log.go 2.13 KB
一键复制 编辑 原始数据 按行查看 历史
liu.changxi@datatom.com 提交于 2021-11-03 11:08 . init
package ceph_cluster
import (
"github.com/sirupsen/logrus"
"time"
)
func (cluster *CephCluster) ClearOsdLog(osdNums []int64) error {
startTime := time.Now()
logrus.Debugf("ClearOsdLog start. ")
defer func() {
cost := time.Now().Sub(startTime).Seconds()
logrus.Debugf("ClearOsdLog end. cost:%f", cost)
}()
for _, client := range cluster.Clients {
err := client.ClearOsdLog(osdNums)
if err != nil {
logrus.Errorf("host :%s, ExecCmd: err:%v", client.IpAddr, err)
return err
}
}
return nil
}
func (cluster *CephCluster) ClearCephLog() error {
startTime := time.Now()
logrus.Debugf("ClearCephLog start. ")
defer func() {
cost := time.Now().Sub(startTime).Seconds()
logrus.Debugf("ClearCephLog end. cost:%f", cost)
}()
for _, client := range cluster.Clients {
err := client.ClearCephLog()
if err != nil {
logrus.Errorf("host :%s, ExecCmd: err:%v", client.IpAddr, err)
return err
}
}
return nil
}
func (cluster *CephCluster) CollectOsdLog(dstDir string, osdNums []int64) error {
var (
err error
)
startTime := time.Now()
logrus.Debugf("CollectOsdLog start. ")
defer func() {
cost := time.Now().Sub(startTime).Seconds()
logrus.Debugf("CollectOsdLog end. cost:%f", cost)
}()
for _, client := range cluster.Clients {
err = client.CollectOsdLog(dstDir, osdNums)
if err != nil {
return err
}
}
return nil
}
func (cluster *CephCluster) CollectCephLog(dstDir string) error {
var (
err error
)
startTime := time.Now()
logrus.Debugf("CollectCephLog start. ")
defer func() {
cost := time.Now().Sub(startTime).Seconds()
logrus.Debugf("CollectCephLog end. cost:%f", cost)
}()
for _, client := range cluster.Clients {
err = client.CollectCephLog(dstDir)
if err != nil {
return err
}
}
return nil
}
func (cluster *CephCluster) BackupAndClearCephLog() error {
startTime := time.Now()
logrus.Debugf("BackupAndClearCephLog start. ")
defer func() {
cost := time.Now().Sub(startTime).Seconds()
logrus.Debugf("BackupAndClearCephLog end. cost:%f", cost)
}()
for _, client := range cluster.Clients {
err := client.BackupAndClearCephLog()
if err != nil {
return err
}
}
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liucxer/ceph-tools.git
git@gitee.com:liucxer/ceph-tools.git
liucxer
ceph-tools
ceph-tools
ed01591ec671

搜索帮助