Build VM for Devstack

I posted already about diskimage-builder and Docker integration. This is a follow-up post about it and Everything-as-a-code approach. Since it takes more time than expected (honestly, I didn’t to any estimations but it seems that it could be done faster), I’ll post you some tips I use for my development environment automation even if it’s not a production-ready solution, but it already could be used if somebody needs it.

Almost any work with upstream OpenStack starts with VM setup with Devstack and required configuration. That’s mean even small automation of routine tasks will make me a bit more happy:).

First of all, I created a few really simple diskimage-builder elements to clone Devstack and configure VM hostname:

elements/
├── devstack
│   └── install.d
│       └── 10-clone-devstack
└── hostname
    └── install.d
        └── 10-set-hostname

I don’t know if there is a better solution, but it’s good enough for me now.

NOTE: don’t forget to add executable flag chmod +x 10-clone-devstack to get this working.

‘hostname element’ contains one, hardcoded for now, line: echo dsvm00 > /etc/hostname. It’s better to pass environment variable with hostname and I’ll do it in the next version.

‘devstack element’ just clones devstack sources:

mkdir -p /opt/stack
git clone https://github.com/openstack-dev/devstack /opt/stack/devstack

That’s all. Now I’m ready to build VM image:

DIB_DEV_USER_PWDLESS_SUDO=yes DIB_DEV_USER_USERNAME=e0ne \
DIB_LOCAL_CONFIG_USERNAME=e0ne ELEMENTS_PATH=./elements/ DIB_RELEASE=xenial \
disk-image-create -o ubuntu \
vm ubuntu openssh-server local-config devuser hostname devstack

I’m using ‘ubuntu’ instead of ‘ubuntu-minimal’ for more comfort. Once the image is built, I can start a new VM based on it:

sudo virt-install -n dsvm00 -r 8192 --os-type=linux  \
--os-variant=ubuntu16.04 --disk ubuntu.qcow2,device=disk,bus=virtio -w \
bridge=virbr0,model=virtio --vnc --noautoconsole --import

NOTE: do not forget to sudo apt install virtinst to get the command above working.

Tags

.net .net-framework .net-framework-3.5 agile ajax ajax-control-toolkit ampq ansible apache asp.net asp.net-mvc automation axum babel bash benchmark blog blog-engine bootstrap buildout c# cache centos chrome ci cinder ckan cli cloud code-review codeplex community config debugger deface dependencies development-environment devices devstack devtime disks django dlr dns docker dockerimage dos easy_install elmah encoding environment-variables error event events everything-as-a-code exception exceptions fabrik firefox flask foreach forms fstab gae gcc gerrit git github go google google-app-engine grep hack hacked hardware headless horizon hound html hugo iaas ienumerable iis internet iptables iron-python ironic iscsi java-script javascript jenkins jquery js jsx kharkivpy kiss kombu kvm kyiv lettuce libvirt linux lio loci logging loopback losetup lvm mac-os macos mercurial microsoft microsoft-sync-framework mobile mono ms-office msbuild networking news nginx npm npx offtopic oop open-source open-xml opensource openstack openvswitch os packages paraller-development patterns-practices performance php pika pip plugins pnp podcast popup postgresql profiler project protocols proxy pycamp pycharm pycon pykyiv pylint pypi python python-3 qcow quantum qumy rabbitmq rar react reactjs refactoring rfc rhel search-engine security selenium server shell silverlight socket software-engineering source-control sourcegear-vault sources sql sql-server sql-server-express sqlalchemy ssh static-site sublimetext svg tests tgt tipfy tornado typescript uapycon ui uneta unit-tests upgrades usability vim virtualenv visual-studio vitrage vm vue.js vuejs web-development web-server web-service web_root webpack webroot windows windows-live word-press x32 x64 xcode xml xss xvfb интернет-магазин книги


Archives

2019 (73)
2018 (2)
2017 (3)
2016 (2)
2015 (3)
2014 (5)
2013 (17)
2012 (22)
2011 (35)
2010 (25)
2009 (35)
2008 (32)
2007 (2)