[pve-devel] [PATCH] New Backup Strategy

Jeff Moskow jeff at rtr.com
Fri Jan 17 15:56:24 CET 2014


Signed-off-by: Jeff Moskow <jeff at rtr.com>
---
 data/PVE/JSONSchema.pm |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/data/PVE/JSONSchema.pm b/data/PVE/JSONSchema.pm
index 94d2db2..92adac4 100644
--- a/data/PVE/JSONSchema.pm
+++ b/data/PVE/JSONSchema.pm
@@ -76,6 +76,16 @@ PVE::JSONSchema::register_standard_option('pve-storage-id', {
     type => 'string', format => 'pve-storage-id',
 }); 
 
+PVE::JSONSchema::register_standard_option('pve-storage-id-list', {
+    description => "List of storage identifiers.",
+    type => 'string', format => 'pve-storage-id-list',
+}); 
+
+PVE::JSONSchema::register_standard_option('strategy', {
+    description => "Backup strategy (when to backup and where to put it).",
+    type => 'string', 
+}); 
+
 my $format_list = {};
 
 sub register_format {
@@ -113,6 +123,16 @@ sub parse_storage_id {
     return $storeid;
 }
 
+PVE::JSONSchema::register_format('pve-storage-id-list', \&parse_storage_id_list);
+sub parse_storage_id_list {
+    my ($storeids, $noerr) = @_;
+
+    if ($storeids !~ m/^[a-z][a-z0-9\-\_\.]*[a-z0-9](,\s*[a-z][a-z0-9\-\_\.]*[a-z0-9])*$/i) {
+       return undef if $noerr;
+       die "storage ID list '$storeids' contains illegal characters\n";
+    }
+    return $storeids;
+}
 
 register_format('pve-vmid', \&pve_verify_vmid);
 sub pve_verify_vmid {
-- 
1.7.10.4




More information about the pve-devel mailing list