let call = Sm_exec.make_call ~sr_ref:sr ~vdi_ref:vdi dconf "vdi_detach" [] in
Sm_exec.parse_unit (Sm_exec.exec_xmlrpc (driver_type driver) (driver_filename driver) call)
-let vdi_activate dconf driver sr vdi =
+let vdi_activate dconf driver sr vdi writable =
debug "vdi_activate" driver (sprintf "sr=%s vdi=%s" (Ref.string_of sr) (Ref.string_of vdi));
- let call = Sm_exec.make_call ~sr_ref:sr ~vdi_ref:vdi dconf "vdi_activate" [] in
+ let call = Sm_exec.make_call ~sr_ref:sr ~vdi_ref:vdi dconf "vdi_activate" [ sprintf "%b" writable ] in
Sm_exec.parse_unit (Sm_exec.exec_xmlrpc (driver_type driver) (driver_filename driver) call)
let vdi_deactivate dconf driver sr vdi =
debug "Executed detach succesfully on VDI '%s'; attach refcount now: %d" (Uuid.to_string uuid) newval
)
- let activate ~__context ~self =
+ let activate ~__context ~self ~mode =
with_vdi_lock
(fun () ->
if (check_enclosing_sr_for_capability __context Smint.Vdi_activate self) then
begin
+ if mode=`RW then debug "foo";
Sm.call_sm_vdi_functions ~__context ~vdi:self
(fun device_config sr_type sr ->
- Sm.vdi_activate device_config sr_type sr self);
+ Sm.vdi_activate device_config sr_type sr self (mode = `RW));
let newval = increment_activate_refcount self in
debug "Executed activate succesfully on VDI '%s'; activate refcount now: %d" (Ref.string_of self) newval
end
let use_vdi ~__context ~vdi ~mode =
VDI.attach ~__context ~self:vdi ~mode;
try
- VDI.activate ~__context ~self:vdi
+ VDI.activate ~__context ~self:vdi ~mode;
with e ->
(* if activate fails then best effort detach VDI before propogating original exception *)
begin
let do_single_attach (vdi,mode) =
VDI.attach ~__context ~self:vdi ~mode;
Hashtbl.replace attached vdi ();
- VDI.activate ~__context ~self:vdi;
+ VDI.activate ~__context ~self:vdi ~mode;
Hashtbl.replace activated vdi () in
(* Attach/activate vbds recording what we've done *)
List.iter do_single_attach vdis;
val attach : __context:Context.t -> self:API.ref_VDI -> mode:[`RO|`RW] -> unit
val detach : __context:Context.t -> self:API.ref_VDI -> unit
- val activate : __context:Context.t -> self:API.ref_VDI -> unit
+ val activate : __context:Context.t -> self:API.ref_VDI -> mode:[`RO|`RW] -> unit
val deactivate : __context:Context.t -> self:API.ref_VDI -> unit
val check_enclosing_sr_for_capability : Context.t -> Smint.capability -> [ `VDI ] Ref.t -> bool
else
begin
debug "Receiver 7a. Activating VDIs";
- List.iter (fun (vdi,_) -> Storage_access.VDI.activate ~__context ~self:vdi) needed_vdis
+ List.iter (fun (vdi,mode) -> Storage_access.VDI.activate ~__context ~self:vdi ~mode) needed_vdis
end;
if delay_device_create_until_after_activate then