]> git.proxmox.com Git - pve-ha-manager.git/blobdiff - src/PVE/HA/Resources/PVEVM.pm
resources: add get_static_stats() method
[pve-ha-manager.git] / src / PVE / HA / Resources / PVEVM.pm
index 58c83e03fea3a161a634538416390f502d761e84..49e4a1d662f5f817c919bcc84bcccd147472defb 100644 (file)
@@ -173,4 +173,18 @@ sub remove_locks {
     return undef;
 }
 
+sub get_static_stats {
+    my ($class, $haenv, $id, $service_node) = @_;
+
+    my $conf = PVE::QemuConfig->load_config($id, $service_node);
+    my $defaults = PVE::QemuServer::load_defaults();
+
+    my $cpus = ($conf->{sockets} || $defaults->{sockets}) * ($conf->{cores} || $defaults->{cores});
+
+    return {
+       maxcpu => $conf->{vcpus} || $cpus,
+       maxmem => ($conf->{memory} || $defaults->{memory}) * 1024 * 1024,
+    };
+}
+
 1;