fix: host update sn

This commit is contained in:
Qiu Jian
2022-03-02 18:57:02 +08:00
parent 0558a305d6
commit 0ae246f01d
+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")
}