[pve-devel] [common 1/2] merge pve-snapshot-name and pve-lxc-snapshot-name to pve-snapshot-id.
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Oct 24 07:23:06 CEST 2018
On Tue, Oct 23, 2018 at 01:25:45PM +0200, Wolfgang Link wrote:
> This format was two time declared in PVE::LXC::Config and PVE::QemuServer.
> ---
> src/PVE/JSONSchema.pm | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
> index fb58ad3..3f14875 100644
> --- a/src/PVE/JSONSchema.pm
> +++ b/src/PVE/JSONSchema.pm
> @@ -52,6 +52,12 @@ sub get_standard_option {
> return $res;
> };
>
> +register_standard_option('pve-snapshot-id', {
> + description => "The name of the snapshot.",
> + type => 'string', format => 'pve-snapshot-id',
> + maxLength => 40,
> +});
> +
> register_standard_option('pve-vmid', {
> description => "The (unique) ID of the VM.",
> type => 'integer', format => 'pve-vmid',
> @@ -149,6 +155,17 @@ sub get_renderer {
>
> register_format('string', sub {}); # allow format => 'string-list'
>
> +register_format('pve-snapshot-id', \&pve_verify_snapshot_name);
s/name/id ??
why not keep the snapshot_name and just move it here? (you need
versioned depends anyway, adding a versioned breaks does not make
matters worse).
> +sub pve_verify_snapshot_id {
> + my ($name, $noerr) = @_;
> +
> + if ($name !~ m/^[a-z][a-z0-9_]+$/i) {
> + return undef if $noerr;
> + die "invalid snapshot-name '$name'\n";
> + }
> + return $name;
> +}
> +
> register_format('urlencoded', \&pve_verify_urlencoded);
> sub pve_verify_urlencoded {
> my ($text, $noerr) = @_;
> --
> 2.11.0
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list