Remove hardcoding of flat network bridge

Change-Id: I66210ba438c1d8a2c12223b8895581127130ad5f
diff --git a/stack.sh b/stack.sh
index 9242182..35a7b3d 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1262,6 +1262,8 @@
 # ---------
 
 if [ "$VIRT_DRIVER" = 'xenserver' ]; then
+    # Get the VM bridge
+    FLAT_NETWORK_BRIDGE=$(grep -o 'flat_network_bridge=[^.]*' /proc/cmdline | cut -d= -f 2)
     read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN."
     add_nova_flag "--connection_type=xenapi"
     add_nova_flag "--xenapi_connection_url=http://169.254.0.1"
@@ -1269,8 +1271,8 @@
     add_nova_flag "--xenapi_connection_password=$XENAPI_PASSWORD"
     add_nova_flag "--noflat_injected"
     add_nova_flag "--flat_interface=eth1"
-    add_nova_flag "--flat_network_bridge=xapi1"
-    add_nova_flag "--public_interface=eth3"
+    add_nova_flag "--flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
+    add_nova_flag "--public_interface=${HOST_IP_IFACE}"
     # Need to avoid crash due to new firewall support
     XEN_FIREWALL_DRIVER=${XEN_FIREWALL_DRIVER:-"nova.virt.firewall.IptablesFirewallDriver"}
     add_nova_flag "--firewall_driver=$XEN_FIREWALL_DRIVER"
diff --git a/tools/xen/build_domU.sh b/tools/xen/build_domU.sh
index 455ad26..a0fd316 100755
--- a/tools/xen/build_domU.sh
+++ b/tools/xen/build_domU.sh
@@ -182,7 +182,7 @@
 if [ -z $PUB_BR ]; then
     PUB_BR=$(xe network-list --minimal uuid=$PUB_NET params=bridge)
 fi
-$TOP_DIR/scripts/install-os-vpx.sh -f $XVA -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -w
+$TOP_DIR/scripts/install-os-vpx.sh -f $XVA -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -w -k "flat_network_bridge=${VM_BR}"
 
 # If we have copied our ssh credentials, use ssh to monitor while the installation runs
 WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1}