Merge pull request #493 from ioito/hotfix/qx-host-server-ignore-rbd-error

避免因ceph存储阻塞host 服务启动
This commit is contained in:
yunion-ci-robot
2019-04-19 20:02:10 +08:00
committed by GitHub
+10 -1
View File
@@ -269,6 +269,15 @@ func (s *SRbdStorage) withCluster(doFunc func(*rados.Conn) (interface{}, error))
}
}
}
for key, timeout := range map[string]int64{"rados_osd_op_timeout": 3, "rados_mon_op_timeout": 3, "client_mount_timeout": 3} {
_timeout, _ := s.StorageConf.Int(key)
if _timeout > 0 {
timeout = _timeout
}
if err := conn.SetConfigOption(key, fmt.Sprintf("%d", timeout)); err != nil {
return nil, err
}
}
if err := conn.Connect(); err != nil {
log.Errorf("connect rbd cluster %s error: %v", s.StorageName, err)
return nil, err
@@ -364,7 +373,7 @@ func (s *SRbdStorage) SyncStorageInfo() (jsonutils.JSONObject, error) {
if len(s.StorageId) > 0 {
capacity, err := s.getCapacity()
if err != nil {
return nil, err
return modules.Storages.PerformAction(hostutils.GetComputeSession(context.Background()), s.StorageId, "offline", nil)
}
content = map[string]interface{}{
"name": s.StorageName,