From f87dd81da0ae3b7460666e090aa051b982fa39b9 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 2 Jun 2017 12:18:41 +0200 Subject: [PATCH] PVE::ReplicationConfig - use new ID format "-" --- PVE/ReplicationConfig.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm index 092c497..923995e 100644 --- a/PVE/ReplicationConfig.pm +++ b/PVE/ReplicationConfig.pm @@ -22,8 +22,8 @@ cfs_register_file($replication_cfg_filename, PVE::JSONSchema::register_standard_option('pve-replication-id', { description => "Replication Job ID.", - type => 'string', format => 'pve-configid', - maxLength => 32, # keep short to reduce snapshot name length + type => 'string', + pattern => '[1-9][0-9]{2,8}-\d{1,9}', }); my $defaultData = { @@ -73,12 +73,16 @@ sub private { sub parse_section_header { my ($class, $line) = @_; - if ($line =~ m/^(\S+):\s*(\S+)\s*$/) { - my ($type, $id) = (lc($1), $2); + if ($line =~ m/^(\S+):\s*(\d+)-(\d+)\s*$/) { + my ($type, $guest, $subid) = (lc($1), int($2), int($3)); + my $id = "$guest-$subid"; # use parsed integers my $errmsg = undef; # set if you want to skip whole section - eval { PVE::JSONSchema::pve_verify_configid($id); }; + eval { + die "invalid replication job id '$id'\n" if $subid < 1; + PVE::JSONSchema::pve_verify_vmid($guest); + }; $errmsg = $@ if $@; - my $config = {}; + my $config = { guest => $guest }; return ($type, $id, $errmsg, $config); } return undef; -- 2.39.2