Build process of ovirt-node and the plugins Douglas Landgraf <dougsland@redhat.com> Red Hat Inc.
ovirt-node
Building ovirt-node Suggestions before start.. Create a Virtual Machine to be the builder Do not add random external repos Use the distro you want the iso should use as base In others words: If you want to distribute an EL6 image, build the image on top of CentOS 6
Building ovirt-node Let's get started.. Create a non root user for builds Adds the user to sudoers # visudo mydeveluser ALL=(ALL) NOPASSWD: ALL Adds the EPEL repo https://fedoraproject.org/wiki/EPEL Login as the new non root user Install needed packages $ sudo yum install livecd-tools appliance-tools-minimizer fedora-packager python-devel rpm-build createrepo selinux-policy-doc checkpolicy selinux-policy-devel hardlink autoconf ltrace automake python-mock pykickstart python-lockfile
Building ovirt-node 6. Create a cache dir $ mkdir ~/ovirt-cache 7. Clone the ovirt-node and ovirt-node-iso $ git clone http://gerrit.ovirt.org/p/ovirt-node.git $ git clone http://gerrit.ovirt.org/p/ovirt-node-iso.git 8. Set env variables for the building $ export OVIRT_NODE_BASE=/home/mynewuser $ export OVIRT_CACHE_DIR=~/ovirt-cache $ export OVIRT_LOCAL_REPO=file://${OVIRT_CACHE_DIR}/ovirt * Adding these variables to .bashrc helps for next login
Building ovirt-node 9. Generating the packages based on kickstart.. $cd ovirt-node $ovirt-node> make your changes $ovirt-node> ./autogen.sh --with-image-minimizer $ovirt-node> make publish * Please note if you execute ./autogen.sh without --with-image-minimizer the .py will remain (helps for debugging) Important distro files on source tree for building: recipes/<distro>-pkgs.ks (Packages to be added or removed) recipes/<distro>-install.ks (Services to be enabled or disabled) recipes/<distro>-post.ks (Scripting/patches after packages were installed) recipes/<distro>-minimizer.ks (Minimization of packages) recipes/common-* (Common stuff for the distro)
Building ovirt-node 10. Generating the iso $cd ovirt-node-iso $ovirt-node-iso> ./autogen.sh --with-recipe=$OVIRT_NODE_BASE/ovirt-node/recipe $ovirt-node-iso> make iso publish Did you know? The distro and repos selections happens in Makefile.am You can add repos via OVIRT_REPO_URL, example: $ make OVIRT_REPO_URL="http://127.0.0.1/repo http://127.0.0.1/repo2”
Ovirt Node Plugins
Building plugins Make sure all patches are tested and merged to the branch Increase the release of package and add the changes into Changelog of spec file (commit both into the branch) Create a tag for the release (Make sure you have cloned the tree via ssh, not anonymous) $ git tag -a ovirt-node-plugin-vdsm-x.y.z -m 'Release of ovirt node plugin vdsm xyz' $ git push gerrit.ovirt.org:ovirt-node-plugin-vdsm ovirt-node-plugin-vdsm-x.y.z
Building plugins 4. Make a local build $plugin-dir> ./autogen && make rpms 5. Make a scratch-build in koji on Fedora's servers with the .srpm for the platforms needed (Why building in koji?) Example: $ fedpkg --dist el6 --srpm /path/to/ovirt-node-plugin-vdsm.srpm $ fedpkg --dist epel7--srpm /path/to/ovirt-node-plugin-vdsm.srpm $ fedpkg --dist f20 --srpm /path/to/ovirt-node-plugin-vdsm.srpm 6. Provide the koji's link to release engineers
Testing changes
Testing changes 1) Manual test: On node: 1. Remount file-system as read and write # mount -o remount,rw / 2. Enable sshd service and add a password to root # /usr/libexec/ovirt-config-password (enable sshd and add pass to root) 3. Copy the sources of plugin into the node # scp source.py root@node_ip_addre:/path/to/original/source.py 4. On node execute the new version for tests: # python -m ovirt.node.setup.__main__ --debug
Testing changes 2) Simulate the node via dry-mode Install needed packages: $ sudo yum install PyPAM python-urwind cracklib-python On RHEL < 7 based machines (python 2.6 machines): Simulating the installer: $ovirt-node> cd src $ovirt-node/src> python -m “ovirt.node.setup.__main__” --debug --dry Simulating the setup menu: $ovirt-node/src> python -m “ovirt.node.installer.__main__” --debug –dry Log available at: /tmp/ovirt-node.debug.log
Testing changes On Fedora or RHEL >= 7 based machines: Simulating the installer: $ovirt-node> cd src $ovirt-node/src> python -m ovirt.node.setup --debug --dry Simulating the setup menu: $ovirt-node/src> python -m ovirt.node.installer --debug –dry Log available at: /tmp/ovirt-node.debug.log
Testing changes 3) A simple example of edit-node using an installed ovirt-node-plugin-vdsm and using local repo to disable non need repos $ ovirt-node/tool/edit-node –repo edit-node.repo –install ovirt-node-plugin-vdsm ovirt-node.iso
Testing changes 3.1) Generate RPM with your changes and add it to node via edit-node tool 1. Generate ovirt-node iso 2. Generate the rpms $plug> make rpms 3. Copy the rpms to a http server $ mkdir -p /var/www/nodebuild $ cp *.rpm /var/www/nodebuild $ createrepo /var/www/nodebuild 4. Create a .repo file to be used with edit-node tool $ vi nodebuild.repo [nodebuild] name=nodebuild baseurl=http://127.0.0.1/nodebuild enabled=1 gpgcheck=0
Testing changes Go to edit-node dir 5. $ cd ovirt-node/tools Execute edit-node 6. $ python ./edit-node --repo=/path/to/nodebuild.repo --install=ovirt-node-plugin-vdsm ovirt-node.iso
References Node Building http://www.ovirt.org/Node_Building
Comments? THANK YOU! http://www.ovirt.org