From 8d82165f5489bb58fd1f01779c77aa5546790057 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 19 Dec 2019 21:00:20 +0800 Subject: [PATCH] baremetal: fix register input params lost --- pkg/mcclient/modules/mod_hosts.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/mcclient/modules/mod_hosts.go b/pkg/mcclient/modules/mod_hosts.go index 79f455f55f..e90d605ef2 100644 --- a/pkg/mcclient/modules/mod_hosts.go +++ b/pkg/mcclient/modules/mod_hosts.go @@ -88,10 +88,10 @@ func (this *HostManager) GetIpmiInfo(s *mcclient.ClientSession, id string, param return ret, nil } -func parseHosts(titles []string, data string) ([]jsonutils.JSONObject, string) { +func parseHosts(titles []string, data string) ([]*jsonutils.JSONDict, string) { msg := "" hosts := strings.Split(data, "\n") - ret := []jsonutils.JSONObject{} + ret := []*jsonutils.JSONDict{} for i, host := range hosts { host = strings.TrimSpace(host) if len(host) == 0 { @@ -122,6 +122,8 @@ func (this *HostManager) DoBatchRegister(s *mcclient.ClientSession, titles []str if err != nil { return nil, err } + input := params.(*jsonutils.JSONDict) + input.Remove("hosts") hosts, msg := parseHosts(titles, data) if len(msg) > 0 { @@ -130,6 +132,7 @@ func (this *HostManager) DoBatchRegister(s *mcclient.ClientSession, titles []str results := make(chan modulebase.SubmitResult, len(hosts)) for _, host := range hosts { + host.Update(input) go func(data jsonutils.JSONObject) { ret, e := this.Create(s, data) id, _ := data.GetString("access_mac")