so that we don't need to specify all usage stats explicitly for
bigger tests.
Note, we explicitly use two digits for memory as with just one a lot
of services are exactly the same, which gives us flaky tests due to
rounding, or some flakiness in the rust code - so this is a bit of a
stop gap for that too and should be reduced to a single digit once
we fixed it in the future.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
my $hardware = $haenv->hardware();
my $stats = $hardware->read_static_service_stats();
- return $stats->{$sid};
+ if (my $service_stats = $stats->{$sid}) {
+ return $service_stats;
+ } elsif ($id =~ /^(\d)(\d\d)/) {
+ # auto assign usage calculated from ID for convenience
+ my ($maxcpu, $maxmeory) = (int($1) + 1, (int($2) + 1) * 1<<29);
+ return { maxcpu => $maxcpu, maxmem => $maxmeory };
+ } else {
+ return {};
+ }
}
1;