4.11.4
4.11.4
This commit is contained in:
@@ -121,6 +121,12 @@ func resourceVinsCreate(ctx context.Context, d *schema.ResourceData, m interface
|
||||
}
|
||||
}
|
||||
|
||||
if start, ok := d.GetOkExists("vnfdev_start"); ok && !start.(bool) {
|
||||
if err := resourceVinsVnfDevStop(ctx, m, vinsID); err != nil {
|
||||
warnings.Add(err)
|
||||
}
|
||||
}
|
||||
|
||||
return append(warnings.Get(), resourceVinsRead(ctx, d, m)...)
|
||||
}
|
||||
|
||||
@@ -786,20 +792,27 @@ func resourceVinsChangeVnfReset(ctx context.Context, d *schema.ResourceData, m i
|
||||
}
|
||||
|
||||
func resourceVinsChangeVnfStartStop(ctx context.Context, d *schema.ResourceData, m interface{}) error {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
vinsId := uint64(d.Get("vins_id").(int))
|
||||
|
||||
_, newStart := d.GetChange("vnfdev_start")
|
||||
if newStart.(bool) {
|
||||
req := vins.VNFDevStartRequest{VINSID: vinsId}
|
||||
|
||||
_, err := c.CloudBroker().VINS().VNFDevStart(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if d.Get("vnfdev_start").(bool) {
|
||||
return resourceVinsVnfDevStart(ctx, m, vinsId)
|
||||
}
|
||||
|
||||
return resourceVinsVnfDevStop(ctx, m, vinsId)
|
||||
}
|
||||
|
||||
func resourceVinsVnfDevStart(ctx context.Context, m interface{}, vinsId uint64) error {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
req := vins.VNFDevStartRequest{VINSID: vinsId}
|
||||
|
||||
_, err := c.CloudBroker().VINS().VNFDevStart(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
func resourceVinsVnfDevStop(ctx context.Context, m interface{}, vinsId uint64) error {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
req := vins.VNFDevStopRequest{VINSID: vinsId}
|
||||
|
||||
_, err := c.CloudBroker().VINS().VNFDevStop(ctx, req)
|
||||
|
||||
@@ -2177,7 +2177,6 @@ func resourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
"vnfdev_start": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
Description: "true to start vnfdev, false to stop vnfdev",
|
||||
},
|
||||
"vnfdev_reset": {
|
||||
|
||||
Reference in New Issue
Block a user