Chandan Purushothama created CLOUDSTACK-226:
-----------------------------------------------

             Summary: UpdatePhysicalNetworkcommand failed due to 
java.sql.BatchUpdateException ;  Tried to extend the existing Guest VLAN Range 
of one physical network into the Guest VLAN range of the other physical network
                 Key: CLOUDSTACK-226
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-226
             Project: CloudStack
          Issue Type: Bug
          Components: Management Server
    Affects Versions: pre-4.0.0
            Reporter: Chandan Purushothama
             Fix For: pre-4.0.0



===============
Steps to Reproduce:
===============

1. Deploy an Advanced Zone setup with two Physical Networks where Physical 
Network 1 carries management,storage,public and guest traffic while Physical 
Network 2 carries only guest traffic.
2. Provide Guest VLAN Range 2480 to 2500 on Physical Network 1 during 
deployment of the setup.
3. Provide Guest VLAN Range 2501 to 2520 on Physical Network 2 during 
deployment of the setup.
4. Once the deployment is done, edit the guest network details of Physical 
Network 1 such that the End Guest VLAN is edited from 2500 to 2510.
5. Click on Apply and observe the observation mentioned below.


==============================================
Before Extending the Guest VLAN Range of Physical Network:
==============================================

mysql> select * from physical_network \G
*************************** 1. row ***************************
                    id: 200
                  uuid: 6c5c0857-ca27-4e6d-97ad-64d82230db24
                  name: Physical Network 1
        data_center_id: 1
                  vnet: 2481-2500
                 speed: NULL
             domain_id: NULL
broadcast_domain_range: ZONE
                 state: Enabled
               created: 2012-09-26 01:51:55
               removed: NULL
*************************** 2. row ***************************
                    id: 201
                  uuid: 01736ead-fbf2-49b5-8e23-754db2e8afa1
                  name: Physical Network 2
        data_center_id: 1
                  vnet: 2501-2520
                 speed: NULL
             domain_id: NULL
broadcast_domain_range: ZONE
                 state: Enabled
               created: 2012-09-26 01:51:55
               removed: NULL
2 rows in set (0.00 sec)


=========================
UpdatePhysicalNetworkCmd Job:
=========================

2012-09-27 14:15:18,835 DEBUG [cloud.async.AsyncJobManagerImpl] 
(catalina-exec-16:null) submit async job-70, details: AsyncJobVO {id:70, 
userId: 2, accountId: 2, sessionKey: null, instanceType: PhysicalNetwork, 
instanceId: null, cmd: com.cloud.api.commands.UpdatePhysicalNetworkCmd, 
cmdOriginator: null, cmdInfo: 
{"tags":"guest1","response":"json","id":"6c5c0857-ca27-4e6d-97ad-64d82230db24","sessionkey":"zXjqIlsgiABR8Ty4cYpLI+hNitE\u003d","ctxUserId":"2","vlan":"2481-2510","_":"1348780808027","ctxAccountId":"2","ctxStartEventId":"294"},
 cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
processStatus: 0, resultCode: 0, result: null, initMsid: 7471666038533, 
completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
2012-09-27 14:15:18,840 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-47:job-70) Executing 
com.cloud.api.commands.UpdatePhysicalNetworkCmd for job-70
2012-09-27 14:15:18,852 DEBUG [cloud.network.NetworkManagerImpl] 
(Job-Executor-47:job-70) ISOLATION METHODS:[VLAN]
2012-09-27 14:15:18,861 DEBUG [cloud.network.NetworkManagerImpl] 
(Job-Executor-47:job-70) Adding vnet range 2501-2510 for the physicalNetwork 
id= 200 and zone id=1 as a part of updatePhysicalNetwork call
2012-09-27 14:15:18,885 DEBUG [db.Transaction.Transaction] 
(Job-Executor-47:job-70) Rolling back the transaction: Time = 23 Name =  
-AsyncJobManagerImpl$1.run:398-Executors$RunnableAdapter.call:471-FutureTask$Sync.innerRun:334-FutureTask.run:166-ThreadPoolExecutor.runWorker:1110-ThreadPoolExecutor$Worker.run:603-Thread.run:679;
 called by 
-Transaction.rollback:887-Transaction.removeUpTo:830-Transaction.close:649-DatabaseCallback.interceptComplete:71-DatabaseCallback.intercept:36-DataCenterDaoImpl.addVnet:251-DatabaseCallback.intercept:34-NetworkManagerImpl.updatePhysicalNetwork:5411-ComponentLocator$InterceptorDispatcher.intercept:1231-UpdatePhysicalNetworkCmd.execute:101-ApiDispatcher.dispatch:138-AsyncJobManagerImpl$1.run:432
2012-09-27 14:15:18,897 ERROR [cloud.api.ApiDispatcher] 
(Job-Executor-47:job-70) Exception while executing UpdatePhysicalNetworkCmd:
com.cloud.utils.exception.CloudRuntimeException: Exception caught adding vnet
        at 
com.cloud.dc.dao.DataCenterVnetDaoImpl.add(DataCenterVnetDaoImpl.java:94)
        at 
com.cloud.utils.db.DatabaseCallback.intercept(DatabaseCallback.java:34)
        at 
com.cloud.dc.dao.DataCenterDaoImpl.addVnet(DataCenterDaoImpl.java:251)
        at 
com.cloud.utils.db.DatabaseCallback.intercept(DatabaseCallback.java:34)
        at 
com.cloud.network.NetworkManagerImpl.updatePhysicalNetwork(NetworkManagerImpl.java:5411)
        at 
com.cloud.utils.component.ComponentLocator$InterceptorDispatcher.intercept(ComponentLocator.java:1231)
        at 
com.cloud.api.commands.UpdatePhysicalNetworkCmd.execute(UpdatePhysicalNetworkCmd.java:101)
        at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:138)
        at 
com.cloud.async.AsyncJobManagerImpl$1.run(AsyncJobManagerImpl.java:432)
        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)
Caused by: java.sql.BatchUpdateException: Duplicate entry '2510-1' for key 
'i_op_dc_vnet_alloc__vnet__data_center_id'
        at 
com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2024)
        at 
com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449)
        at 
org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
        at 
com.cloud.dc.dao.DataCenterVnetDaoImpl.add(DataCenterVnetDaoImpl.java:91)
        ... 26 more
Caused by: 
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: 
Duplicate entry '2510-1' for key 'i_op_dc_vnet_alloc__vnet__data_center_id'
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.Util.getInstance(Util.java:386)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
        at 
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
        at 
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
        at 
com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1979)
        ... 29 more
2012-09-27 14:15:18,899 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-47:job-70) Complete async job-70, jobStatus: 2, resultCode: 530, 
result: Error Code: 530 Error text: Exception caught adding vnet
2012-09-27 14:15:19,272 DEBUG [cloud.async.AsyncJobManagerImpl] 
(catalina-exec-1:null) submit async job-71, details: AsyncJobVO {id:71, userId: 
2, accountId: 2, sessionKey: null, instanceType: TrafficType, instanceId: null, 
cmd: com.cloud.api.commands.UpdateTrafficTypeCmd, cmdOriginator: null, cmdInfo: 
{"response":"json","id":"3144b1eb-fe6a-4013-b27d-b39605922f94","sessionkey":"zXjqIlsgiABR8Ty4cYpLI+hNitE\u003d","ctxUserId":"2","xennetworklabel":"cloud-xenbr0","_":"1348780808528","ctxAccountId":"2","ctxStartEventId":"297"},
 cmdVersion: 0, callbackType: 0, callbackAddress: null, status: 0, 
processStatus: 0, resultCode: 0, result: null, initMsid: 7471666038533, 
completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
2012-09-27 14:15:19,276 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-48:job-71) Executing com.cloud.api.commands.UpdateTrafficTypeCmd 
for job-71
2012-09-27 14:15:19,312 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-48:job-71) Complete async job-71, jobStatus: 1, resultCode: 0, 
result: com.cloud.api.response.TrafficTypeResponse@35a2b667
2012-09-27 14:15:19,321 DEBUG [cloud.async.AsyncJobManagerImpl] 
(Job-Executor-48:job-71) Done executing 
com.cloud.api.commands.UpdateTrafficTypeCmd for job-71

==============================================
After Extending the Guest VLAN Range of Physical Network:
==============================================

**Observe vnet info of both the Physical Networks**

mysql> select * from physical_network \G
*************************** 1. row ***************************
                    id: 200
                  uuid: 6c5c0857-ca27-4e6d-97ad-64d82230db24
                  name: Physical Network 1
        data_center_id: 1
                  vnet: 2481-2510
                 speed: NULL
             domain_id: NULL
broadcast_domain_range: ZONE
                 state: Enabled
               created: 2012-09-26 01:51:55
               removed: NULL
*************************** 2. row ***************************
                    id: 201
                  uuid: 01736ead-fbf2-49b5-8e23-754db2e8afa1
                  name: Physical Network 2
        data_center_id: 1
                  vnet: 2501-2520
                 speed: NULL
             domain_id: NULL
broadcast_domain_range: ZONE
                 state: Enabled
               created: 2012-09-26 01:51:55
               removed: NULL
2 rows in set (0.00 sec)

mysql> select * from op_dc_vnet_alloc;
+----+------+---------------------+----------------+--------------------------------------+------------+---------------------+
| id | vnet | physical_network_id | data_center_id | reservation_id             
          | account_id | taken               |
+----+------+---------------------+----------------+--------------------------------------+------------+---------------------+
| 41 | 2481 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 42 | 2482 |                 200 |              1 | 
671879a8-8f68-47fb-ace0-bceadc31d152 |          3 | 2012-09-26 18:50:58 |
| 43 | 2483 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 44 | 2484 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 45 | 2485 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 46 | 2486 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 47 | 2487 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 48 | 2488 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 49 | 2489 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 50 | 2490 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 51 | 2491 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 52 | 2492 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 53 | 2493 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 54 | 2494 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 55 | 2495 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 56 | 2496 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 57 | 2497 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 58 | 2498 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 59 | 2499 |                 200 |              1 | 
d1af86fa-e4a1-42fd-9937-c1f0ffa33f45 |          3 | 2012-09-27 01:17:34 |
| 60 | 2500 |                 200 |              1 | NULL                       
          |       NULL | NULL                |
| 61 | 2501 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 62 | 2502 |                 201 |              1 | 
303a54eb-1c15-44ce-9316-e64b2d24b4cd |          3 | 2012-09-26 19:04:46 |
| 63 | 2503 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 64 | 2504 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 65 | 2505 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 66 | 2506 |                 201 |              1 | 
ab9d8b6b-d5ce-4454-8015-157b480433e2 |          3 | 2012-09-27 01:19:24 |
| 67 | 2507 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 68 | 2508 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 69 | 2509 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 70 | 2510 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 71 | 2511 |                 201 |              1 | 
f078f8bb-8063-412f-91a7-3dce441e1759 |          3 | 2012-09-26 18:57:16 |
| 72 | 2512 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 73 | 2513 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 74 | 2514 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 75 | 2515 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 76 | 2516 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 77 | 2517 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 78 | 2518 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 79 | 2519 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
| 80 | 2520 |                 201 |              1 | NULL                       
          |       NULL | NULL                |
+----+------+---------------------+----------------+--------------------------------------+------------+---------------------+
40 rows in set (0.00 sec)

======
Git Info:
======

Git Revision: 30b19887fd05c7694f8fdf45be9fe9b02d90b1d1
Git URL: https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git


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