feat(region): no_bmc option of host create api (#15270)

This commit is contained in:
Zexi Li
2022-11-01 17:38:42 +08:00
committed by GitHub
parent 1bad4c75ba
commit 5ffe1c3506
3 changed files with 8 additions and 1 deletions
+4
View File
@@ -419,6 +419,7 @@ func init() {
AccessWire string `help:"Access wire"`
NoProbe bool `help:"just save the record, do not probe"`
NoBMC bool `help:"No BMC hardware"`
NoPrepare bool `help:"just probe, do not reboot baremetal to prepare"`
DisablePxeBoot bool `help:"set enable_pxe_boot to false, which is true by default"`
@@ -460,6 +461,9 @@ func init() {
if args.NoPrepare {
params.Add(jsonutils.JSONTrue, "no_prepare")
}
if args.NoBMC {
params.Add(jsonutils.JSONTrue, "no_bmc")
}
if args.DisablePxeBoot {
params.Add(jsonutils.JSONFalse, "enable_pxe_boot")
}
+3
View File
@@ -413,6 +413,9 @@ type HostCreateInput struct {
// 新建带IPMI信息的物理机时不进行IPMI信息探测
NoProbe *bool `json:"no_probe"`
// 物理机不带 BMC 控制器
NoBMC bool `json:"no_bmc"`
// host uuid
Uuid string `json:"uuid"`
+1 -1
View File
@@ -3524,7 +3524,7 @@ func (manager *SHostManager) ValidateCreateData(
input.ZoneId = zoneObj.GetId()
// data.Set("zone_id", jsonutils.NewString(zoneObj.GetId()))
}
if !noProbe {
if !noProbe || input.NoBMC {
var accessNet *SNetwork
accessIpAddr := input.AccessIp // tString("access_ip")
if len(accessIpAddr) > 0 {