Allow user-defined nova.conf flags in charm config. Add config-changed hook
This commit is contained in:
parent
4adb6c7ea7
commit
cc79e4fccb
@ -27,7 +27,6 @@ options:
|
||||
default: kvm
|
||||
type: string
|
||||
description: "Virtualization flavor. Supported: kvm, xen, uml, lxc. qemu"
|
||||
|
||||
# needed if using flatmanager
|
||||
bridge-interface:
|
||||
default: br100
|
||||
@ -41,9 +40,13 @@ options:
|
||||
default: 255.255.255.0
|
||||
type: string
|
||||
description: Netmask to be assigned to bridge interface
|
||||
|
||||
# needed if using flatdhcpmanager
|
||||
flat-interface:
|
||||
default: eth1
|
||||
type: string
|
||||
description: Network interface on which to build bridge
|
||||
config-flags:
|
||||
default: None
|
||||
type: string
|
||||
description: Comma separated list of key=value config flags to be set in nova.conf.
|
||||
|
||||
|
1
hooks/config-changed
Symbolic link
1
hooks/config-changed
Symbolic link
@ -0,0 +1 @@
|
||||
nova-compute-relations
|
@ -28,6 +28,19 @@ function set_or_update {
|
||||
fi
|
||||
}
|
||||
|
||||
function set_config_flags() {
|
||||
# Set user-defined nova.conf flags from deployment config
|
||||
juju-log "Processing config-flags."
|
||||
flags=$(config-get config-flags)
|
||||
if [[ "$flags" != "None" && -n "$flags" ]] ; then
|
||||
for f in $(echo $flags | sed -e 's/,/ /g') ; do
|
||||
k=$(echo $f | cut -d= -f1)
|
||||
v=$(echo $f | cut -d= -f2)
|
||||
set_or_update "$k" "$v"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function nova_ctl_status {
|
||||
SERVICE=$1
|
||||
# workaround upstarts lack of scriptable return codes
|
||||
|
@ -11,7 +11,8 @@ fi
|
||||
function install_hook {
|
||||
[[ -z $VIRT_TYPE ]] && VIRT_TYPE="kvm"
|
||||
case $VIRT_TYPE in
|
||||
"kvm"|"qemu") COMPUTE_PKG="nova-compute-kvm";;
|
||||
"kvm") COMPUTE_PKG="nova-compute-kvm";;
|
||||
"qemu") COMPUTE_PKG="nova-compute-qemu";;
|
||||
"xen") COMPUTE_PKG="nova-compute-xen";;
|
||||
"uml") COMPUTE_PKG="nova-compute-uml";;
|
||||
"lxc") COMPUTE_PKG="nova-compute-lxc";;
|
||||
@ -22,29 +23,17 @@ function install_hook {
|
||||
apt-get update || exit 1
|
||||
apt-get -y install $COMPUTE_PKG nova-api nova-network || exit 1
|
||||
|
||||
# there is no nova-compute-qemu pkg. Install kvm and reconfigure
|
||||
# manually for qemu.
|
||||
if [[ "$VIRT_TYPE" == "qemu" ]] ; then
|
||||
sed -i 's/\(\-\-libvirt_type=\).*/\1qemu/g' /etc/nova/nova-compute.conf
|
||||
fi
|
||||
# Configure any flags specified in deployment config
|
||||
set_config_flags
|
||||
|
||||
# XXX sudo on the juju sample AMI doesnt function
|
||||
# as it should (doesn't include suoders.d/*). do this
|
||||
# manually until we can use any AMI
|
||||
echo "nova ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers
|
||||
|
||||
# DISABLED till SSL cert stuff is done (otherwise libvirt wont start)
|
||||
# update /etc/default/libvirt-bin to listen on tcp
|
||||
# for live migration purposes
|
||||
#DEFAULT_OPTS=$(grep "^libvirtd_opts" /etc/default/libvirt-bin | cut -d= -f2)
|
||||
#if ! echo $DEFAULT_OPTS | grep '\-l' >/dev/null ; then
|
||||
# juju-log "Updating /etc/default/libvirt-bin"
|
||||
# sed -i "s/\(^libvirtd_opts=\"\)/\1-l /g" /etc/default/libvirt-bin
|
||||
# service libvirt-bin restart
|
||||
#fi
|
||||
nova_ctl all stop
|
||||
}
|
||||
|
||||
function config_changed {
|
||||
set_config_flags
|
||||
nova_ctl all restart
|
||||
}
|
||||
|
||||
function amqp_joined {
|
||||
juju-log "amqp_joined: requesting credentials for $RABBIT_USER"
|
||||
echo "amqp_joined: requesting credentials for $RABBIT_USER"
|
||||
@ -133,6 +122,7 @@ function keystone_joined {
|
||||
case $ARG0 in
|
||||
"install") install_hook ;;
|
||||
"start"|"stop") exit 0 ;;
|
||||
"config-changed") config_changed ;;
|
||||
"amqp-relation-joined") amqp_joined ;;
|
||||
"amqp-relation-changed") amqp_changed ;;
|
||||
"shared-db-relation-joined") db_joined ;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user