[pve-devel] [RFC PATCH qemu-server 1/4] meta info: allow additional properties to be given
Dominik Csapak
d.csapak at proxmox.com
Fri Nov 3 12:53:36 CET 2023
we'll need this since we want to record the profile used for creation,
which we get from outside
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/QemuServer.pm | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 0568b2bc..c22b1544 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2125,15 +2125,22 @@ sub parse_meta_info {
}
sub new_meta_info_string {
- my () = @_; # for now do not allow to override any value
+ my ($additional_props) = @_;
- return PVE::JSONSchema::print_property_string(
- {
- 'creation-qemu' => kvm_user_version(),
- ctime => "". int(time()),
- },
- $meta_info_fmt
- );
+ $additional_props //= {};
+
+ # for now do not allow to override any value
+ delete $additional_props->{'creation-qemu'};
+ delete $additional_props->{'ctime'};
+
+ my $opts = {
+ 'creation-qemu' => kvm_user_version(),
+ ctime => "". int(time()),
+ };
+
+ $opts->{$_} = $additional_props->{$_} for keys $additional_props->%*;
+
+ return PVE::JSONSchema::print_property_string($opts, $meta_info_fmt);
}
sub qemu_created_version_fixups {
--
2.30.2
More information about the pve-devel
mailing list