Message ID | 20161114123334.5585-2-anthony.perard@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Nov 14, 2016 at 12:33:32PM +0000, Anthony PERARD wrote: > This script installs any necessary packages and clones all of the OpenStack > trees which are used by devstack to deploy OpenStack. > > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> .. snip.. > diff --git a/ts-openstack-deploy b/ts-openstack-deploy > new file mode 100755 > index 0000000..f26963a > --- /dev/null > +++ b/ts-openstack-deploy > @@ -0,0 +1,132 @@ > +#!/usr/bin/perl > +# This is part of "osstest", an automated testing framework for Xen. > +# Copyright (C) 2015 Citrix Inc. 2016. > +# > +# This program is free software: you can redistribute it and/or modify > +# it under the terms of the GNU Affero General Public License as published by > +# the Free Software Foundation, either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU Affero General Public License for more details. > +# > +# You should have received a copy of the GNU Affero General Public License > +# along with this program. If not, see <http://www.gnu.org/licenses/>. > + > +use strict qw(vars); > +use Osstest; > +use Osstest::TestSupport; > +use Osstest::BuildSupport; > + > +tsreadconfig(); > +our ($whhost) = @ARGV; > +$whhost ||= 'host'; > +our $ho = selecthost($whhost); > +our $builddir = target_jobdir($ho); > + > +sub packages () { > + target_install_packages($ho, qw(git sudo)); > +} > +sub checkout () { > + prepbuilddirs(); > + build_clone($ho, 'cinder', $builddir, 'cinder'); > + build_clone($ho, 'devstack', $builddir, 'devstack'); > + build_clone($ho, 'glance', $builddir, 'glance'); > + build_clone($ho, 'keystone', $builddir, 'keystone'); > + build_clone($ho, 'nova', $builddir, 'nova'); > + build_clone($ho, 'requirements', $builddir, 'requirements'); > + build_clone($ho, 'tempest', $builddir, 'tempest'); > + > + my $vg = target_choose_vg($ho, 10*1024); # 10GB > + target_putfilecontents_stash($ho, 60, <<END, $builddir.'/devstack/local.conf'); > +[[local|localrc]] > +# Everything should be cloned by osstest, so devstack don't have to do it > +ERROR_ON_CLONE=True > +USE_SCREEN=False > +ADMIN_PASSWORD=secretadmin > +DATABASE_PASSWORD=secretdatabase > +RABBIT_PASSWORD=secretrabbit > +SERVICE_PASSWORD=secretservice > +SERVICE_TOKEN=atokenserviced > +# make it small because there is no way to not have this lvm volume created > +VOLUME_BACKING_FILE_SIZE=50M > +CINDER_LVM_TYPE=default > +DEST=$builddir > +DATA_DIR=\$DEST/data > +SERVICE_DIR=\$DEST/status > +SUBUNIT_OUTPUT=\$DEST/devstack.subunit > +LOGFILE=\$DEST/logs/stack.sh.log > +LOG_COLOR=False > +LIBVIRT_TYPE=xen > +disable_service horizon > +disable_service n-novnc > +disable_service dstat > +enable_service n-obj > +# Disable neutron and switch back to nova-network > +disable_service q-svc > +disable_service q-dhcp > +disable_service q-meta > +disable_service q-agt > +disable_service q-l3 > +enable_service n-net > +[[post-config|\$CINDER_CONF]] > +[lvmdriver-1] > +volume_group = $vg > +END > + > + # libvirt is already installed, but not as a package, so avoid installation of > + # the libvirt package with devstack > + # https://bugs.launchpad.net/devstack/+bug/1641144 > + target_editfile($ho, "$builddir/devstack/files/debs/nova", sub { > + while (<EI>) { > + next if m/.*libvirt.*/; > + print EO or die $!; > + } > + }); > + target_editfile($ho, "$builddir/devstack/lib/nova_plugins/functions-libvirt", sub { > + while (<EI>) { > + next if m/install_package.*libvirt.*/; > + print EO or die $!; > + } > + }); > + > + # devstack blindly assume that systemd is used if systemctl is present > + # https://bugs.launchpad.net/devstack/+bug/1641112 Would it make sense to put xen-devel as an CC on those bugs so when there is an resolution these changes would be removed? Or would we keep them forever (which looks to be OK). > + target_editfile($ho, "$builddir/devstack/functions-common", sub { > + while (<EI>) { > + if (m#\[ -x /bin/systemctl#) { > + s#\[ -x /bin/systemctl \]#false# > + } > + print EO or die $!; > + } > + }); > + > + # OpenStack needs access to libvirt from a user. > + target_cmd_root($ho, <<END); > + addgroup --system libvirt > + cat >> /etc/libvirt/libvirtd.conf <<EOF > +unix_sock_group = "libvirt" > +unix_sock_ro_perms = "0777" > +unix_sock_rw_perms = "0770" > +EOF > + service libvirtd restart > +END > + > + # devstack is going to setup the host, install some dependency. You mean give it access to install whatever it wants. > + target_putfilecontents_root_stash($ho, 100, <<END,"/etc/sudoers.d/devstack"); > +osstest ALL=(ALL) NOPASSWD:ALL > +END > +} > + > +sub deploy() { > + target_cmd($ho, <<END, 1800); > + cd $builddir/devstack > + ./stack.sh > +END > +} > + > +packages(); > +checkout(); > +deploy(); > -- > Anthony PERARD > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > https://lists.xen.org/xen-devel
Anthony PERARD writes ("[OSSTEST PATCH v7 1/3] ts-openstack-deploy: Deploy OpenStack on a host with devstack"): > This script installs any necessary packages and clones all of the OpenStack > trees which are used by devstack to deploy OpenStack. Thanks. I have only trivial comments. > +proc need-hosts/test-devstack {} { return host } > +proc run-job/test-devstack {} { > + run-ts . = ts-openstack-deploy host ^ Should have a `+' here I think. Sorry for not spotting this before. > + # libvirt is already installed, but not as a package, so avoid installation of Comment has too-long lines. > + # the libvirt package with devstack > + # https://bugs.launchpad.net/devstack/+bug/1641144 > + target_editfile($ho, "$builddir/devstack/files/debs/nova", sub { > + while (<EI>) { > + next if m/.*libvirt.*/; > + print EO or die $!; > + } > + }); > + target_editfile($ho, "$builddir/devstack/lib/nova_plugins/functions-libvirt", sub { Code has too-long lines. > + service libvirtd restart > +END > + > + # devstack is going to setup the host, install some dependency. > + target_putfilecontents_root_stash($ho, 100, <<END,"/etc/sudoers.d/devstack"); Too-long line. Thanks, Ian.
diff --git a/sg-run-job b/sg-run-job index 9c3e0ce..7b9296c 100755 --- a/sg-run-job +++ b/sg-run-job @@ -474,6 +474,11 @@ proc run-job/test-rumprun {} { ts-guest-destroy-hard host $g + } +proc need-hosts/test-devstack {} { return host } +proc run-job/test-devstack {} { + run-ts . = ts-openstack-deploy host +} + if {[file exists sg-run-job-adhoc]} { source sg-run-job-adhoc } diff --git a/ts-openstack-deploy b/ts-openstack-deploy new file mode 100755 index 0000000..f26963a --- /dev/null +++ b/ts-openstack-deploy @@ -0,0 +1,132 @@ +#!/usr/bin/perl +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2015 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use strict qw(vars); +use Osstest; +use Osstest::TestSupport; +use Osstest::BuildSupport; + +tsreadconfig(); +our ($whhost) = @ARGV; +$whhost ||= 'host'; +our $ho = selecthost($whhost); +our $builddir = target_jobdir($ho); + +sub packages () { + target_install_packages($ho, qw(git sudo)); +} +sub checkout () { + prepbuilddirs(); + build_clone($ho, 'cinder', $builddir, 'cinder'); + build_clone($ho, 'devstack', $builddir, 'devstack'); + build_clone($ho, 'glance', $builddir, 'glance'); + build_clone($ho, 'keystone', $builddir, 'keystone'); + build_clone($ho, 'nova', $builddir, 'nova'); + build_clone($ho, 'requirements', $builddir, 'requirements'); + build_clone($ho, 'tempest', $builddir, 'tempest'); + + my $vg = target_choose_vg($ho, 10*1024); # 10GB + target_putfilecontents_stash($ho, 60, <<END, $builddir.'/devstack/local.conf'); +[[local|localrc]] +# Everything should be cloned by osstest, so devstack don't have to do it +ERROR_ON_CLONE=True +USE_SCREEN=False +ADMIN_PASSWORD=secretadmin +DATABASE_PASSWORD=secretdatabase +RABBIT_PASSWORD=secretrabbit +SERVICE_PASSWORD=secretservice +SERVICE_TOKEN=atokenserviced +# make it small because there is no way to not have this lvm volume created +VOLUME_BACKING_FILE_SIZE=50M +CINDER_LVM_TYPE=default +DEST=$builddir +DATA_DIR=\$DEST/data +SERVICE_DIR=\$DEST/status +SUBUNIT_OUTPUT=\$DEST/devstack.subunit +LOGFILE=\$DEST/logs/stack.sh.log +LOG_COLOR=False +LIBVIRT_TYPE=xen +disable_service horizon +disable_service n-novnc +disable_service dstat +enable_service n-obj +# Disable neutron and switch back to nova-network +disable_service q-svc +disable_service q-dhcp +disable_service q-meta +disable_service q-agt +disable_service q-l3 +enable_service n-net +[[post-config|\$CINDER_CONF]] +[lvmdriver-1] +volume_group = $vg +END + + # libvirt is already installed, but not as a package, so avoid installation of + # the libvirt package with devstack + # https://bugs.launchpad.net/devstack/+bug/1641144 + target_editfile($ho, "$builddir/devstack/files/debs/nova", sub { + while (<EI>) { + next if m/.*libvirt.*/; + print EO or die $!; + } + }); + target_editfile($ho, "$builddir/devstack/lib/nova_plugins/functions-libvirt", sub { + while (<EI>) { + next if m/install_package.*libvirt.*/; + print EO or die $!; + } + }); + + # devstack blindly assume that systemd is used if systemctl is present + # https://bugs.launchpad.net/devstack/+bug/1641112 + target_editfile($ho, "$builddir/devstack/functions-common", sub { + while (<EI>) { + if (m#\[ -x /bin/systemctl#) { + s#\[ -x /bin/systemctl \]#false# + } + print EO or die $!; + } + }); + + # OpenStack needs access to libvirt from a user. + target_cmd_root($ho, <<END); + addgroup --system libvirt + cat >> /etc/libvirt/libvirtd.conf <<EOF +unix_sock_group = "libvirt" +unix_sock_ro_perms = "0777" +unix_sock_rw_perms = "0770" +EOF + service libvirtd restart +END + + # devstack is going to setup the host, install some dependency. + target_putfilecontents_root_stash($ho, 100, <<END,"/etc/sudoers.d/devstack"); +osstest ALL=(ALL) NOPASSWD:ALL +END +} + +sub deploy() { + target_cmd($ho, <<END, 1800); + cd $builddir/devstack + ./stack.sh +END +} + +packages(); +checkout(); +deploy();
This script installs any necessary packages and clones all of the OpenStack trees which are used by devstack to deploy OpenStack. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- Changes in V7: - reindent - fix style - remove many workaround, there are not needed anymore. - create bug report upstream Changes in V6: - rebased - fix issues due to new debian and newer devstack: - add missing libvirt group - switch back to old nova-network instead of neutron - have devstack use 'service' instead of 'systemctl' to restart services Only change in V5: - edit stackrc from devstack file to change the hardcoded path DEST No change in V4: - acked Change in V3: - Use host as argument to run the job. - Use selectjob() and get rid of the unused $gho. - Use target_jobdir() instead of builddirsprops(). - Remove GIT_BASE from devstack config. - Rename the script to ts-openstack-deploy (from ts-openstack-devstack). --- sg-run-job | 5 ++ ts-openstack-deploy | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100755 ts-openstack-deploy