-
Notifications
You must be signed in to change notification settings - Fork 1
/
aoi-configure-networks
executable file
·34 lines (27 loc) · 1.16 KB
/
aoi-configure-networks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash -e
DEFAULT_DOMAIN=vm
DEFAULT_NETWORK=default
TEST_NETWORK=testnet
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# First, define the testnet network (if needed)
virsh net-dumpxml "$TEST_NETWORK" > /dev/null 2> /dev/null || ./aoi-create-test-network
# XXX This is disabled for now, since virsh networks do not consider
# themselves authoritative. So forwarding DNS queries to a virsh-managed
# dnsmasq instance doesn't always work out well.
# Next, create a temporary directory for modifying the XML for the default
# network. We want to give it a DNS domain, so we can forward DNS queries to
# it.
# TMPDIR="$(mktemp -d)"
# function cleanup {
# rm -rf $TMPDIR
# }
# trap cleanup EXIT
# cd "$TMPDIR"
# Dump the XML for the default domain, modify the domain, and then redefine
# the network. Then stop and start it for the changes to take effect.
# virsh net-dumpxml $DEFAULT_NETWORK > default.xml
# $SCRIPT_DIR/aoi-update-virsh-net-xml-domain default.xml $DEFAULT_DOMAIN > new.xml
# virsh net-define new.xml
# Don't worry, this doesn't destroy anything. Just stops the network.
# virsh net-destroy $DEFAULT_NETWORK
# virsh net-start $DEFAULT_NETWORK