From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 938C51FF13E for ; Fri, 20 Mar 2026 10:27:21 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9457F11E56; Fri, 20 Mar 2026 10:27:37 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 4/5] fake remote: add jitter to disk/memory values Date: Fri, 20 Mar 2026 10:25:41 +0100 Message-ID: <20260320092702.1069143-5-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260320092702.1069143-1-d.csapak@proxmox.com> References: <20260320092702.1069143-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -1.024 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 6QGZJNYJOIQDWV3YY6Q5VVGN5CKGDDD4 X-Message-ID-Hash: 6QGZJNYJOIQDWV3YY6Q5VVGN5CKGDDD4 X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: by using the current time and the vmid / index as a factor. This makes the data look a bit more like 'real' data. This has two nice effects: we get more realistic values for over the wire compression (this is useful to measure network bandwidth impact of theses api calls) and the values get used in some parts of the ui where we now can observe changes. Signed-off-by: Dominik Csapak --- server/src/test_support/fake_remote.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/server/src/test_support/fake_remote.rs b/server/src/test_support/fake_remote.rs index 501f2dc6..ae367f68 100644 --- a/server/src/test_support/fake_remote.rs +++ b/server/src/test_support/fake_remote.rs @@ -147,23 +147,26 @@ impl pve_api_types::client::PveClient for FakePveClient { let cpu = 0.1; let maxcpu = 4.0; + let bytejitter = 2.0 * 1024.0 * 1024.0 * 1024.0 * proxmox_time::epoch_f64().sin(); + for _ in 0..self.nr_of_vms { vmid += 1; + let jitter = ((vmid as f64).sin() * bytejitter).round() as i64; result.push(ClusterResource { cgroup_mode: None, content: None, cpu: Some(cpu), diskread: Some(1034), diskwrite: Some(1034), - disk: Some(disk), + disk: Some(disk.saturating_add_signed(jitter)), hastate: None, id: format!("qemu/{vmid}"), level: Some("".into()), maxcpu: Some(maxcpu), maxdisk: Some(maxdisk), maxmem: Some(maxmem), - mem: Some(mem), - memhost: Some(memhost), + mem: Some(mem.saturating_sub_signed(jitter)), + memhost: Some(memhost.saturating_add_signed(jitter)), name: Some(format!("vm-{vmid}")), netin: Some(1034), netout: Some(1034), @@ -189,11 +192,12 @@ impl pve_api_types::client::PveClient for FakePveClient { for _ in 0..self.nr_of_cts { vmid += 1; + let jitter = ((vmid as f64).sin() * bytejitter).round() as i64; result.push(ClusterResource { cgroup_mode: None, content: None, cpu: Some(cpu), - disk: Some(disk), + disk: Some(disk.saturating_add_signed(jitter)), diskread: Some(1034), diskwrite: Some(1034), hastate: None, @@ -203,7 +207,7 @@ impl pve_api_types::client::PveClient for FakePveClient { maxdisk: Some(maxdisk), maxmem: Some(maxmem), memhost: Some(memhost), - mem: Some(mem), + mem: Some(mem.saturating_add_signed(jitter)), name: Some(format!("ct-{vmid}")), netin: Some(1034), netout: Some(1034), @@ -228,11 +232,12 @@ impl pve_api_types::client::PveClient for FakePveClient { } for i in 0..self.nr_of_nodes { + let jitter = ((i as f64).sin() * bytejitter).round() as i64; result.push(ClusterResource { cgroup_mode: None, content: None, cpu: Some(cpu), - disk: Some(disk), + disk: Some(disk.saturating_add_signed(jitter)), diskread: None, diskwrite: None, hastate: None, @@ -241,7 +246,7 @@ impl pve_api_types::client::PveClient for FakePveClient { maxcpu: Some(16.), maxdisk: Some(maxdisk), maxmem: Some(maxmem), - mem: Some(mem), + mem: Some(mem.saturating_add_signed(jitter)), memhost: None, name: None, netin: None, @@ -267,11 +272,12 @@ impl pve_api_types::client::PveClient for FakePveClient { } for i in 0..self.nr_of_storages { + let jitter = ((i as f64).sin() * bytejitter).round() as i64; result.push(ClusterResource { cgroup_mode: None, content: Some(vec![StorageContent::Images, StorageContent::Rootdir]), cpu: None, - disk: Some(disk), + disk: Some(disk.saturating_add_signed(jitter)), diskread: None, diskwrite: None, hastate: None, -- 2.47.3