Sanjeev N created CLOUDSTACK-4492:
-------------------------------------

             Summary: [object_store_ref] Attaching volume to a vm is failing 
after upgrade if the volume was uploaded before upgrade 
                 Key: CLOUDSTACK-4492
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-4492
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
          Components: Storage Controller, Volumes
    Affects Versions: 4.2.1
         Environment: Build is from commit 
:a6bf80216466ada185de7e04d3e64be4e25c11a7
Upgrade from 3.0.6 to 4.2 
            Reporter: Sanjeev N
            Priority: Critical
             Fix For: 4.2.1


Failing to attach a volume to a vm after upgrade if it was uploaded before 
upgrade.

Steps to Reproduce:
================
1.Bring up CS with VMWare cluster using 3.0.6 GA build
2.upload volume using API:
http://10.147.59.126:8096/client/api?command=uploadVolume&format=OVA&name=cent53-upload-BU&url=http://10.147.28.7/templates/vmware/CentOS5.3-x86_64.ova&zoneid=9076c21d-d0c4-4cee-9820-2a551b65616e&account=admin&domainid=1
3.Upgrade to 4.2
4.Deploy one vm with root disk
5.Try to attach the volume uploaded at step2 to vm created above

Result:
=====
Attaching volume failed with InvalidParameterValueException

Observations:
===========
Uploaded volume has state set to "UploadOp" in volumes table. However 
AttachVolumeCmd is checking for volume state to be either in Allocated, Ready 
or in Uploaded state. So attaching is failing.

Following is the log snippet:

2013-08-26 01:36:30,254 DEBUG [cloud.api.ApiServlet] (catalina-exec-4:null) 
===START===  10.146.0.131 -- GET  
command=attachVolume&id=55cd0b1d-cf01-4fff-b6a1-d2d3f6d90d7e&virtualMachineId=ce3c8eb5-05f9-445b-ab74-68751e8a982a&response=json&sessionkey=u8uFWRNIgqqVZ%2B%2FBLCQbaSfZMCw%3D&_=1377495389690
2013-08-26 01:36:30,405 DEBUG [cloud.async.AsyncJobManagerImpl] 
(catalina-exec-4:null) submit async job-189 = [ 
0a33a5ee-9c58-4791-a0e5-cf6a070d9fc1 ], details: AsyncJobVO {id:189, userId: 2, 
accountId: 2, sessionKey: null, instanceType: Volume, instanceId: 20, cmd: 
org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd, cmdOriginator: 
null, cmdInfo: 
{"response":"json","id":"55cd0b1d-cf01-4fff-b6a1-d2d3f6d90d7e","sessionkey":"u8uFWRNIgqqVZ+/BLCQbaSfZMCw\u003d","cmdEventType":"VOLUME.ATTACH","ctxUserId":"2","virtualMachineId":"ce3c8eb5-05f9-445b-ab74-68751e8a982a","httpmethod":"GET","_":"1377495389690","ctxAccountId":"2","ctxStartEventId":"2015"},
 cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
processStatus: 0, resultCode: 0, result: null, initMsid: 6615759585382, 
completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
2013-08-26 01:36:30,408 DEBUG [cloud.api.ApiServlet] (catalina-exec-4:null) 
===END===  10.146.0.131 -- GET  
command=attachVolume&id=55cd0b1d-cf01-4fff-b6a1-d2d3f6d90d7e&virtualMachineId=ce3c8eb5-05f9-445b-ab74-68751e8a982a&response=json&sessionkey=u8uFWRNIgqqVZ%2B%2FBLCQbaSfZMCw%3D&_=1377495389690
2013-08-26 01:36:30,410 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-157:job-189 = [ 0a33a5ee-9c58-4791-a0e5-cf6a070d9fc1 ]) Executing 
org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd for job-189 = [ 
0a33a5ee-9c58-4791-a0e5-cf6a070d9fc1 ]
2013-08-26 01:36:30,468 ERROR [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-157:job-189 = [ 0a33a5ee-9c58-4791-a0e5-cf6a070d9fc1 ]) 
Unexpected exception while executing 
org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd
com.cloud.exception.InvalidParameterValueException: Volume state must be in 
Allocated, Ready or in Uploaded state
        at 
com.cloud.storage.VolumeManagerImpl.attachVolumeToVM(VolumeManagerImpl.java:1807)
        at 
com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
        at 
org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd.execute(AttachVolumeCmd.java:122)
        at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:158)
        at 
com.cloud.async.AsyncJobManagerImpl$1.run(AsyncJobManagerImpl.java:531)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)
2013-08-26 01:36:30,477 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-157:job-189 = [ 0a33a5ee-9c58-4791-a0e5-cf6a070d9fc1 ]) Complete 
async job-189 = [ 0a33a5ee-9c58-4791-a0e5-cf6a070d9fc1 ], jobStatus: 2, 
resultCode: 530, result: Error Code: 530 Error text: Volume state must be in 
Allocated, Ready or in Uploaded state

Volume uploaded before upgrade:
mysql> select * from volumes where id=20\G;
*************************** 1. row ***************************
                        id: 20
                account_id: 2
                 domain_id: 1
                   pool_id: NULL
              last_pool_id: NULL
               instance_id: NULL
                 device_id: NULL
                      name: cent53-upload-BU
                      uuid: 55cd0b1d-cf01-4fff-b6a1-d2d3f6d90d7e
                      size: 2147483648
                    folder: NULL
                      path: NULL
                    pod_id: NULL
            data_center_id: 1
                iscsi_name: NULL
                   host_ip: NULL
               volume_type: DATADISK
                 pool_type: NULL
          disk_offering_id: 6
               template_id: NULL
                    iso_id: NULL
first_snapshot_backup_uuid: NULL
               recreatable: 0
                   created: 2013-08-23 10:21:32
                  attached: NULL
                   updated: 2013-08-23 10:21:32
                   removed: NULL
                     state: UploadOp
                chain_info: NULL
              update_count: 1
                 disk_type: NULL
    vm_snapshot_chain_size: NULL
            display_volume: 1
                    format: NULL
                  min_iops: NULL
                  max_iops: NULL
1 row in set (0.00 sec)
mysql> select * from volume_store_ref\G;
*************************** 1. row ***************************
                  id: 1
            store_id: 2
           volume_id: 20
             zone_id: 1
             created: 2013-08-23 10:21:32
        last_updated: 2013-08-23 11:33:27
              job_id: c37f188f-b064-4e9e-9067-5c90467a8bf4
        download_pct: 100
                size: 2147483648
       physical_size: 459320832
      download_state: DOWNLOADED
            checksum: NULL
           error_str: Install completed successfully at 8/23/13 10:27 AM
          local_path: 
/mnt/SecStorage/bc9187bb-901f-3370-97cf-1821ac45b564/volumes/20/dnld3787038292255267623tmp_
        install_path: volumes/20/dbcd8a50-0621-32b1-9bd3-25da28da6791.ova
                 url: http://10.147.28.7/templates/vmware/CentOS5.3-x86_64.ova
        download_url: NULL
download_url_created: NULL
               state: Ready
           destroyed: 0
        update_count: 0
             ref_cnt: 0
             updated: NULL
1 row in set (0.00 sec)

ERROR:
No query specified

Attaching management server log file and cloud DB.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to