[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-8922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16318015#comment-16318015
 ] 

ASF GitHub Bot commented on CLOUDSTACK-8922:
--------------------------------------------

yvsubhash closed pull request #905: BUG-ID: CLOUDSTACK-8922:  Unable to delete 
IP tag
URL: https://github.com/apache/cloudstack/pull/905
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.travis.yml b/.travis.yml
index b4749c05e31..b7b358c2e18 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -91,6 +91,7 @@ env:
              smoke/test_staticroles
              smoke/test_templates
              smoke/test_usage
+             smoke/test_tags
              smoke/test_usage_events
              smoke/test_vm_life_cycle
              smoke/test_vm_snapshots
@@ -144,8 +145,6 @@ env:
              component/test_stopped_vm"
 
     - TESTS="component/test_resource_limits"
-
-    - TESTS="component/test_tags
              component/test_templates
              component/test_update_vm
              component/test_volumes"
diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java 
b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
index 7528d6861dc..752adb517cd 100644
--- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
+++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java
@@ -299,21 +299,9 @@ public String getUuid(String resourceId, 
ResourceObjectType resourceType) {
     @DB
     @ActionEvent(eventType = EventTypes.EVENT_TAGS_DELETE, eventDescription = 
"deleting resource tags")
     public boolean deleteTags(List<String> resourceIds, ResourceObjectType 
resourceType, Map<String, String> tags) {
-        Account caller = CallContext.current().getCallingAccount();
-
-        SearchBuilder<ResourceTagVO> sb = 
_resourceTagDao.createSearchBuilder();
-        sb.and().op("resourceId", sb.entity().getResourceId(), 
SearchCriteria.Op.IN);
-        sb.or("resourceUuid", sb.entity().getResourceUuid(), 
SearchCriteria.Op.IN);
-        sb.cp();
-        sb.and("resourceType", sb.entity().getResourceType(), 
SearchCriteria.Op.EQ);
-
-        SearchCriteria<ResourceTagVO> sc = sb.create();
-        sc.setParameters("resourceId", resourceIds.toArray());
-        sc.setParameters("resourceUuid", resourceIds.toArray());
-        sc.setParameters("resourceType", resourceType);
 
-        List<? extends ResourceTag> resourceTags = _resourceTagDao.search(sc, 
null);
-        ;
+        Account caller = CallContext.current().getCallingAccount();
+        List<? extends ResourceTag> resourceTags = 
getResourceTags(resourceIds, resourceType);
         final List<ResourceTag> tagsToRemove = new ArrayList<ResourceTag>();
 
         // Finalize which tags should be removed
@@ -363,6 +351,48 @@ public void doInTransactionWithoutResult(TransactionStatus 
status) {
         return true;
     }
 
+    private List<? extends ResourceTag>  getResourceTags(final List<String> 
resourceIds, ResourceObjectType resourceType) {
+
+        List<String> uuids = new ArrayList<String>();
+        List<String> internalIds = new ArrayList<String>();
+        for(String resourceId : resourceIds){
+            
if(resourceId.matches("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$")){
+                uuids.add(resourceId);
+            }else{
+                try {
+                    Long.parseLong(resourceId);
+                } catch (final NumberFormatException e) {
+                    throw new InvalidParameterValueException("Invalid 
resourceId");
+                }
+                internalIds.add(resourceId);
+            }
+        }
+
+        SearchBuilder<ResourceTagVO> sb = 
_resourceTagDao.createSearchBuilder();
+
+        if(!uuids.isEmpty() && !internalIds.isEmpty()){
+            throw new InvalidParameterValueException("Expecting only uuids or 
Ids");
+        }else if (!uuids.isEmpty()){
+            sb.and("resourceUuid", sb.entity().getResourceUuid(), 
SearchCriteria.Op.IN);
+        }else if (!internalIds.isEmpty()){
+            sb.and("resourceId", sb.entity().getResourceId(), 
SearchCriteria.Op.IN);
+        }
+
+        sb.and("resourceType", sb.entity().getResourceType(), 
SearchCriteria.Op.EQ);
+
+        SearchCriteria<ResourceTagVO> sc = sb.create();
+
+        if (!uuids.isEmpty()){
+            sc.setParameters("resourceUuid", resourceIds.toArray());
+        }else if (!internalIds.isEmpty()){
+            sc.setParameters("resourceId", resourceIds.toArray());
+        }
+
+        sc.setParameters("resourceType", resourceType);
+        return _resourceTagDao.search(sc, null);
+
+    }
+
     @Override
     public List<? extends ResourceTag> 
listByResourceTypeAndId(ResourceObjectType type, long resourceId) {
         return _resourceTagDao.listBy(resourceId, type);
diff --git a/test/integration/component/test_tags.py 
b/test/integration/smoke/test_tags.py
similarity index 89%
rename from test/integration/component/test_tags.py
rename to test/integration/smoke/test_tags.py
index f9b0655016d..8bfebb87984 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/smoke/test_tags.py
@@ -2543,3 +2543,258 @@ def test_24_public_IP_tag(self):
             "List tags should return empty response"
         )
         return
+    @attr(tags=["advanced"], required_hardware="false")
+    def test_25_IP_Address_tag(self):
+        """ Testcreation, adding and removing tag on public IP address
+        """
+        # Validate the following
+        # 1. Create a domain and 2 user accounts under that domain
+        # 2. Create network in both accounts and acquire public IP address
+        # 3. Create a tag on acquired public IP address using createTags API
+        # 4. Delete above created both tag using deleteTags API
+
+        self.debug("Creating a sub-domain under: %s" % self.domain.name)
+        self.child_domain = Domain.create(
+            self.apiclient,
+            services=self.services["domain"],
+            parentdomainid=self.domain.id
+        )
+        self.admin_acc_1 = Account.create(
+            self.apiclient,
+            self.services["account"],
+            admin=False,
+            domainid=self.child_domain.id
+        )
+        # Cleanup the resources created at end of test
+        self.cleanup.append(self.admin_acc_1)
+        self.dom_admin_api_client1 = self.testClient.getUserApiClient(
+            UserName=self.admin_acc_1.name,
+            DomainName=self.admin_acc_1.domain
+        )
+        result = createEnabledNetworkOffering(
+            self.apiclient,
+            self.services["network_offering"]
+        )
+        assert result[0] == PASS, \
+            "Network offering create/enable failed with error %s" % result[2]
+        self.network_offering = result[1]
+        self.network = Network.create(
+            self.dom_admin_api_client1,
+            self.services["network"],
+            networkofferingid=self.network_offering.id,
+            accountid=self.admin_acc_1.name,
+            domainid=self.admin_acc_1.domainid,
+            zoneid=self.zone.id
+        )
+        self.debug("Fetching the network details for account: %s" %
+                   self.admin_acc_1.name
+                   )
+        networks = Network.list(
+            self.dom_admin_api_client1,
+            account=self.admin_acc_1.name,
+            domainid=self.admin_acc_1.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
+        network = networks[0]
+        self.debug("Network for the account: %s is %s" %
+                   (self.admin_acc_1.name, network.name)
+                   )
+        self.debug("Associating public IP for network: %s" % network.id)
+        public_ip1 = PublicIPAddress.create(
+            self.dom_admin_api_client1,
+            accountid=self.admin_acc_1.name,
+            zoneid=self.zone.id,
+            domainid=self.admin_acc_1.domainid,
+            networkid=network.id
+        )
+        self.debug("Creating a tag for Public IP")
+        tag1 = Tag.create(
+            self.dom_admin_api_client1,
+            resourceIds=public_ip1.ipaddress.id,
+            resourceType='PublicIpAddress',
+            tags={'region': 'India'}
+        )
+        self.debug("Tag created: %s" % tag1.__dict__)
+
+        tags = Tag.list(
+            self.dom_admin_api_client1,
+            listall=True,
+            resourceType='PublicIpAddress',
+            account=self.admin_acc_1.name,
+            domainid=self.admin_acc_1.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'India',
+            'The tag should have original value'
+        )
+        publicIps = PublicIPAddress.list(
+            self.dom_admin_api_client1,
+            account=self.admin_acc_1.name,
+            domainid=self.admin_acc_1.domainid,
+            listall=True,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            isinstance(publicIps, list),
+            True,
+            "List Public IPs should not return an empty response"
+        )
+
+        # Setting up second user account.
+        self.admin_acc_2 = Account.create(
+            self.apiclient,
+            self.services["account"],
+            admin=False,
+            domainid=self.child_domain.id
+        )
+        # Cleanup the resources created at end of test
+        self.cleanup.append(self.admin_acc_2)
+        self.cleanup.append(self.child_domain)
+        self.dom_admin_api_client2 = self.testClient.getUserApiClient(
+            UserName=self.admin_acc_2.name,
+            DomainName=self.admin_acc_2.domain
+        )
+        result = createEnabledNetworkOffering(
+            self.apiclient,
+            self.services["network_offering"]
+        )
+        assert result[0] == PASS, \
+            "Network offering create/enable failed with error %s" % result[2]
+        self.network_offering = result[1]
+        self.network = Network.create(
+            self.dom_admin_api_client2,
+            self.services["network"],
+            networkofferingid=self.network_offering.id,
+            accountid=self.admin_acc_2.name,
+            domainid=self.admin_acc_2.domainid,
+            zoneid=self.zone.id
+        )
+        self.debug("Fetching the network details for account: %s" %
+                   self.admin_acc_2.name
+                   )
+        networks = Network.list(
+            self.dom_admin_api_client2,
+            account=self.admin_acc_2.name,
+            domainid=self.admin_acc_2.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
+        network = networks[0]
+        self.debug("Network for the account: %s is %s" %
+                   (self.admin_acc_2.name, network.name)
+                   )
+        self.debug("Associating public IP for network: %s" % network.id)
+        public_ip2 = PublicIPAddress.create(
+            self.dom_admin_api_client2,
+            accountid=self.admin_acc_2.name,
+            zoneid=self.zone.id,
+            domainid=self.admin_acc_2.domainid,
+            networkid=network.id
+        )
+        self.debug("Creating a tag for Public IP")
+        tag2 = Tag.create(
+            self.dom_admin_api_client2,
+            resourceIds=public_ip2.ipaddress.id,
+            resourceType='PublicIpAddress',
+            tags={'region': 'Pune'}
+        )
+        self.debug("Tag created: %s" % tag2.__dict__)
+
+        tags = Tag.list(
+            self.dom_admin_api_client2,
+            listall=True,
+            resourceType='PublicIpAddress',
+            account=self.admin_acc_2.name,
+            domainid=self.admin_acc_2.domainid,
+            key='region',
+            value='Pune'
+        )
+        self.assertEqual(
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'Pune',
+            'The tag should have original value'
+        )
+        publicIps = PublicIPAddress.list(
+            self.dom_admin_api_client2,
+            account=self.admin_acc_2.name,
+            domainid=self.admin_acc_2.domainid,
+            listall=True,
+            key='region',
+            value='Pune'
+        )
+        self.assertEqual(
+            isinstance(publicIps, list),
+            True,
+            "List Public IPs should not return an empty response"
+        )
+
+        idset = self.dbclient.execute( "SELECT resource_uuid from 
resource_tags WHERE `key` = 'region' AND `value` = 'India'");
+        self.assertNotEqual(
+            len(idset),
+            0,
+            "Check DB Query result set"
+        )
+        iresult = idset[0]
+        rid = iresult[0]
+
+        self.dbclient.execute( "UPDATE resource_tags SET resource_id = CAST( 
'%s' AS SIGNED) WHERE `key` = 'region' AND `value` = 'Pune'" % rid);
+
+        try:
+            tag1.delete(
+                self.dom_admin_api_client1,
+                resourceIds=public_ip1.ipaddress.id,
+                resourceType='PublicIpAddress',
+                tags={'region': 'India'}
+            )
+        except Exception as e:
+            self.fail("Failed to delete the tag - %s" % e)
+
+        self.debug("Verifying if tag is actually deleted!")
+        tags = Tag.list(
+            self.dom_admin_api_client1,
+            listall=True,
+            resourceType='PublicIpAddress',
+            account=self.admin_acc_1.name,
+            domainid=self.admin_acc_1.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
+        try:
+            tag2.delete(
+                self.dom_admin_api_client2,
+                resourceIds=public_ip2.ipaddress.id,
+                resourceType='PublicIpAddress',
+                tags={'region': 'Pune'}
+            )
+        except Exception as e:
+            self.fail("Failed to delete the tag - %s" % e)
+        return
+


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Unable to delete IP tag
> -----------------------
>
>                 Key: CLOUDSTACK-8922
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8922
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Management Server
>    Affects Versions: 4.5.2
>            Reporter: subhash yedugundla
>
> 1. Acquire new IP address 
> 2. Create tags for the IP 
> 3. Delete the tag from Step#2 
>  an error occurs at Step#3 whereby the delete tag operation fails with 
> "Acct[f4d0c381-e0b7-4aed-aa90-3336d42f7540-71000000017] does not have 
> permission to operate within domain id\u003d632"
> TROUBLESHOOTING
> ==================
> Acquire new IP address
> *********************
> {noformat}
> 2014-11-19 15:08:15,870 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (catalina-exec-20:ctx-faed32b5 ctx-712308cb ctx-401bfcaf) submit async 
> job-72419, details: AsyncJobVO {id:72419, userId: 17, accountId: 15, 
> instanceType: IpAddress, instanceId: 672, cmd: 
> org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd, cmdInfo: 
> {"id":"672","response":"json","cmdEventType":"NET.IPASSIGN","ctxUserId":"17","zoneid":"a117e75f-d02e-4074-806d-889c61261394","httpmethod":"GET","ctxAccountId":"15","networkid":"0ca7c69e-c281-407b-a152-2559c10a81a6","ctxStartEventId":"166725","signature":"3NZRU6dIBxg1HMDiP/MkY2agRn4\u003d","apikey":"tuwHXs1AfpQheJeJ9BcLdoVxIBCItASnguAbus76AMUcIXuyFgHOJiIB44fO57p_bBaqyfppmxrC-rQSb-nxXg"},
>  cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: 
> null, initMsid: 345048681027, completeMsid: null, lastUpdated: null, 
> lastPolled: null, created: null}
> 2014-11-19 15:08:15,870 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-68:ctx-fca9add6 job-72419) Executing AsyncJobVO {id:72419, 
> userId: 17, accountId: 15, instanceType: IpAddress, instanceId: 672, cmd: 
> org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd, cmdInfo: 
> {"id":"672","response":"json","cmdEventType":"NET.IPASSIGN","ctxUserId":"17","zoneid":"a117e75f-d02e-4074-806d-889c61261394","httpmethod":"GET","ctxAccountId":"15","networkid":"0ca7c69e-c281-407b-a152-2559c10a81a6","ctxStartEventId":"166725","signature":"3NZRU6dIBxg1HMDiP/MkY2agRn4\u003d","apikey":"tuwHXs1AfpQheJeJ9BcLdoVxIBCItASnguAbus76AMUcIXuyFgHOJiIB44fO57p_bBaqyfppmxrC-rQSb-nxXg"},
>  cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: 
> null, initMsid: 345048681027, completeMsid: null, lastUpdated: null, 
> lastPolled: null, created: null}
> 2014-11-19 15:08:15,890 DEBUG [c.c.u.AccountManagerImpl] 
> (API-Job-Executor-68:ctx-fca9add6 job-72419 ctx-96bbdee5) Access to 
> Ntwk[216|Guest|8] granted to 
> Acct[f4d0c381-e0b7-4aed-aa90-3336d42f7540-71000000017] by DomainChecker
> 2014-11-19 15:08:15,911 DEBUG [c.c.n.IpAddressManagerImpl] 
> (API-Job-Executor-68:ctx-fca9add6 job-72419 ctx-96bbdee5) Successfully 
> associated ip address 210.140.170.160 to network Ntwk[216|Guest|8]
> 2014-11-19 15:08:15,922 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-68:ctx-fca9add6 job-72419 ctx-96bbdee5) Complete async 
> job-72419, jobStatus: SUCCEEDED, resultCode: 0, result: 
> org.apache.cloudstack.api.response.IPAddressResponse/ipaddress/{"id":"3d7c3a2a-1f2d-46dc-9905-4a7ce620e7e9","ipaddress":"210.140.170.160","allocated":"2014-11-19T15:08:15+0900","zoneid":"a117e75f-d02e-4074-806d-889c61261394","zonename":"tesla","issourcenat":false,"account":"71000000017","domainid":"cc27e32c-6acd-4fdf-a1e5-734cef8a7fe0","domain":"71000000017","forvirtualnetwork":true,"isstaticnat":false,"issystem":false,"associatednetworkid":"0ca7c69e-c281-407b-a152-2559c10a81a6","associatednetworkname":"network1","networkid":"79132c74-fe77-4bd5-9915-ce7c577fb95f","state":"Allocating","physicalnetworkid":"4a00ce42-6a30-4494-afdd-3531d883237b","tags":[],"isportable":false}
> 2014-11-19 15:08:15,932 INFO  [o.a.c.f.j.i.AsyncJobMonitor] 
> (API-Job-Executor-68:ctx-fca9add6 job-72419) Remove job-72419 from job 
> monitoring
> +-------+-------------------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> | id    | job_cmd                                                           | 
> job_status | job_init_msid | job_complete_msid | created             | 
> last_updated        |
> +-------+-------------------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> | 72419 | org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd | 
>          1 |  345048681027 |      345048681027 | 2014-11-19 06:08:15 | 
> 2014-11-19 06:08:15 |
> +-------+-------------------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> 1 row in set (0.00 sec)
> {noformat}
> Create Tag
> ***********
> {noformat}
> 2014-11-19 15:08:16,376 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (catalina-exec-1:ctx-dee6efde ctx-ae7d665b ctx-34f0c207) submit async 
> job-72421, details: AsyncJobVO {id:72421, userId: 17, accountId: 15, 
> instanceType: None, instanceId: null, cmd: 
> org.apache.cloudstack.api.command.user.tag.CreateTagsCmd, cmdInfo: 
> {"response":"json","cmdEventType":"CREATE_TAGS","ctxUserId":"17","tags[0].value":"hyamashita001-test13","tags[0].key":"cloud-description","httpmethod":"GET","resourcetype":"PublicIPAddress","ctxAccountId":"15","ctxStartEventId":"166734","signature":"Wdx759HnH7eeh1YbfZbqyiPHqOI\u003d","resourceids":"3d7c3a2a-1f2d-46dc-9905-4a7ce620e7e9","apikey":"tuwHXs1AfpQheJeJ9BcLdoVxIBCItASnguAbus76AMUcIXuyFgHOJiIB44fO57p_bBaqyfppmxrC-rQSb-nxXg"},
>  cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: 
> null, initMsid: 345048681027, completeMsid: null, lastUpdated: null, 
> lastPolled: null, created: null}
> 2014-11-19 15:08:16,376 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-66:ctx-60c43fb5 job-72421) Executing AsyncJobVO {id:72421, 
> userId: 17, accountId: 15, instanceType: None, instanceId: null, cmd: 
> org.apache.cloudstack.api.command.user.tag.CreateTagsCmd, cmdInfo: 
> {"response":"json","cmdEventType":"CREATE_TAGS","ctxUserId":"17","tags[0].value":"hyamashita001-test13","tags[0].key":"cloud-description","httpmethod":"GET","resourcetype":"PublicIPAddress","ctxAccountId":"15","ctxStartEventId":"166734","signature":"Wdx759HnH7eeh1YbfZbqyiPHqOI\u003d","resourceids":"3d7c3a2a-1f2d-46dc-9905-4a7ce620e7e9","apikey":"tuwHXs1AfpQheJeJ9BcLdoVxIBCItASnguAbus76AMUcIXuyFgHOJiIB44fO57p_bBaqyfppmxrC-rQSb-nxXg"},
>  cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: 
> null, initMsid: 345048681027, completeMsid: null, lastUpdated: null, 
> lastPolled: null, created: null}
> 2014-11-19 15:08:16,394 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-66:ctx-60c43fb5 job-72421 ctx-269323f2) Complete async 
> job-72421, jobStatus: SUCCEEDED, resultCode: 0, result: 
> org.apache.cloudstack.api.response.SuccessResponse/null/{"success":true}
> 2014-11-19 15:08:16,404 INFO  [o.a.c.f.j.i.AsyncJobMonitor] 
> (API-Job-Executor-66:ctx-60c43fb5 job-72421) Remove job-72421 from job 
> monitoring
> +-------+----------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> | id    | job_cmd                                                  | 
> job_status | job_init_msid | job_complete_msid | created             | 
> last_updated        |
> +-------+----------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> | 72421 | org.apache.cloudstack.api.command.user.tag.CreateTagsCmd |          
> 1 |  345048681027 |      345048681027 | 2014-11-19 06:08:16 | 2014-11-19 
> 06:08:16 |
> +-------+----------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> {noformat}
> As we can see both the Acquire IP address process and Create TAG process 
> completes successfully.
> Delete Tag
> ***********
> {noformat}
> 2014-11-19 15:15:06,496 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (catalina-exec-18:ctx-f9096d31 ctx-c18e0cef ctx-a73fb445) submit async 
> job-72484, details: AsyncJobVO {id:72484, userId: 17, accountId: 15, 
> instanceType: None, instanceId: null, cmd: 
> org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd, cmdInfo: 
> {"response":"json","cmdEventType":"DELETE_TAGS","ctxUserId":"17","tags[0].key":"cloud-description","httpmethod":"GET","resourcetype":"PublicIPAddress","ctxAccountId":"15","ctxStartEventId":"166921","signature":"7aUyelqNUGlgp+4PVdfCzJ0P7xY\u003d","resourceids":"3d7c3a2a-1f2d-46dc-9905-4a7ce620e7e9","apikey":"tuwHXs1AfpQheJeJ9BcLdoVxIBCItASnguAbus76AMUcIXuyFgHOJiIB44fO57p_bBaqyfppmxrC-rQSb-nxXg"},
>  cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: 
> null, initMsid: 345048681027, completeMsid: null, lastUpdated: null, 
> lastPolled: null, created: null}
> 2014-11-19 15:15:06,496 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-104:ctx-a96a8572 job-72484) Executing AsyncJobVO {id:72484, 
> userId: 17, accountId: 15, instanceType: None, instanceId: null, cmd: 
> org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd, cmdInfo: 
> {"response":"json","cmdEventType":"DELETE_TAGS","ctxUserId":"17","tags[0].key":"cloud-description","httpmethod":"GET","resourcetype":"PublicIPAddress","ctxAccountId":"15","ctxStartEventId":"166921","signature":"7aUyelqNUGlgp+4PVdfCzJ0P7xY\u003d","resourceids":"3d7c3a2a-1f2d-46dc-9905-4a7ce620e7e9","apikey":"tuwHXs1AfpQheJeJ9BcLdoVxIBCItASnguAbus76AMUcIXuyFgHOJiIB44fO57p_bBaqyfppmxrC-rQSb-nxXg"},
>  cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: 
> null, initMsid: 345048681027, completeMsid: null, lastUpdated: null, 
> lastPolled: null, created: null}
> 2014-11-19 15:15:06,502 DEBUG [c.c.u.AccountManagerImpl] 
> (API-Job-Executor-104:ctx-a96a8572 job-72484 ctx-d9207bf9) Access to 
> Acct[6b3b9128-2ef1-4866-8a60-33b284c749de-71000000726] granted to 
> Acct[f4d0c381-e0b7-4aed-aa90-3336d42f7540-71000000017] by DomainChecker
> 2014-11-19 15:15:06,506 DEBUG [c.c.u.AccountManagerImpl] 
> (catalina-exec-8:ctx-74989794 ctx-5decfcea ctx-111e7f31) Access to 
> Acct[f4d0c381-e0b7-4aed-aa90-3336d42f7540-71000000017] granted to 
> Acct[13ebed98-547c-4036-a4fd-f8c2e4e5dc5c-71000000017] by DomainChecker
> 2014-11-19 15:15:06,510 ERROR [c.c.a.ApiAsyncJobDispatcher] 
> (API-Job-Executor-104:ctx-a96a8572 job-72484) Unexpected exception while 
> executing org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd
> com.cloud.exception.PermissionDeniedException: 
> Acct[f4d0c381-e0b7-4aed-aa90-3336d42f7540-71000000017] does not have 
> permission to operate within domain id=632
>       at com.cloud.acl.DomainChecker.checkAccess(DomainChecker.java:77)
>       at 
> com.cloud.user.AccountManagerImpl.checkAccess(AccountManagerImpl.java:451)
>       at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>       at 
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>       at 
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>       at com.sun.proxy.$Proxy83.checkAccess(Unknown Source)
>       at 
> com.cloud.tags.TaggedResourceManagerImpl.deleteTags(TaggedResourceManagerImpl.java:375)
>       at sun.reflect.GeneratedMethodAccessor546.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>       at 
> com.cloud.event.ActionEventInterceptor.invoke(ActionEventInterceptor.java:50)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
>       at 
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>       at 
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>       at com.sun.proxy.$Proxy315.deleteTags(Unknown Source)
>       at 
> org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd.execute(DeleteTagsCmd.java:103)
>       at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:161)
>       at 
> com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:97)
>       at 
> org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:507)
>       at 
> org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:50)
>       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:47)
>       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:745)
> 2014-11-19 15:15:06,511 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] 
> (API-Job-Executor-104:ctx-a96a8572 job-72484) Complete async job-72484, 
> jobStatus: FAILED, resultCode: 530, result: 
> org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":530,"errortext":"Acct[f4d0c381-e0b7-4aed-aa90-3336d42f7540-71000000017]
>  does not have permission to operate within domain id\u003d632"}
> 2014-11-19 15:15:06,521 INFO  [o.a.c.f.j.i.AsyncJobMonitor] 
> (API-Job-Executor-104:ctx-a96a8572 job-72484) Remove job-72484 from job 
> monitoring
> +-------+----------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> | id    | job_cmd                                                  | 
> job_status | job_init_msid | job_complete_msid | created             | 
> last_updated        |
> +-------+----------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> | 72484 | org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd |          
> 2 |  345048681027 |      345048681027 | 2014-11-19 06:15:06 | 2014-11-19 
> 06:15:06 |
> | 72489 | org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd |          
> 2 |  345048681027 |      345048681027 | 2014-11-19 06:15:45 | 2014-11-19 
> 06:15:45 |
> +-------+----------------------------------------------------------+------------+---------------+-------------------+---------------------+---------------------+
> 2 rows in set (0.00 sec)
> {noformat}
> Account ID 15 has below credentials 
> {noformat}
> +----+--------------+--------------------------------------+------+-----------+---------+
> | id | account_name | uuid                                 | type | domain_id 
> | state   |
> +----+--------------+--------------------------------------+------+-----------+---------+
> | 15 | 71000000017  | f4d0c381-e0b7-4aed-aa90-3336d42f7540 |    2 |        11 
> | enabled |
> +----+--------------+--------------------------------------+------+-----------+---------+
> 1 row in set (0.00 sec)
> {noformat}
> Below is the DB record for domain id=632
> {noformat}
> +-----+-------------+--------------------------------------+--------+----------------+
> | id  | name        | uuid                                 | state  | 
> network_domain |
> +-----+-------------+--------------------------------------+--------+----------------+
> | 632 | 71000000726 | 0536af94-fce7-46d2-b98a-9e3fd0f304ae | Active | NULL    
>        |
> +-----+-------------+--------------------------------------+--------+----------------+
> {noformat}
> Even though the logs say that access to domain id=632 has been granted to 
> account id=15 below;
> {noformat}
> 2014-11-19 15:15:06,502 DEBUG [c.c.u.AccountManagerImpl] 
> (API-Job-Executor-104:ctx-a96a8572 job-72484 ctx-d9207bf9) Access to 
> Acct[6b3b9128-2ef1-4866-8a60-33b284c749de-71000000726] granted to 
> Acct[f4d0c381-e0b7-4aed-aa90-3336d42f7540-71000000017] by DomainChecker
> {noformat}
> The operation fails with no permission.
> {noformat}
> com.cloud.exception.PermissionDeniedException: 
> Acct[f4d0c381-e0b7-4aed-aa90-3336d42f7540-71000000017] does not have 
> permission to operate within domain id=632
> {noformat}
> EXPECTED BEHAVIOR
> ==================
> User should be able to delete the tags
> ACTUAL BEHAVIOR
> ==================
> User is unable to delete tags



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to