From d458bbaec448d83de1698e79825faf74bdadf883 Mon Sep 17 00:00:00 2001 From: J M Date: Thu, 11 Jun 2026 12:01:09 +0800 Subject: [PATCH] [xinfini]: wait out mapping teardown on unexport A volume restored from backup keeps its iscsi client-group mapping when the unexport polling gives up before the storage finishes the asynchronous teardown (observed ~2.5min per path, 13 paths > 30min, while the polling budget was 5min and its failure is swallowed). Any later vhost activate then fails with "BsVolume has been mapped" from CreateBdcBdevRequest, because a mapping in deleting state cannot be operated on and the volume cannot be mapped again until it is gone. Make the deletion polling budget configurable and extend it to one hour for the unexport mapping deletion, so unexport outlives the teardown window and the volume becomes Ready unmapped. Resolves: ZSTAC-85604 Change-Id: I381583e75cb36af3c905ba42ed0de514caba44fe --- .../org/zstack/xinfini/XInfiniApiHelper.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugin/xinfini/src/main/java/org/zstack/xinfini/XInfiniApiHelper.java b/plugin/xinfini/src/main/java/org/zstack/xinfini/XInfiniApiHelper.java index b67bfa0da7e..10b93bbefb0 100644 --- a/plugin/xinfini/src/main/java/org/zstack/xinfini/XInfiniApiHelper.java +++ b/plugin/xinfini/src/main/java/org/zstack/xinfini/XInfiniApiHelper.java @@ -416,9 +416,20 @@ protected boolean onFailure(Throwable t) { private void retryUtilResourceDeleted(XInfiniRequest req, Class rsp) { + retryUtilResourceDeleted(req, rsp, 150, 2); + } + + private void retryUtilResourceDeleted(XInfiniRequest req, + Class rsp, + int retryTimes, + int retryInterval) { new Retry() { + { + times = retryTimes; + interval = retryInterval; + } + @Override - @RetryCondition(times = 150, interval = 2) protected Void call() { T r = XInfiniApiHelper.this.call(req, rsp); if (!r.resourceIsDeleted()) { @@ -731,7 +742,10 @@ public void deleteVolumeClientGroupMapping(int mapId) { GetVolumeClientGroupMappingRequest gReq = new GetVolumeClientGroupMappingRequest(); gReq.setId(mapId); - retryUtilResourceDeleted(gReq, GetVolumeClientGroupMappingResponse.class); + // the storage tears mappings down asynchronously path by path and cannot be + // operated on while deleting; observed taking over 30 minutes, so wait long + // enough to cover the teardown window + retryUtilResourceDeleted(gReq, GetVolumeClientGroupMappingResponse.class, 1800, 2); } public List queryIscsiGatewayClientGroupMappingByGroupId(int groupId) {