[pve-devel] [PATCH guest-common 1/1] abstract config: add method to calculate derived properties from a config
Fiona Ebner
f.ebner at proxmox.com
Tue Feb 28 11:54:07 CET 2023
HA manager currently needs to know about internal details about the
configs and how the properties are calculated. With this method, those
details are abstracted away, allowing to change the configuration
structure. In particular, QemuConfig's 'memory' can be turned into
a property string without HA manager needing to know about it (once HA
manager switched to using this mehtod).
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
src/PVE/AbstractConfig.pm | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/PVE/AbstractConfig.pm b/src/PVE/AbstractConfig.pm
index a0c0bc6..3d2c255 100644
--- a/src/PVE/AbstractConfig.pm
+++ b/src/PVE/AbstractConfig.pm
@@ -1158,6 +1158,15 @@ sub snapshot_rollback {
$class->lock_config($vmid, $updatefn);
}
+# Calculate a derived property from a configuration. Derived properties are:
+# max-cpu - maximum amount of CPUs the guest can currently use (can be a fraction)
+# max-memory - maximum amount of memory the guest can currently use
+sub get_derived_property {
+ my ($class, $conf, $name) = @_;
+
+ die "implement me - abstract method\n";
+}
+
# bash completion helper
sub snapshot_list {
--
2.30.2
More information about the pve-devel
mailing list