Skip to content

Commit 9ded6f8

Browse files
committed
teepod-ui: Support for updating port mapping
1 parent 7822ce9 commit 9ded6f8

File tree

4 files changed

+279
-83
lines changed

4 files changed

+279
-83
lines changed

teepod/rpc/proto/teepod_rpc.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ message UpgradeAppRequest {
9898
bytes encrypted_env = 3;
9999
// Optional update user config. Leave empty to not update.
100100
string user_config = 4;
101+
// Optional update port mapping.
102+
bool update_ports = 5;
103+
// Port mapping
104+
repeated PortMapping ports = 7;
101105
}
102106

103107
// Message for VM list response

teepod/src/app.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ impl App {
122122
&self,
123123
work_dir: impl AsRef<Path>,
124124
cids_assigned: &HashMap<String, u32>,
125+
auto_start: bool,
125126
) -> Result<()> {
126127
let vm_work_dir = VmWorkDir::new(work_dir.as_ref());
127128
let manifest = vm_work_dir.manifest().context("Failed to read manifest")?;
@@ -160,6 +161,9 @@ impl App {
160161
}
161162
teapot.add(VmState::new(vm_config));
162163
};
164+
if auto_start && vm_work_dir.started().unwrap_or_default() {
165+
self.start_vm(&vm_id).await?;
166+
}
163167
Ok(())
164168
}
165169

@@ -285,7 +289,7 @@ impl App {
285289
let entry = entry.context("Failed to read directory entry")?;
286290
let vm_path = entry.path();
287291
if vm_path.is_dir() {
288-
if let Err(err) = self.load_vm(vm_path, &occupied_cids).await {
292+
if let Err(err) = self.load_vm(vm_path, &occupied_cids, true).await {
289293
error!("Failed to load VM: {err:?}");
290294
}
291295
}

0 commit comments

Comments
 (0)