[pve-devel] [PATCH v4 qemu-server 19/27] Allow parsing vmstate entries

Fabian Ebner f.ebner at proxmox.com
Thu Mar 26 09:09:49 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuConfig.pm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 8cf3865..f2e66f9 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -5,6 +5,7 @@ use warnings;
 
 use PVE::AbstractConfig;
 use PVE::INotify;
+use PVE::JSONSchema;
 use PVE::QemuServer::Drive;
 use PVE::QemuServer::Helpers;
 use PVE::QemuServer::Monitor qw(mon_cmd);
@@ -89,7 +90,17 @@ sub valid_volume_keys {
 sub parse_volume {
     my ($class, $key, $volume_string, $noerr) = @_;
 
-    my $volume = PVE::QemuServer::Drive::parse_drive($key, $volume_string);
+    my $volume;
+    if ($key eq 'vmstate') {
+	eval { PVE::JSONSchema::check_format('pve-volume-id', $volume_string) };
+	if (my $err = $@) {
+	    return undef if $noerr;
+	    die $err;
+	}
+	$volume = { 'file' => $volume_string };
+    } else {
+	$volume = PVE::QemuServer::Drive::parse_drive($key, $volume_string);
+    }
 
     die "unable to parse volume\n" if !defined($volume) && !$noerr;
 
-- 
2.20.1





More information about the pve-devel mailing list