4.11.0
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
cb_k8ci "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8ci"
|
||||
cb_k8s "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8s"
|
||||
cb_lb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/lb"
|
||||
cb_node "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/node"
|
||||
cb_rg "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/rg"
|
||||
cb_stack "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stack"
|
||||
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"
|
||||
@@ -467,53 +467,23 @@ func ExistGID(ctx context.Context, gid uint64, c *controller.ControllerCfg) erro
|
||||
return fmt.Errorf("GID with id %v not found", gid)
|
||||
}
|
||||
|
||||
func ExistStack(ctx context.Context, stackId uint64, c *controller.ControllerCfg) error {
|
||||
req := cb_stack.ListRequest{
|
||||
ByID: stackId,
|
||||
func ExistNode(ctx context.Context, nodeId uint64, c *controller.ControllerCfg) error {
|
||||
req := cb_node.ListRequest{
|
||||
ByID: nodeId,
|
||||
}
|
||||
|
||||
stackList, err := c.CloudBroker().Stack().List(ctx, req)
|
||||
nodeList, err := c.CloudBroker().Node().List(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(stackList.Data) == 0 {
|
||||
return fmt.Errorf("stack with id %v not found", stackList)
|
||||
if len(nodeList.Data) == 0 {
|
||||
return fmt.Errorf("node with id %v not found", nodeList)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ExistStackInPcidevice checks if compute exists with specified stackId and specified non-deleted rgId.
|
||||
func ExistStackInPcidevice(ctx context.Context, stackId, rgId uint64, c *controller.ControllerCfg) error {
|
||||
req := cb_rg.ListRequest{
|
||||
ByID: rgId,
|
||||
IncludeDeleted: false,
|
||||
}
|
||||
|
||||
rgList, err := c.CloudBroker().RG().List(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, v := range rgList.Data {
|
||||
for _, idVM := range v.VMs {
|
||||
req := cb_compute.GetRequest{
|
||||
ComputeID: idVM,
|
||||
}
|
||||
computeRec, err := c.CloudBroker().Compute().Get(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if computeRec.StackID == stackId {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("no compute found with stack_id %v and rg_id %v", stackId, rgId)
|
||||
}
|
||||
|
||||
func ExistLB(ctx context.Context, lbId uint64, c *controller.ControllerCfg) error {
|
||||
|
||||
req := cb_lb.ListRequest{
|
||||
|
||||
Reference in New Issue
Block a user