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

Alena Prokharchyk resolved CLOUDSTACK-3810.
-------------------------------------------

    Resolution: Invalid

The bug is invalid. The deployVm call was executed with account/domainId 
parameters AND projectId. In this case account/domainId take precedence, and 
the vm is created for the account, not for the project.

In project, all the accounts are owned by the project, not by accounts that 
participate in it. So when deployVm is called, only projectId has to be passed 
in to the call. I've just tested it from the UI/API, the vm gets assigned to 
the project correctly. Here are the examples of the calls:

http://localhost:8096/?command=deployVirtualMachine&zoneId=8bde3dd6-0f87-433d-a441-6f703c080e2b&templateId=7f52417a-f54d-11e2-aad9-664f5bd82b4f&hypervisor=XenServer&serviceOfferingId=d0445460-e11d-4598-ad97-a5d2466b7812&networkIds=eb543209-fffa-4a02-8e59-0bb56391c05c&projectId=1


http://localhost:8080/client/api?command=deployVirtualMachine&zoneId=8bde3dd6-0f87-433d-a441-6f703c080e2b&templateId=7f52417a-f54d-11e2-aad9-664f5bd82b4f&hypervisor=XenServer&serviceOfferingId=d0445460-e11d-4598-ad97-a5d2466b7812&networkIds=eb543209-fffa-4a02-8e59-0bb56391c05c&response=json&sessionkey=zB2cQrd1yxkDRSDZ3Fev35e60Ec%3D&projectid=39c394d3-66ec-4001-bc2e-69e92b79f769&_=1374772987979
                
> deployVirtualMachine ignoring projectid
> ---------------------------------------
>
>                 Key: CLOUDSTACK-3810
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-3810
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: API
>    Affects Versions: 4.1.0
>            Reporter: David Matteson
>            Assignee: Alena Prokharchyk
>
> API call to deployVirtualMachine with a specified projectid will deploy the 
> VM but the VM will not be assigned to the specified project.
> Additionally:
> - The response to the API call does not include a projectid or project (name) 
> as it says it should, not even empty fields. (See below.)
> - The projectid does show up in the logs in the job details, but it is not 
> included in the response to the API client.
> - Going into the web GUI and going into "Project View" for the specified 
> project, the VM does not show up.
> - The web GUI has no place in the VM detail view to list the project or 
> projectid.
> - Specifying an invalid value for the projectid does produce an error, but 
> specifying a valid projectid does not seem to result in the VM actually being 
> put into the project.
> - Calling listVirtualMachines after the deploy with the specified projectid 
> returns an empty set. (So the VM was definitely not added to the project.)
> Example:
> API called with projectid = 70188170-daff-493e-862c-c6d9537364c8
> Result returned from API:
> stdClass::__set_state(array(
>    'accountid' => 'e03df0f8-d9df-11e2-afc6-003048b8f5dc',
>    'userid' => 'b979dcce-9eb2-4b4d-8f45-f0005c4f69ec',
>    'cmd' => 'org.apache.cloudstack.api.command.user.vm.DeployVMCmd',
>    'jobstatus' => 1,
>    'jobprocstatus' => 0,
>    'jobresultcode' => 0,
>    'jobresulttype' => 'object',
>    'jobresult' => 
>   stdClass::__set_state(array(
>      'virtualmachine' => 
>     stdClass::__set_state(array(
>        'id' => '28ca859a-0ef6-48e6-8afb-6cdd683fd460',
>        'name' => 'happycloud',
>        'displayname' => 'happycloud',
>        'account' => 'user7899',
>        'domainid' => '980da72c-2bb6-414c-a4f3-3ce5e4a7308f',
>        'domain' => 'domain7899',
>        'created' => '2013-07-24T16:04:12-0400',
>        'state' => 'Running',
>        'haenable' => false,
>        'groupid' => '0dac8ea7-0aac-4f58-8df5-56988cf2331e',
>        'group' => 'group44800',
>        'zoneid' => 'b92e18f8-3708-487b-a786-7ed06d944c54',
>        'zonename' => 'Southfield',
>        'hostid' => 'e84f3201-f18c-423f-8caf-3e9cb991339f',
>        'hostname' => XXXX',
>        'templateid' => '5a8201e8-3cb2-4284-b30b-be1f9ccc542f',
>        'templatename' => 'CentOS 6',
>        'templatedisplaytext' => 'CentOS 6',
>        'passwordenabled' => true,
>        'serviceofferingid' => '34efe670-2039-4a65-b7c0-799d914f42e0',
>        'serviceofferingname' => '4 Cores 1500 MHz 6144 MB RAM 1000 Mbps Xfer 
> false HA  Storage',
>        'cpunumber' => 4,
>        'cpuspeed' => 1500,
>        'memory' => 6144,
>        'guestosid' => 'a9607906-d990-11e2-a249-003048b8f5dc',
>        'rootdeviceid' => 0,
>        'rootdevicetype' => 'ROOT',
>        'securitygroup' => 
>       array (
>       ),
>        'password' => XXXX',
>        'nic' => 
>       array (
>         0 => 
>         stdClass::__set_state(array(
>            'id' => 'a811e4c2-7a39-4ca6-95ba-1d734b15ba01',
>            'networkid' => '35442bdc-7c88-452c-b547-6961bb44d7f3',
>            'networkname' => 'Cloud Public',
>            'netmask' => '255.255.255.0',
>            'gateway' => '162.212.134.1',
>            'ipaddress' => '162.212.134.185',
>            'isolationuri' => 'vlan://610',
>            'broadcasturi' => 'vlan://610',
>            'traffictype' => 'Guest',
>            'type' => 'Shared',
>            'isdefault' => true,
>            'macaddress' => '06:b2:96:00:05:d9',
>         )),
>       ),
>        'hypervisor' => 'KVM',
>        'instancename' => 'i-4-44-VM',
>        'tags' => 
>       array (
>       ),
>        'jobid' => '9bf0155b-8b66-4793-8818-bf7f224fea04',
>        'jobstatus' => 0,
>     )),
>   )),
>    'created' => '2013-07-24T16:04:13-0400',
>    'jobid' => '9bf0155b-8b66-4793-8818-bf7f224fea04',
> )) 
> Log snippet (VM ids will differ from above example response as the one above 
> is from last night and I just did this one for the purpose of this bug):
> 2013-07-25 10:25:50,716 DEBUG [cloud.api.ApiServlet] (catalina-exec-6:null) 
> ===START===  216.119.143.50 -- POST  
> account=user7899&apikey=XXX&command=deployVirtualMachine&diskofferingid=f126763d-f2b5-4676-b914-aea32169c3f0&displayname=happycloud&domainid=980da72c-2bb6-414c-a4f3-3ce5e4a7308f&group=group44800&hypervisor=KVM&name=happycloud&networkids=35442bdc-7c88-452c-b547-6961bb44d7f3&projectid=70188170-daff-493e-862c-c6d9537364c8&response=json&serviceofferingid=34efe670-2039-4a65-b7c0-799d914f42e0&size=25&templateid=5a8201e8-3cb2-4284-b30b-be1f9ccc542f&zoneid=b92e18f8-3708-487b-a786-7ed06d944c54&signature=XXXX
> 2013-07-25 10:25:50,720 DEBUG [cloud.api.ApiDispatcher] 
> (catalina-exec-6:null) InfrastructureEntity name 
> is:com.cloud.offering.ServiceOffering
> 2013-07-25 10:25:50,721 DEBUG [cloud.api.ApiDispatcher] 
> (catalina-exec-6:null) ControlledEntity name 
> is:com.cloud.template.VirtualMachineTemplate
> 2013-07-25 10:25:50,723 DEBUG [cloud.api.ApiDispatcher] 
> (catalina-exec-6:null) ControlledEntity name is:com.cloud.network.Network
> 2013-07-25 10:25:50,725 DEBUG [cloud.api.ApiDispatcher] 
> (catalina-exec-6:null) InfrastructureEntity name 
> is:com.cloud.offering.DiskOffering
> 2013-07-25 10:25:50,744 DEBUG [cloud.network.NetworkModelImpl] 
> (catalina-exec-6:null) Service SecurityGroup is not supported in the network 
> id=220
> 2013-07-25 10:25:50,855 DEBUG [cloud.vm.UserVmManagerImpl] 
> (catalina-exec-6:null) Allocating in the DB for vm
> 2013-07-25 10:25:50,863 DEBUG [cloud.vm.VirtualMachineManagerImpl] 
> (catalina-exec-6:null) Allocating entries for VM: VM[User|happycloud]
> 2013-07-25 10:25:50,864 DEBUG [cloud.vm.VirtualMachineManagerImpl] 
> (catalina-exec-6:null) Allocating nics for VM[User|happycloud]
> 2013-07-25 10:25:50,864 DEBUG [cloud.network.NetworkManagerImpl] 
> (catalina-exec-6:null) Allocating nic for vm VM[User|happycloud] in network 
> Ntwk[220|Guest|7] with requested profile NicProfile[0-0-null-null-null
> 2013-07-25 10:25:50,872 DEBUG [cloud.network.NetworkModelImpl] 
> (catalina-exec-6:null) Service SecurityGroup is not supported in the network 
> id=220
> 2013-07-25 10:25:50,873 DEBUG [cloud.vm.VirtualMachineManagerImpl] 
> (catalina-exec-6:null) Allocaing disks for VM[User|happycloud]
> 2013-07-25 10:25:50,883 DEBUG [cloud.vm.VirtualMachineManagerImpl] 
> (catalina-exec-6:null) Allocation completed for VM: VM[User|happycloud]
> 2013-07-25 10:25:50,883 DEBUG [cloud.vm.UserVmManagerImpl] 
> (catalina-exec-6:null) Successfully allocated DB entry for VM[User|happycloud]
> 2013-07-25 10:25:51,059 DEBUG [cloud.network.NetworkModelImpl] 
> (catalina-exec-6:null) Service SecurityGroup is not supported in the network 
> id=220
> 2013-07-25 10:25:51,061 DEBUG [cloud.network.NetworkModelImpl] 
> (catalina-exec-6:null) Service SecurityGroup is not supported in the network 
> id=220
> 2013-07-25 10:25:51,312 DEBUG [cloud.async.AsyncJobManagerImpl] 
> (catalina-exec-6:null) submit async job-229, details: AsyncJobVO {id:229, 
> userId: 4, accountId: 2, sessionKey: null, instanceType: VirtualMachine, 
> instanceId: 45, cmd: org.apache.cloudstack.api.command.user.vm.DeployVMCmd, 
> cmdOriginator: null, cmdInfo: 
> {"serviceofferingid":"34efe670-2039-4a65-b7c0-799d914f42e0","ctxUserId":"4","zoneid":"b92e18f8-3708-487b-a786-7ed06d944c54","templateid":"5a8201e8-3cb2-4284-b30b-be1f9ccc542f","networkids":"35442bdc-7c88-452c-b547-6961bb44d7f3","domainid":"980da72c-2bb6-414c-a4f3-3ce5e4a7308f","apikey":"XXXX","size":"25","id":"45","response":"json","hypervisor":"KVM","name":"happycloud","account":"user7899","projectid":"70188170-daff-493e-862c-c6d9537364c8","ctxAccountId":"2","diskofferingid":"f126763d-f2b5-4676-b914-aea32169c3f0","group":"group44800","ctxStartEventId":"968","signature":"XXXX","displayname":"happycloud"},
>  cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
> processStatus: 0, resultCode: 0, result: null, initMsid: 207378511324, 
> completeMsid: null, lastUpdated: null, lastPolled: null, created: null}

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