mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
Merge pull request #310 in YUNIONIO/onecloud from ~ZHOUYOUSONG/onecloud:bugfix/yousong-allow-change-bw-zero to release/2.1.0
* commit 'c96849e3343879e60925d2ab92bcfbbb6f43dff1': guests: allow change nic bandwidth to 0
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