The following procedure was tested using Debian 8.1.0 on Juno version of OpenStack.
Create an image which emulates the Hard Drive.
kvm-img create -f qcow2 debian8.img 20G
Boot the virtual machine
kvm -m 512 -cdrom debian-8.1.0-amd64-CD-1.iso -drive file=debian8.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 “Standard system utilities” during installation. Once the installation is complete, shutdown the Virtual Machine. Now start the Virtual Machine to boot from the Hard Drive using the following command
kvm -m 512 -drive file=debian.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 and Upload the image file to OpenStack using the following command.
glance image-create --name Debian-8 --is-public true --container-format bare --disk-format qcow2 --file debian8.img