[pve-devel] [PATCH v3 qemu-server 06/22] Allow parsing vmstate entries
Fabian Ebner
f.ebner at proxmox.com
Thu Mar 12 13:08:16 CET 2020
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
Done in here instead of parse_drive, because state
files don't feel like proper drives and this is
only used for the abstract volume iterator anyways.
PVE/QemuConfig.pm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 8b3ce36..cf96295 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