feat(region,host): usb passthrough

This commit is contained in:
Zexi Li
2021-12-28 19:05:42 +08:00
parent c974692962
commit 8423aa9e63
26 changed files with 1471 additions and 633 deletions
+8 -3
View File
@@ -40,7 +40,8 @@ func AddHostHandler(prefix string, app *appsrv.Application) {
auth.Authenticate(setOnHostDown))
for action, f := range map[string]actionFunc{
"sync": hostSync,
"sync": hostSync,
"probe-isolated-devices": hostProbeIsolatedDevices,
} {
app.AddHandler("POST",
fmt.Sprintf("%s/%s/<sid>/%s", prefix, keyword, action),
@@ -76,6 +77,10 @@ func hostActions(f actionFunc) appsrv.FilterHandler {
}
}
func hostSync(ctx context.Context, sid string, body jsonutils.JSONObject) (interface{}, error) {
return hostinfo.Instance().UpdateSyncInfo(sid, body)
func hostSync(ctx context.Context, hostId string, body jsonutils.JSONObject) (interface{}, error) {
return hostinfo.Instance().UpdateSyncInfo(hostId, body)
}
func hostProbeIsolatedDevices(ctx context.Context, hostId string, body jsonutils.JSONObject) (interface{}, error) {
return hostinfo.Instance().ProbeSyncIsolatedDevices(hostId, body)
}