In this post we look at how to take a VirtualBox image (ova) file and use it in openstack backed by ceph. In this example I will use an image provided by kali.org.
To start you will need a Linux instance with around 4 CPU’s and 4GB or RAM, less will work but I was on a time limit.
# apt-get install p7zip-full
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
p7zip-rar
The following NEW packages will be installed:
p7zip-full
0 upgraded, 1 newly installed, 0 to remove and 59 not upgraded.
Need to get 903 kB of archives.
After this operation, 3,922 kB of additional disk space will be used.
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/universe p7zip-full amd64 9.20.1~dfsg.1-4+deb7u1build0.14.04.1 [903 kB]
Fetched 903 kB in 0s (933 kB/s)
Selecting previously unselected package p7zip-full.
(Reading database ... 60793 files and directories currently installed.)
Preparing to unpack .../p7zip-full_9.20.1~dfsg.1-4+deb7u1build0.14.04.1_amd64.deb ...
Unpacking p7zip-full (9.20.1~dfsg.1-4+deb7u1build0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up p7zip-full (9.20.1~dfsg.1-4+deb7u1build0.14.04.1) ...
root@glance:~# 7za e Kali-Linux-2.0.0-vbox-amd64.7z
7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
Processing archive: Kali-Linux-2.0.0-vbox-amd64.7z
Extracting Kali-Linux-2.0.0-vbox-amd64.ova
Everything is Ok
Size: 3713021952
Compressed: 3513198801
Now we can extract the ova file to review the VMDK files inside:
1234567891011
# file Kali-Linux-2.0.0-vbox-amd64.ova
Kali-Linux-2.0.0-vbox-amd64.ova: POSIX tar archive (GNU)
root@glance:~# tar -tf Kali-Linux-2.0.0-vbox-amd64.ova
Kali-Linux-2.0.0-vbox-amd64.ovf
Kali-Linux-2.0.0-vbox-amd64-disk1.vmdk
Kali-Linux-2.0.0-vbox-amd64.mf
root@glance:~# tar -xvf Kali-Linux-2.0.0-vbox-amd64.ova
Kali-Linux-2.0.0-vbox-amd64.ovf
Kali-Linux-2.0.0-vbox-amd64-disk1.vmdk
Kali-Linux-2.0.0-vbox-amd64.mf
root@glance:~#
Now we convert the VMDK to a raw file - a qcow2 would also work here but as my openstack install is backed by ceph I am using RAW
1
root@glance:~# qemu-img convert -O raw Kali-Linux-2.0.0-vbox-amd64-disk1.vmdk Kali-Linux-2.0.0-vbox-amd64-disk1.raw
Finally we upload the converted image to glance using the glance phyton-client
1
root@glance:~# glance image-create --name "Kali2_64" --disk-format raw --container-format bare --is-protected True < Kali-Linux-2.0.0-vbox-amd64-disk1.raw
Now are image is ready to be used and we can boot an instance from it