Convert to Juju Charm

This commit is contained in:
Adam Gandelman 2011-09-16 14:55:02 -07:00
parent 61b687f46b
commit 6e72e5b5c2
4 changed files with 19 additions and 19 deletions

View File

@ -1,45 +1,45 @@
options: options:
nova-release: nova-release:
default: distro default: distro
type: str type: string
description: Nova PPA from which to install. (distro, trunk, milestone, milestone-proposed) description: Nova PPA from which to install. (distro, trunk, milestone, milestone-proposed)
nova-config: nova-config:
default: /etc/nova/nova.conf default: /etc/nova/nova.conf
type: str type: string
description: Full path to nova.conf description: Full path to nova.conf
rabbit-user: rabbit-user:
default: nova default: nova
type: str type: string
description: Username used to access rabbitmq queue description: Username used to access rabbitmq queue
rabbit-vhost: rabbit-vhost:
default: nova default: nova
type: str type: string
decsription: Rabbitmq vhost decsription: Rabbitmq vhost
db-user: db-user:
default: nova default: nova
type: str type: string
description: Username for database access description: Username for database access
nova-db: nova-db:
default: nova default: nova
type: str type: string
description: Database name description: Database name
# needed if using flatmanager # needed if using flatmanager
bridge-interface: bridge-interface:
default: br100 default: br100
type: str type: string
description: Bridge interface to be configured description: Bridge interface to be configured
bridge-ip: bridge-ip:
default: 11.0.0.1 default: 11.0.0.1
type: str type: string
description: IP to be assigned to bridge interface description: IP to be assigned to bridge interface
bridge-netmask: bridge-netmask:
default: 255.255.255.0 default: 255.255.255.0
type: str type: string
description: Netmask to be assigned to bridge interface description: Netmask to be assigned to bridge interface
# needed if using flatdhcpmanager # needed if using flatdhcpmanager
flat-interface: flat-interface:
default: eth1 default: eth1
type: str type: string
description: Network interface on which to build bridge description: Network interface on which to build bridge

View File

@ -20,7 +20,7 @@ function set_or_update {
[[ -z $KEY ]] && exit 1 [[ -z $KEY ]] && exit 1
[[ -z $VALUE ]] && exit 1 [[ -z $VALUE ]] && exit 1
cat $NOVA_CONF | grep "\-\-$KEY=$VALUE" >/dev/null \ cat $NOVA_CONF | grep "\-\-$KEY=$VALUE" >/dev/null \
&& ensemble-log "nova-compute: $KEY=$VALUE already set" exit 0 && juju-log "nova-compute: $KEY=$VALUE already set" exit 0
if cat $NOVA_CONF | grep "\-\-$KEY=" >/dev/null ; then if cat $NOVA_CONF | grep "\-\-$KEY=" >/dev/null ; then
sed -i "s|\(--$KEY=\).*|\1$VALUE|" $NOVA_CONF sed -i "s|\(--$KEY=\).*|\1$VALUE|" $NOVA_CONF
else else
@ -47,7 +47,7 @@ function nova_ctl {
fi fi
ACTION=$2 ACTION=$2
if [[ -z $CTL ]] || [[ -z $ACTION ]] ; then if [[ -z $CTL ]] || [[ -z $ACTION ]] ; then
ensemble-log "ERROR nova_ctl: Not enough arguments" juju-log "ERROR nova_ctl: Not enough arguments"
exit 1 exit 1
fi fi
for i in $CTL ; do for i in $CTL ; do
@ -60,7 +60,7 @@ function nova_ctl {
nova_ctl_status $i && service $i restart || service $i start ;; nova_ctl_status $i && service $i restart || service $i start ;;
esac esac
if [[ $? != 0 ]] ; then if [[ $? != 0 ]] ; then
ensemble-log "nova_ctl: ERROR - Service $i failed to $ACTION" juju-log "nova_ctl: ERROR - Service $i failed to $ACTION"
fi fi
done done
} }
@ -107,7 +107,7 @@ function configure_network_manager {
"FlatDHCPManager") "FlatDHCPManager")
FLAT_INTERFACE=$(config-get flat-interface) FLAT_INTERFACE=$(config-get flat-interface)
EC2_HOST=$(relation-get ec2_host) EC2_HOST=$(relation-get ec2_host)
[[ -z $EC2_HOST ]] && ensemble-log "nova-compute: Missing EC2_HOST" \ [[ -z $EC2_HOST ]] && juju-log "nova-compute: Missing EC2_HOST" \
&& exit 0 && exit 0
set_or_update network_manager nova.network.manager.FlatDHCPManager set_or_update network_manager nova.network.manager.FlatDHCPManager
# the interface on which bridge is built # the interface on which bridge is built
@ -123,7 +123,7 @@ function configure_network_manager {
function add_ppa { function add_ppa {
# don't setup PPA, install from archive # don't setup PPA, install from archive
[[ $PPA == "distro" ]] && return 0 [[ $PPA == "distro" ]] && return 0
ensemble-log "nova-compute: Configuring PPA access for $PPA" juju-log "nova-compute: Configuring PPA access for $PPA"
. /etc/lsb-release . /etc/lsb-release
PPA_URL="deb http://ppa.launchpad.net/nova-core/$PPA/ubuntu $DISTRIB_CODENAME main" PPA_URL="deb http://ppa.launchpad.net/nova-core/$PPA/ubuntu $DISTRIB_CODENAME main"
echo "Executing: add-apt-repository \"$PPA_URL\"" || exit 1 echo "Executing: add-apt-repository \"$PPA_URL\"" || exit 1

View File

@ -14,7 +14,7 @@ function install_hook {
apt-get update || exit 1 apt-get update || exit 1
apt-get -y install $SERVICES || exit 1 apt-get -y install $SERVICES || exit 1
# XXX sudo on the ensemble sample AMI doesnt function # XXX sudo on the juju sample AMI doesnt function
# as it should (doesn't include suoders.d/*). do this # as it should (doesn't include suoders.d/*). do this
# manually until we can use any AMI # manually until we can use any AMI
echo "nova ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers echo "nova ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers
@ -23,7 +23,7 @@ function install_hook {
} }
function amqp_joined { function amqp_joined {
ensemble-log "amqp_joined: requesting credentials for $RABBIT_USER" juju-log "amqp_joined: requesting credentials for $RABBIT_USER"
echo "amqp_joined: requesting credentials for $RABBIT_USER" echo "amqp_joined: requesting credentials for $RABBIT_USER"
relation-set username=$RABBIT_USER relation-set username=$RABBIT_USER
relation-set vhost=$RABBIT_VHOST relation-set vhost=$RABBIT_VHOST
@ -47,7 +47,7 @@ function amqp_changed {
function db_joined { function db_joined {
# tell mysql provider which database we want. it will create it and give us # tell mysql provider which database we want. it will create it and give us
# credentials # credentials
ensemble-log "db_joined: requesting database access to $NOVA_DB for $DB_USER@$IP" juju-log "db_joined: requesting database access to $NOVA_DB for $DB_USER@$IP"
relation-set database=$NOVA_DB relation-set database=$NOVA_DB
relation-set username=$DB_USER relation-set username=$DB_USER
relation-set hostname=$HOSTNAME relation-set hostname=$HOSTNAME

View File

@ -1,6 +1,6 @@
ensemble: formula ensemble: formula
name: nova-compute name: nova-compute
revision: 36 revision: 37
summary: "OpenStack compute" summary: "OpenStack compute"
description: | description: |
OpenStack Compute, codenamed Nova, is a cloud computing fabric controller. In OpenStack Compute, codenamed Nova, is a cloud computing fabric controller. In