Authored by qinchao

修正qcloud的cvm主机,状态为过期的不显示

... ... @@ -390,7 +390,7 @@ public class HostInfoServiceImpl implements IHostInfoService {
logger.info("delete ip from database , ipList is {} ,cloudType is {} ,", oldIpList, cloudType);
for(String ip : oldIpList){
try{
//删除数据--暂时屏蔽
//删除数据
hostInfoMapper.deleteByIp(ip);
}catch (Exception e){
logger.error("delete ip error ! ip is {} : {}", ip , cloudType);
... ...
... ... @@ -200,6 +200,10 @@ public class QcloudClientFactory {
String hostid=jo.getString("InstanceId");
String hostname=jo.getString("InstanceName");
String ip=jo.getJSONArray("PrivateIpAddresses").size()>0?jo.getJSONArray("PrivateIpAddresses").getString(0):"";
String restrictState=jo.getString("RestrictState"); ///状态,不要EXPIRED状态的主机,NORMAL表示正常状态的实例 ,EXPIRED:表示过期的实例 ,PROTECTIVELY_ISOLATED:表示被安全隔离的实例。
if("EXPIRED".equalsIgnoreCase(restrictState)){
continue;
}
if(!instanceIDs.contains(hostid)){
instanceIDs.add(hostid);
Host host=new Host(DataCenter.qcloud,hostid, ip, hostname);
... ... @@ -229,6 +233,10 @@ public class QcloudClientFactory {
String hostid=jo.getString("InstanceId");
String hostname=jo.getString("InstanceName");
String ip=jo.getJSONArray("PrivateIpAddresses").size()>0?jo.getJSONArray("PrivateIpAddresses").getString(0):"";
String restrictState=jo.getString("RestrictState"); ///状态,不要EXPIRED状态的主机,NORMAL表示正常状态的实例 ,EXPIRED:表示过期的实例 ,PROTECTIVELY_ISOLATED:表示被安全隔离的实例。
if("EXPIRED".equalsIgnoreCase(restrictState)){
continue;
}
if(!instanceIDs.contains(hostid)){
instanceIDs.add(hostid);
Host host=new Host(DataCenter.qcloud,hostid, ip, hostname);
... ...