Merge pull request #13575 from swordqiu/hotfix/qj-host-update-sn

fix: host update sn
This commit is contained in:
Zexi Li
2022-03-03 09:29:38 +08:00
committed by GitHub
+5
View File
@@ -161,6 +161,8 @@ func init() {
IpmiUsername string `help:"IPMI user"`
IpmiPassword string `help:"IPMI password"`
IpmiIpAddr string `help:"IPMI ip_addr"`
Sn string `help:"serial number"`
}
R(&HostUpdateOptions{}, "host-update", "Update information of a host", func(s *mcclient.ClientSession, args *HostUpdateOptions) error {
params := jsonutils.NewDict()
@@ -200,6 +202,9 @@ func init() {
if len(args.IpmiIpAddr) > 0 {
params.Add(jsonutils.NewString(args.IpmiIpAddr), "ipmi_ip_addr")
}
if len(args.Sn) > 0 {
params.Add(jsonutils.NewString(args.Sn), "sn")
}
if params.Size() == 0 {
return fmt.Errorf("Not data to update")
}