From 32ea2c9227f95dc58a71367f10687edc1394d76e Mon Sep 17 00:00:00 2001 From: ioito Date: Fri, 19 Apr 2019 14:39:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BF=BD=E7=95=A5rbd=E9=94=99=E8=AF=AF,?= =?UTF-8?q?=E5=B9=B6=E5=B0=86rbd=20storage=E7=BD=AE=E4=B8=BA=E7=A6=BB?= =?UTF-8?q?=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/hostman/storageman/storage_rbd.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/hostman/storageman/storage_rbd.go b/pkg/hostman/storageman/storage_rbd.go index 27f52b7539..1a56a6d829 100644 --- a/pkg/hostman/storageman/storage_rbd.go +++ b/pkg/hostman/storageman/storage_rbd.go @@ -364,7 +364,8 @@ func (s *SRbdStorage) SyncStorageInfo() (jsonutils.JSONObject, error) { if len(s.StorageId) > 0 { capacity, err := s.getCapacity() if err != nil { - return nil, err + log.Errorf("get ceph capacity error: %v", err) + return modules.Storages.PerformAction(hostutils.GetComputeSession(context.Background()), s.StorageId, "offline", jsonutils.Marshal(map[string]string{"reason": err.Error()})) } content = map[string]interface{}{ "name": s.StorageName, From 81f13a0286400d20c3c79fefd05e4fe4e710d035 Mon Sep 17 00:00:00 2001 From: ioito Date: Fri, 19 Apr 2019 15:27:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=9E=E6=8E=A5ceph?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/hostman/storageman/storage_rbd.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/hostman/storageman/storage_rbd.go b/pkg/hostman/storageman/storage_rbd.go index 1a56a6d829..2426e03f77 100644 --- a/pkg/hostman/storageman/storage_rbd.go +++ b/pkg/hostman/storageman/storage_rbd.go @@ -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,8 +373,7 @@ func (s *SRbdStorage) SyncStorageInfo() (jsonutils.JSONObject, error) { if len(s.StorageId) > 0 { capacity, err := s.getCapacity() if err != nil { - log.Errorf("get ceph capacity error: %v", err) - return modules.Storages.PerformAction(hostutils.GetComputeSession(context.Background()), s.StorageId, "offline", jsonutils.Marshal(map[string]string{"reason": err.Error()})) + return modules.Storages.PerformAction(hostutils.GetComputeSession(context.Background()), s.StorageId, "offline", nil) } content = map[string]interface{}{ "name": s.StorageName,