Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 23 lines (16 sloc) 0.898 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/bin/bash

set -e

. @INVENTORY@

names=$(xe pif-list host-uuid="$INSTALLATION_UUID" management=false params=device VLAN=-1 --minimal | sed -e 's/,/+/g')
pifs=$(xe pif-list host-uuid="$INSTALLATION_UUID" management=false VLAN=-1 --minimal)

echo "Creating network associated with $names"
BOND_NET=$(xe network-create name-label="Pool-wide network associated with $names")

BOND=$(xe bond-create network-uuid=$BOND_NET pif-uuids="$pifs")

PIF=$(xe bond-list params=master uuid=$BOND --minimal)

xe pif-list host-uuid="$INSTALLATION_UUID" management=false VLAN=-1 --minimal | sed -e 's/,/\n/g' | while read PIF ; do
    name=$(xe pif-param-get uuid=$PIF param-name=network-name-label)
    VLAN_NR=$(( $RANDOM % 255 ))
    echo "Creating $name vlan $VLAN_NR"
    NET=$(xe network-create name-label="$name vlan $VLAN_NR")
    VLAN=$(xe vlan-create network-uuid=$NET pif-uuid=$PIF vlan=$VLAN_NR)
done
Something went wrong with that request. Please try again.