@@ -189,7 +189,7 @@ func (n *NodeClient) NetworkListInterfaces(ctx context.Context) (result map[stri
189189
190190// NetworkListAllInterfaces return all physical devices on a node
191191func (n * NodeClient ) NetworkListAllInterfaces (ctx context.Context ) (result map [string ]Interface , err error ) {
192- const cmd = "zos.network. admin.interfaces"
192+ const cmd = "zos.admin.interfaces"
193193
194194 err = n .bus .Call (ctx , n .nodeTwin , cmd , nil , & result )
195195
@@ -199,19 +199,92 @@ func (n *NodeClient) NetworkListAllInterfaces(ctx context.Context) (result map[s
199199// NetworkSetPublicExitDevice select which physical interface to use as an exit device
200200// setting `iface` to `zos` will then make node run in a single nic setup.
201201func (n * NodeClient ) NetworkSetPublicExitDevice (ctx context.Context , iface string ) error {
202- const cmd = "zos.network. admin.set_public_nic"
202+ const cmd = "zos.admin.set_public_nic"
203203
204204 return n .bus .Call (ctx , n .nodeTwin , cmd , iface , nil )
205205}
206206
207207// NetworkGetPublicExitDevice gets the current dual nic setup of the node.
208208func (n * NodeClient ) NetworkGetPublicExitDevice (ctx context.Context ) (exit ExitDevice , err error ) {
209- const cmd = "zos.network. admin.get_public_nic"
209+ const cmd = "zos.admin.get_public_nic"
210210
211211 err = n .bus .Call (ctx , n .nodeTwin , cmd , nil , & exit )
212212 return
213213}
214214
215+ // AdminRebootNode stops all the running services and reboots the node
216+ func (n * NodeClient ) AdminRebootNode (ctx context.Context ) error {
217+ const cmd = "zos.admin.reboot"
218+
219+ return n .bus .Call (ctx , n .nodeTwin , cmd , nil , nil )
220+ }
221+
222+ // AdminRestartService restarts a zinit service
223+ func (n * NodeClient ) AdminRestartService (ctx context.Context , service string ) error {
224+ const cmd = "zos.admin.restart"
225+
226+ return n .bus .Call (ctx , n .nodeTwin , cmd , service , nil )
227+ }
228+
229+ // AdminRestartAll restarts all zinit services
230+ func (n * NodeClient ) AdminRestartAll (ctx context.Context ) error {
231+ const cmd = "zos.admin.restart_all"
232+
233+ return n .bus .Call (ctx , n .nodeTwin , cmd , nil , nil )
234+ }
235+
236+ // AdminShowLogs returns l lines of zinit logs
237+ func (n * NodeClient ) AdminShowLogs (ctx context.Context , l int ) (logs []byte , err error ) {
238+ const cmd = "zos.admin.show_logs"
239+
240+ err = n .bus .Call (ctx , n .nodeTwin , cmd , l , & logs )
241+ return
242+ }
243+
244+ // AdminShowResolve return the content of /etc/resolv.conf
245+ func (n * NodeClient ) AdminShowResolve (ctx context.Context ) (res []byte , err error ) {
246+ const cmd = "zos.admin.show_resolve"
247+
248+ err = n .bus .Call (ctx , n .nodeTwin , cmd , nil , & res )
249+ return
250+ }
251+
252+ // AdminShowOpenConnections return information about all open connections in the node
253+ func (n * NodeClient ) AdminShowOpenConnections (ctx context.Context ) (res []byte , err error ) {
254+ const cmd = "zos.admin.show_open_connections"
255+
256+ err = n .bus .Call (ctx , n .nodeTwin , cmd , nil , & res )
257+ return
258+ }
259+
260+ // AdminStopWorkload stops a workload
261+ func (n * NodeClient ) AdminStopWorkload (ctx context.Context , twinID uint32 , wlID uint64 ) error {
262+ const cmd = "zos.admin.stop_workload"
263+ args := struct {
264+ TwinID uint32 `json:"twin_id"`
265+ WorkloadID uint64 `json:"workload_id"`
266+ }{
267+ TwinID : twinID ,
268+ WorkloadID : wlID ,
269+ }
270+
271+ return n .bus .Call (ctx , n .nodeTwin , cmd , args , nil )
272+ }
273+
274+ // AdminResumeWorkload stops a workload
275+ func (n * NodeClient ) AdminResumeWorkload (ctx context.Context , twinID uint32 , wlID uint64 ) error {
276+ const cmd = "zos.admin.resume_workload"
277+ args := struct {
278+ TwinID uint32 `json:"twin_id"`
279+ WorkloadID uint64 `json:"workload_id"`
280+ }{
281+ TwinID : twinID ,
282+ WorkloadID : wlID ,
283+ }
284+
285+ return n .bus .Call (ctx , n .nodeTwin , cmd , args , nil )
286+ }
287+
215288// NetworkListPublicIPs list taken public IPs on the node
216289func (n * NodeClient ) NetworkListPublicIPs (ctx context.Context ) ([]string , error ) {
217290 const cmd = "zos.network.list_public_ips"
0 commit comments