mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-15 18:12:35 +01:00
fix security group rule which not get updated into db, and simulator agents reports the wrong security group to mgt server
This commit is contained in:
parent
ae64c56c12
commit
d461cfbf1b
@ -20,6 +20,7 @@ import com.cloud.agent.api.MigrateCommand;
|
||||
import com.cloud.agent.api.NetworkUsageAnswer;
|
||||
import com.cloud.agent.api.NetworkUsageCommand;
|
||||
import com.cloud.agent.api.RebootCommand;
|
||||
import com.cloud.agent.api.SecurityIngressRuleAnswer;
|
||||
import com.cloud.agent.api.SecurityIngressRulesCmd;
|
||||
import com.cloud.agent.api.StartCommand;
|
||||
import com.cloud.agent.api.StopCommand;
|
||||
@ -79,8 +80,8 @@ public interface MockVmManager extends Manager {
|
||||
Answer CheckConsoleProxyLoad(CheckConsoleProxyLoadCommand cmd);
|
||||
Answer WatchConsoleProxyLoad(WatchConsoleProxyLoadCommand cmd);
|
||||
|
||||
Answer AddSecurityIngressRules(SecurityIngressRulesCmd cmd);
|
||||
Answer SavePassword(SavePasswordCommand cmd);
|
||||
HashMap<String, Pair<Long, Long>> syncNetworkGroups(String hostGuid);
|
||||
SecurityIngressRuleAnswer AddSecurityIngressRules(SecurityIngressRulesCmd cmd, String hostGuid);
|
||||
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@ public class MockVmManagerImpl implements MockVmManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecurityIngressRuleAnswer AddSecurityIngressRules(SecurityIngressRulesCmd cmd) {
|
||||
public SecurityIngressRuleAnswer AddSecurityIngressRules(SecurityIngressRulesCmd cmd, String hostGuid) {
|
||||
MockVMVO vm = _mockVmDao.findByVmName(cmd.getVmName());
|
||||
if (vm == null) {
|
||||
return new SecurityIngressRuleAnswer(cmd, false, "cant' find the vm: " + cmd.getVmName());
|
||||
@ -364,8 +364,8 @@ public class MockVmManagerImpl implements MockVmManager {
|
||||
rules.setRuleSet(cmd.stringifyRules());
|
||||
rules.setSeqNum(cmd.getSeqNum());
|
||||
rules.setSignature(cmd.getSignature());
|
||||
rules.setVmId(vm.getId());
|
||||
rules.setHostId(vm.getHostId());
|
||||
rules.setVmId(cmd.getVmId());
|
||||
rules.setHostId(hostGuid);
|
||||
|
||||
_mockSecurityDao.persist(rules);
|
||||
} else if (update){
|
||||
@ -373,7 +373,7 @@ public class MockVmManagerImpl implements MockVmManager {
|
||||
rules.setSignature(cmd.getSignature());
|
||||
rules.setRuleSet(cmd.stringifyRules());
|
||||
rules.setVmId(cmd.getVmId());
|
||||
rules.setHostId(vm.getHostId());
|
||||
rules.setHostId(hostGuid);
|
||||
_mockSecurityDao.update(rules.getId(), rules);
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ public class SimulatorManagerImpl implements SimulatorManager {
|
||||
try {
|
||||
Connection conn = Transaction.getStandaloneConnectionWithException();
|
||||
conn.setAutoCommit(true);
|
||||
_concierge = new ConnectionConcierge("AgentMonitor", conn, false);
|
||||
_concierge = new ConnectionConcierge("SimulatorConnection", conn, true);
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to get a db connection", e);
|
||||
}
|
||||
@ -186,7 +186,7 @@ public class SimulatorManagerImpl implements SimulatorManager {
|
||||
} else if (cmd instanceof WatchConsoleProxyLoadCommand) {
|
||||
return _mockVmMgr.WatchConsoleProxyLoad((WatchConsoleProxyLoadCommand)cmd);
|
||||
} else if (cmd instanceof SecurityIngressRulesCmd) {
|
||||
return _mockVmMgr.AddSecurityIngressRules((SecurityIngressRulesCmd)cmd);
|
||||
return _mockVmMgr.AddSecurityIngressRules((SecurityIngressRulesCmd)cmd, hostGuid);
|
||||
} else if (cmd instanceof SavePasswordCommand) {
|
||||
return _mockVmMgr.SavePassword((SavePasswordCommand)cmd);
|
||||
} else if (cmd instanceof PrimaryStorageDownloadCommand) {
|
||||
|
||||
@ -23,13 +23,13 @@ public class MockSecurityRulesVO {
|
||||
private String signature;
|
||||
|
||||
@Column(name="seqnum")
|
||||
private Long seqnum;
|
||||
private Long seqNum;
|
||||
|
||||
@Column(name="ruleset")
|
||||
private String ruleset;
|
||||
private String ruleSet;
|
||||
|
||||
@Column(name="hostid")
|
||||
private Long hostId;
|
||||
private String hostId;
|
||||
|
||||
@Column(name="vmname")
|
||||
public String vmName;
|
||||
@ -42,11 +42,11 @@ public class MockSecurityRulesVO {
|
||||
this.vmName = vmName;
|
||||
}
|
||||
|
||||
public Long getHostId() {
|
||||
public String getHostId() {
|
||||
return this.hostId;
|
||||
}
|
||||
|
||||
public void setHostId(Long hostId) {
|
||||
public void setHostId(String hostId) {
|
||||
this.hostId = hostId;
|
||||
}
|
||||
|
||||
@ -71,18 +71,18 @@ public class MockSecurityRulesVO {
|
||||
}
|
||||
|
||||
public Long getSeqNum() {
|
||||
return this.seqnum;
|
||||
return this.seqNum;
|
||||
}
|
||||
|
||||
public void setSeqNum(Long seqNum) {
|
||||
this.seqnum = seqNum;
|
||||
this.seqNum = seqNum;
|
||||
}
|
||||
|
||||
public String getRuleSet() {
|
||||
return this.ruleset;
|
||||
return this.ruleSet;
|
||||
}
|
||||
|
||||
public void setRuleSet(String ruleset) {
|
||||
this.ruleset = ruleset;
|
||||
this.ruleSet = ruleset;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,10 +96,10 @@ CREATE TABLE `cloud`.`mocksecurityrules` (
|
||||
`vmid` bigint unsigned,
|
||||
`signature` varchar(255),
|
||||
`ruleset` varchar(4095),
|
||||
`hostid` bigint unsigned,
|
||||
`hostid` varchar(255),
|
||||
`seqnum` bigint unsigned,
|
||||
`vmname` varchar(255),
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `i_mocksecurityrules__vmid`(`vmid`),
|
||||
INDEX `i_mocksecurityrules__hostid`(`hostid`)
|
||||
) ENGINE=Memory DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user