You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "Prasanna Santhanam (JIRA)" <ji...@apache.org> on 2013/07/24 11:09:50 UTC

[jira] [Reopened] (CLOUDSTACK-3735) Automation: Domain deletion fails even when the networks within the domain have been destroyed

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

Prasanna Santhanam reopened CLOUDSTACK-3735:
--------------------------------------------


The test cleans up all resources before proceeding to deleteDomain. I'm aware that domain cleanup fails when resources are under use in the domain. In this case there are no resources as I showed in step 5. 6 where we delete the account. The logs will also show you that gc for the account has finished and reclaimed resources before going on to delete the domain. I think the search query for listing the networks 'active' in the domain is filtering without any condition which is why this is failing.

For eg: the state when the domain deletion happens looks like this:

mysql> select * from vm_network_map where network_id=275;
+----+-------+------------+
| id | vm_id | network_id |
+----+-------+------------+
| 41 |    55 |        275 |
| 42 |    57 |        275 |
+----+-------+------------+
2 rows in set (0.00 sec)

mysql> select account_id, domain_id, name, id, state from vm_instance where id in (55,57);
+------------+-----------+--------------------------------------+----+-----------+
| account_id | domain_id | name                                 | id | state     |
+------------+-----------+--------------------------------------+----+-----------+
|         30 |         6 | 36b75ab8-0eb4-4431-9b82-45666c7a69b1 | 55 | Expunging |
|         29 |         6 | 9edf7322-f18a-4e14-ab01-d469254fdcf6 | 57 | Expunging |
+------------+-----------+--------------------------------------+----+-----------+
2 rows in set (0.00 sec)

mysql> select * from account where id in (29,30);
+----+-------------------------------------------------------------------------------+--------------------------------------+------+-----------+---------+---------------------+----------------+----------------+-----------------+---------+
| id | account_name                                                                  | uuid                                 | type | domain_id | state   | removed             | cleanup_needed | network_domain | default_zone_id | default |
+----+-------------------------------------------------------------------------------+--------------------------------------+------+-----------+---------+---------------------+----------------+----------------+-----------------+---------+
| 29 | admin-XABU1-TestSharedNetworks-test_createSharedNetwork_domainSpecific-E7WTAU | 70ef43d1-a7d2-47be-8112-e604f8f329b3 |    2 |         6 | enabled | 2013-07-24 08:57:31 |              0 | NULL           |            NULL |       0 |
| 30 | admin-XABU1-TestSharedNetworks-test_createSharedNetwork_domainSpecific-5DZ2QM | dc1bb07c-c5d2-48a2-a4d8-cdb9afd19649 |    0 |         6 | enabled | 2013-07-24 08:57:36 |              0 | NULL           |            NULL |       0 |
+----+-------------------------------------------------------------------------------+--------------------------------------+------+-----------+---------+---------------------+----------------+----------------+-----------------+---------+
2 rows in set (0.00 sec)

mysql> select * from networks where id=275\G
*************************** 1. row ***************************
                   id: 275
                 name: MySharedNetwork - Test
                 uuid: c2f74572-d358-4a24-a936-1c9376d012d5
         display_text: MySharedNetwork
         traffic_type: Guest
broadcast_domain_type: Vlan
        broadcast_uri: vlan://1200
              gateway: 172.16.15.1
                 cidr: 172.16.15.0/24
                 mode: Dhcp
  network_offering_id: 37
  physical_network_id: 200
       data_center_id: 1
            guru_name: DirectNetworkGuru
                state: Destroy
              related: 275
            domain_id: 1
           account_id: 1
                 dns1: NULL
                 dns2: NULL
            guru_data: NULL
           set_fields: 0
             acl_type: Domain
       network_domain: cs1sandbox.simulator
       reservation_id: NULL
           guest_type: Shared
     restart_required: 0
              created: 2013-07-24 08:57:05
              removed: 2013-07-24 08:58:41
    specify_ip_ranges: 1
               vpc_id: NULL
          ip6_gateway: NULL
             ip6_cidr: NULL
         network_cidr: NULL
      display_network: 1
       network_acl_id: NULL
1 row in set (0.00 sec)

And yet the domain deletion fails:

If you see the filter for listing networks in the domain called in deleteDomain in the DomainManagerImpl.java
public List<Long> listNetworkIdsByDomain(long domainId) {
        List<Long> networkIdsToReturn = new ArrayList<Long>();
        List<NetworkDomainVO> maps = listDomainNetworkMapByDomain(domainId);
        for (NetworkDomainVO map : maps) {
            networkIdsToReturn.add(map.getNetworkId());
        } 
        return networkIdsToReturn;
    }


There is nothing preventing a 'Destroyed' network from not appearing in that map.

                
> Automation: Domain deletion fails even when the networks within the domain have been destroyed
> ----------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-3735
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-3735
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>    Affects Versions: 4.2.0
>            Reporter: Prasanna Santhanam
>            Assignee: Alena Prokharchyk
>            Priority: Critical
>             Fix For: 4.2.0
>
>         Attachments: vmops.log.tar.bz2
>
>
> When the domain has networks created by accounts within it and all the networks
> and accounts have been destroyed we are unable to delete the domain
> Steps:
> 1. Create a domain under ROOT
> 2. Create an account under the domain
> 3. Create a network (guest) within the account
> 4. delete the network
> 5. delete the account
> 6. try to delete the domain
> domain deletion fails
> Network in question as pointed to by the DomainManagerImpl.java
> mysql> select * from networks where id=206\G
> *************************** 1. row ***************************
>                    id: 206
>                  name: MySharedNetwork - Test
>                  uuid: 5f36bbc8-2207-42e3-8bd6-d9e571ac7678
>          display_text: MySharedNetwork
>          traffic_type: Guest
> broadcast_domain_type: Vlan
>         broadcast_uri: vlan://1200
>               gateway: 172.16.15.1
>                  cidr: 172.16.15.0/24
>                  mode: Dhcp
>   network_offering_id: 17
>   physical_network_id: 200
>        data_center_id: 1
>             guru_name: DirectNetworkGuru
>                 state: Destroy
>               related: 206
>             domain_id: 1
>            account_id: 1
>                  dns1: NULL
>                  dns2: NULL
>             guru_data: NULL
>            set_fields: 0
>              acl_type: Domain
>        network_domain: cs1sandbox.simulator
>        reservation_id: NULL
>            guest_type: Shared
>      restart_required: 0
>               created: 2013-07-23 12:08:37
>               removed: 2013-07-23 12:10:13
>     specify_ip_ranges: 1
>                vpc_id: NULL
>           ip6_gateway: NULL
>              ip6_cidr: NULL
>          network_cidr: NULL
>       display_network: 1
>        network_acl_id: NULL
> 1 row in set (0.00 sec)
> mysql> select * from domain_network_ref;
> +----+-----------+------------+------------------+
> | id | domain_id | network_id | subdomain_access |
> +----+-----------+------------+------------------+
> |  1 |         2 |        204 |                1 |
> |  2 |         3 |        205 |                1 |
> |  3 |         4 |        206 |                1 |
> +----+-----------+------------+------------------+
> 3 rows in set (0.00 sec)
> But as can be seen the state of the domain is 'Destroy' and it has been removed (date is non NULL)
> ERROR [cloud.user.DomainManagerImpl] (Job-Executor-12:job-28 = [ adc38e3a-2d47-4fd8-a80c-0cc209182f65 ]) Exception deleting domain with id 3
> com.cloud.utils.exception.CloudRuntimeException: Can't delete the domain yet because it has 1 non-removed networks
> 	at com.cloud.user.DomainManagerImpl.deleteDomain(DomainManagerImpl.java:274)
> 	at com.cloud.user.DomainManagerImpl.deleteDomain(DomainManagerImpl.java:226)
> 	at com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
> 	at org.apache.cloudstack.region.RegionManagerImpl.deleteDomain(RegionManagerImpl.java:231)
> 	at org.apache.cloudstack.region.RegionServiceImpl.deleteDomain(RegionServiceImpl.java:166)
> 	at org.apache.cloudstack.api.command.admin.domain.DeleteDomainCmd.execute(DeleteDomainCmd.java:99)
> 	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:439)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
> 	at java.lang.Thread.run(Thread.java:680)
> ERROR [cloud.async.AsyncJobManagerImpl] (Job-Executor-12:job-28 = [ adc38e3a-2d47-4fd8-a80c-0cc209182f65 ]) Unexpected exception while executing org.apache.cloudstack.api.command.admin.domain.DeleteDomainCmd
> com.cloud.utils.exception.CloudRuntimeException: Can't delete the domain yet because it has 1 non-removed networks
> 	at com.cloud.user.DomainManagerImpl.deleteDomain(DomainManagerImpl.java:274)
> 	at com.cloud.user.DomainManagerImpl.deleteDomain(DomainManagerImpl.java:226)
> 	at com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:125)
> 	at org.apache.cloudstack.region.RegionManagerImpl.deleteDomain(RegionManagerImpl.java:231)
> 	at org.apache.cloudstack.region.RegionServiceImpl.deleteDomain(RegionServiceImpl.java:166)
> 	at org.apache.cloudstack.api.command.admin.domain.DeleteDomainCmd.execute(DeleteDomainCmd.java:99)
> 	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:439)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
> 	at java.lang.Thread.run(Thread.java:680)
> Attaching management server logs

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