[ https://issues.apache.org/jira/browse/CLOUDSTACK-7074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14070666#comment-14070666 ]
edison su commented on CLOUDSTACK-7074: --------------------------------------- As this issue is caused by a race condition, it's not happened all the time, so I think we can refine the test case, to handle the error gracefully. For example, in the test case, we can: 1. add a primary storage 2. call listvolumes api to get the volumes of this storage, it should be empty 3. put the storage into maintenance. 4. wait serveral minutes, then call api to delete the storage. 5. if step 4 failed, then call listvolumes again, if there are volumes created on this storage, then we mark this test case success, otherwise mark it as failure. > [Automation] [BVT] test_01_primary_storage_nfs failing during > PreparePrimaryStorageForMaintenanceCmd > ---------------------------------------------------------------------------------------------------- > > Key: CLOUDSTACK-7074 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7074 > Project: CloudStack > Issue Type: Test > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Simulator > Affects Versions: 4.5.0 > Environment: Master - 4.5 build > BVT run from simulator > Reporter: Rayees Namathponnan > Assignee: Ashutosk Kelkar > Priority: Blocker > Fix For: 4.5.0 > > Attachments: vmops.rar > > > Steps to reproduce > Run BVT from simulator, test case > integration.smoke.test_primary_storage.TestPrimaryStorageServices.test_01_primary_storage_nfs > fails with below error > 2014-07-06 23:17:10,745 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] > (API-Job-Executor-124:ctx-fedceda0 job-223) Executing AsyncJobVO {id:223, use > rId: 2, accountId: 2, instanceType: StoragePool, instanceId: 4, cmd: > org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageFor > MaintenanceCmd, cmdInfo: > {"response":"json","id":"54e824e0-8431-3e45-b35d-a4f9b547df56","ctxDetails":"{\"com.cloud.storage.StoragePool\":\"54 > e824e0-8431-3e45-b35d-a4f9b547df56\"}","cmdEventType":"MAINT.PREPARE.PS","ctxUserId":"2","httpmethod":"GET","uuid":"54e824e0-8431-3e45-b35d-a > 4f9b547df56","ctxAccountId":"2","ctxStartEventId":"720","apiKey":"XhIrLnYTF-2c2uBt22f_kAbgMMuKDbHrjPyLKSOca9k5o08kGxZiiFVG-m637OyA71QLs9MRgbK > 2twbtvYcQNg","signature":"6Ppi5k2c5/wYcs3i4XmPDq1SWGc\u003d"}, cmdVersion: 0, > status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: n > ull, initMsid: 95530185772, completeMsid: null, lastUpdated: null, > lastPolled: null, created: null} > 2014-07-06 23:17:10,746 DEBUG [c.c.d.DeploymentPlanningManagerImpl] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf) Deployme > ntPlanner allocation algorithm: com.cloud.deploy.FirstFitPlanner@2553e6 > 2014-07-06 23:17:10,746 DEBUG [c.c.d.DeploymentPlanningManagerImpl] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf) Trying t > o allocate a host and storage pools from dc:1, pod:null,cluster:null, > requested cpu: 500, requested ram: 134217728 > 2014-07-06 23:17:10,746 DEBUG [c.c.d.DeploymentPlanningManagerImpl] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf) Is ROOT > volume READY (pool already allocated)?: No > 2014-07-06 23:17:10,746 DEBUG [c.c.d.FirstFitPlanner] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf) Searching > all possible > resources under this Zone: 1 > 2014-07-06 23:17:10,747 DEBUG [c.c.d.FirstFitPlanner] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf) Listing > clusters in or > der of aggregate capacity, that have (atleast one host with) enough CPU and > RAM capacity under this Zone: 1 > 2014-07-06 23:17:10,749 DEBUG [c.c.a.ApiServlet] > (1061680681@qtp-1957555412-3:ctx-d0db1f98) ===START=== 172.16.88.7 -- GET > jobid=6c848209-6 > f65-41cb-b80a-c62c32bce55d&apiKey=XhIrLnYTF-2c2uBt22f_kAbgMMuKDbHrjPyLKSOca9k5o08kGxZiiFVG-m637OyA71QLs9MRgbK2twbtvYcQNg&command=queryAsyncJo > bResult&response=json&signature=sxMFd6BpPKZJpsDRjRAZHif1w30%3D > 2014-07-06 23:17:10,762 ERROR [c.c.a.ApiAsyncJobDispatcher] > (API-Job-Executor-124:ctx-fedceda0 job-223) Unexpected exception while > executing > org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageForMaintenanceCmd > com.cloud.exception.InvalidParameterValueException: Primary storage with id 4 > is not ready for migration, as the status is:Maintenance > at > com.cloud.storage.StorageManagerImpl.preparePrimaryStorageForMaintenance(StorageManagerImpl.java:1221) > at > com.cloud.storage.StorageManagerImpl.preparePrimaryStorageForMaintenance(StorageManagerImpl.java:179) > at > org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageForMaintenanceCmd.execute(PreparePrimaryStorageForMaintenance > Cmd.java:103) > at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:141) > at > com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:108) > at > org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:507) > at > org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103) > at > org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53) > at > org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46) > at > org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:464) > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) > at java.util.concurrent.FutureTask.run(FutureTask.java:262) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:744) > 2014-07-06 23:17:10,762 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] > (API-Job-Executor-124:ctx-fedceda0 job-223) Complete async job-223, jobStatus > : FAILED, resultCode: 530, result: > org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":530,"errortext":"Prim > ary storage with id 4 is not ready for migration, as the status > is:Maintenance"} > 2014-07-06 23:17:10,772 DEBUG [c.c.d.DeploymentPlanningManagerImpl] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf) Checking > resources in Cluster: 1 under Pod: 1 > 2014-07-06 23:17:10,772 DEBUG [c.c.a.m.a.i.FirstFitAllocator] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf > FirstFitRouting > Allocator) Looking for hosts in dc: 1 pod:1 cluster:1 > 2014-07-06 23:17:10,776 DEBUG [c.c.a.m.a.i.FirstFitAllocator] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf > FirstFitRouting > Allocator) FirstFitAllocator has 2 hosts to check for allocation: > [Host[-2-Routing], Host[-1-Routing]] > 2014-07-06 23:17:10,782 DEBUG [c.c.a.m.a.i.FirstFitAllocator] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf > FirstFitRouting > Allocator) Found 2 hosts for allocation after prioritization: > [Host[-2-Routing], Host[-1-Routing]] > 2014-07-06 23:17:10,835 DEBUG [c.c.a.m.a.i.FirstFitAllocator] > (Work-Job-Executor-72:ctx-01201e17 job-221/job-222 ctx-68ee52cf > FirstFitRouting > Allocator) Looking for speed=500Mhz, Ram=128 -- This message was sent by Atlassian JIRA (v6.2#6252)