mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
refactor(host): host_health: do not import guestman
This commit is contained in:
@@ -34,6 +34,7 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/hostman/guestman/types"
|
||||
deployapi "yunion.io/x/onecloud/pkg/hostman/hostdeployer/apis"
|
||||
"yunion.io/x/onecloud/pkg/hostman/hostutils"
|
||||
"yunion.io/x/onecloud/pkg/hostman/options"
|
||||
@@ -876,6 +877,7 @@ func Stop() {
|
||||
func Init(host hostutils.IHost, serversPath string) {
|
||||
if guestManager == nil {
|
||||
guestManager = NewGuestManager(host, serversPath)
|
||||
types.HealthCheckReactor = guestManager
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package types
|
||||
|
||||
type IHealthCheckReactor interface {
|
||||
ShutdownSharedStorageServers()
|
||||
}
|
||||
|
||||
var HealthCheckReactor IHealthCheckReactor
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/hostman/guestman"
|
||||
"yunion.io/x/onecloud/pkg/hostman/guestman/types"
|
||||
"yunion.io/x/onecloud/pkg/hostman/options"
|
||||
)
|
||||
|
||||
@@ -36,10 +36,9 @@ const (
|
||||
)
|
||||
|
||||
type SHostHealthManager struct {
|
||||
cli Client
|
||||
status Status
|
||||
guestManager *guestman.SGuestManager
|
||||
onHostDown string
|
||||
cli Client
|
||||
status Status
|
||||
onHostDown string
|
||||
}
|
||||
|
||||
const SHUTDOWN_SERVERS = "shutdown-servers"
|
||||
@@ -65,7 +64,6 @@ func InitHostHealthManager(hostId, onHostDown string) (*SHostHealthManager, erro
|
||||
default:
|
||||
return nil, fmt.Errorf("not support health driver %s", options.HostOptions.HealthDriver)
|
||||
}
|
||||
m.guestManager = guestman.GetGuestManager()
|
||||
m.onHostDown = onHostDown
|
||||
m.cli.SetOnUnhealthy(m.OnUnhealth)
|
||||
if err := m.StartHealthCheck(); err != nil {
|
||||
@@ -95,7 +93,7 @@ func (m *SHostHealthManager) SetOnHostDown(onHostDown string) {
|
||||
|
||||
// shutdown servers used shared storage
|
||||
func (m *SHostHealthManager) shutdownServers() {
|
||||
m.guestManager.ShutdownSharedStorageServers()
|
||||
types.HealthCheckReactor.ShutdownSharedStorageServers()
|
||||
}
|
||||
|
||||
func (m *SHostHealthManager) Stop() error {
|
||||
|
||||
Reference in New Issue
Block a user