diff --git a/config.yaml b/config.yaml index 3e0d0fc..73f5c6f 100644 --- a/config.yaml +++ b/config.yaml @@ -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. + diff --git a/hooks/config-changed b/hooks/config-changed new file mode 120000 index 0000000..6f9ff4f --- /dev/null +++ b/hooks/config-changed @@ -0,0 +1 @@ +nova-compute-relations \ No newline at end of file diff --git a/hooks/nova-compute-common b/hooks/nova-compute-common index 9009f4e..9d42add 100755 --- a/hooks/nova-compute-common +++ b/hooks/nova-compute-common @@ -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 diff --git a/hooks/nova-compute-relations b/hooks/nova-compute-relations index 39a67df..8942c00 100755 --- a/hooks/nova-compute-relations +++ b/hooks/nova-compute-relations @@ -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 ;;