Skip to content

Commit

Permalink
fix(vm-network): fix iptables rules (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmd-fl authored Sep 30, 2024
1 parent 9e70b08 commit 757eacf
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 119 deletions.
91 changes: 83 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/peer-metrics/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub struct SystemInfo {
#[derive(Default, Debug, Clone, Hash, Eq, PartialEq, EncodeLabelSet)]
pub struct VmInfo {
pub allow_gpu: u8,
pub interface: String,
pub public_ip: String,
pub host_ssh_port: u16,
pub vm_ssh_port: u16,
Expand Down
2 changes: 2 additions & 0 deletions crates/server-config/src/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,8 @@ pub struct VmConfig {

#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq)]
pub struct VmNetworkConfig {
#[serde(default)]
pub interface: Option<String>,
#[serde(default = "default_bridge_name")]
pub bridge_name: String,
pub public_ip: Ipv4Addr,
Expand Down
2 changes: 2 additions & 0 deletions crates/server-config/src/resolved_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ mod tests {
libvirt_uri = "qemu:///system"
allow_gpu = true
[vm.network]
interface = "eth0"
bridge_name = "br422442"
public_ip = "1.1.1.1"
vm_ip = "2.2.2.2"
Expand All @@ -883,6 +884,7 @@ mod tests {
libvirt_uri: "qemu:///system".to_string(),
allow_gpu: true,
network: VmNetworkConfig {
interface: Some("eth0".to_string()),
bridge_name: "br422442".to_string(),
public_ip: Ipv4Addr::new(1, 1, 1, 1),
vm_ip: Ipv4Addr::new(2, 2, 2, 2),
Expand Down
7 changes: 2 additions & 5 deletions crates/vm-network-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ name = "vm-network-utils"
version = "0.1.0"
edition = "2021"

[[bin]]
name = 'vm-network-utils'
path = "bin/main.rs"

[target.'cfg(target_os = "linux")'.dependencies]
iptables = "0.5.2"

[dependencies]
thiserror = { workspace = true }
tracing = { workspace = true }
tracing = { workspace = true }
netdev = "0.31.0"
37 changes: 0 additions & 37 deletions crates/vm-network-utils/bin/main.rs

This file was deleted.

Loading

0 comments on commit 757eacf

Please sign in to comment.