Browse code

Merge "Insert required iptables rules for Ironic"

Jenkins authored on 2014/05/03 06:28:24
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
... ...
@@ -393,11 +393,16 @@ function enroll_vms {
393 393
     neutron port-delete $PORT_ID
394 394
 }
395 395
 
396
-function configure_tftpd {
397
-    # enable tftp natting for allowing connections to SERVICE_HOST's tftp server
396
+function configure_iptables {
397
+    # enable tftp natting for allowing connections to HOST_IP's tftp server
398 398
     sudo modprobe nf_conntrack_tftp
399 399
     sudo modprobe nf_nat_tftp
400
+    # nodes boot from TFTP and callback to the API server listening on $HOST_IP
401
+    sudo iptables -I INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
402
+    sudo iptables -I INPUT -d $HOST_IP -p tcp --dport 6385 -j ACCEPT || true
403
+}
400 404
 
405
+function configure_tftpd {
401 406
     if is_ubuntu; then
402 407
         PXEBIN=/usr/lib/syslinux/pxelinux.0
403 408
     elif is_fedora; then
... ...
@@ -520,6 +525,7 @@ function prepare_baremetal_basic_ops {
520 520
     create_bridge_and_vms
521 521
     enroll_vms
522 522
     configure_tftpd
523
+    configure_iptables
523 524
 
524 525
     # restart nova-compute to ensure its resource tracking is up to
525 526
     # date with newly enrolled nodes
... ...
@@ -539,6 +545,10 @@ function cleanup_baremetal_basic_ops {
539 539
     sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/cleanup-nodes $IRONIC_VM_COUNT $IRONIC_VM_NETWORK_BRIDGE"
540 540
     sudo rm -rf /etc/xinetd.d/tftp /etc/init/tftpd-hpa.override
541 541
     restart_service xinetd
542
+    sudo iptables -D INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
543
+    sudo iptables -D INPUT -d $HOST_IP -p tcp --dport 6385 -j ACCEPT || true
544
+    sudo rmmod nf_conntrack_tftp || true
545
+    sudo rmmod nf_nat_tftp || true
542 546
 }
543 547
 
544 548
 # Restore xtrace + pipefail