From a5c9f2b27842bf342fe9ab6301451fd2203d824d Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Sat, 4 Mar 2023 01:44:09 +0800 Subject: [PATCH] fix: hostman StartService() (#16126) Co-authored-by: Qiu Jian --- cmd/host/main.go | 7 +------ pkg/hostman/host_services.go | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/host/main.go b/cmd/host/main.go index 6278d771e2..063b7958d1 100644 --- a/cmd/host/main.go +++ b/cmd/host/main.go @@ -17,7 +17,6 @@ package main import ( "context" - "yunion.io/x/onecloud/pkg/cloudcommon/service" "yunion.io/x/onecloud/pkg/hostman" "yunion.io/x/onecloud/pkg/util/atexit" "yunion.io/x/onecloud/pkg/util/procutils" @@ -28,9 +27,5 @@ func main() { go procutils.WaitZombieLoop(context.TODO()) - var srv = &hostman.SHostService{} - srv.SServiceBase = &service.SServiceBase{ - Service: srv, - } - srv.StartService() + hostman.StartService() } diff --git a/pkg/hostman/host_services.go b/pkg/hostman/host_services.go index 44a65efa83..2eddf35a33 100644 --- a/pkg/hostman/host_services.go +++ b/pkg/hostman/host_services.go @@ -206,3 +206,11 @@ func writeFile(dir, file string, data []byte) (string, error) { p := filepath.Join(dir, file) return p, ioutil.WriteFile(p, data, 0600) } + +func StartService() { + var srv = &SHostService{} + srv.SServiceBase = &service.SServiceBase{ + Service: srv, + } + srv.StartService() +}