From 49287d8070870a583707078d86a1a714e754f4c5 Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Thu, 11 Jul 2019 10:53:34 +0800 Subject: [PATCH] baremetal init fsdriver --- pkg/baremetal/service/service.go | 2 ++ pkg/hostman/guestfs/fsdriver/drivers.go | 7 +++++-- pkg/hostman/hostdeployer/apis/utils.go | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/baremetal/service/service.go b/pkg/baremetal/service/service.go index 33af0c65b5..086faa80f9 100644 --- a/pkg/baremetal/service/service.go +++ b/pkg/baremetal/service/service.go @@ -28,6 +28,7 @@ import ( app_common "yunion.io/x/onecloud/pkg/cloudcommon/app" common_options "yunion.io/x/onecloud/pkg/cloudcommon/options" "yunion.io/x/onecloud/pkg/cloudcommon/service" + "yunion.io/x/onecloud/pkg/hostman/guestfs/fsdriver" ) type BaremetalService struct { @@ -42,6 +43,7 @@ func (s *BaremetalService) StartService() { common_options.ParseOptions(&o.Options, os.Args, "baremetal.conf", "baremetal") app_common.InitAuth(&o.Options.CommonOptions, s.startAgent) + fsdriver.Init(nil) app := app_common.InitApp(&o.Options.BaseOptions, false) handler.InitHandlers(app) diff --git a/pkg/hostman/guestfs/fsdriver/drivers.go b/pkg/hostman/guestfs/fsdriver/drivers.go index ad83b808ff..388ff435ab 100644 --- a/pkg/hostman/guestfs/fsdriver/drivers.go +++ b/pkg/hostman/guestfs/fsdriver/drivers.go @@ -26,8 +26,11 @@ func GetRootfsDrivers() []newRootFsDriverFunc { } func Init(initPrivatePrefixes []string) { - privatePrefixes = make([]string, len(initPrivatePrefixes)) - copy(privatePrefixes, initPrivatePrefixes) + if len(initPrivatePrefixes) > 0 { + privatePrefixes = make([]string, len(initPrivatePrefixes)) + copy(privatePrefixes, initPrivatePrefixes) + } + linuxFsDrivers := []newRootFsDriverFunc{ NewCentosRootFs, NewFedoraRootFs, NewRhelRootFs, NewDebianRootFs, NewCirrosRootFs, NewCirrosNewRootFs, NewUbuntuRootFs, diff --git a/pkg/hostman/hostdeployer/apis/utils.go b/pkg/hostman/hostdeployer/apis/utils.go index 7aa92f5d05..f58fc0158f 100644 --- a/pkg/hostman/hostdeployer/apis/utils.go +++ b/pkg/hostman/hostdeployer/apis/utils.go @@ -95,7 +95,7 @@ func GuestDescToDeployDesc(guestDesc *jsonutils.JSONDict) (*GuestDesc, error) { if jnicsStandby != nil { nicsStandby := make([]*Nic, 0) - err := jnicsStandby.Unmarshal(nicsStandby) + err := jnicsStandby.Unmarshal(&nicsStandby) if err != nil { return nil, err }