From 4753a17fa29393b3f99b6dfcdcec48d935e6ebd9 Mon Sep 17 00:00:00 2001 From: ghe0 Date: Sat, 5 Jul 2025 16:36:35 +0300 Subject: [PATCH] allow VM nodes to offer multiple slot offers --- build.rs | 4 ++++ proto/snp/vm.proto | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/build.rs b/build.rs index 2946654..4d79d44 100644 --- a/build.rs +++ b/build.rs @@ -32,6 +32,10 @@ fn main() -> Result<(), Box> { ".general_proto.InspectOperatorResp", "#[derive(serde::Serialize, serde::Deserialize)]", ) + .type_attribute( + ".vm_proto.VmNodeOffer", + "#[derive(serde::Serialize, serde::Deserialize)]", + ) .type_attribute( ".vm_proto.VmNodeListResp", "#[derive(serde::Serialize, serde::Deserialize)]", diff --git a/proto/snp/vm.proto b/proto/snp/vm.proto index 8cbbb3d..00279a7 100644 --- a/proto/snp/vm.proto +++ b/proto/snp/vm.proto @@ -54,8 +54,13 @@ message RegisterVmNodeReq { string country = 4; string region = 5; string city = 6; - // nanocredits per unit per minute - uint64 price = 7; +} + +message VmNodeOffer { + uint64 price = 1; + uint64 vcpus = 2; + uint64 memory_mib = 3; + uint64 disk_mib = 4; } message VmNodeResources { @@ -63,10 +68,8 @@ message VmNodeResources { uint32 avail_ports = 2; uint32 avail_ipv4 = 3; uint32 avail_ipv6 = 4; - uint32 avail_vcpus = 5; - uint32 avail_memory_mib = 6; - uint32 avail_storage_mib = 7; - uint32 max_ports_per_vm = 8; + uint32 max_ports_per_vm = 5; + repeated VmNodeOffer offers = 6; } message NewVmReq { @@ -176,10 +179,7 @@ message VmNodeListResp { string city = 5; string ip = 6; // required for latency test repeated string reports = 7; // TODO: this will become an enum - uint64 price = 8; // nanocredits per unit per minute - uint64 vcpus = 9; - uint64 memory_mib = 10; - uint64 disk_mib = 11; + repeated VmNodeOffer offers = 9; bool public_ipv4 = 12; bool public_ipv6 = 13; }