File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed
Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -3721,12 +3721,7 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
37213721 Helpers. call_api_functions ~__context
37223722 (fun rpc session_id ->
37233723 Client.SR. update rpc session_id sr
3724- );
3725-
3726- (* Check if SR has SR_STATS capability then create SR-stats VDI *)
3727- let sr_record = Db.SR. get_record_internal ~__context ~self: sr in
3728- if Smint. (has_capability Sr_stats (Xapi_sr_operations. features_of_sr ~__context sr_record)) then
3729- Xapi_vdi_helpers. create_rrd_vdi ~__context ~sr: sr
3724+ )
37303725
37313726 let unplug ~__context ~self =
37323727 info " PBD.unplug: PBD = '%s'" (pbd_uuid ~__context self);
Original file line number Diff line number Diff line change @@ -151,7 +151,15 @@ let plug ~__context ~self =
151151 Xapi_sm. register_plugin ~__context query_result;
152152
153153 (* The allowed-operations depend on the capabilities *)
154- Xapi_sr_operations. update_allowed_operations ~__context ~self: sr
154+ Xapi_sr_operations. update_allowed_operations ~__context ~self: sr;
155+
156+ (* Check if SR has SR_STATS capability and sr master then create SR-stats VDI*)
157+ let sr_record = Db.SR. get_record_internal ~__context ~self: sr in
158+ if (Smint. (has_capability Sr_stats (Xapi_sr_operations. features_of_sr ~__context sr_record)) &&
159+ (Helpers. i_am_srmaster ~__context ~sr )) then begin
160+ let vdi = Xapi_vdi_helpers. create_rrd_vdi ~__context ~sr: sr in
161+ Xapi_vdi_helpers. push_sr_rdds ~__context ~sr: sr ~vdi: vdi
162+ end
155163 end
156164
157165let unplug ~__context ~self =
Original file line number Diff line number Diff line change @@ -265,3 +265,16 @@ let read_rrd ~__context ~sr ~vdi =
265265 )
266266 )
267267
268+
269+ module Rrdd = Rrd_client. Client
270+
271+ let push_sr_rdds ~__context ~sr ~vdi =
272+ let sr_uuid = Db.SR. get_uuid ~__context ~self: sr in
273+ let sr_rrds_path = Rrdd. sr_rrds_path ~sr_uuid: sr_uuid in
274+ let gzipped_rrds = read_rrd ~__context ~sr: sr ~vdi: vdi in
275+ begin match gzipped_rrds with
276+ | None -> debug " stats vdi doesn't have rdds"
277+ | Some x ->
278+ Unixext. write_string_to_file sr_rrds_path x;
279+ Rrdd. push_sr_rrd ~sr_uuid: sr_uuid
280+ end
You can’t perform that action at this time.
0 commit comments