Skip to content

Commit

Permalink
Minor bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpontillo committed Jun 1, 2016
1 parent cbb986d commit 94cc21a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion aoi
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ from sys import argv

def launch(*args, **kwargs):
cmd = "./" + kwargs.pop('command')
os.chdir(os.path.dirname(argv[0]))
os.chdir(os.path.dirname(os.path.realpath(__file__)))
os.execvp(cmd, (cmd, kwargs.pop('hostname'), kwargs.pop('image')))

def init(*args, **kwargs):
cmd = "./" + kwargs.pop('command')
os.chdir(os.path.dirname(os.path.realpath(__file__)))
os.execvp(cmd, [cmd])

def delete(*args, **kwargs):
cmd = "./" + kwargs.pop('command')
os.chdir(os.path.dirname(os.path.realpath(__file__)))
os.execvp(cmd, [cmd, kwargs.pop('hostname')])

parser = argparse.ArgumentParser(prog='aoi')
Expand Down
27 changes: 16 additions & 11 deletions aoi-configure-networks
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# First, define the testnet network (if needed)
virsh net-dumpxml testnet > /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"
# 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
# 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
# virsh net-destroy $DEFAULT_NETWORK
# virsh net-start $DEFAULT_NETWORK

0 comments on commit 94cc21a

Please sign in to comment.