File tree Expand file tree Collapse file tree 1 file changed +23
-13
lines changed Expand file tree Collapse file tree 1 file changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -141,19 +141,29 @@ let do_dispatch ?session_id ?forward_op ?self:_ supports_async called_fn_name
141
141
Context. of_http_req ?session_id ~internal_async_subtask ~generate_task_for
142
142
~supports_async ~label ~http_req ~fd ()
143
143
in
144
- let identity =
145
- try
146
- Option. map
147
- (fun session_id ->
148
- let subject =
149
- Db.Session. get_auth_user_sid ~__context ~self: session_id
150
- in
151
- Tgroup.Group.Identity. make ?user_agent:http_req.user_agent subject
152
- )
153
- session_id
154
- with _ -> None
155
- in
156
- Tgroup. of_creator (Tgroup.Group.Creator. make ?identity () ) ;
144
+ ( if ! Xapi_globs. tgroups_enabled then
145
+ let identity =
146
+ try
147
+ Option. map
148
+ (fun session_id ->
149
+ let subject =
150
+ Db.Session. get_auth_user_sid ~__context ~self: session_id
151
+ in
152
+ Tgroup.Group.Identity. make ?user_agent:http_req.user_agent
153
+ subject
154
+ )
155
+ ( if ! Xapi_globs. slave_emergency_mode then
156
+ (* in emergency mode we cannot reach the coordinator,
157
+ and we must not attempt to make Db calls
158
+ *)
159
+ None
160
+ else
161
+ session_id
162
+ )
163
+ with _ -> None
164
+ in
165
+ Tgroup. of_creator (Tgroup.Group.Creator. make ?identity () )
166
+ ) ;
157
167
let sync () =
158
168
let need_complete = not (Context. forwarded_task __context) in
159
169
exec_with_context ~__context ~need_complete ~called_async
You can’t perform that action at this time.
0 commit comments