Browse code

Merge "Insert required iptables rules for Ironic" into stable/icehouse

Jenkins authored on 2014/06/20 12:32:00
Showing 3 changed files
... ...
@@ -1,3 +1,4 @@
1
+iptables
1 2
 libguestfs0
2 3
 libvirt-bin
3 4
 openssh-client
... ...
@@ -1,6 +1,8 @@
1
+iptables
1 2
 libguestfs
2 3
 libvirt
3 4
 libvirt-python
5
+net-tools
4 6
 openssh-clients
5 7
 openvswitch
6 8
 python-libguestfs
... ...
@@ -380,11 +380,16 @@ function enroll_vms {
380 380
     neutron port-delete $PORT_ID
381 381
 }
382 382
 
383
-function configure_tftpd {
384
-    # enable tftp natting for allowing connections to SERVICE_HOST's tftp server
383
+function configure_iptables {
384
+    # enable tftp natting for allowing connections to HOST_IP's tftp server
385 385
     sudo modprobe nf_conntrack_tftp
386 386
     sudo modprobe nf_nat_tftp
387
+    # nodes boot from TFTP and callback to the API server listening on $HOST_IP
388
+    sudo iptables -I INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
389
+    sudo iptables -I INPUT -d $HOST_IP -p tcp --dport 6385 -j ACCEPT || true
390
+}
387 391
 
392
+function configure_tftpd {
388 393
     if is_ubuntu; then
389 394
         PXEBIN=/usr/lib/syslinux/pxelinux.0
390 395
     elif is_fedora; then
... ...
@@ -528,6 +533,7 @@ function prepare_baremetal_basic_ops {
528 528
     create_bridge_and_vms
529 529
     enroll_vms
530 530
     configure_tftpd
531
+    configure_iptables
531 532
 
532 533
     # restart nova-compute to ensure its resource tracking is up to
533 534
     # date with newly enrolled nodes
... ...
@@ -547,6 +553,10 @@ function cleanup_baremetal_basic_ops {
547 547
     sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/cleanup-nodes $IRONIC_VM_COUNT $IRONIC_VM_NETWORK_BRIDGE"
548 548
     sudo rm -rf /etc/xinetd.d/tftp /etc/init/tftpd-hpa.override
549 549
     restart_service xinetd
550
+    sudo iptables -D INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
551
+    sudo iptables -D INPUT -d $HOST_IP -p tcp --dport 6385 -j ACCEPT || true
552
+    sudo rmmod nf_conntrack_tftp || true
553
+    sudo rmmod nf_nat_tftp || true
550 554
 }
551 555
 
552 556
 # Restore xtrace + pipefail