added snippet upload
This commit is contained in:
parent
349afa60e1
commit
861ca4edf7
7 changed files with 281 additions and 81 deletions
36
snippet.diff
Normal file
36
snippet.diff
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
diff --git a/PVE/API2/Storage/Status.pm b/PVE/API2/Storage/Status.pm
|
||||
index 9a5a952..fd7ac5f 100644
|
||||
--- a/PVE/API2/Storage/Status.pm
|
||||
+++ b/PVE/API2/Storage/Status.pm
|
||||
@@ -417,8 +417,10 @@ __PACKAGE__->register_method ({
|
||||
raise_param_exc({ filename => "missing '.tar.gz' or '.tar.xz' extension" });
|
||||
}
|
||||
$path = PVE::Storage::get_vztmpl_dir($cfg, $param->{storage});
|
||||
- } else {
|
||||
- raise_param_exc({ content => "upload content type '$content' not allowed" });
|
||||
+ } elsif ($content eq 'snippets') {
|
||||
+ $path = PVE::Storage::get_snippet_dir($cfg, $param->{storage});
|
||||
+ } else {
|
||||
+ raise_param_exc({ content => "upload content type '$content' not allowed" });
|
||||
}
|
||||
|
||||
die "storage '$param->{storage}' does not support '$content' content\n"
|
||||
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
|
||||
index eb5e86f..bc0981b 100755
|
||||
--- a/PVE/Storage.pm
|
||||
+++ b/PVE/Storage.pm
|
||||
@@ -340,6 +340,15 @@ sub get_iso_dir {
|
||||
return $plugin->get_subdir($scfg, 'iso');
|
||||
}
|
||||
|
||||
+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_vztmpl_dir {
|
||||
my ($cfg, $storeid) = @_;
|
||||
Loading…
Add table
Add a link
Reference in a new issue