# feat: Support hot-update for VPC guest bandwidth and improve cross-…#24015
Draft
ljluestc wants to merge 1 commit intoyunionio:masterfrom
Draft
# feat: Support hot-update for VPC guest bandwidth and improve cross-…#24015ljluestc wants to merge 1 commit intoyunionio:masterfrom
ljluestc wants to merge 1 commit intoyunionio:masterfrom
Conversation
…platform compatibility
## Description
This PR implements hot-updating of bandwidth limits for VPC guests and includes significant improvements for cross-platform development (macOS/Linux).
### Key Changes
1. **VPC Bandwidth Hot-Update:**
- **Hot-Update Logic**: Modified `pkg/hostman/guestman/qemu-kvm.go` to explicitly detect changes in network interface bandwidth (`Bw`).
- **Immediate Application**: When a change is detected, the system now automatically:
- Regenerates the network interface setup script using `generateNicScripts`.
- Executes the script via `SetNicUp` to apply the new traffic control (TC) rules and OVS configuration immediately.
- **Optimization**: Preserved the optimized path for simple VLAN-only updates to avoid unnecessary script execution.
2. **Cross-Platform Compatibility (Zero-Failure Protocol):**
- **Platform Stubs**: Introduced `_others.go` files and standard `//go:build linux` build tags across multiple packages (`cgrouputils`, `iproute2`, `lbagent`, `snapshot_service`) to resolve compilation errors on non-Linux systems.
- **Dependency Refactoring**: Updated `pkg/cloudproxy/agent/worker/worker.go` to replace the Linux-specific `netlink` library with the standard `net` library, ensuring the agent compiles and runs on macOS.
- **Test Stability**: Fixed various unit tests to ensure a "Zero-Failure" state for `go test ./pkg/...` on macOS environments.
## Related Issue
- Fixes yunionio#12553: VPC Guest Bandwidth requires VM restart to take effect.
## Testing
- **Unit Tests**:
- `go test ./pkg/hostman/guestman/...` - **PASSED**
- `go test ./pkg/hostman/...` - **PASSED**
- **Manual Verification**:
- Verified that changing the bandwidth limit for a running VM triggers the `SetNicUp` flow.
- Confirmed that the `ovs-vsctl` and `tc` commands are effectively updated without interrupting the VM instance.
- Validated that the project compiles and tests pass on macOS (Darwin).
## Checklist
- [x] Code compiles correctly.
- [x] Unit tests passed.
- [x] Logic verified for hot-update scenario.
- [x] Cross-platform build tags applied correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…platform compatibility
Description
This PR implements hot-updating of bandwidth limits for VPC guests and includes significant improvements for cross-platform development (macOS/Linux).
Key Changes
VPC Bandwidth Hot-Update:
pkg/hostman/guestman/qemu-kvm.goto explicitly detect changes in network interface bandwidth (Bw).generateNicScripts.SetNicUpto apply the new traffic control (TC) rules and OVS configuration immediately.Cross-Platform Compatibility (Zero-Failure Protocol):
_others.gofiles and standard//go:build linuxbuild tags across multiple packages (cgrouputils,iproute2,lbagent,snapshot_service) to resolve compilation errors on non-Linux systems.pkg/cloudproxy/agent/worker/worker.goto replace the Linux-specificnetlinklibrary with the standardnetlibrary, ensuring the agent compiles and runs on macOS.go test ./pkg/...on macOS environments.Related Issue
Testing
go test ./pkg/hostman/guestman/...- PASSEDgo test ./pkg/hostman/...- PASSEDSetNicUpflow.ovs-vsctlandtccommands are effectively updated without interrupting the VM instance.Checklist
What this PR does / why we need it:
Does this PR need to be backport to the previous release branch?: