Ask Your Question

Revision history [back]

When a compute node runs several instances from the same image, indeed the image is shared. You can easily confirm this. Log on to that compute node as root and then:

# cd /var/lib/nova/instances
# qemu-img info INSTANCE-ID-1/disk
image: 9516726f-1ca8-4fdf-996b-94609b3e9df1/disk
file format: qcow2
virtual size: 40G (42949672960 bytes)
disk size: 17M
cluster_size: 65536
backing file: //var/lib/nova/instances/_base/74b1b76ab284b9e72f989bc12cb4f3eb2941ee36
(...)
# qemu-img info INSTANCE-ID-2/disk
image: dad886d1-ef8c-4170-abd5-cf618ea4f60e/disk
file format: qcow2
virtual size: 40G (42949672960 bytes)
disk size: 19M
cluster_size: 65536
backing file: //var/lib/nova/instances/_base/74b1b76ab284b9e72f989bc12cb4f3eb2941ee36
(...)

The two disks in the example share the same backing file.

So, what are those base images? They are raw images as far as Qemu is concerned, and sparse files as far as Linux is concerned.

# ls -lsh _base
total 1.9G
 18M -rw-r--r-- 1 libvirt-qemu libvirt-qemu  40M Jan 20 11:47 03985c69c(...)
954M -rw-r--r-- 1 libvirt-qemu libvirt-qemu 8.0G Jan 21 00:05 74b1b76a(...)
954M -rw-r--r-- 1 libvirt-qemu libvirt-qemu 8.0G Jan 20 04:44 e6ca599b(...)

# for i in _base/*
> do qemu-img info $i
> done
image: _base/03985c69c83c77a16e98b4acd9b2134f524d94fb
file format: raw
virtual size: 39M (41126400 bytes)
disk size: 18M
image: _base/74b1b76ab284b9e72f989bc12cb4f3eb2941ee36
file format: raw
virtual size: 8.0G (8589934592 bytes)
disk size: 953M
image: _base/e6ca599b76baf4a5b193b55c7933cb53ff051f39
file format: raw
virtual size: 8.0G (8589934592 bytes)
disk size: 953M

Disclaimers

  • This is on Mitaka, using libvirt/KVM as hypervisor. Don't expect implementation to be identical in other versions of OpenStack and other hypervisors.
  • This is a default configuration. There are a few config parameters that modify the behavior, such as force_raw_images, use_cow_images
  • Libvirt can be configured to use LVM volumes for ephemeral disks.