This article explains how to create a CentOS 7 image on KVM for uploading it to the image store on OpenStack Juno (This article may be applicable for other versions as well). I have used KVM running on Ubuntu 14.04.2 64-bit server for creation of the image.
The first step would be to create a qcow2 image. This will represent the main HDD of the virtual machine, so make sure to give it as much space as you will need.
kvm-img create -f qcow2 centos7.img 20G
Start the Virtual Machine booting from the CD using the following command.
kvm -m 1024 -cdrom CentOS-7-x86_64-Minimal-1503-01.iso -drive file=centos7.img,if=virtio,index=0 -boot d -net nic -net user -nographic -vnc :1
Connect to the Virtual Machine through VNC (use display number :1).For Example, where 10.10.10.1 is the IP address of the host machine.
vncviewer 10.10.10.1 :1
Select “Minimal Installation” under the section “Software selection”. Once the installation is over shutdown and boot the Virtual Machine from Hard Drive.
kvm -m 1024 -drive file=centos.img,if=virtio,index=0,boot=on -boot c -net nic -net user -nographic -vnc :1
Do the necessary changes needed for the image.
Shutdown the Virtual Machine. Upload the image to OpenStack using the following command
glance image-create --name CentOS-7 --is-public true --container-format bare --disk-format qcow2 --file centos7.img