diff options
author | Szilard Cserey <szilard.cserey@ericsson.com> | 2015-09-21 01:36:21 +0200 |
---|---|---|
committer | Szilard Cserey <szilard.cserey@ericsson.com> | 2015-09-21 16:32:38 +0200 |
commit | 7972d9699abd16bd115ff1b440e057131178efd6 (patch) | |
tree | 616efb01f335ad74f6a8a25d6634b2330f22b428 | |
parent | 53cee12e3767a2a8e31dbefaa68a3fc2881abde2 (diff) |
Grant access for Fuel VM to external public network
Change-Id: I429d41ea9942321fb4768a5a4d46d0976adbf47d
Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
-rwxr-xr-x | common/ci/setup.sh | 42 | ||||
-rw-r--r-- | fuel/deploy/deploy_env.py | 7 | ||||
-rw-r--r-- | fuel/deploy/install_fuel_master.py | 2 | ||||
-rw-r--r-- | fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dha.yaml | 10 |
4 files changed, 43 insertions, 18 deletions
diff --git a/common/ci/setup.sh b/common/ci/setup.sh index 380ac4d..82fede4 100755 --- a/common/ci/setup.sh +++ b/common/ci/setup.sh @@ -10,7 +10,8 @@ reset=`tput sgr0` blue=`tput setaf 4` red=`tput setaf 1` green=`tput setaf 2` -interface='enp7s0' +private_interface='enp6s0' +public_interface='enp8s0' pxe_bridge='pxebr' fuel_gw_ip='10.20.0.1/16' ##END VARS @@ -100,26 +101,26 @@ check_interface() { } setup_pxe_bridge() { - #Check whether base interface exists - echo "${blue}Checking whether base interface ${interface} exists${reset}" - if ! ip link show ${interface}; then - echo "${red}Base interface ${interface} does not exists!${reset}" + #Check whether private interface exists + echo "${blue}Checking whether private interface ${private_interface} exists${reset}" + if ! ip link show ${private_interface}; then + echo "${red}Private interface ${private_interface} does not exists!${reset}" exit 1 else echo "${green}OK!${reset}" fi - #Check whether base interface is UP - check_interface ${interface} + #Check whether private interface is UP + check_interface ${private_interface} pxe_vid=0 - pxe_interface="${interface}.${pxe_vid}" + pxe_interface="${private_interface}.${pxe_vid}" #Check whether VLAN 0 (PXE) interface exists echo "${blue}Checking whether VLAN 0 (PXE) interface ${pxe_interface} exists${reset}" if ! ip link show ${pxe_interface}; then echo "${blue}Creating VLAN 0 (PXE) interface ${pxe_interface}${reset}" - ip link add link ${interface} name ${pxe_interface} type vlan id ${pxe_vid} + ip link add link ${private_interface} name ${pxe_interface} type vlan id ${pxe_vid} else echo "${green}OK!${reset}" fi @@ -165,6 +166,28 @@ setup_pxe_bridge() { echo "${green}OK!${reset}" fi } +###check whether access to public network is granted +check_access_enabled_to_public_network() { + #Check whether public interface exists + echo "${blue}Checking whether public interface ${public_interface} exists${reset}" + if ! ip link show ${public_interface}; then + echo "${red}Public interface ${public_interface} does not exists!${reset}" + exit 1 + else + echo "${green}OK!${reset}" + fi + + #Check whether public interface ${public_interface} is UP + check_interface ${public_interface} + + echo "${blue}Checking whether access is granted to public network through interface ${public_interface}${reset}" + if ! sudo iptables -t nat -L POSTROUTING -v | grep "MASQUERADE.*${public_interface}.*anywhere.*anywhere"; then + echo "${blue}Enable access to public network through interface ${public_interface}${reset}" + iptables -t nat -A POSTROUTING -o ${public_interface} -j MASQUERADE + else + echo "${green}OK!${reset}" + fi +} ##END FUNCTIONS main() { @@ -173,6 +196,7 @@ main() { load_kvm_kernel_mod start_libvirtd_service setup_pxe_bridge + check_access_enabled_to_public_network } main "$@" diff --git a/fuel/deploy/deploy_env.py b/fuel/deploy/deploy_env.py index fb3cf12..be8bed3 100644 --- a/fuel/deploy/deploy_env.py +++ b/fuel/deploy/deploy_env.py @@ -88,9 +88,10 @@ class CloudDeploy(object): blade_node_file = '%s/%s' % ( self.work_dir, os.path.basename(self.blade_node_file)) with self.ssh as s: - status = s.run('python %s %s %s %s' - % (('-nh' if self.no_health_check else ''), - deploy_app, dea_file, blade_node_file)) + status = s.run( + 'python %s %s %s %s' % ( + deploy_app, ('-nh' if self.no_health_check else ''), + dea_file, blade_node_file)) return status def check_supported_release(self): diff --git a/fuel/deploy/install_fuel_master.py b/fuel/deploy/install_fuel_master.py index b4e12d4..acacf37 100644 --- a/fuel/deploy/install_fuel_master.py +++ b/fuel/deploy/install_fuel_master.py @@ -115,7 +115,7 @@ class InstallFuelMaster(object): r, e = s.exec_cmd('fuel plugins --install %s' % f, False) if e and 'does not update installed package' not in r: raise Exception('Installation of Fuel Plugin %s ' - 'failed' % f) + 'failed: %s' % (f, e)) def wait_for_node_up(self): WAIT_LOOP = 60 diff --git a/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dha.yaml b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dha.yaml index aa0c6d7..cfc9709 100644 --- a/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dha.yaml +++ b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dha.yaml @@ -12,27 +12,27 @@ adapter: ipmi nodes: - id: 1 - pxeMac: 00:25:B5:A0:00:2A + pxeMac: 00:25:b5:a0:00:2a ipmiIp: 172.30.8.75 ipmiUser: admin ipmiPass: octopus - id: 2 - pxeMac: 00:25:B5:A0:00:3A + pxeMac: 00:25:b5:a0:00:3a ipmiIp: 172.30.8.65 ipmiUser: admin ipmiPass: octopus - id: 3 - pxeMac: 00:25:B5:A0:00:4A + pxeMac: 00:25:b5:a0:00:4a ipmiIp: 172.30.8.74 ipmiUser: admin ipmiPass: octopus - id: 4 - pxeMac: 00:25:B5:A0:00:5A + pxeMac: 00:25:b5:a0:00:5a ipmiIp: 172.30.8.73 ipmiUser: admin ipmiPass: octopus - id: 5 - pxeMac: 00:25:B5:A0:00:6A + pxeMac: 00:25:b5:a0:00:6a ipmiIp: 172.30.8.72 ipmiUser: admin ipmiPass: octopus |