From b61a02d2d2543e96262223254b58c816eb4ab180 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 22 Mar 2024 10:41:32 +0100 Subject: [PATCH] Activate can be called several times As it is idempotent we just need to return if the VDI is already activate. Signed-off-by: Guillaume --- xapi/storage/libs/libcow/datapath.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xapi/storage/libs/libcow/datapath.py b/xapi/storage/libs/libcow/datapath.py index 88a3f59..233e852 100644 --- a/xapi/storage/libs/libcow/datapath.py +++ b/xapi/storage/libs/libcow/datapath.py @@ -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: