v1.5.0
This commit is contained in:
@@ -64,8 +64,10 @@ type CreateRequest struct {
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
// Slice of structs with net interface description.
|
||||
// If not specified, compute will be created with default interface from RG.
|
||||
// To create compute without interfaces, pass initialized empty slice .
|
||||
// Required: false
|
||||
Interfaces []Interface `url:"-" json:"interfaces,omitempty" validate:"omitempty,min=1,dive"`
|
||||
Interfaces []Interface `url:"-" json:"interfaces,omitempty" validate:"omitempty,dive"`
|
||||
|
||||
// Input data for cloud-init facility
|
||||
// Required: false
|
||||
@@ -102,15 +104,21 @@ func (k KVMPPC) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
}
|
||||
}
|
||||
|
||||
interfaces := make([]string, 0, len(req.Interfaces))
|
||||
var interfaces []string
|
||||
|
||||
for i := range req.Interfaces {
|
||||
b, err := json.Marshal(req.Interfaces[i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
if req.Interfaces != nil && len(req.Interfaces) != 0 {
|
||||
interfaces = make([]string, 0, len(req.Interfaces))
|
||||
|
||||
for i := range req.Interfaces {
|
||||
b, err := json.Marshal(req.Interfaces[i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
interfaces = append(interfaces, string(b))
|
||||
}
|
||||
|
||||
interfaces = append(interfaces, string(b))
|
||||
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
|
||||
interfaces = []string{"[]"}
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCreateRequest{
|
||||
|
||||
@@ -41,9 +41,11 @@ type CreateBlankRequest struct {
|
||||
// Required: true
|
||||
Pool string `url:"pool" json:"pool" validate:"required"`
|
||||
|
||||
// Slice of structs with net interface description
|
||||
// Slice of structs with net interface description.
|
||||
// If not specified, compute will be created with default interface from RG.
|
||||
// To create compute without interfaces, pass initialized empty slice .
|
||||
// Required: false
|
||||
Interfaces []Interface `url:"-" json:"interfaces,omitempty" validate:"omitempty,min=1,dive"`
|
||||
Interfaces []Interface `url:"-" json:"interfaces,omitempty" validate:"omitempty,dive"`
|
||||
|
||||
// Text description of this VM
|
||||
// Required: false
|
||||
@@ -64,15 +66,21 @@ func (k KVMPPC) CreateBlank(ctx context.Context, req CreateBlankRequest) (uint64
|
||||
}
|
||||
}
|
||||
|
||||
interfaces := make([]string, 0, len(req.Interfaces))
|
||||
var interfaces []string
|
||||
|
||||
for i := range req.Interfaces {
|
||||
b, err := json.Marshal(req.Interfaces[i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
if req.Interfaces != nil && len(req.Interfaces) != 0 {
|
||||
interfaces = make([]string, 0, len(req.Interfaces))
|
||||
|
||||
for i := range req.Interfaces {
|
||||
b, err := json.Marshal(req.Interfaces[i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
interfaces = append(interfaces, string(b))
|
||||
}
|
||||
|
||||
interfaces = append(interfaces, string(b))
|
||||
} else if req.Interfaces != nil && len(req.Interfaces) == 0 {
|
||||
interfaces = []string{"[]"}
|
||||
}
|
||||
|
||||
reqWrapped := wrapperCreateBlankRequest{
|
||||
|
||||
Reference in New Issue
Block a user