From 6b2058dcee7f0e546be33e47c8c5da85faaa263e Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Thu, 26 Dec 2019 16:50:09 +0800 Subject: [PATCH] fix endpoint type, chntpw path --- pkg/hostman/hostdeployer/deployserver/deployserver.go | 8 +++++++- pkg/hostman/hostinfo/hostinfo.go | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/hostman/hostdeployer/deployserver/deployserver.go b/pkg/hostman/hostdeployer/deployserver/deployserver.go index 7eaecf3818..443ad9bfdf 100644 --- a/pkg/hostman/hostdeployer/deployserver/deployserver.go +++ b/pkg/hostman/hostdeployer/deployserver/deployserver.go @@ -249,7 +249,13 @@ func (s *SDeployService) PrepareEnv() error { } if !winutils.CheckTool(DeployOption.ChntpwPath) { - log.Errorf("Failed to find chntpw tool") + if winutils.CheckTool("/usr/bin/chntpw.static") { + winutils.SetChntpwPath("/usr/bin/chntpw.static") + } else { + log.Errorf("Failed to find chntpw tool") + } + } else { + winutils.SetChntpwPath(DeployOption.ChntpwPath) } output, err = procutils.NewCommand("pvscan").Output() diff --git a/pkg/hostman/hostinfo/hostinfo.go b/pkg/hostman/hostinfo/hostinfo.go index 0b67ec0c2a..84f797b0af 100644 --- a/pkg/hostman/hostinfo/hostinfo.go +++ b/pkg/hostman/hostinfo/hostinfo.go @@ -44,6 +44,7 @@ import ( "yunion.io/x/onecloud/pkg/hostman/storageman" "yunion.io/x/onecloud/pkg/hostman/system_service" "yunion.io/x/onecloud/pkg/mcclient" + "yunion.io/x/onecloud/pkg/mcclient/auth" "yunion.io/x/onecloud/pkg/mcclient/modules" "yunion.io/x/onecloud/pkg/util/cgrouputils" "yunion.io/x/onecloud/pkg/util/fileutils2" @@ -1353,6 +1354,9 @@ func (h *SHostInfo) unregister() { func (h *SHostInfo) OnCatalogChanged(catalog mcclient.KeystoneServiceCatalogV3) { // TODO: dynamic probe endpoint type defaultEndpointType := options.HostOptions.SessionEndpointType + if len(defaultEndpointType) == 0 { + defaultEndpointType = auth.PublicEndpointType + } if options.HostOptions.ManageNtpConfiguration { ntpd := system_service.GetService("ntpd") urls, _ := catalog.GetServiceURLs("ntp", options.HostOptions.Region, "", defaultEndpointType)