fixed small bug with updating

This commit is contained in:
Ramil_Algayev 2025-01-04 20:20:42 +04:00
parent bff04c7b7e
commit d8c183df25

@ -263,8 +263,12 @@ impl BrainData {
contract.disk_size_gb = updatevmreq.0.disk_size_gb;
contract.vcpus = updatevmreq.0.vcpus;
contract.memory_mb = updatevmreq.0.memory_mb;
if !updatevmreq.0.kernel_sha.is_empty() {
contract.kernel_sha = updatevmreq.0.kernel_sha;
}
if !updatevmreq.0.dtrfs_sha.is_empty() {
contract.dtrfs_sha = updatevmreq.0.dtrfs_sha;
}
contract.updated_at = Utc::now().to_rfc3339();
}
}
@ -274,9 +278,7 @@ impl BrainData {
mut req: grpc::NewVmReq,
tx: OneshotSender<grpc::NewVmResp>,
) {
if req.uuid.is_empty() {
req.uuid = uuid::Uuid::new_v4().to_string();
}
info!("Inserting new vm request in memory: {req:?}");
self.tmp_newvm_reqs
.insert(req.uuid.clone(), (req.clone(), tx));