diff options
9 files changed, 233 insertions, 126 deletions
diff --git a/meta-openstack/classes/compute.bbclass b/meta-openstack/classes/compute.bbclass new file mode 100644 index 00000000..3ed38e0e --- /dev/null +++ b/meta-openstack/classes/compute.bbclass @@ -0,0 +1,2 @@ +CONTROLLER_IP = "192.168.7.2" +CONTROLLER_HOST = "192.168.7.2" diff --git a/meta-openstack/classes/controller.bbclass b/meta-openstack/classes/controller.bbclass new file mode 100644 index 00000000..1db2714b --- /dev/null +++ b/meta-openstack/classes/controller.bbclass @@ -0,0 +1,2 @@ +CONTROLLER_IP = "0.0.0.0" +CONTROLLER_HOST = "localhost" diff --git a/meta-openstack/recipes-devtools/python/python-nova-compute_2013.1.3.bb b/meta-openstack/recipes-devtools/python/python-nova-compute_2013.1.3.bb new file mode 100644 index 00000000..204313d0 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-nova-compute_2013.1.3.bb @@ -0,0 +1,35 @@ + +include python-nova.inc + +PR = "r0" + +FILESEXTRAPATHS := "${THISDIR}/${PYTHON_PN}" + +SRC_URI += "file://nova-compute \ + file://nova.conf \ + file://openrc \ + " + +inherit compute update-rc.d + +PACKAGES = "${SRCNAME}-compute ${SRCNAME}-compute-misc" + +do_install_append() { + if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/nova-compute ${D}${sysconfdir}/init.d/nova-compute + fi +} + +FILES_${SRCNAME}-compute = " ${files_${SRCNAME}-compute}" + +# the controller is built, so we package it out of the way +FILES_${SRCNAME}-compute-misc = "${files_${SRCNAME}-controller} ${files_${SRCNAME}-common} ${files_${PYTHON_PN}}" + +RDEPENDS_${SRCNAME}-compute = "${PYTHON_PN} ${SRCNAME}-common \ + qemu libvirt libvirt-libvirtd libvirt-python libvirt-virsh" + +RCONFLICTS_${SRCNAME}-compute = "${SRCNAME}-controller" + +INITSCRIPT_PACKAGES = "${SRCNAME}-compute" +INITSCRIPT_NAME_${SRCNAME}-compute = "nova-compute" diff --git a/meta-openstack/recipes-devtools/python/python-nova-controller_2013.1.3.bb b/meta-openstack/recipes-devtools/python/python-nova-controller_2013.1.3.bb new file mode 100644 index 00000000..686c1d75 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-nova-controller_2013.1.3.bb @@ -0,0 +1,52 @@ +include python-nova.inc + +PR = "r0" + +FILESEXTRAPATHS := "${THISDIR}/${PYTHON_PN}" + +SRC_URI += "file://nova-all \ + file://nova.conf \ + file://openrc \ + " + +inherit controller update-rc.d + +PACKAGES = "${SRCNAME}-controller ${SRCNAME}-controller-misc" + +do_install_append() { + if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/nova-all ${D}${sysconfdir}/init.d/nova-all + fi +} + +pkg_postinst_${SRCNAME}-controller () { + if [ "x$D" != "x" ]; then + exit 1 + fi + + # This is to make sure postgres is configured and running + if ! pidof postmaster > /dev/null; then + sudo -u postgres initdb -D /etc/postgresql/ + /etc/init.d/postgresql start + sleep 0.2 + sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" + fi + + sudo -u postgres createdb nova + nova-manage db sync +} + + +FILES_${SRCNAME}-controller = "${files_${SRCNAME}-controller}" + +# If the compute is built, so we package it out of the way +FILES_${SRCNAME}-controller-misc = "${files_${SRCNAME}-compute} ${files_${SRCNAME}-common} ${files_${PYTHON_PN}}" + +RDEPENDS_${SRCNAME}-controller = "${PYTHON_PN} ${SRCNAME}-common \ + postgresql postgresql-client python-psycopg2" + +RCONFLICTS_${SRCNAME}-controller = "${SRCNAME}-compute" + +INITSCRIPT_PACKAGES = "${SRCNAME}-controller" +INITSCRIPT_NAME_${SRCNAME}-controller = "nova-all" diff --git a/meta-openstack/recipes-devtools/python/python-nova.inc b/meta-openstack/recipes-devtools/python/python-nova.inc new file mode 100644 index 00000000..be464600 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-nova.inc @@ -0,0 +1,99 @@ +DESCRIPTION = "Nova is a cloud computing fabric controller" +HOMEPAGE = "https://launchpad.net/nova" +SECTION = "devel/python" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2" + +DEPENDS = "sudo" + +SRCNAME = "nova" +PYTHON_PN = "python-nova" + +FILESEXTRAPATHS := "${THISDIR}/${PYTHON_PN}" + +SRC_URI = "https://launchpad.net/${SRCNAME}/grizzly/${PV}/+download/${SRCNAME}-${PV}.tar.gz \ + file://0001-nova-api-paste.ini-make-controller-IP-configurable.patch \ + " + +SRC_URI[md5sum] = "6215982b9ed08b9042e088470d60a0a6" +SRC_URI[sha256sum] = "f7c25186920daccb16867c5fd272318beb8cc076e5a55f79b5906618ef2724f4" + +S = "${WORKDIR}/${SRCNAME}-${PV}" + +inherit setuptools identity + +do_install_append() { + + if [ ! -f "${WORKDIR}/nova.conf" ]; then + return + fi + + TEMPLATE_CONF_DIR=${S}${sysconfdir}/${SRCNAME} + NOVA_CONF_DIR=${D}/${sysconfdir}/nova + + install -d ${NOVA_CONF_DIR} + install -m 600 ${S}/etc/nova/policy.json ${NOVA_CONF_DIR}/ + + # Deploy filters to /etc/nova/rootwrap.d + install -m 755 -d ${NOVA_CONF_DIR}/rootwrap.d + install -m 600 ${S}/etc/nova/rootwrap.d/*.filters ${NOVA_CONF_DIR}/rootwrap.d + chown -R root:root ${NOVA_CONF_DIR}/rootwrap.d + chmod 644 ${NOVA_CONF_DIR}/rootwrap.d + + # Set up rootwrap.conf, pointing to /etc/nova/rootwrap.d + install -m 644 ${S}/etc/nova/rootwrap.conf ${NOVA_CONF_DIR}/ + sed -e "s:^filters_path=.*$:filters_path=${NOVA_CONF_DIR}/rootwrap.d:" \ + -i ${NOVA_CONF_DIR}/rootwrap.conf + chown root:root $NOVA_CONF_DIR/rootwrap.conf + + # Set up the rootwrap sudoers for nova + install -d ${D}${sysconfdir}/sudoers.d + touch ${D}${sysconfdir}/sudoers.d/nova-rootwrap + chmod 0440 ${D}${sysconfdir}/sudoers.d/nova-rootwrap + chown root:root ${D}${sysconfdir}/sudoers.d/nova-rootwrap + echo "root ALL=(root) NOPASSWD: ${bindir}/nova-rootwrap" > \ + ${D}${sysconfdir}/sudoers.d/nova-rootwrap + + # Configuration options + sed -e "s:%SERVICE_TENANT_NAME%:${SERVICE_TENANT_NAME}:g" \ + ${TEMPLATE_CONF_DIR}/api-paste.ini > ${WORKDIR}/api-paste.ini + sed -e "s:%SERVICE_USER%:${SRCNAME}:g" -i ${WORKDIR}/api-paste.ini + sed -e "s:%SERVICE_PASSWORD%:${SERVICE_PASSWORD}:g" \ + -i ${WORKDIR}/api-paste.ini + sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${WORKDIR}/api-paste.ini + + sed -e "s:%DB_USER%:${DB_USER}:g" -i ${WORKDIR}/nova.conf + sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${WORKDIR}/nova.conf + + sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${WORKDIR}/nova.conf + sed -e "s:%CONTROLLER_HOST%:${CONTROLLER_HOST}:g" -i ${WORKDIR}/nova.conf + + sed -e "s:%OS_PASSWORD%:${ADMIN_PASSWORD}:g" -i ${WORKDIR}/openrc + sed -e "s:%SERVICE_TOKEN%:${SERVICE_TOKEN}:g" -i ${WORKDIR}/openrc + + sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${WORKDIR}/openrc + sed -e "s:%CONTROLLER_HOST%:${CONTROLLER_HOST}:g" -i ${WORKDIR}/openrc + + # Copy the configuration file + install -m 664 ${WORKDIR}/nova.conf ${NOVA_CONF_DIR}/nova.conf + install -m 664 ${WORKDIR}/api-paste.ini ${NOVA_CONF_DIR} + install -m 664 ${WORKDIR}/openrc ${NOVA_CONF_DIR} + + install -d ${NOVA_CONF_DIR}/instances +} + +# note the lowercase "files", these variables are used in the packaging +# recipes themselves. +files_${PYTHON_PN} = "${libdir}/*" + +files_${SRCNAME}-common = " ${bindir}/nova-manage \ + ${bindir}/nova-rootwrap \ + ${sysconfdir}/sudoers.d" + +files_${SRCNAME}-compute = " ${bindir}/nova-compute \ + ${sysconfdir}/${SRCNAME}/* \ + ${sysconfdir}/init.d/nova-compute" + +files_${SRCNAME}-controller = " ${bindir}/* \ + ${sysconfdir}/${SRCNAME}/* \ + ${sysconfdir}/init.d/nova-all"
\ No newline at end of file diff --git a/meta-openstack/recipes-devtools/python/python-nova/0001-nova-api-paste.ini-make-controller-IP-configurable.patch b/meta-openstack/recipes-devtools/python/python-nova/0001-nova-api-paste.ini-make-controller-IP-configurable.patch new file mode 100644 index 00000000..7d2ed7e8 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-nova/0001-nova-api-paste.ini-make-controller-IP-configurable.patch @@ -0,0 +1,26 @@ +From dd200f769d745ed4cb02faf40ebc32252046d783 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@windriver.com> +Date: Wed, 28 Aug 2013 01:38:16 -0400 +Subject: [PATCH] nova/api-paste.ini: make controller IP configurable + +Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> +--- + etc/nova/api-paste.ini | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/etc/nova/api-paste.ini b/etc/nova/api-paste.ini +index 34c87b9..c770408 100644 +--- a/etc/nova/api-paste.ini ++++ b/etc/nova/api-paste.ini +@@ -98,7 +98,7 @@ paste.filter_factory = nova.api.auth:NovaKeystoneContext.factory + + [filter:authtoken] + paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory +-auth_host = 127.0.0.1 ++auth_host = %CONTROLLER_IP% + auth_port = 35357 + auth_protocol = http + admin_tenant_name = %SERVICE_TENANT_NAME% +-- +1.7.10.4 + diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova.conf b/meta-openstack/recipes-devtools/python/python-nova/nova.conf index dbbd1a80..f698349a 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/nova.conf +++ b/meta-openstack/recipes-devtools/python/python-nova/nova.conf @@ -34,11 +34,12 @@ force_dhcp_release=False dhcpbridge=/usr/bin/nova-dhcpbridge #Database configuration -sql_connection = postgresql://%DB_USER%:%DB_PASSWORD%@localhost/nova +# sql_connection = postgresql://%DB_USER%:%DB_PASSWORD%@localhost/nova +sql_connection = postgresql://%DB_USER%:%DB_PASSWORD%@%CONTROLLER_HOST%/nova #RabbitMQ configuration rpc_backend = nova.rpc.impl_kombu -rabbit_host = 0.0.0.0 +rabbit_host = %CONTROLLER_IP% rabbit_port = 5672 #Quantum diff --git a/meta-openstack/recipes-devtools/python/python-nova/openrc b/meta-openstack/recipes-devtools/python/python-nova/openrc index 1d0a1ea3..c28f3557 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/openrc +++ b/meta-openstack/recipes-devtools/python/python-nova/openrc @@ -1,6 +1,6 @@ export OS_TENANT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=%OS_PASSWORD% -export OS_AUTH_URL="http://localhost:5000/v2.0/" -export SERVICE_ENDPOINT="http://localhost:35357/v2.0" +export OS_AUTH_URL="http://%CONTROLLER_HOST%:5000/v2.0/" +export SERVICE_ENDPOINT="http://%CONTROLLER_HOST%:35357/v2.0" export SERVICE_TOKEN=%SERVICE_TOKEN% diff --git a/meta-openstack/recipes-devtools/python/python-nova_2013.1.3.bb b/meta-openstack/recipes-devtools/python/python-nova_2013.1.3.bb index 95065fcf..c10bebb1 100644 --- a/meta-openstack/recipes-devtools/python/python-nova_2013.1.3.bb +++ b/meta-openstack/recipes-devtools/python/python-nova_2013.1.3.bb @@ -1,88 +1,6 @@ -DESCRIPTION = "Nova is a cloud computing fabric controller" -HOMEPAGE = "https://launchpad.net/nova" -SECTION = "devel/python" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2" +include python-nova.inc -DEPENDS = "sudo" - -PR = "r0" -SRCNAME = "nova" - -SRC_URI = "https://launchpad.net/${SRCNAME}/grizzly/${PV}/+download/${SRCNAME}-${PV}.tar.gz \ - file://nova.conf \ - file://nova-compute \ - file://nova-all \ - file://openrc \ - " -SRC_URI[md5sum] = "6215982b9ed08b9042e088470d60a0a6" -SRC_URI[sha256sum] = "f7c25186920daccb16867c5fd272318beb8cc076e5a55f79b5906618ef2724f4" - -S = "${WORKDIR}/${SRCNAME}-${PV}" - -inherit setuptools useradd update-rc.d identity - -do_install_append() { - TEMPLATE_CONF_DIR=${S}${sysconfdir}/${SRCNAME} - NOVA_CONF_DIR=${D}/${sysconfdir}/nova - - install -d ${NOVA_CONF_DIR} - install -m 600 ${S}/etc/nova/policy.json ${NOVA_CONF_DIR}/ - - # Deploy filters to /etc/nova/rootwrap.d - install -m 755 -d ${NOVA_CONF_DIR}/rootwrap.d - install -m 600 ${S}/etc/nova/rootwrap.d/*.filters ${NOVA_CONF_DIR}/rootwrap.d - chown -R root:root ${NOVA_CONF_DIR}/rootwrap.d - chmod 644 ${NOVA_CONF_DIR}/rootwrap.d - - # Set up rootwrap.conf, pointing to /etc/nova/rootwrap.d - install -m 644 ${S}/etc/nova/rootwrap.conf ${NOVA_CONF_DIR}/ - sed -e "s:^filters_path=.*$:filters_path=${NOVA_CONF_DIR}/rootwrap.d:" \ - -i ${NOVA_CONF_DIR}/rootwrap.conf - chown root:root $NOVA_CONF_DIR/rootwrap.conf - - # Set up the rootwrap sudoers for nova - install -d ${D}${sysconfdir}/sudoers.d - touch ${D}${sysconfdir}/sudoers.d/nova-rootwrap - chmod 0440 ${D}${sysconfdir}/sudoers.d/nova-rootwrap - chown root:root ${D}${sysconfdir}/sudoers.d/nova-rootwrap - echo "root ALL=(root) NOPASSWD: ${bindir}/nova-rootwrap" > \ - ${D}${sysconfdir}/sudoers.d/nova-rootwrap - - #Configuration options - sed -e "s:%SERVICE_TENANT_NAME%:${SERVICE_TENANT_NAME}:g" \ - ${TEMPLATE_CONF_DIR}/api-paste.ini > ${WORKDIR}/api-paste.ini - sed -e "s:%SERVICE_USER%:${SRCNAME}:g" -i ${WORKDIR}/api-paste.ini - sed -e "s:%SERVICE_PASSWORD%:${SERVICE_PASSWORD}:g" \ - -i ${WORKDIR}/api-paste.ini - - sed -e "s:%DB_USER%:${DB_USER}:g" -i ${WORKDIR}/nova.conf - sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${WORKDIR}/nova.conf - - sed -e "s:%OS_PASSWORD%:${ADMIN_PASSWORD}:g" -i ${WORKDIR}/openrc - sed -e "s:%SERVICE_TOKEN%:${SERVICE_TOKEN}:g" -i ${WORKDIR}/openrc - - #Copy the configuration file - install -m 664 ${WORKDIR}/nova.conf ${NOVA_CONF_DIR}/nova.conf - install -m 664 ${WORKDIR}/api-paste.ini ${NOVA_CONF_DIR} - install -m 664 ${WORKDIR}/openrc ${NOVA_CONF_DIR} - - install -d ${NOVA_CONF_DIR}/instances - - if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/nova-compute ${D}${sysconfdir}/init.d/nova-compute - install -m 0755 ${WORKDIR}/nova-all ${D}${sysconfdir}/init.d/nova-all - fi - -} - -USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM_${PN} = "--system nova" -USERADD_PARAM_${PN} = "--system --home /var/lib/nova -g nova \ - --no-create-home --shell /bin/false nova" - -PACKAGES += "${SRCNAME}-common ${SRCNAME}-compute ${SRCNAME}-controller" +inherit useradd pkg_postinst_${SRCNAME}-common () { if [ "x$D" != "x" ]; then @@ -92,36 +10,21 @@ pkg_postinst_${SRCNAME}-common () { echo "source /etc/nova/openrc" > /home/root/.bashrc } -pkg_postinst_${SRCNAME}-controller () { - if [ "x$D" != "x" ]; then - exit 1 - fi +PACKAGES += "${SRCNAME}-common ${SRCNAME}-common-misc" - # This is to make sure postgres is configured and running - if ! pidof postmaster > /dev/null; then - sudo -u postgres initdb -D /etc/postgresql/ - /etc/init.d/postgresql start - sleep 0.2 - sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '${DB_PASSWORD}'" - fi +FILES_${PN} = "${files_${PN}}" - sudo -u postgres createdb nova - nova-manage db sync -} - - -FILES_${PN} = "${libdir}/*" +FILES_${SRCNAME}-common = "${files_${SRCNAME}-common}" -FILES_${SRCNAME}-common = " ${bindir}/nova-manage \ - ${bindir}/nova-rootwrap \ - ${sysconfdir}/${SRCNAME}/* \ - ${sysconfdir}/sudoers.d" +FILES_${SRCNAME}-common-misc = "${files_${SRCNAME}-compute} ${files_${SRCNAME}-controller}" -FILES_${SRCNAME}-compute = "${bindir}/nova-compute \ - ${sysconfdir}/init.d/nova-compute" +RDEPENDS_${SRCNAME}-common = "${PN} openssl openssl-misc libxml2 libxslt \ + iptables curl dnsmasq sudo procps" -FILES_${SRCNAME}-controller = "${bindir}/* \ - ${sysconfdir}/init.d/nova-all" +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM_${PN} = "--system nova" +USERADD_PARAM_${PN} = "--system --home /var/lib/nova -g nova \ + --no-create-home --shell /bin/false nova" RDEPENDS_${PN} = " python-modules \ python-misc \ @@ -158,16 +61,3 @@ RDEPENDS_${PN} = " python-modules \ python-webob \ python-websockify \ " - -RDEPENDS_${SRCNAME}-common = "${PN} openssl openssl-misc libxml2 libxslt \ - iptables curl dnsmasq sudo procps" - -RDEPENDS_${SRCNAME}-compute = "${PN} nova-common \ - qemu libvirt libvirt-libvirtd libvirt-python libvirt-virsh" - -RDEPENDS_${SRCNAME}-controller = "${PN} nova-common \ - postgresql postgresql-client python-psycopg2" - -INITSCRIPT_PACKAGES = "${SRCNAME}-compute ${SRCNAME}-controller" -INITSCRIPT_NAME_${SRCNAME}-compute = "nova-compute" -INITSCRIPT_NAME_${SRCNAME}-controller = "nova-all" |