Skip to content

Commit 4d9bf34

Browse files
committed
add admin workload docs
1 parent f1c0924 commit 4d9bf34

File tree

5 files changed

+78
-15
lines changed

5 files changed

+78
-15
lines changed

client/node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func (n *NodeClient) AdminRestartAll(ctx context.Context) error {
280280
return n.bus.Call(ctx, n.nodeTwin, cmd, nil, nil)
281281
}
282282

283-
// AdminShowLogs returns a l lines of zinit logs
283+
// AdminShowLogs returns l lines of zinit logs
284284
func (n *NodeClient) AdminShowLogs(ctx context.Context, l int) (logs []byte, err error) {
285285
const cmd = "zos.admin.show_logs"
286286

docs/manual/api.md

Lines changed: 74 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ so `used = user_used + system`, while `system` is only the amount of resourced r
8484
| `zos.storage.pools` | - |`[]Pool`|
8585

8686
List all node pools with their types, size and used space
87-
where
87+
88+
Where
8889

8990
```json
9091
Pool {
@@ -151,29 +152,95 @@ it means it can act like an access node to user private networks
151152

152153
## Admin
153154

154-
The next set of commands are ONLY possible to be called by the `farmer` only.
155+
The next set of commands are ONLY possible to be called by the `farmer` owning the node.
155156

156157
### Reboot Node
157158

158159
| command |body| return|
159160
|---|---|---|
160161
| `zos.admin.reboot` | - | - |
161162

162-
Stops all services then reboot the node
163+
Stops all services then reboots the node
163164

164165
### Restart Service
165166

166167
| command |body| return|
167168
|---|---|---|
168-
| `zos.admin.reboot` | string | - |
169+
| `zos.admin.restart` | string | - |
169170

170171
Restarts a service running on the node
171172

173+
### Restart All Services
174+
175+
| command |body| return|
176+
|---|---|---|
177+
| `zos.admin.restart_all` | - | - |
178+
179+
Restarts all zinit services running on the node
180+
181+
### Show Logs
182+
183+
| command |body| return|
184+
|---|---|---|
185+
| `zos.admin.show_logs` | int | []byte |
186+
187+
Shows a number of lines of zinit logs
188+
189+
### Show Resolve
190+
191+
| command |body| return|
192+
|---|---|---|
193+
| `zos.admin.show_resolve` | - | []byte |
194+
195+
Shows the content of /etc/resolv.conf
196+
197+
### Show Open Connections
198+
199+
| command |body| return|
200+
|---|---|---|
201+
| `zos.admin.show_open_connections` | - | []byte |
202+
203+
Shows information about all open connections in the node
204+
205+
### Stop Workload
206+
207+
| command |body| return|
208+
|---|---|---|
209+
| `zos.admin.Stop` | `Args` | - |
210+
211+
Where
212+
213+
```json
214+
Args {
215+
"twin_id": "uint32",
216+
"workload_id": "uint64",
217+
}
218+
```
219+
220+
Stops a workload
221+
222+
### Resume Workload
223+
224+
| command |body| return|
225+
|---|---|---|
226+
| `zos.admin.resume` | `Args` | - |
227+
228+
Where
229+
230+
```json
231+
Args {
232+
"twin_id": "uint32",
233+
"workload_id": "uint64",
234+
}
235+
```
236+
237+
Resumes a stopped workload
238+
172239
### List Physical Interfaces
173240

174241
| command |body| return|
175242
|---|---|---|
176-
| `zos.network.admin.interfaces` | - |`map[string]Interface` |
243+
| `zos.admin.interfaces` | - |`map[string]Interface` |
177244

178245
Where
179246

@@ -191,7 +258,7 @@ Those interfaces then can be used as an input to `set_public_nic`
191258

192259
| command |body| return|
193260
|---|---|---|
194-
| `zos.network.admin.get_public_nic` | - |`ExitDevice` |
261+
| `zos.admin.get_public_nic` | - |`ExitDevice` |
195262

196263
Where
197264

@@ -209,7 +276,7 @@ returns the interface used by public traffic (for user workloads)
209276

210277
| command |body| return|
211278
|---|---|---|
212-
| `zos.network.admin.set_public_nic` | `name` |- |
279+
| `zos.admin.set_public_nic` | `name` |- |
213280

214281
name must be one of (free) names returned by `zos.network.admin.interfaces`
215282

@@ -239,7 +306,6 @@ name must be one of (free) names returned by `zos.network.admin.interfaces`
239306
|---|---|---|
240307
| `zos.system.node_features_get` | - |`[]NodeFeature` |
241308

242-
243309
Where
244310

245311
```json

pkg/primitives/statistics.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@ func (s *statsStream) Total() gridtypes.Capacity {
236236
}
237237

238238
func (s *statsStream) OpenConnections() ([]byte, error) {
239-
args := []string{"-ptn", "state", "established"}
240-
cmd := exec.Command("ss", args...)
241-
return cmd.Output()
239+
return exec.Command("ss", "-ptn", "state", "established").Output()
242240
}
243241

244242
func (s *statsStream) openConnectionsCount() (int, error) {

pkg/provision.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ type Statistics interface {
3232
GetCounters() (Counters, error)
3333
ListGPUs() ([]GPUInfo, error)
3434
OpenConnections() ([]byte, error)
35-
// Pause(id gridtypes.WorkloadID) error
3635
}
3736

3837
type Counters struct {

pkg/zinit/commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func (c *Client) List() (out map[string]ServiceState, err error) {
207207
}
208208

209209
// List returns all the service monitored and their status
210-
func (c *Client) Log(n int) (out string, err error) {
210+
func (c *Client) Log(n int) (out []byte, err error) {
211211
cmd1 := exec.Command("zinit", "log", "-s")
212212
cmd2 := exec.Command("tail", "-n", fmt.Sprint(n))
213213

@@ -231,7 +231,7 @@ func (c *Client) Log(n int) (out string, err error) {
231231
return
232232
}
233233

234-
return string(output), err
234+
return output, err
235235
}
236236

237237
// Status returns the status of a service

0 commit comments

Comments
 (0)