Skip to content

Commit 5e1ca0a

Browse files
committed
vmm: Fix status display after CVM updated
1 parent 9a13df3 commit 5e1ca0a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

vmm/src/app.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ impl App {
142142
.app_compose()
143143
.context("Failed to read compose file")?;
144144
{
145-
let mut teapot = self.lock();
146-
let cid = teapot
145+
let mut states = self.lock();
146+
let cid = states
147147
.get(&vm_id)
148148
.map(|vm| vm.config.cid)
149149
.or_else(|| cids_assigned.get(&vm_id).cloned())
150-
.or_else(|| teapot.cid_pool.allocate())
150+
.or_else(|| states.cid_pool.allocate())
151151
.context("CID pool exhausted")?;
152152
let vm_config = VmConfig {
153153
manifest,
@@ -163,7 +163,14 @@ impl App {
163163
self.config.cvm.max_disk_size
164164
);
165165
}
166-
teapot.add(VmState::new(vm_config));
166+
match states.get_mut(&vm_id) {
167+
Some(vm) => {
168+
vm.config = vm_config.into();
169+
}
170+
None => {
171+
states.add(VmState::new(vm_config));
172+
}
173+
}
167174
};
168175
if auto_start && vm_work_dir.started().unwrap_or_default() {
169176
self.start_vm(&vm_id).await?;

0 commit comments

Comments
 (0)