On Tue, Sep 12, 2017 at 08:41:54AM +0200, Wolfgang Link wrote: > A base snapshot can be a replication snapshot or a normal snapshot. > Normal snapshots use the format configid. > --- > src/PVE/JSONSchema.pm | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm > index 3295599..501f0fa 100644 > --- a/src/PVE/JSONSchema.pm > +++ b/src/PVE/JSONSchema.pm > @@ -163,6 +163,20 @@ sub pve_verify_vmid { > return $vmid; > } > > +register_format('pve-base-snapshot', \&pve_base_snapshot); > +sub pve_base_snapshot { > + my ($base_snapshot, $noerr) = @_; > + > + if ($base_snapshot !~ m/^__replicate_[1-9]\d\d+\-\d+_\d+__$/i) { > + # We use configid as snapshot name in qemu and lxc.
We also limit it to a length of 40, though. Currently QemuServer.pm defines a standard option named 'pve-snapshot-name' and LXC/Config.pm defines a 'pve-lxc-snapshot-name' option. Both are the same. I'd rather have both a 'pve-snapshot-name' format as well as the standard option in pve-common's JSONSchema.pm. The option would simply use the format, and the 'pve-base-snapshot' format introduced here would then call the ve-snapshot-name's format verifier instead of the one of pve_verify_configid() in its fallback. qemu-server & pve-container should then drop their own standard option and use the common one, along with pve-storage. > + $base_snapshot = PVE::JSONSchema::pve_verify_configid($base_snapshot, > $noerr); > + } > + die "value does not look like a valid base snapshot\n" > + if !defined($base_snapshot) && $noerr; > + > + return $base_snapshot; > +} > + > register_format('pve-node', \&pve_verify_node_name); > sub pve_verify_node_name { > my ($node, $noerr) = @_; > -- > 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel