]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/Plugin.pm
cifs: small line bloat reduction
[pve-storage.git] / PVE / Storage / Plugin.pm
index 5cb3d900360530689df62c4a3c4ce3e338cf6f70..ca7a0d4ed4dcc8f50043caf1e726c0dd56e509b7 100644 (file)
@@ -169,6 +169,11 @@ my $defaultData = {
            type => 'boolean',
            optional => 1,
        },
+       subdir => {
+           description => "Subdir to mount.",
+           type => 'string', format => 'pve-storage-path',
+           optional => 1,
+       },
        'format' => {
            description => "Default image format.",
            type => 'string', format => 'pve-storage-format',
@@ -181,8 +186,8 @@ my $defaultData = {
            default => 'metadata',
            optional => 1,
        },
-       dirs => {
-           description => "Overrides for default directories",
+       'content-dirs' => {
+           description => "Overrides for default content type directories.",
            type => "string", format => "pve-dir-override-list",
            optional => 1,
        },
@@ -213,7 +218,7 @@ sub valid_content_types {
 sub dirs_hash_to_string {
     my $hash = shift;
 
-    return join(',', map { "$_:$hash->{$_}" } sort keys %$hash);
+    return join(',', map { "$_=$hash->{$_}" } sort keys %$hash);
 }
 
 sub default_format {
@@ -350,8 +355,8 @@ PVE::JSONSchema::register_format('pve-dir-override', \&verify_dir_override);
 sub verify_dir_override {
     my ($value, $noerr) = @_;
 
-    if($value =~ m/^([a-z]+):(.+)$/ &&
-       verify_content($1, $noerr) && verify_path($2, $noerr)) {
+    if($value =~ m/^([a-z]+)=\/.+$/ &&
+       verify_content($1, $noerr)) {
        return $value;
     }
 
@@ -429,12 +434,12 @@ sub decode_value {
        #}
 
        return $res;
-    } elsif ($key eq 'dirs') {
+    } elsif ($key eq 'content-dirs') {
        my $valid_content = $def->{content}->[0];
        my $res = {};
 
        foreach my $dir (PVE::Tools::split_list($value)) {
-           my ($content, $path) = split(/:/, $dir, 2);
+           my ($content, $path) = split(/=/, $dir, 2);
 
            if (!$valid_content->{$content}) {
                warn "storage does not support content type '$content'\n";
@@ -458,7 +463,7 @@ sub encode_value {
     } elsif ($key eq 'content') {
        my $res = content_hash_to_string($value) || 'none';
        return $res;
-    } elsif ($key eq 'dirs') {
+    } elsif ($key eq 'content-dirs') {
        my $res = dirs_hash_to_string($value);
        return $res;
     }
@@ -654,7 +659,7 @@ sub get_subdir {
     die "storage definition has no path\n" if !$path;
     die "unknown vtype '$vtype'\n" if !exists($vtype_subdirs->{$vtype});
 
-    my $subdir = $scfg->{dirs}->{$vtype} // "/".$vtype_subdirs->{$vtype};
+    my $subdir = $scfg->{"content-dirs"}->{$vtype} // "/".$vtype_subdirs->{$vtype};
 
     return $path.$subdir;
 }