2323import java .sql .SQLException ;
2424import java .sql .Statement ;
2525import java .util .List ;
26+ import java .util .UUID ;
2627import java .util .Vector ;
2728
28- import com .cloud .network .IpAddress ;
2929import com .cloud .utils .component .ComponentLocator ;
3030import com .cloud .utils .db .DB ;
3131import com .cloud .utils .db .Transaction ;
@@ -448,7 +448,7 @@ public List<String> saveIPRange(String type, long podId, long zoneId, long vlanD
448448 }
449449
450450 public Vector <String > savePublicIPRange (Transaction txn , long startIP , long endIP , long zoneId , long vlanDbId , Long sourceNetworkId , long physicalNetworkId ) {
451- String insertSql = "INSERT INTO `cloud`.`user_ip_address` (public_ip_address, data_center_id, vlan_db_id, mac_address, source_network_id, physical_network_id) VALUES (?, ?, ?, (select mac_address from `cloud`.`data_center` where id=?), ?, ?)" ;
451+ String insertSql = "INSERT INTO `cloud`.`user_ip_address` (public_ip_address, data_center_id, vlan_db_id, mac_address, source_network_id, physical_network_id, uuid ) VALUES (?, ?, ?, (select mac_address from `cloud`.`data_center` where id=?), ? , ?, ?)" ;
452452 String updateSql = "UPDATE `cloud`.`data_center` set mac_address = mac_address+1 where id=?" ;
453453 Vector <String > problemIPs = new Vector <String >();
454454 PreparedStatement stmt = null ;
@@ -469,6 +469,7 @@ public Vector<String> savePublicIPRange(Transaction txn, long startIP, long endI
469469 stmt .setLong (4 , zoneId );
470470 stmt .setLong (5 , sourceNetworkId );
471471 stmt .setLong (6 , physicalNetworkId );
472+ stmt .setString (7 , UUID .randomUUID ().toString ());
472473 stmt .executeUpdate ();
473474 stmt .close ();
474475 stmt = conn .prepareStatement (updateSql );
0 commit comments