mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
directly search ssvm in host table when sending SecStorageFirewallCfgCommand
This commit is contained in:
parent
71ff88f211
commit
5d6653224b
@ -405,35 +405,25 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SecondaryStorageVmVO> alreadyRunning = _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, State.Running, State.Migrating, State.Starting);
|
|
||||||
|
|
||||||
String copyPort = _useSSlCopy? "443" : Integer.toString(TemplateConstants.DEFAULT_TMPLT_COPY_PORT);
|
String copyPort = _useSSlCopy? "443" : Integer.toString(TemplateConstants.DEFAULT_TMPLT_COPY_PORT);
|
||||||
SecStorageFirewallCfgCommand cpc = new SecStorageFirewallCfgCommand();
|
SecStorageFirewallCfgCommand cpc = new SecStorageFirewallCfgCommand();
|
||||||
SecStorageFirewallCfgCommand thiscpc = new SecStorageFirewallCfgCommand();
|
SecStorageFirewallCfgCommand thiscpc = new SecStorageFirewallCfgCommand();
|
||||||
thiscpc.addPortConfig(thisSecStorageVm.getPublicIpAddress(), copyPort, true, TemplateConstants.DEFAULT_TMPLT_COPY_INTF);
|
thiscpc.addPortConfig(thisSecStorageVm.getPublicIpAddress(), copyPort, true, TemplateConstants.DEFAULT_TMPLT_COPY_INTF);
|
||||||
for (SecondaryStorageVmVO ssVm : alreadyRunning) {
|
|
||||||
if ( ssVm.getDataCenterIdToDeployIn() == zoneId ) {
|
SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
|
||||||
continue;
|
sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, zoneId);
|
||||||
}
|
sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.SecondaryStorageVM);
|
||||||
if (ssVm.getPublicIpAddress() != null) {
|
sc.addAnd(sc.getEntity().getStatus(), Op.IN, com.cloud.host.Status.Up, com.cloud.host.Status.Connecting);
|
||||||
cpc.addPortConfig(ssVm.getPublicIpAddress(), copyPort, true, TemplateConstants.DEFAULT_TMPLT_COPY_INTF);
|
List<HostVO> ssvms = sc.list();
|
||||||
}
|
for (HostVO ssvm : ssvms) {
|
||||||
if ( ssVm.getState() != State.Running ) {
|
Answer answer = _agentMgr.easySend(ssvm.getId(), thiscpc);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String instanceName = ssVm.getInstanceName();
|
|
||||||
HostVO host = _resourceMgr.findHostByName(instanceName);
|
|
||||||
if ( host == null ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Answer answer = _agentMgr.easySend(host.getId(), thiscpc);
|
|
||||||
if (answer != null && answer.getResult()) {
|
if (answer != null && answer.getResult()) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Successfully programmed firewall rules into " + ssVm.getHostName());
|
s_logger.debug("Successfully programmed firewall rules into SSVM " + ssvm.getName());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("failed to program firewall rules into secondary storage vm : " + ssVm.getHostName());
|
s_logger.debug("failed to program firewall rules into secondary storage vm : " + ssvm.getName());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user