60 lines
1.9 KiB
Diff
60 lines
1.9 KiB
Diff
--- Storage.pm.old 2021-11-28 12:58:53.026308987 +0100
|
|
+++ Storage.pm 2021-11-28 12:59:14.394144995 +0100
|
|
@@ -427,6 +427,15 @@
|
|
return $plugin->get_subdir($scfg, 'vztmpl');
|
|
}
|
|
|
|
+sub get_snippet_dir {
|
|
+ my ($cfg, $storeid) = @_;
|
|
+
|
|
+ my $scfg = storage_config($cfg, $storeid);
|
|
+ my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
|
+
|
|
+ return $plugin->get_subdir($scfg, 'snippets');
|
|
+}
|
|
+
|
|
sub get_backup_dir {
|
|
my ($cfg, $storeid) = @_;
|
|
|
|
|
|
--- API2/Storage/Config.pm.old 2021-11-28 14:09:07.861745249 +0100
|
|
+++ API2/Storage/Config.pm 2021-11-28 14:00:09.133897607 +0100
|
|
@@ -19,7 +19,7 @@
|
|
|
|
use base qw(PVE::RESTHandler);
|
|
|
|
-my @ctypes = qw(images vztmpl iso backup);
|
|
+my @ctypes = qw(images vztmpl iso backup snippets);
|
|
|
|
my $storage_type_enum = PVE::Storage::Plugin->lookup_types();
|
|
|
|
|
|
--- API2/Storage/Status.pm.old 2021-11-28 13:51:17.609996827 +0100
|
|
+++ API2/Storage/Status.pm 2021-11-28 13:51:02.190115817 +0100
|
|
@@ -381,7 +381,7 @@
|
|
content => {
|
|
description => "Content type.",
|
|
type => 'string', format => 'pve-storage-content',
|
|
- enum => ['iso', 'vztmpl'],
|
|
+ enum => ['iso', 'vztmpl', 'snippets'],
|
|
},
|
|
filename => {
|
|
description => "The name of the file to create. Caution: This will be normalized!",
|
|
@@ -433,6 +433,8 @@
|
|
raise_param_exc({ filename => "wrong file extension" });
|
|
}
|
|
$path = PVE::Storage::get_vztmpl_dir($cfg, $param->{storage});
|
|
+ } elsif ($content eq 'snippets') {
|
|
+ $path = PVE::Storage::get_snippet_dir($cfg, $param->{storage});
|
|
} else {
|
|
raise_param_exc({ content => "upload content type '$content' not allowed" });
|
|
}
|
|
@@ -534,7 +536,7 @@
|
|
content => {
|
|
description => "Content type.", # TODO: could be optional & detected in most cases
|
|
type => 'string', format => 'pve-storage-content',
|
|
- enum => ['iso', 'vztmpl'],
|
|
+ enum => ['iso', 'vztmpl', 'snippets'],
|
|
},
|
|
filename => {
|
|
description => "The name of the file to create. Caution: This will be normalized!",
|