Skip to content

Commit de51faf

Browse files
committed
ephemeral: Default to bridged networking
There's no reason to default to `none` - let's make it match the podman default. In my testing this works except for DNS in the guest - haven't debugged why yet. Signed-off-by: Colin Walters <[email protected]>
1 parent cbcd469 commit de51faf

File tree

6 files changed

+17
-31
lines changed

6 files changed

+17
-31
lines changed

crates/kit/src/libvirt/upload.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ pub fn run(global_opts: &crate::libvirt::LibvirtOptions, opts: LibvirtUploadOpts
220220
memory: opts.memory.clone(),
221221
vcpus: opts.vcpus,
222222
kernel_args: opts.karg.clone(),
223-
net: Some("none".to_string()),
224223
..Default::default()
225224
},
226225
..Default::default()

crates/kit/src/libvirt_upload_disk.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ pub fn run(opts: LibvirtUploadDiskOpts) -> Result<()> {
291291
memory: opts.memory.clone(),
292292
vcpus: opts.vcpus,
293293
kernel_args: opts.karg.clone(),
294-
net: Some("none".to_string()),
295294
..Default::default()
296295
},
297296
..Default::default()

crates/kit/src/run_ephemeral.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ pub struct CommonPodmanOptions {
146146
#[clap(long = "name", help = "Assign a name to the container")]
147147
pub name: Option<String>,
148148

149+
#[clap(long = "network", help = "Configure the network for the container")]
150+
pub network: Option<String>,
151+
149152
#[clap(
150153
long = "label",
151154
help = "Add metadata to the container in key=value form"
@@ -165,12 +168,6 @@ pub struct CommonVmOpts {
165168
#[clap(long = "karg", help = "Additional kernel command line arguments")]
166169
pub kernel_args: Vec<String>,
167170

168-
#[clap(
169-
long,
170-
help = "Network configuration (none, user, bridge=name) [default: none]"
171-
)]
172-
pub net: Option<String>,
173-
174171
#[clap(long, help = "Enable console output to terminal for debugging")]
175172
pub console: bool,
176173

@@ -211,11 +208,6 @@ impl CommonVmOpts {
211208
pub fn vcpus(&self) -> u32 {
212209
self.vcpus.unwrap_or_else(default_vcpus)
213210
}
214-
215-
/// Get network config (default: "none")
216-
pub fn net_string(&self) -> String {
217-
self.net.clone().unwrap_or_else(|| "none".to_string())
218-
}
219211
}
220212

221213
/// Ephemeral VM options: container-style flags, host bind mounts, systemd injection.
@@ -380,19 +372,19 @@ fn prepare_run_command_with_temp(
380372
for label in opts.podman.label.iter() {
381373
cmd.arg(format!("--label={label}"));
382374
}
383-
cmd.arg(format!("--net={}", opts.common.net_string().as_str()));
384375

385-
// Add container name if specified
376+
// Propagate all podman arguments
386377
if let Some(ref name) = opts.podman.name {
387378
cmd.args(["--name", name]);
388379
}
389-
390-
// Add --rm flag based on user input (default: true)
380+
// Note that (unlike the libvirt flow) we rely on the default bridge network to avoid
381+
// port conflicts
382+
if let Some(network) = opts.podman.network.as_deref() {
383+
cmd.args(["--network", network]);
384+
}
391385
if opts.podman.rm {
392386
cmd.arg("--rm");
393387
}
394-
395-
// Add -t, -i, -d flags based on user input (mirror podman behavior)
396388
if opts.podman.tty {
397389
cmd.arg("-t");
398390
}

docs/src/man/bcvk-ephemeral-run-ssh.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ Run ephemeral VM and SSH into it
3737

3838
Additional kernel command line arguments
3939

40-
**--net**=*NET*
41-
42-
Network configuration (none, user, bridge=name) [default: none]
43-
4440
**--console**
4541

4642
Enable console output to terminal for debugging
@@ -81,6 +77,10 @@ Run ephemeral VM and SSH into it
8177

8278
Assign a name to the container
8379

80+
**--network**=*NETWORK*
81+
82+
Configure the network for the container
83+
8484
**--label**=*LABEL*
8585

8686
Add metadata to the container in key=value form

docs/src/man/bcvk-ephemeral-run.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ This design allows bcvk to provide VM-like isolation and boot behavior while lev
6363

6464
Additional kernel command line arguments
6565

66-
**--net**=*NET*
67-
68-
Network configuration (none, user, bridge=name) [default: none]
69-
7066
**--console**
7167

7268
Enable console output to terminal for debugging
@@ -107,6 +103,10 @@ This design allows bcvk to provide VM-like isolation and boot behavior while lev
107103

108104
Assign a name to the container
109105

106+
**--network**=*NETWORK*
107+
108+
Configure the network for the container
109+
110110
**--label**=*LABEL*
111111

112112
Add metadata to the container in key=value form

docs/src/man/bcvk-to-disk.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ The installation process:
7979

8080
Additional kernel command line arguments
8181

82-
**--net**=*NET*
83-
84-
Network configuration (none, user, bridge=name) [default: none]
85-
8682
**--console**
8783

8884
Enable console output to terminal for debugging

0 commit comments

Comments
 (0)