[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-1871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirk Kosinski updated CLOUDSTACK-1871:
--------------------------------------

    Description: 
If a root admin wants to upload a volume to a particular account and domain and 
includes the account and domainId parameters to uploadVolume, only the account 
is applied to the resulting volume, and the domain will be ROOT. The volume 
will not be usable by or visible to the desired account since it is in the 
wrong domain, and most likely won't be usable by any account at all (unless 
there happens to be an account with the same name in the ROOT domain).

To reproduce:

1) Use root admin credentials to call uploadVolume with account and domainId 
parameters with valid values.
2) Check whether or not the domain on the resulting volume is what you 
specified in 1).

Example from api-server.log:

2013-04-01 14:33:29,872 INFO  [cloud.api.ApiServer] (catalina-exec-10:null) 
(userId=2 accountId=2 sessionId=null) 172.20.0.59 -- GET 
account=devuser&apiKey=<snip>&command=uploadVolume&domainid=84828cc6-89b0-4d71-8451-a0919525df22&format=QCOW2&name=blankdisk1&response=json&url=http%3A%2F%2Fserver%2Fblankdisk.qcow2.bz2&zoneid=08a17e4e-df55-45e8-a318-0fc62ffae559&signature=<snip>
 200 { "uploadvolumeresponse" : 
{"jobid":"0281081e-aed7-4b39-8d32-47824b88ae66"} }

Matching entry in management-server.log:

2013-04-01 14:33:29,866 DEBUG [cloud.async.AsyncJobManagerImpl] 
(catalina-exec-10:null) submit async job-35, details: AsyncJobVO {id:35, 
userId: 2, accountId: 2, sessionKey: null, instanceType: None, instanceId: 
null, cmd: com.cloud.api.commands.UploadVolumeCmd, cmdOriginator: null, 
cmdInfo: 
{"response":"json","ctxUserId":"2","zoneid":"08a17e4e-df55-45e8-a318-0fc62ffae559","name":"blankdisk1","account":"devuser","domainid":"84828cc6-89b0-4d71-8451-a0919525df22","ctxAccountId":"2","format":"QCOW2","ctxStartEventId":"210","apiKey":"<snip>","signature":"<snip>","url":"http://server/blankdisk.qcow2.bz2"},
 cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
processStatus: 0, resultCode: 0, result: null, initMsid: 4993812620, 
completeMsid: null, lastUpdated: null, lastPolled: null, created: null}

Resulting volume in the database (note domain_id = 1, the ROOT domain).

mysql> select * from volumes where id = 10\G
*************************** 1. row ***************************
                        id: 10
                account_id: 3
                 domain_id: 1
                   pool_id: NULL
              last_pool_id: NULL
               instance_id: NULL
                 device_id: NULL
                      name: blankdisk1
                      uuid: b63e00b9-cf09-4b0a-b8a8-8056ae89abf6
                      size: 0
                    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
first_snapshot_backup_uuid: NULL
               recreatable: 0
                   created: 2013-04-01 21:33:29
                  attached: NULL
                   updated: 2013-04-01 21:33:29
                   removed: NULL
                     state: UploadOp
                chain_info: NULL
              update_count: 1
1 row in set (0.00 sec)

mysql> select id,uuid,name,path from domain;
+----+--------------------------------------+------+-------+
| id | uuid                                 | name | path  |
+----+--------------------------------------+------+-------+
|  1 | 4cf6bf74-6dc9-453e-95b6-7f3483192aa9 | ROOT | /     |
|  2 | 84828cc6-89b0-4d71-8451-a0919525df22 | dev  | /dev/ |
+----+--------------------------------------+------+-------+
2 rows in set (0.00 sec)



  was:
If a root admin wants to upload a volume to a particular account and domain and 
includes the account and domainId parameters to uploadVolume, only the account 
is applied to the resulting volume, and the domain will be ROOT. The volume 
will not be usable by or visible to the desired account since it is in the 
wrong domain, and most likely won't be usable by any account at all (unless 
there happens to be an account with the same name in the ROOT domain).

To reproduce:

1) Use root admin credentials to call uploadVolume with account and domainId 
parameters with valid values.
2) Check whether or not the domain on the resulting volume is what you 
specified in 1).

Example from api-server.log:

2013-04-01 14:33:29,872 INFO  [cloud.api.ApiServer] (catalina-exec-10:null) 
(userId=2 accountId=2 sessionId=null) 172.20.0.59 -- GET 
account=devuser&apiKey=<snip>&command=uploadVolume&domainid=84828cc6-89b0-4d71-8451-a0919525df22&format=QCOW2&name=blankdisk1&response=json&url=http%3A%2F%2Fserver%2Fblankdisk.qcow2.bz2&zoneid=08a17e4e-df55-45e8-a318-0fc62ffae559&signature=<snip>
 200 { "uploadvolumeresponse" : 
{"jobid":"0281081e-aed7-4b39-8d32-47824b88ae66"} }

Matching entry in management-server.log:

2013-04-01 14:33:29,866 DEBUG [cloud.async.AsyncJobManagerImpl] 
(catalina-exec-10:null) submit async job-35, details: AsyncJobVO {id:35, 
userId: 2, accountId: 2, sessionKey: null, instanceType: None, instanceId: 
null, cmd: com.cloud.api.commands.UploadVolumeCmd, cmdOriginator: null, 
cmdInfo: 
{"response":"json","ctxUserId":"2","zoneid":"08a17e4e-df55-45e8-a318-0fc62ffae559","name":"blankdisk1","account":"devuser","domainid":"84828cc6-89b0-4d71-8451-a0919525df22","ctxAccountId":"2","format":"QCOW2","ctxStartEventId":"210","apiKey":"<snip>","signature":"<snip>","url":"http://server/blankdisk.qcow2.bz2"},
 cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
processStatus: 0, resultCode: 0, result: null, initMsid: 4993812620, 
completeMsid: null, lastUpdated: null, lastPolled: null, created: null}

Resulting volume in the database (note domain_id = 1, the ROOT domain).

mysql> select * from volumes where id = 10\G
*************************** 1. row ***************************
                        id: 10
                account_id: 3
                 domain_id: 1
                   pool_id: NULL
              last_pool_id: NULL
               instance_id: NULL
                 device_id: NULL
                      name: blankdisk1
                      uuid: b63e00b9-cf09-4b0a-b8a8-8056ae89abf6
                      size: 0
                    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
first_snapshot_backup_uuid: NULL
               recreatable: 0
                   created: 2013-04-01 21:33:29
                  attached: NULL
                   updated: 2013-04-01 21:33:29
                   removed: NULL
                     state: UploadOp
                chain_info: NULL
              update_count: 1
1 row in set (0.00 sec)



    
> domainId parameter to uploadVolume not working
> ----------------------------------------------
>
>                 Key: CLOUDSTACK-1871
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-1871
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: API, Management Server
>    Affects Versions: 4.0.1
>            Reporter: Kirk Kosinski
>
> If a root admin wants to upload a volume to a particular account and domain 
> and includes the account and domainId parameters to uploadVolume, only the 
> account is applied to the resulting volume, and the domain will be ROOT. The 
> volume will not be usable by or visible to the desired account since it is in 
> the wrong domain, and most likely won't be usable by any account at all 
> (unless there happens to be an account with the same name in the ROOT domain).
> To reproduce:
> 1) Use root admin credentials to call uploadVolume with account and domainId 
> parameters with valid values.
> 2) Check whether or not the domain on the resulting volume is what you 
> specified in 1).
> Example from api-server.log:
> 2013-04-01 14:33:29,872 INFO  [cloud.api.ApiServer] (catalina-exec-10:null) 
> (userId=2 accountId=2 sessionId=null) 172.20.0.59 -- GET 
> account=devuser&apiKey=<snip>&command=uploadVolume&domainid=84828cc6-89b0-4d71-8451-a0919525df22&format=QCOW2&name=blankdisk1&response=json&url=http%3A%2F%2Fserver%2Fblankdisk.qcow2.bz2&zoneid=08a17e4e-df55-45e8-a318-0fc62ffae559&signature=<snip>
>  200 { "uploadvolumeresponse" : 
> {"jobid":"0281081e-aed7-4b39-8d32-47824b88ae66"} }
> Matching entry in management-server.log:
> 2013-04-01 14:33:29,866 DEBUG [cloud.async.AsyncJobManagerImpl] 
> (catalina-exec-10:null) submit async job-35, details: AsyncJobVO {id:35, 
> userId: 2, accountId: 2, sessionKey: null, instanceType: None, instanceId: 
> null, cmd: com.cloud.api.commands.UploadVolumeCmd, cmdOriginator: null, 
> cmdInfo: 
> {"response":"json","ctxUserId":"2","zoneid":"08a17e4e-df55-45e8-a318-0fc62ffae559","name":"blankdisk1","account":"devuser","domainid":"84828cc6-89b0-4d71-8451-a0919525df22","ctxAccountId":"2","format":"QCOW2","ctxStartEventId":"210","apiKey":"<snip>","signature":"<snip>","url":"http://server/blankdisk.qcow2.bz2"},
>  cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
> processStatus: 0, resultCode: 0, result: null, initMsid: 4993812620, 
> completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
> Resulting volume in the database (note domain_id = 1, the ROOT domain).
> mysql> select * from volumes where id = 10\G
> *************************** 1. row ***************************
>                         id: 10
>                 account_id: 3
>                  domain_id: 1
>                    pool_id: NULL
>               last_pool_id: NULL
>                instance_id: NULL
>                  device_id: NULL
>                       name: blankdisk1
>                       uuid: b63e00b9-cf09-4b0a-b8a8-8056ae89abf6
>                       size: 0
>                     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
> first_snapshot_backup_uuid: NULL
>                recreatable: 0
>                    created: 2013-04-01 21:33:29
>                   attached: NULL
>                    updated: 2013-04-01 21:33:29
>                    removed: NULL
>                      state: UploadOp
>                 chain_info: NULL
>               update_count: 1
> 1 row in set (0.00 sec)
> mysql> select id,uuid,name,path from domain;
> +----+--------------------------------------+------+-------+
> | id | uuid                                 | name | path  |
> +----+--------------------------------------+------+-------+
> |  1 | 4cf6bf74-6dc9-453e-95b6-7f3483192aa9 | ROOT | /     |
> |  2 | 84828cc6-89b0-4d71-8451-a0919525df22 | dev  | /dev/ |
> +----+--------------------------------------+------+-------+
> 2 rows in set (0.00 sec)

--
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