File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ func (s *Server) Start(ctx context.Context) error {
7979 s .registerExternalFiles (mux )
8080 s .registerDRBDPassphrase (mux )
8181 s .registerRDClone (mux )
82+ s .registerSOSReport (mux )
8283
8384 srv := & http.Server {
8485 Addr : s .Addr ,
Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2026 Cozystack contributors.
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */
16+
17+ package rest
18+
19+ import (
20+ "net/http"
21+ )
22+
23+ // registerSOSReport wires the `linstor sos-report download` endpoint.
24+ // Bundling controller logs + every satellite's local state into a
25+ // tarball is operationally useful but non-trivial — we 501 today so
26+ // the CLI gets a clear error rather than 404'ing.
27+ func (s * Server ) registerSOSReport (mux * http.ServeMux ) {
28+ mux .HandleFunc ("GET /v1/sos-report" , handleSOSReport )
29+ }
30+
31+ func handleSOSReport (w http.ResponseWriter , _ * http.Request ) {
32+ writeError (w , http .StatusNotImplemented , "sos-report bundling not yet implemented" )
33+ }
Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2026 Cozystack contributors.
3+
4+ Licensed under the Apache License, Version 2.0 (the "License");
5+ you may not use this file except in compliance with the License.
6+ You may obtain a copy of the License at
7+
8+ http://www.apache.org/licenses/LICENSE-2.0
9+
10+ Unless required by applicable law or agreed to in writing, software
11+ distributed under the License is distributed on an "AS IS" BASIS,
12+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ See the License for the specific language governing permissions and
14+ limitations under the License.
15+ */
16+
17+ package rest
18+
19+ import (
20+ "net/http"
21+ "testing"
22+
23+ "github.com/cozystack/blockstor/pkg/store"
24+ )
25+
26+ // TestSOSReportReturns501: linstor CLI's `sos-report download` calls
27+ // /v1/sos-report. We don't yet bundle controller logs / state into a
28+ // tarball; explicitly 501 so the CLI can render a clear error rather
29+ // than crash on the unexpected 404.
30+ func TestSOSReportReturns501 (t * testing.T ) {
31+ base , stop := startServerWithStore (t , store .NewInMemory ())
32+ defer stop ()
33+
34+ resp := httpGet (t , base + "/v1/sos-report" )
35+ _ = resp .Body .Close ()
36+
37+ if resp .StatusCode != http .StatusNotImplemented {
38+ t .Errorf ("status: got %d, want 501" , resp .StatusCode )
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments