4.12.0
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
cb_trunk "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/trunk"
|
||||
cb_vfpool "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/vfpool"
|
||||
cb_vins "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/vins"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/sdn/logicalports"
|
||||
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
@@ -595,14 +596,21 @@ func ExistK8s(ctx context.Context, k8sId uint64, c *controller.ControllerCfg) er
|
||||
return nil
|
||||
}
|
||||
|
||||
func IsMoreThanOneDisksTypeB(ctx context.Context, disks interface{}) error {
|
||||
func IsMoreThanOneDisksTypeB(ctx context.Context, disks interface{}, chipset string) error {
|
||||
count := 0
|
||||
|
||||
key := "bus_number"
|
||||
if chipset == "i440fx" {
|
||||
key = "pci_slot"
|
||||
}
|
||||
|
||||
for _, elem := range disks.([]interface{}) {
|
||||
diskVal := elem.(map[string]interface{})
|
||||
if diskVal["disk_type"].(string) == "B" {
|
||||
|
||||
if val, ok := diskVal[key].(int); ok && val == 6 {
|
||||
count++
|
||||
}
|
||||
|
||||
if count > 1 {
|
||||
return fmt.Errorf("block disks have more 1 disk type 'B'")
|
||||
}
|
||||
@@ -648,9 +656,16 @@ func ExistBlankCompute(ctx context.Context, computeId uint64, m interface{}) err
|
||||
computeImageId := computeRecord.ImageID
|
||||
bootImageId := -1
|
||||
for _, d := range computeRecord.Disks {
|
||||
if d.Type == "B" {
|
||||
bootImageId = int(d.ImageID)
|
||||
break
|
||||
if computeRecord.Chipset == "i440fx" {
|
||||
if d.PCISlot == 6 {
|
||||
bootImageId = int(d.ImageID)
|
||||
break
|
||||
}
|
||||
} else {
|
||||
if d.BusNumber == 6 {
|
||||
bootImageId = int(d.ImageID)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,3 +694,20 @@ func ExistPlatformDisk(ctx context.Context, diskId uint64, m interface{}) error
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ExistSDNNet(ctx context.Context, sdnIds []string, c *controller.ControllerCfg) []error {
|
||||
var errs []error
|
||||
|
||||
for _, uniqueIdentifier := range sdnIds {
|
||||
if uniqueIdentifier == "" {
|
||||
continue
|
||||
}
|
||||
req := logicalports.GetByUniqueIdentifierRequest{ID: uniqueIdentifier}
|
||||
_, err := c.SDN().LogicalPorts().GetByUniqueIdentifier(ctx, req)
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Errorf("SDN logical port with unique identifier %q not found", uniqueIdentifier))
|
||||
}
|
||||
}
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user