Mohammed Morsi
2009-Jun-03 20:00 UTC
[Ovirt-devel] [PATCH server] ovirt server installer autobuild integration
update server autobuild to set up a new isolated vm environment and go through the server installer process and rails tests --- autobuild.sh | 65 ++++++++++++++++++++++++++++++++++++++++++ ovirt-installer-test-answers | 21 +++++++++++++ ovirt-server-test.ks | 37 ++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 0 deletions(-) create mode 100644 ovirt-installer-test-answers create mode 100644 ovirt-server-test.ks diff --git a/autobuild.sh b/autobuild.sh index 2cc11d6..66a5167 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -25,10 +25,13 @@ set -v test -f Makefile && make -k distclean || : +############# build the server rpm + # put rails in development mode cp conf/ovirt-rails.sysconf conf/ovirt-rails.sysconf.orig echo "RAILS_ENV=development" >> conf/ovirt-rails.sysconf +# build server & installer rpms ./autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT make dist @@ -43,4 +46,66 @@ if [ -f /usr/bin/rpmbuild ]; then rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz fi +# restore to checkout mv conf/ovirt-rails.sysconf.orig conf/ovirt-rails.sysconf + +############## setup new vm to test installer + +# setup parameters to ssh to vm +SSHKEY=~/.ssh/id_autobuild +remote_target="root at 192.168.122.190" # should be an address on default libvirt network +ssh_cmd="ssh -i $SSHKEY -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null $remote_target" +scp_cmd="scp -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" + +# generate new ssh key if not found +if [ ! -r $SSHKEY ]; then + mkdir -p $(dirname "$SSHKEY") + ssh-keygen -q -t rsa -N "" -f $SSHKEY +fi + +# copy the key and installer answers to the kickstart +cp ovirt-server-test.ks ovirt-server-test.ks.orig +cat >> ovirt-server-test.ks << KS +%post +mkdir -p /root/.ssh +chmod 700 /root/.ssh +cat > /root/.ssh/authorized_keys << \EOF +$(ssh-keygen -y -f $SSHKEY) +EOF +chmod 600 /root/.ssh/authorized_keys + +cat > /root/ovirt-installer-answers << \EOF +$(cat ovirt-installer-test-answers) +EOF + +%end +KS + +# remove old server vm +test ! -f ovirt-server-test.tar || rm -f ovirt-server-test.tar +test ! -d test-vm || rm -rf test-vm +sudo virsh destroy ovirt-server-test || true +sudo virsh undefine ovirt-server-test || true + +# create new vm for server, configuring via kickstart, boot it +sudo appliance-creator --config ovirt-server-test.ks --name ovirt-server-test \ + -f qcow2 -p tar -d -v + +# restore original kickstart +mv ovirt-server-test.ks.orig ovirt-server-test.ks + +# define the libvirt vm, boot it +mkdir -p test-vm +tar -xSvf ovirt-server-test.tar -C test-vm +sudo virt-image test-vm/ovirt-server-test/ovirt-server-test.xml +sudo virsh define /etc/libvirt/qemu/ovirt-server-test.xml + +################### test server vm + +# run installer on server vm, answering preconfigured questions +$ssh_cmd "ovirt-installer < /root/ovirt-installer-answers" +$ssh_cmd "ace -d install ovirt" + +# run tests on newly installed server +$ssh_cmd "cd /usr/share/ovirt-server && rake db:migrate && rake test" diff --git a/ovirt-installer-test-answers b/ovirt-installer-test-answers new file mode 100644 index 0000000..6827360 --- /dev/null +++ b/ovirt-installer-test-answers @@ -0,0 +1,21 @@ +y +eth0 +eth0 +management.ovirtautobuild.com +n +n +192.168.134 +3 +50 +ovirtautobuild.com +192.168.134.1 +y +n +cobbler +cobbler +cobbler +v23zj59an +v23zj59an +ovirtautobuild.com +ovirt +ovirt diff --git a/ovirt-server-test.ks b/ovirt-server-test.ks new file mode 100644 index 0000000..c30ed5a --- /dev/null +++ b/ovirt-server-test.ks @@ -0,0 +1,37 @@ +install + +lang en_US.UTF-8 +keyboard us +# should have address on default libvirt network +network --device=eth0 --bootproto=static --ip=192.168.122.190 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.122.1 --gateway=192.168.122.1 +# Root password is 'ovirt' +rootpw --iscrypted Xa8QeYfWrtscM +firewall --disabled +authconfig --enableshadow --enablemd5 +selinux --disabled +# NOTE: ntp/ntpdate need to stay in this list to ensure that time on the +# appliance is correct prior to the ovirt-server-installer being run. Otherwise you +# get Kerberos errors +services --disabled=libvirtd,postgresql --enabled=network,iptables,ntpdate,acpid,sshd +timezone --utc UTC +text + +bootloader --location=mbr --driveorder=sda --append="console=tty0" +zerombr +clearpart --all --drives=sda +part /boot --ondisk=sda --fstype=ext3 --size=100 +part / --ondisk=sda --fstype=ext3 --size=5000 +part swap --ondisk=sda --fstype=swap --size=512 +reboot + +repo --name=f10 --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-10&arch=x86_64 +repo --name=ovirt-org --baseurl=http://ovirt.org/repos/ovirt/10/x86_64 +repo --name=f10-updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f10&arch=x86_64 +repo --name=ovirt-local --baseurl=file:///var/lib/builder/ovirt/package-root/rpm + +%packages --excludedocs --nobase +%include /usr/share/appliance-os/includes/base-pkgs.ks +openssh-server +ovirt-server +ovirt-server-installer +ovirt-node-image-pxe -- 1.6.0.6
Mohammed Morsi
2009-Jun-12 14:26 UTC
[Ovirt-devel] [PATCH server] ovirt server installer autobuild integration
From: root <root at llama.lab.bos.redhat.com> update server autobuild to set up a new isolated vm environment and go through the server installer process and rails tests --- autobuild.sh | 72 ++++++++++++++++++++++++++++++++++++++++++ ovirt-installer-test-answers | 21 ++++++++++++ ovirt-server-test.ks | 37 +++++++++++++++++++++ 3 files changed, 130 insertions(+), 0 deletions(-) create mode 100644 ovirt-installer-test-answers create mode 100644 ovirt-server-test.ks diff --git a/autobuild.sh b/autobuild.sh index 2cc11d6..7284ef9 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -25,10 +25,13 @@ set -v test -f Makefile && make -k distclean || : +############# build the server rpm + # put rails in development mode cp conf/ovirt-rails.sysconf conf/ovirt-rails.sysconf.orig echo "RAILS_ENV=development" >> conf/ovirt-rails.sysconf +# build server & installer rpms ./autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT make dist @@ -43,4 +46,73 @@ if [ -f /usr/bin/rpmbuild ]; then rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz fi +# restore to checkout mv conf/ovirt-rails.sysconf.orig conf/ovirt-rails.sysconf + +############## setup new vm to test installer + +# setup parameters to ssh to vm +SSHKEY=~/.ssh/id_autobuild +remote_target="root at 192.168.122.190" # should be an address on default libvirt network +ssh_cmd="ssh -i $SSHKEY -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null $remote_target" +scp_cmd="scp -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" + +# generate new ssh key if not found +if [ ! -r $SSHKEY ]; then + mkdir -p $(dirname "$SSHKEY") + ssh-keygen -q -t rsa -N "" -f $SSHKEY +fi + +# copy the key and installer answers to the kickstart +cp ovirt-server-test.ks ovirt-server-test.ks.orig +cat >> ovirt-server-test.ks << KS +%post +mkdir -p /root/.ssh +chmod 700 /root/.ssh +cat > /root/.ssh/authorized_keys << \EOF +$(ssh-keygen -y -f $SSHKEY) +EOF +chmod 600 /root/.ssh/authorized_keys + +cat > /root/ovirt-installer-answers << \EOF +$(cat ovirt-installer-test-answers) +EOF + +%end +KS + +# remove old server vm +test ! -f ovirt-server-test.tar || rm -f ovirt-server-test.tar +test ! -d test-vm || rm -rf test-vm +sudo virsh destroy ovirt-server-test || true +sudo virsh undefine ovirt-server-test || true + +# create new vm for server, configuring via kickstart, boot it +sudo appliance-creator --config ovirt-server-test.ks --name ovirt-server-test \ + -f qcow2 -p tar -d -v + +# restore original kickstart +mv ovirt-server-test.ks.orig ovirt-server-test.ks + +# define the libvirt vm, boot it +mkdir -p test-vm +tar -xSvf ovirt-server-test.tar -C test-vm +sudo virt-image test-vm/ovirt-server-test/ovirt-server-test.xml +sudo virsh define /etc/libvirt/qemu/ovirt-server-test.xml + +################### test server vm + +# wait till ovirt-appliance is started +for i in $(seq 1 60); do + $ssh_cmd exit && break + sleep 10 +done + +# run installer on server vm, answering preconfigured questions +$ssh_cmd "ovirt-installer < /root/ovirt-installer-answers" +$ssh_cmd "ace -d install ovirt" || true # FIXME when "installer always returns failed" + # bug is fixed, remove this "|| true" + +# run tests on newly installed server +$ssh_cmd "cd /usr/share/ovirt-server && rake db:migrate && rake test" diff --git a/ovirt-installer-test-answers b/ovirt-installer-test-answers new file mode 100644 index 0000000..6827360 --- /dev/null +++ b/ovirt-installer-test-answers @@ -0,0 +1,21 @@ +y +eth0 +eth0 +management.ovirtautobuild.com +n +n +192.168.134 +3 +50 +ovirtautobuild.com +192.168.134.1 +y +n +cobbler +cobbler +cobbler +v23zj59an +v23zj59an +ovirtautobuild.com +ovirt +ovirt diff --git a/ovirt-server-test.ks b/ovirt-server-test.ks new file mode 100644 index 0000000..d0b8842 --- /dev/null +++ b/ovirt-server-test.ks @@ -0,0 +1,37 @@ +install + +lang en_US.UTF-8 +keyboard us +# should have address on default libvirt network +network --device=eth0 --bootproto=static --ip=192.168.122.190 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.122.1 --gateway=192.168.122.1 +# Root password is 'ovirt' +rootpw --iscrypted Xa8QeYfWrtscM +firewall --disabled +authconfig --enableshadow --enablemd5 +selinux --disabled +# NOTE: ntp/ntpdate need to stay in this list to ensure that time on the +# appliance is correct prior to the ovirt-server-installer being run. Otherwise you +# get Kerberos errors +services --disabled=libvirtd,postgresql --enabled=network,iptables,ntpdate,acpid,sshd +timezone --utc UTC +text + +bootloader --location=mbr --driveorder=sda --append="console=tty0" +zerombr +clearpart --all --drives=sda +part /boot --ondisk=sda --fstype=ext3 --size=100 +part / --ondisk=sda --fstype=ext3 --size=5000 +part swap --ondisk=sda --fstype=swap --size=512 +reboot + +repo --name=f10 --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-10&arch=x86_64 +repo --name=ovirt-org --baseurl=http://ovirt.org/repos/ovirt/10/x86_64 +repo --name=f10-updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f10&arch=x86_64 +repo --name=ovirt-local --baseurl=file:///var/lib/builder/ovirt/package-root/rpm/RPMS + +%packages --excludedocs --nobase +%include /usr/share/appliance-os/includes/base-pkgs.ks +openssh-server +ovirt-server +ovirt-server-installer +ovirt-node-image-pxe -- 1.6.0.6
Apparently Analagous Threads
- oVirt Appliance / Single Machine Install
- Rsync sometimes decides to delete all data
- [PATCH viewer] ovirt viewer autobuild.sh
- [PATCH 1/3] Add private key protection information extraction to ssh-keygen
- [RFC] Preferentially TOFU certificate authorities rather than host keys