Skip to content

Commit

Permalink
fix: fix the return mismatch on blade rename in cfm-service
Browse files Browse the repository at this point in the history
  • Loading branch information
Meng-20 committed Oct 10, 2024
1 parent 944694b commit 20a969a
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion pkg/api/api_default_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,30 @@ func (cfm *CfmApiService) BladesUpdateById(ctx context.Context, applianceId stri
return formatErrorResp(ctx, err.(*common.RequestError))
}

return openapi.Response(http.StatusOK, newBlade), nil
totals, err := newBlade.GetResourceTotals(ctx)
if err != nil {
return formatErrorResp(ctx, err.(*common.RequestError))
}

b := openapi.Blade{
Id: newBlade.Id,
IpAddress: newBlade.GetNetIp(),
Port: int32(newBlade.GetNetPort()),
Status: string(newBlade.Status),
Ports: openapi.MemberItem{
Uri: manager.GetCfmUriBladePorts(appliance.Id, newBlade.Id),
},
Resources: openapi.MemberItem{
Uri: manager.GetCfmUriBladeResources(appliance.Id, newBlade.Id),
},
Memory: openapi.MemberItem{
Uri: manager.GetCfmUriBladeMemory(appliance.Id, newBlade.Id),
},
TotalMemoryAvailableMiB: totals.TotalMemoryAvailableMiB,
TotalMemoryAllocatedMiB: totals.TotalMemoryAllocatedMiB,
}

return openapi.Response(http.StatusOK, b), nil
}

// BladesGetResourceById -
Expand Down

0 comments on commit 20a969a

Please sign in to comment.