[pve-devel] [PATCH v5 qemu-server 11/19] Allow parsing vmstate entries

Fabian Ebner f.ebner at proxmox.com
Wed Apr 8 11:25:06 CEST 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 78f5c60..7874081 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::CPUConfig;
 use PVE::QemuServer::Drive;
 use PVE::QemuServer::Helpers;
@@ -90,7 +91,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