mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
guests: allow change nic bandwidth to 0
To restore the default no limit behavior
This commit is contained in:
@@ -122,7 +122,7 @@ func (manager *SGuestnetworkManager) newGuestNetwork(ctx context.Context, userCr
|
||||
driver = "virtio"
|
||||
}
|
||||
gn.Driver = driver
|
||||
if bwLimit > 0 {
|
||||
if bwLimit >= 0 {
|
||||
gn.BwLimit = bwLimit
|
||||
}
|
||||
|
||||
|
||||
@@ -2881,8 +2881,8 @@ func (self *SGuest) PerformChangeBandwidth(ctx context.Context, userCred mcclien
|
||||
return nil, httperrors.NewBadRequestError("Index Not fount or out of NIC index")
|
||||
}
|
||||
bandwidth, err := data.Int("bandwidth")
|
||||
if err != nil || bandwidth <= 0 {
|
||||
return nil, httperrors.NewBadRequestError("Bandwidth must be larger than 0")
|
||||
if err != nil || bandwidth < 0 {
|
||||
return nil, httperrors.NewBadRequestError("Bandwidth must be non-negative")
|
||||
}
|
||||
guestnic := &guestnics[index]
|
||||
if guestnic.BwLimit != int(bandwidth) {
|
||||
|
||||
Reference in New Issue
Block a user