Skip to content

Commit

Permalink
Activate can be called several times
Browse files Browse the repository at this point in the history
As it is idempotent we just need to return if the VDI is already
activate.

Signed-off-by: Guillaume <[email protected]>
  • Loading branch information
gthvn1 committed Mar 28, 2024
1 parent 0017bea commit b61a02d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions xapi/storage/libs/libcow/datapath.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ def activate(cls, dbg, uri, domain, cb):
with Lock(opq, 'gl', cb):
with cb.db_context(opq) as db:
vdi = db.get_vdi_by_id(key)
# Raise Storage Error VDIInUse - 24
# activate should be idempotent. So just return if the VDI is
# already active.
if vdi.active_on:
raise util.create_storage_error(
"SR_BACKEND_FAILURE_24",
["VDIInUse", "The VDI is currently in use"])
return
vol_path = cb.volumeGetPath(opq, str(vdi.volume.id))
img = cls._get_image_from_vdi(vdi, vol_path)
if not vdi.sharable:
Expand Down

0 comments on commit b61a02d

Please sign in to comment.