Skip to content

Commit 14e8a43

Browse files
committed
Merge pull request #2339 from euanh/CA-177513
CA-177513: Push RRDs to slaves correctly
2 parents 3f25415 + b7237f6 commit 14e8a43

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

ocaml/xapi/rrdd_proxy.ml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,18 @@ let put_rrd_forwarder (req : Http.Request.t) (s : Unix.file_descr) _ =
193193
ignore (Xapi_services.hand_over_connection req s !(Rrd_interface.forwarded_path))
194194
)
195195

196-
let is_vm_on_localhost ~__context ~(vm_uuid : string) : bool =
197-
let localhost = Helpers.get_localhost ~__context in
196+
let host_for_vm ~__context ~vm_uuid =
198197
let vm = Db.VM.get_by_uuid ~__context ~uuid:vm_uuid in
199-
let vm_host = Db.VM.get_resident_on ~__context ~self:vm in
200-
localhost = vm_host
198+
Db.VM.get_resident_on ~__context ~self:vm
201199

202200
let push_rrd ~__context ~(vm_uuid : string) : unit =
203-
let is_on_localhost = is_vm_on_localhost ~__context ~vm_uuid in
204-
let domid = vm_uuid_to_domid ~__context ~uuid:vm_uuid in
205-
if is_on_localhost then
201+
let vm_host = host_for_vm ~__context ~vm_uuid in
202+
if vm_host = (Helpers.get_localhost ~__context) then
203+
let domid = vm_uuid_to_domid ~__context ~uuid:vm_uuid in
206204
log_and_ignore_exn (fun () -> Rrdd.push_rrd_local ~vm_uuid ~domid )
207205
else
208-
let master = Pool_role.get_master_address () in
209-
log_and_ignore_exn (fun () -> Rrdd.push_rrd_remote ~vm_uuid ~remote_address:master)
206+
let remote_address = Db.Host.get_address ~__context ~self:vm_host in
207+
log_and_ignore_exn (fun () -> Rrdd.push_rrd_remote ~vm_uuid ~remote_address)
210208

211209
let migrate_rrd ~__context ?remote_address ?session_id ~vm_uuid ~host_uuid () =
212210
let remote_address = match remote_address with

0 commit comments

Comments
 (0)