bug 7760: fix a regression when adding host

status 7760: resolved fixed
This commit is contained in:
root 2010-12-29 19:37:43 -05:00
parent 2d6875f711
commit c6847f001a
3 changed files with 4 additions and 3 deletions

View File

@ -163,6 +163,7 @@ import com.cloud.utils.db.DB;
import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction; import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.Ip;
import com.cloud.utils.net.MacAddress; import com.cloud.utils.net.MacAddress;
import com.cloud.utils.net.NetUtils; import com.cloud.utils.net.NetUtils;
import com.cloud.utils.nio.HandlerFactory; import com.cloud.utils.nio.HandlerFactory;
@ -1916,7 +1917,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
} }
} }
if (serverPublicIP != null && !_publicIPAddressDao.mark(dc.getId(), serverPublicIP)) { if (serverPublicIP != null && !_publicIPAddressDao.mark(dc.getId(), new Ip(serverPublicIP))) {
// If the server's public IP address is already in the database, // If the server's public IP address is already in the database,
// return false // return false
List<IPAddressVO> existingPublicIPs = _publicIPAddressDao.listByDcIdIpAddress(dc.getId(), serverPublicIP); List<IPAddressVO> existingPublicIPs = _publicIPAddressDao.listByDcIdIpAddress(dc.getId(), serverPublicIP);

View File

@ -40,7 +40,7 @@ public interface IPAddressDao extends GenericDao<IPAddressVO, Ip> {
int countIPs(long dcId, Long accountId, String vlanId, String vlanGateway, String vlanNetmask); int countIPs(long dcId, Long accountId, String vlanId, String vlanGateway, String vlanNetmask);
boolean mark(long dcId, String ip); boolean mark(long dcId, Ip ip);
List<String> assignAcccountSpecificIps(long accountId, long longValue, Long vlanDbId, boolean sourceNat); List<String> assignAcccountSpecificIps(long accountId, long longValue, Long vlanDbId, boolean sourceNat);

View File

@ -97,7 +97,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Ip> implements
} }
@Override @Override
public boolean mark(long dcId, String ip) { public boolean mark(long dcId, Ip ip) {
SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create(); SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
sc.setParameters("dataCenterId", dcId); sc.setParameters("dataCenterId", dcId);
sc.setParameters("ipAddress", ip); sc.setParameters("ipAddress", ip);