1) As the lack of dom0 scripting support in vmware hyperviors, domR, and other system VM will fall back to private network interface instead of link local interface, accordingly,

domR scripting will be running directly inside domR and be driven from management server instead of dom0 host
2) firewall/sshd setting changes for #1
This commit is contained in:
Kelven Yang 2010-10-21 21:36:56 -07:00
parent 18ffd7e7a8
commit 1c702a1d69
6 changed files with 31 additions and 12 deletions

View File

@ -31,6 +31,7 @@ public class StartRouterCommand extends AbstractStartCommand {
int networkRateMbps; int networkRateMbps;
int networkRateMulticastMbps; int networkRateMulticastMbps;
private String guestOSDescription; private String guestOSDescription;
private String mgmt_host;
protected StartRouterCommand() { protected StartRouterCommand() {
super(); super();
@ -43,12 +44,13 @@ public class StartRouterCommand extends AbstractStartCommand {
public StartRouterCommand(DomainRouterVO router, int networkRateMbps, int networkRateMulticastMbps, public StartRouterCommand(DomainRouterVO router, int networkRateMbps, int networkRateMulticastMbps,
String routerName, String[] storageIps, List<VolumeVO> vols, boolean mirroredVols, String routerName, String[] storageIps, List<VolumeVO> vols, boolean mirroredVols,
String guestOSDescription ) { String guestOSDescription, String mgmtHost) {
super(routerName, storageIps, vols, mirroredVols); super(routerName, storageIps, vols, mirroredVols);
this.router = router; this.router = router;
this.networkRateMbps = networkRateMbps; this.networkRateMbps = networkRateMbps;
this.networkRateMulticastMbps = networkRateMulticastMbps; this.networkRateMulticastMbps = networkRateMulticastMbps;
this.guestOSDescription = guestOSDescription; this.guestOSDescription = guestOSDescription;
this.mgmt_host = mgmtHost;
} }
public DomainRouter getRouter() { public DomainRouter getRouter() {
@ -66,12 +68,17 @@ public class StartRouterCommand extends AbstractStartCommand {
public int getNetworkRateMulticastMbps() { public int getNetworkRateMulticastMbps() {
return networkRateMulticastMbps; return networkRateMulticastMbps;
} }
public String getManagementHost() {
return mgmt_host;
}
public String getBootArgs() { public String getBootArgs() {
String eth2Ip = router.getPublicIpAddress()==null?"0.0.0.0":router.getPublicIpAddress(); String eth2Ip = router.getPublicIpAddress()==null?"0.0.0.0":router.getPublicIpAddress();
String basic = " eth0ip=" + router.getGuestIpAddress() + " eth0mask=" + router.getGuestNetmask() + " eth1ip=" String basic = " eth0ip=" + router.getGuestIpAddress() + " eth0mask=" + router.getGuestNetmask() + " eth1ip="
+ router.getPrivateIpAddress() + " eth1mask=" + router.getPrivateNetmask() + " gateway=" + router.getGateway() + router.getPrivateIpAddress() + " eth1mask=" + router.getPrivateNetmask() + " gateway=" + router.getGateway()
+ " dns1=" + router.getDns1() + " name=" + router.getName(); + " dns1=" + router.getDns1() + " name=" + router.getName() + " mgmtcidr=" + mgmt_host;
if (!router.getPublicMacAddress().equalsIgnoreCase("FE:FF:FF:FF:FF:FF")) { if (!router.getPublicMacAddress().equalsIgnoreCase("FE:FF:FF:FF:FF:FF")) {
basic = basic + " eth2ip=" + eth2Ip + " eth2mask=" + router.getPublicNetmask(); basic = basic + " eth2ip=" + eth2Ip + " eth2mask=" + router.getPublicNetmask();
} }

View File

@ -43,9 +43,9 @@ patch() {
privkey=/var/cache/cloud/authorized_keys privkey=/var/cache/cloud/authorized_keys
umount $EXTRA_MOUNT umount $EXTRA_MOUNT
elif [ -e /dev/cdrom1 ]; then elif [ -e /dev/cdrom1 ]; then
vmware-guestd --cmd 'machine.id.get' > /var/cache/cloud/cmdline vmware-guestd --cmd 'machine.id.get' > /var/cache/cloud/cmdline
else else
cat /proc/cmdline > /var/cache/cloud/cmdline cat /proc/cmdline > /var/cache/cloud/cmdline
fi fi
if [ -e /dev/xvdd ]; then if [ -e /dev/xvdd ]; then
@ -258,9 +258,13 @@ setup_secstorage() {
echo "$public_ip $NAME" >> /etc/hosts echo "$public_ip $NAME" >> /etc/hosts
cp /etc/iptables/iptables-secstorage /etc/iptables/rules cp /etc/iptables/iptables-secstorage /etc/iptables/rules
setup_sshd $ETH0_IP if [ -e /dev/cdrom1 ]; then
setup_sshd $ETH1_IP
else
setup_sshd $ETH0_IP
fi
setup_apache2 $ETH2_IP setup_apache2 $ETH2_IP
enable_fwding 0 enable_fwding 0
enable_svc haproxy 0 enable_svc haproxy 0
enable_svc dnsmasq 0 enable_svc dnsmasq 0
@ -268,7 +272,6 @@ setup_secstorage() {
enable_svc cloud 1 enable_svc cloud 1
} }
setup_console_proxy() { setup_console_proxy() {
log_action_begin_msg "Setting up console proxy system vm" log_action_begin_msg "Setting up console proxy system vm"
setup_common eth0 eth1 eth2 setup_common eth0 eth1 eth2
@ -277,7 +280,11 @@ setup_console_proxy() {
sed -i /gateway/d /etc/hosts sed -i /gateway/d /etc/hosts
echo "$public_ip $NAME" >> /etc/hosts echo "$public_ip $NAME" >> /etc/hosts
cp /etc/iptables/iptables-consoleproxy /etc/iptables/rules cp /etc/iptables/iptables-consoleproxy /etc/iptables/rules
setup_sshd $ETH0_IP if [ -e /dev/cdrom1 ]; then
setup_sshd $ETH1_IP
else
setup_sshd $ETH0_IP
fi
enable_fwding 0 enable_fwding 0
enable_svc haproxy 0 enable_svc haproxy 0
@ -346,6 +353,9 @@ for i in $CMDLINE
eth2ip) eth2ip)
ETH2_IP=$VALUE ETH2_IP=$VALUE
;; ;;
host)
MGMT_HOST=$VALUE
;;
gateway) gateway)
GW=$VALUE GW=$VALUE
;; ;;

View File

@ -14,7 +14,9 @@ COMMIT
-A INPUT -i eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -i eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT -A INPUT -p icmp -j ACCEPT
-A INPUT -i eth0 -p tcp -m state --state NEW -m tcp --dport 3922 -j ACCEPT -A INPUT -i eth0 -p tcp -m state --state NEW -m tcp --dport 3922 -j ACCEPT
-A INPUT -i eth1 -p tcp -m state --state NEW -m tcp --dport 3922 -j ACCEPT
-A INPUT -i eth0 -p tcp -m state --state NEW -m tcp --dport 8001 -j ACCEPT -A INPUT -i eth0 -p tcp -m state --state NEW -m tcp --dport 8001 -j ACCEPT
-A INPUT -i eth1 -p tcp -m state --state NEW -m tcp --dport 8001 -j ACCEPT
-A INPUT -i eth2 -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT -A INPUT -i eth2 -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -i eth2 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -i eth2 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
COMMIT COMMIT

View File

@ -17,4 +17,5 @@ COMMIT
-A INPUT -i lo -j ACCEPT -A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -j ACCEPT -A INPUT -p icmp -j ACCEPT
-A INPUT -i eth0 -p tcp -m state --state NEW --dport 3922 -j ACCEPT -A INPUT -i eth0 -p tcp -m state --state NEW --dport 3922 -j ACCEPT
-A INPUT -i eth1 -p tcp -m state --state NEW --dport 3922 -j ACCEPT
COMMIT COMMIT

View File

@ -8,8 +8,6 @@ def vm_data(args):
router_ip = args.pop('routerIP') router_ip = args.pop('routerIP')
vm_ip = args.pop('vmIP') vm_ip = args.pop('vmIP')
util.SMlog(" adding vmdata for VM with IP: " + vm_ip + " to router with IP: " + router_ip)
for pair in args: for pair in args:
pairList = pair.split(',') pairList = pair.split(',')
vmDataFolder = pairList[0] vmDataFolder = pairList[0]
@ -41,7 +39,6 @@ def vm_data(args):
txt = util.pread2(cmd) txt = util.pread2(cmd)
txt = 'success' txt = 'success'
except: except:
util.SMlog(" vmdata failed with folder: " + vmDataFolder + " and file: " + vmDataFile)
txt = '' txt = ''
if (fd != None): if (fd != None):

View File

@ -230,6 +230,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, VirtualMach
String _domain; String _domain;
String _instance; String _instance;
String _defaultHypervisorType; String _defaultHypervisorType;
String _mgmt_host;
int _routerCleanupInterval = 3600; int _routerCleanupInterval = 3600;
int _routerStatsInterval = 300; int _routerStatsInterval = 300;
@ -970,7 +971,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, VirtualMach
} }
final StartRouterCommand cmdStartRouter = new StartRouterCommand(router, _networkRate, final StartRouterCommand cmdStartRouter = new StartRouterCommand(router, _networkRate,
_multicastRate, name, storageIps, vols, mirroredVols, guestOSDescription); _multicastRate, name, storageIps, vols, mirroredVols, guestOSDescription, _mgmt_host);
answer = _agentMgr.send(routingHost.getId(), cmdStartRouter); answer = _agentMgr.send(routingHost.getId(), cmdStartRouter);
if (answer != null && answer.getResult()) { if (answer != null && answer.getResult()) {
if (answer instanceof StartRouterAnswer){ if (answer instanceof StartRouterAnswer){
@ -1411,6 +1412,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, VirtualMach
final Map<String, String> configs = _configDao.getConfiguration("AgentManager", params); final Map<String, String> configs = _configDao.getConfiguration("AgentManager", params);
_mgmt_host = configs.get("host");
_routerRamSize = NumbersUtil.parseInt(configs.get("router.ram.size"), 128); _routerRamSize = NumbersUtil.parseInt(configs.get("router.ram.size"), 128);
// String value = configs.get("guest.ip.network"); // String value = configs.get("guest.ip.network");