Cinder duplicated volume sync due to potential time window issue

From PBC, the customer encounter below error:

1. Create a volume in ICM
2. Update PowerVC UUID in cinder volume metadata, in the mean time,
PowerVC volume created, end event comes.
3. Check if PowerVC UUID set in volume metadata, but there is
Time window issue here, sometimes db update not reflect
immediately, so no PVC UUID found , and create a duplicated
volume by mistake.

Change-Id: I4e5546034dbf3ff50c2db588e948818431a665c6
Closes-Bug: #1472126
This commit is contained in:
Jerry Cai 2015-07-07 15:38:50 +08:00
parent b8cc4d3065
commit d80d863743
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@
# from cinderclient.v1 import client
import cinder.db.sqlalchemy.models
import sys
import time
import logging
from oslo.config import cfg
@ -738,6 +739,8 @@ class PowerVCCinderManager(service.Service):
"""
pvc_volume_id = payload.get('volume_id')
# wait 15sec to avoid time window that will create duplicated volume
time.sleep(15)
# If the volume already exists locally then ignore
local_volume = self._get_local_volume_by_pvc_id(context, pvc_volume_id)