From 3023c9cadbfdb291744b14471dc0c3dcd8645947 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Wed, 25 Feb 2026 09:02:59 +0800 Subject: [PATCH] fix: keep climc network-create backward compatibility (#24341) Co-authored-by: Qiu Jian --- cmd/climc/shell/compute/networks.go | 16 ++++++++++++++++ pkg/mcclient/options/compute/network.go | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cmd/climc/shell/compute/networks.go b/cmd/climc/shell/compute/networks.go index 48406990b2..3244e68f81 100644 --- a/cmd/climc/shell/compute/networks.go +++ b/cmd/climc/shell/compute/networks.go @@ -98,6 +98,22 @@ func init() { return nil }) + type NetworkCreate3Options struct { + compute_options.NetworkCreateOptions `start_ip->positional:"false" end_ip->positional:"false" net_mask->positional:"false"` + } + R(&NetworkCreate3Options{}, "network-create3", "Create a dual-stack virtual network", func(s *mcclient.ClientSession, args *NetworkCreate3Options) error { + params, err := args.Params() + if err != nil { + return err + } + net, err := modules.Networks.Create(s, params) + if err != nil { + return err + } + printObject(net) + return nil + }) + type NetworkSplitOptions struct { NETWORK string `help:"ID or name of network to split"` IP string `help:"Start ip of the split network"` diff --git a/pkg/mcclient/options/compute/network.go b/pkg/mcclient/options/compute/network.go index a9526f1150..76c44641fe 100644 --- a/pkg/mcclient/options/compute/network.go +++ b/pkg/mcclient/options/compute/network.go @@ -67,9 +67,9 @@ func (opts *NetworkListOptions) Params() (jsonutils.JSONObject, error) { type NetworkCreateOptions struct { WIRE string `help:"ID or Name of wire in which the network is created"` NETWORK string `help:"Name of new network"` - StartIp string `help:"Start of IPv4 address range"` - EndIp string `help:"End of IPv4 address rnage"` - NetMask int64 `help:"Length of network mask"` + StartIp string `help:"Start of IPv4 address range" positional:"true" json:"start_ip"` + EndIp string `help:"End of IPv4 address rnage" positional:"true" json:"end_ip"` + NetMask int64 `help:"Length of network mask" positional:"true" json:"net_mask"` Gateway string `help:"Default gateway"` StartIp6 string `help:"IPv6 start ip"`