Skip to content

Commit

Permalink
CA-136654: Don't rely on a XAPI session existing
Browse files Browse the repository at this point in the history
With static VDIs, the SR code is run without a XAPI session.  In this
case, set O_DIRECT to be on for safety since there is external knob to
adjust it.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #142 on xapi-project/sm
  • Loading branch information
rosslagerwall authored and chandrikas committed May 29, 2014
1 parent a6c8f25 commit 6c2d966
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/FileSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ def handles(srtype):
handles = staticmethod(handles)

def _check_o_direct(self):
other_config = self.session.xenapi.SR.get_other_config(self.sr_ref)
o_direct = other_config.get("o_direct")
self.o_direct = o_direct is not None and o_direct == "true"
if self.sr_ref and self.session is not None:
other_config = self.session.xenapi.SR.get_other_config(self.sr_ref)
o_direct = other_config.get("o_direct")
self.o_direct = o_direct is not None and o_direct == "true"
else:
self.o_direct = True

def load(self, sr_uuid):
self.ops_exclusive = OPS_EXCLUSIVE
Expand Down

0 comments on commit 6c2d966

Please sign in to comment.