[
https://issues.apache.org/jira/browse/CLOUDSTACK-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13566337#comment-13566337
]
Wei Zhou commented on CLOUDSTACK-1088:
--------------------------------------
when I run API call
command=enableStaticNat&ipaddressid=73&virtualmachineid=67&response=json, I
check the data in cloud.user_ip_address table,
(1) the first time, return "success" . in database
+----+--------------------------------------+------------+-----------+-------------------+----------------+------------+---------------------+------------+----------------+-------+-----------+-------------+-------------------+------------+---------------------+-----------+--------+
| id | uuid | account_id | domain_id |
public_ip_address | data_center_id | source_nat | allocated |
vlan_db_id | one_to_one_nat | vm_id | state | mac_address |
source_network_id | network_id | physical_network_id | is_system | vpc_id |
+----+--------------------------------------+------------+-----------+-------------------+----------------+------------+---------------------+------------+----------------+-------+-----------+-------------+-------------------+------------+---------------------+-----------+--------+
| 73 | cfb98e93-bffb-4d08-8edc-1d9c086a4ec0 | 2 | 1 |
10.11.101.172 | 1 | 0 | 2013-01-16 17:18:56 |
1 | 1 | 67 | Allocated | 84 | 200 |
221 | 200 | 0 | NULL |
(2) the second time. return "Failed to enable static nat for the ip address
id=73 as vm id=67 is already associated with ip id=73". in database
+----+--------------------------------------+------------+-----------+-------------------+----------------+------------+---------------------+------------+----------------+-------+-----------+-------------+-------------------+------------+---------------------+-----------+--------+
| id | uuid | account_id | domain_id |
public_ip_address | data_center_id | source_nat | allocated |
vlan_db_id | one_to_one_nat | vm_id | state | mac_address |
source_network_id | network_id | physical_network_id | is_system | vpc_id |
+----+--------------------------------------+------------+-----------+-------------------+----------------+------------+---------------------+------------+----------------+-------+-----------+-------------+-------------------+------------+---------------------+-----------+--------+
| 73 | cfb98e93-bffb-4d08-8edc-1d9c086a4ec0 | 2 | 1 |
10.11.101.172 | 1 | 0 | 2013-01-16 17:18:56 |
1 | 0 | NULL | Allocated | 84 | 200 |
221 | 200 | 0 | NULL |
In com.cloud.network.rules.RulesManagerImpl.enableStaticNat(long, long, long,
boolean),
try { ......
} finally {
if (!result) {
ipAddress.setOneToOneNat(false);
ipAddress.setAssociatedWithVmId(null);
_ipAddressDao.update(ipAddress.getId(), ipAddress);
we can see that the user_ip_address(one_to_one_nat , vm_id) will set to
(0,null) when the operation failed. This can explain the errors in Description.
> EnableStaticNat error will clear the data in database
> -----------------------------------------------------
>
> Key: CLOUDSTACK-1088
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-1088
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Affects Versions: 4.0.0
> Reporter: Wei Zhou
>
> The issue occur in two conditions
> (1) If I use two sessions or browsers to EnableStaticNat on CloudStack UI.
> one is successful, the other is failed. However, there is no ip in database.
> (2) If I use API call EnableStaticNat several times The first time succeed,
> the second failed, the third succeed. the result is
> success-fail-success-fail-success-fail, which it is not correct.
--
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