From cecd329fe42271d78d239a142ae0d4a04ffa314a Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Tue, 29 Dec 2020 14:46:13 +0800 Subject: [PATCH] fix(climc): host add netif add params bridge/interface --- cmd/climc/shell/compute/hosts.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/climc/shell/compute/hosts.go b/cmd/climc/shell/compute/hosts.go index c44399277f..6e47ebf39f 100644 --- a/cmd/climc/shell/compute/hosts.go +++ b/cmd/climc/shell/compute/hosts.go @@ -407,12 +407,14 @@ func init() { }) type HostAddNetIfOptions struct { - ID string `help:"ID or Name of host"` - WIRE string `help:"ID or Name of wire to attach"` - MAC string `help:"Mac address of NIC"` - INDEX int64 `help:"nic index"` - Type string `help:"Nic type" choices:"admin|ipmi"` - IpAddr string `help:"IP address"` + ID string `help:"ID or Name of host"` + WIRE string `help:"ID or Name of wire to attach"` + MAC string `help:"Mac address of NIC"` + INDEX int64 `help:"nic index"` + Type string `help:"Nic type" choices:"admin|ipmi"` + IpAddr string `help:"IP address"` + Bridge string `help:"Bridge of hostwire"` + Interface string `help:"Interface name, eg:eth0, en0"` } R(&HostAddNetIfOptions{}, "host-add-netif", "Host add a NIC", func(s *mcclient.ClientSession, args *HostAddNetIfOptions) error { params := jsonutils.NewDict() @@ -426,6 +428,12 @@ func init() { if len(args.IpAddr) > 0 { params.Add(jsonutils.NewString(args.IpAddr), "ip_addr") } + if len(args.Bridge) > 0 { + params.Add(jsonutils.NewString(args.Bridge), "bridge") + } + if len(args.Interface) > 0 { + params.Add(jsonutils.NewString(args.Interface), "interface") + } result, err := modules.Hosts.PerformAction(s, args.ID, "add-netif", params) if err != nil { return err