← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1510328] [NEW] Nova pre-allocation of qcow2 is flawed

 

Public bug reported:

The nova/virt/libvirt/imagebackend.py file contains code for pre-
allocating image files, so that sufficient space is guaranteed available
for the VM's full disk size. As well as preventing accidental out-of-
space conditions, this is important for maximising performance.

It currently just calls 'qemu-img info' to get the virtual image size,
and then calls 'fallocate' to allocate file system blocks to match this
size. This is fine for raw files, but is significantly flawed for qcow2
files.

 - QCow2 files have extra space overhead beyond the logical image size.
There is header metadata, cluster lookup tables and so forth. As a
result Nova is not allocating sufficient space for qcow2 files.

 - The qcow2 internal metadata is not being pre-allocated. Since the
allocation was done as the FS level, qcow2 file doesn't know it has all
this space pre-allocated, so its internal metadata still setup to assume
it is a (mostly) empty file. This will have a runtime performance
overhead on guest writes, since further internal metadata will have to
be updated.

 - The file will suffer from fragmentation. Again since the internal
metadat does not know the FS has full pre-allocated its size, as the
guest writes blocks, they will be allocated in the internal metadata on
a first-come-first-served basis. This will caused the layout of the
virtual disk blocks to be random inside the qcow2 file. This causes
significant fragmentation which will be bad for performance.

The solution to all these problems is to use qemu-img to do the
preallocation, so the qcow2 file internals are fully in sync with the
filesystem size.

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: libvirt

** Tags added: libvirt

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1510328

Title:
  Nova pre-allocation of qcow2 is flawed

Status in OpenStack Compute (nova):
  New

Bug description:
  The nova/virt/libvirt/imagebackend.py file contains code for pre-
  allocating image files, so that sufficient space is guaranteed
  available for the VM's full disk size. As well as preventing
  accidental out-of-space conditions, this is important for maximising
  performance.

  It currently just calls 'qemu-img info' to get the virtual image size,
  and then calls 'fallocate' to allocate file system blocks to match
  this size. This is fine for raw files, but is significantly flawed for
  qcow2 files.

   - QCow2 files have extra space overhead beyond the logical image
  size. There is header metadata, cluster lookup tables and so forth. As
  a result Nova is not allocating sufficient space for qcow2 files.

   - The qcow2 internal metadata is not being pre-allocated. Since the
  allocation was done as the FS level, qcow2 file doesn't know it has
  all this space pre-allocated, so its internal metadata still setup to
  assume it is a (mostly) empty file. This will have a runtime
  performance overhead on guest writes, since further internal metadata
  will have to be updated.

   - The file will suffer from fragmentation. Again since the internal
  metadat does not know the FS has full pre-allocated its size, as the
  guest writes blocks, they will be allocated in the internal metadata
  on a first-come-first-served basis. This will caused the layout of the
  virtual disk blocks to be random inside the qcow2 file. This causes
  significant fragmentation which will be bad for performance.

  The solution to all these problems is to use qemu-img to do the
  preallocation, so the qcow2 file internals are fully in sync with the
  filesystem size.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1510328/+subscriptions