Statistics
| Branch: | Revision:

root / block / vmdk.c @ cc84d90f

History | View | Annotate | Download (55.2 kB)

# Date Author Comment
d5124c00 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for creating images

Add an Error ** parameter to BlockDriver.bdrv_create to allow more
specific error messages.

Signed-off-by: Max Reitz <>

34b5d2c6 09/12/2013 11:12 am Max Reitz

block: Error parameter for open functions

Add an Error ** parameter to bdrv_open, bdrv_file_open and associated
functions to allow more specific error messages.

Signed-off-by: Max Reitz <>

015a1036 09/12/2013 11:12 am Max Reitz

bdrv: Use "Error" for opening images

Add an Error ** parameter to BlockDriver.bdrv_open and
BlockDriver.bdrv_file_open to allow more specific error messages.

Signed-off-by: Max Reitz <>

b6b8a333 09/06/2013 04:25 pm Paolo Bonzini

block: introduce bdrv_get_block_status API

For now, bdrv_get_block_status is just another name for bdrv_is_allocated.
The next patches will add more flags.

This also touches all block drivers with a mostly mechanical rename. The
sole exception is cow; because it calls cow_co_is_allocated from the read...

4bc74be9 09/06/2013 04:25 pm Paolo Bonzini

block: return get_block_status data and flags for formats

Reviewed-by: Eric Blake <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

4f6fd349 09/06/2013 04:25 pm Fam Zheng

block: make bdrv_delete() static

Manage BlockDriverState lifecycle with refcnt, so bdrv_delete() is no
longer public and should be called by bdrv_unref() if refcnt is
decreased to 0.

This is an identical change because effectively, there's no multiple
reference of BDS now: no caller of bdrv_ref() yet, only bdrv_new() sets...

b0651b8c 08/22/2013 04:35 pm Fam Zheng

vmdk: Move l1_size check into vmdk_add_extent()

This header check is common to VMDK3 and VMDK4, so move it into
vmdk_add_extent().

Signed-off-by: Fam Zheng <>
Signed-off-by: Stefan Hajnoczi <>

f6b61e54 08/22/2013 04:35 pm Fam Zheng

vmdk: fix L1 and L2 table size in vmdk3 open

VMDK3 header has the field l1dir_size, but vmdk_open_vmdk3 hardcoded the
value. This patch honors the header field.

And the L2 table size is 4096 according to VMDK spec1, instead of
1 << 9 (512).

[1]:
http://www.vmware.com/support/developer/vddk/vmdk_50_technote.pdf?src=vmdk...

daac8fdc 08/22/2013 04:35 pm Fam Zheng

vmdk: support vmfsSparse files

VMware ESX hosts use a variant of the VMDK3 format, identified by the
vmfsSparse create type ad the VMFSSPARSE extent type.

It has 16 KB grain tables (L2) and a variable-size grain directory (L1).
In addition, the grain size is always 512, but that is not a problem...

04d542c8 08/22/2013 04:35 pm Paolo Bonzini

vmdk: support vmfs files

VMware ESX hosts also use different create and extent types for flat
files, respectively "vmfs" and "VMFS". This is not documented, but it
can be found at http://kb.vmware.com/kb/10002511 (Recreating a missing
virtual machine disk (VMDK) descriptor file)....

5d8caa54 08/06/2013 04:27 pm Fam Zheng

vmdk: Make VMDK3Header and VmdkGrainMarker QEMU_PACKED

It's best to make it consistent that all on disk structures are
QEMU_PACKED.

Signed-off-by: Fam Zheng <>
Signed-off-by: Kevin Wolf <>

e98768d4 08/06/2013 04:27 pm Fam Zheng

vmdk: use unsigned values for on disk header fields

The size and offset fields are all non-negative values, use uint64_t for
them to avoid getting negative in memory value by int overflow.

Signed-off-by: Fam Zheng <>
Signed-off-by: Kevin Wolf <>

8aa1331c 08/06/2013 04:27 pm Fam Zheng

vmdk: check granularity field in opening

Granularity is used to calculate the cluster size and allocate r/w
buffer. Check the value from image before using it, so we don't abort()
for unbounded memory allocation.

Signed-off-by: Fam Zheng <>...

f8ce0403 08/06/2013 04:27 pm Fam Zheng

vmdk: check l2 table size when opening

header.num_gtes_per_gte determines size for L2 table. Check for too big
value before using it. Limit to 512M entries (2GB per one L2 table).

Signed-off-by: Fam Zheng <>
Signed-off-by: Kevin Wolf <>

2c43e43c 08/06/2013 04:27 pm Fam Zheng

vmdk: check l1 size before opening image

L1 table size is calculated from capacity, granularity and l2 table
size. If capacity is too big or later two are too small, the L1 table
will be too big to allocate in memory. Limit it to a reasonable range.

Signed-off-by: Fam Zheng <>...

bf81507d 08/06/2013 04:27 pm Fam Zheng

vmdk: use heap allocation for whole_grain

We should never grow the stack beyond 1 MB, otherwise we'll fall off the
end. Thread stacks and coroutine stacks (1 MB) do not grow.
get_cluster_offset() allocates a big stack offset, it will fail for big
cluster images, change to heap allocated buffer....

ca8804ce 08/06/2013 04:27 pm Fam Zheng

vmdk: rename num_gtes_per_gte to num_gtes_per_gt

num_gtes_per_gte is a historical typo, rename it to a more sensible
name. It means "number of GrainTableEntries per GrainTable".

Signed-off-by: Fam Zheng <>
Signed-off-by: Kevin Wolf <>

8e507243 08/02/2013 05:07 pm Fam Zheng

vmdk: fix comment for vmdk_co_write_zeroes

The comment was truncated. Add the missing parts, especially explain why
we need zero_dry_run.

Signed-off-by: Fam Zheng <>
Signed-off-by: Michael Tokarev <>

da7a50f9 07/05/2013 10:40 am Fam Zheng

vmdk: Implement .bdrv_has_zero_init

Depending on the subformat, has_zero_init queries underlying storage for
flat extent. If it has a flat extent and its underlying storage doesn't
have zero init, return 0. Otherwise return 1.

Aligns the operator assignments....

8ed610a1 06/28/2013 10:20 am Fam Zheng

vmdk: remove wrong calculation of relative path

When creating image with backing file, the driver tries to calculate the
relative path from created image file to backing file, but the path
computation is incorrect. e.g.:

$ qemu-img create -f vmdk -b vmdk-data-disk.vmdk vmdk-data-snapshot1...
96c51eb5 06/24/2013 11:25 am Fam Zheng

vmdk: refuse to open higher version than supported

Refuse to open higher version for safety.

Although we try to be compatible with published VMDK spec, VMware has
newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge
what's changed in it. And it is very likely to have more new versions in...

5a394b9e 06/17/2013 06:47 pm Stefan Hajnoczi

vmdk: byteswap VMDK4Header.desc_offset field

Remember to byteswap VMDK4Header.desc_offset on big-endian machines.

Cc:
Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

0bed087d 06/17/2013 06:47 pm Evgeny Budilovsky

vmdk: Allow reading variable size descriptor files

the hard-coded 2k buffer on the stack won't allow reading big descriptor
files which can be generated when storing big images. For example 500G
vmdk splitted to 2G chunks.

Signed-off-by: Evgeny Budilovsky <>...

cdeaf1f1 05/03/2013 11:33 am Fam Zheng

vmdk: add bdrv_co_write_zeroes

Use special offset to write zeroes efficiently, when zeroed-grain GTE is
available. If zero-write an allocated cluster, cluster is leaked because
its offset pointer is overwritten by "0x1".

Signed-off-by: Fam Zheng <>...

e304e8e5 05/03/2013 11:33 am Fam Zheng

vmdk: store fields of VmdkMetaData in cpu endian

Previously VmdkMetaData.offset is stored little endian while other
fields are cpu endian. This changes offset to cpu endian and convert
before writing to image.
Signed-off-by: Fam Zheng <>
Signed-off-by: Stefan Hajnoczi <>

95b0aa42 05/03/2013 11:33 am Fam Zheng

vmdk: change magic number to macro

Two hard coded flag bits are changed to macros.
Signed-off-by: Fam Zheng <>
Signed-off-by: Stefan Hajnoczi <>

69e0b6df 05/03/2013 11:33 am Fam Zheng

vmdk: Add option to create zeroed-grain image

Add image create option "zeroed-grain" to enable zeroed-grain GTE
feature of vmdk sparse extents. When this option is on, header version
of newly created extent will be 2 and VMDK4_FLAG_ZERO_GRAIN flag bit
will be set....

14ead646 05/03/2013 11:33 am Fam Zheng

vmdk: add support for “zeroed‐grain” GTE

Introduced support for zeroed-grain GTE, as specified in Virtual Disk
Format 5.01.

Recent VMware hosted platform products support a new “zeroed‐grain”
grain table entry (GTE). The zeroed‐grain GTE returns all zeros on...
65f74725 05/03/2013 11:33 am Fam Zheng

vmdk: named return code.

Internal routines in vmdk.c previously return -1 on error and 0 on
success. More return values are useful for future changes such as
zeroed-grain GTE. Change all the magic `return 0` and `return -1` to
macro names:

  • VMDK_OK 0...
787e4a85 03/22/2013 06:51 pm Kevin Wolf

block: Add options QDict to bdrv_file_open() prototypes

The new parameter is unused yet.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>

1a86938f 03/15/2013 05:07 pm Kevin Wolf

block: Add options QDict to .bdrv_open()

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Stefan Hajnoczi <>

de9c0cec 03/15/2013 05:07 pm Kevin Wolf

block: Add options QDict to bdrv_open() prototype

It doesn't do anything yet except storing the options QDict in the
BlockDriverState.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Eric Blake <>
Reviewed-by: Stefan Hajnoczi <>...

cd923475 02/01/2013 03:58 pm Philipp Hahn

vmdk: Allow space in file name

The previous scanf() format string stopped parsing the file name on the
first white white space, which seems to be allowed at least by VMware
Workstation.

Change the format string to collect everything between the first and...

7f2039f6 02/01/2013 03:58 pm Othmar Pasteka

vmdk: Allow selecting SCSI adapter in image creation

Introduce a new option "adapter_type" when converting to vmdk images.
It can be one of the following: ide (default), buslogic, lsilogic
or legacyESX (according to the vmdk spec from vmware).

In case of a non-ide adapter, heads is set to 255 instead of the 16....

15bac0d5 01/25/2013 07:18 pm Stefan Weil

block: Use error code EMEDIUMTYPE for wrong format in some block drivers

This improves error reports for bochs, cow, qcow, qcow2, qed and vmdk
when a file with the wrong format is selected.

Signed-off-by: Stefan Weil <>
Reviewed-by: Eric Blake <>...

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

caf71f86 12/19/2012 09:31 am Paolo Bonzini

migration: move include files to include/migration/

Signed-off-by: Paolo Bonzini <>

737e150e 12/19/2012 09:31 am Paolo Bonzini

block: move include files to include/block/

Signed-off-by: Paolo Bonzini <>

b1649fae 11/14/2012 07:19 pm Gerhard Wiesinger

vmdk: Fix data corruption bug in WRITE and READ handling

Fixed a MAJOR BUG in VMDK files on file boundaries on reads
and ALSO ON WRITES WHICH MIGHT CORRUPT THE IMAGE AND DATA!!!!!!

Triggered for example with the following VMDK file (partly listed):
RW 4193792 FLAT "XP-W1-f001.vmdk" 0...

d66f8e7b 10/05/2012 03:58 pm Jim Meyering

vmdk: relative_path: use pstrcpy in place of strncpy

Avoid strncpy+manual-NUL-terminate. Use pstrcpy instead.

Acked-by: Kevin Wolf <>
Signed-off-by: Jim Meyering <>
Signed-off-by: Anthony Liguori <>

3897575f 09/24/2012 04:15 pm Jeff Cody

block: vmdk image file reopen

This patch supports reopen for VMDK image files. VMDK extents are added
to the existing reopen queue, so that the transactional model of reopen
is maintained with multiple image files.

Signed-off-by: Jeff Cody <>...

65bd155c 08/17/2012 02:27 pm Kevin Wolf

vmdk: Read footer for streamOptimized images

The footer takes precedence over the header when it exists. It contains
the real grain directory offset that is missing in the header. Without
this patch, streamOptimized images with a footer cannot be read.

Signed-off-by: Kevin Wolf <>...

7a736bfa 08/17/2012 12:14 pm Kevin Wolf

vmdk: Fix header structure

Commit bb45ded9 swapped gd_offset and rgd_offset. This is wrong.

Signed-off-by: Kevin Wolf <>

6165f4d8 08/15/2012 11:48 am Corey Bryant

block: Convert open calls to qemu_open

This patch converts all block layer open calls to qemu_open.

Note that this adds the O_CLOEXEC flag to the changed open paths
when the O_CLOEXEC macro is defined.

Signed-off-by: Corey Bryant <>...

2e1e79da 08/15/2012 11:48 am Corey Bryant

block: Convert close calls to qemu_close

This patch converts all block layer close calls, that correspond
to qemu_open calls, to qemu_close.

Signed-off-by: Corey Bryant <>
Signed-off-by: Kevin Wolf <>

29cdb251 04/05/2012 03:54 pm Paolo Bonzini

block: push recursive flushing up from drivers

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

75d12341 03/07/2012 03:03 pm Stefan Weil

block/vmdk: Fix warning from splint (comparision of unsigned value)

l1_entry_sectors will never be less than 0.

Signed-off-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

f8a2e5e3 12/05/2011 03:51 pm Stefan Hajnoczi

block: convert qcow2, qcow2, and vmdk to .bdrv_co_is_allocated()

The qcow2, qcow, and vmdk block drivers are based on coroutines. They have a
coroutine mutex which protects internal state. We can convert the
.bdrv_is_allocated() function to .bdrv_co_is_allocated() by holding the mutex...

2bc3166c 11/23/2011 06:04 pm Kevin Wolf

vmdk: Add migration blocker

VMDK caches L2 tables. For migration to work, they would have to be
invalidated. Block migration for now.

Signed-off-by: Kevin Wolf <>

2923d34f 11/21/2011 11:05 pm Stefan Weil

Include zlib.h using #include <>

zlib.h is not a local include file, therefore it should be included
using <> instead of "".

Signed-off-by: Stefan Weil <>
Signed-off-by: Anthony Liguori <>

c68b89ac 11/11/2011 03:02 pm Kevin Wolf

block: Rename bdrv_co_flush to bdrv_co_flush_to_disk

There are two different types of flush that you can do: Flushing one level up
to the OS (i.e. writing data to the host page cache) or flushing it all the way
down to the disk. The existing functions flush to the disk, reflect this in the...

8494a397 10/31/2011 06:09 pm Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

Conflicts:
block/vmdk.c

3a069ff1 10/31/2011 05:23 pm Anthony Liguori

Merge remote-tracking branch 'stefanha/trivial-patches' into staging

bac8d7b4 10/28/2011 08:25 pm Kevin Wolf

vmdk: Fix use of uninitialised value

In error cases, cid is never set.

Signed-off-by: Kevin Wolf <>

99f1835d 10/28/2011 08:25 pm Kevin Wolf

vmdk: Improve error handling

Return the right error values in some more places.

Signed-off-by: Kevin Wolf <>

93897b9f 10/28/2011 08:25 pm Kevin Wolf

vmdk: Fix possible segfaults

Data we read from the disk isn't necessarily null terminated and may not
contain the string we're looking for. The code needs to be a bit more careful
here.

Signed-off-by: Kevin Wolf <>

c18a1c88 10/26/2011 03:36 pm Pavel Borzenkov

vmdk: remove unneeded variable assignment

Spotted by Clang Analyzer

Signed-off-by: Pavel Borzenkov <>
Signed-off-by: Stefan Hajnoczi <>

8379e46d 10/26/2011 03:36 pm Pavel Borzenkov

vmdk: vmdk_read_cid returns garbage if p_name is NULL

Spotted by Clang Analyzer

Signed-off-by: Pavel Borzenkov <>
Signed-off-by: Stefan Hajnoczi <>

2914caa0 10/21/2011 06:34 pm Paolo Bonzini

block: take lock around bdrv_read implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_read implementations to take the mutex.

Drivers that implement bdrv_read rather than bdrv_co_readv can
then benefit from asynchronous operation (at least if the underlying...

e183ef75 10/21/2011 06:34 pm Paolo Bonzini

block: take lock around bdrv_write implementations

This does the first part of the conversion to coroutines, by
wrapping bdrv_write implementations to take the mutex.

Drivers that implement bdrv_write rather than bdrv_co_writev can
then benefit from asynchronous operation (at least if the underlying...

8b94ff85 10/21/2011 06:34 pm Paolo Bonzini

block: change flush to co_flush

Since coroutine operation is now mandatory, convert all bdrv_flush
implementations to coroutines. For qcow2, this means taking the lock.
Other implementations are simpler and just forward bdrv_flush to the
underlying protocol, so they can avoid the lock....

588b65a3 10/21/2011 06:34 pm Paolo Bonzini

vmdk: fix return values of vmdk_parent_open

While vmdk_open_desc_file (touched by the patch) correctly changed -1
to -EINVAL, vmdk_open did not. Fix it directly in vmdk_parent_open.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

bae0a0cc 10/21/2011 06:34 pm Paolo Bonzini

vmdk: clean up open

Move vmdk_parent_open to vmdk_open. There's another path how
vmdk_parent_open can be reached:

vmdk_parse_extents() ->  vmdk_open_sparse() ->  vmdk_open_vmdk4() ->
vmdk_open_desc_file().

If that can happen, however, the code is bogus. vmdk_parent_open...

848c66e8 10/21/2011 06:34 pm Paolo Bonzini

block: add a CoMutex to synchronous read drivers

The big conversion of bdrv_read/write to coroutines caused the two
homonymous callbacks in BlockDriver to become reentrant. It goes
like this:

1) bdrv_read is now called in a coroutine, and calls bdrv_read or...

b3c0bfb6 09/20/2011 01:27 pm Fam Zheng

VMDK: fix leak of extent_file

Release extent_file on error in vmdk_parse_extents. Added closing files
in freeing extents.

Signed-off-by: Fam Zheng <>
Signed-off-by: Kevin Wolf <>

bb45ded9 09/06/2011 01:33 pm Fam Zheng

VMDK: bugfix, opening vSphere 4 exported image

The vSphere 4 exported image is streamOptimized extent, which is not
quite correctly handled. Ignore rdgOffset when RGD flag bit not set.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>...

f16f509d 09/06/2011 01:33 pm Fam Zheng

VMDK: bugfix, open Haiku vmdk image

Haiku provides a specially formed vmdk image, which let qemu abort. It a
combination of sparse header and flat data (i.e. with not l1/l2 table at
all). The fix is turn to descriptor when sparse header is zero in field
'capacity'....

6c031aac 09/06/2011 01:31 pm Fam Zheng

VMDK: creating streamOptimized subformat

Creating streamOptimized subformat. Added subformat option
'streamOptimized', to create a image with compression enabled and each
cluster with a GrainMarker.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>...

2b2c8c5d 09/06/2011 01:30 pm Fam Zheng

VMDK: read/write compressed extent

Add support for reading/writing compressed extent.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

432bb170 09/06/2011 01:27 pm Fam Zheng

VMDK: Opening compressed extent.

Added flags field for compressed/streamOptimized extents, open and save
image configuration.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

dd3f6ee2 09/06/2011 01:25 pm Fam Zheng

VMDK: separate vmdk_read_extent/vmdk_write_extent

Factor out read/write extent code, since there will be more things to
take care of once reading/writing compressed clusters is introduced.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>...

86c6b429 09/06/2011 01:22 pm Fam Zheng

VMDK: add twoGbMaxExtentSparse support

Add twoGbMaxExtentSparse support. Introduce vmdk_free_last_extent.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

6398de51 09/06/2011 01:20 pm Fam Zheng

VMDK: enable twoGbMaxExtentFlat

Enable the createType 'twoGbMaxExtentFlat'. The supporting code is
already in.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

541dc0d4 09/03/2011 01:45 pm Stefan Weil

Use new macro QEMU_PACKED for packed structures

Most changes were made using these commands:

git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/'
git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/'...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

4a1d5e1f 07/19/2011 04:39 pm Fam Zheng

block: add bdrv_get_allocated_file_size() operation

qemu-img.c wants to count allocated file size of image. Previously it
counts a single bs->file by 'stat' or Window API. As VMDK introduces
multiple file support, the operation becomes format specific with...

69b4d86d 07/19/2011 04:39 pm Fam Zheng

VMDK: move 'static' cid_update flag to bs field

Cid_update is the flag for updating CID on first write after opening the
image. This should be per image open rather than per program life cycle,
so change it from static var of vmdk_write to a field in BDRVVmdkState....

91b85bd3 07/19/2011 04:39 pm Fam Zheng

VMDK: change get_cluster_offset return type

The return type of get_cluster_offset was an offset that use 0 to denote
'not allocated', this will be no longer true for flat extents, as we see
flat extent file as a single huge cluster whose offset is 0 and length...

7fa60fa3 07/19/2011 04:39 pm Fam Zheng

VMDK: open/read/write for monolithicFlat image

Parse vmdk decriptor file and open mono flat image.
Read/write the flat extent.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

f66fd6c3 07/19/2011 04:39 pm Fam Zheng

VMDK: create different subformats

Add create option 'format', with enums:
monolithicSparse
monolithicFlat
twoGbMaxExtentSparse
twoGbMaxExtentFlat
Each creates a subformat image file. The default is monolithicSparse.

Signed-off-by: Fam Zheng <>...

ae261c86 07/19/2011 04:39 pm Fam Zheng

VMDK: fix coding style

Conform coding style in vmdk.c to pass scripts/checkpatch.pl checks.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

0e69c543 07/19/2011 04:39 pm Fam Zheng

VMDK: bugfix, align offset to cluster in get_whole_cluster

In get_whole_cluster, the offset is not aligned to cluster when reading
from backing_hd. When the first write to child is not at the cluster
boundary, wrong address data from parent is copied to child....

01fc99d6 07/19/2011 04:39 pm Fam Zheng

VMDK: probe for monolithicFlat images

Probe as the same behavior as VMware does.
Recognize image as monolithicFlat descriptor file when the file is text
and the first effective line (not '#' leaded comment or space line) is
either 'version=1' or 'version=2'. No space or upper case charactors...

b4b3ab14 07/19/2011 04:39 pm Fam Zheng

VMDK: separate vmdk_open by format version

Separate vmdk_open by subformats to:
  • vmdk_open_vmdk3
  • vmdk_open_vmdk4

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

e1da9b24 07/19/2011 04:39 pm Fam Zheng

VMDK: add field BDRVVmdkState.desc_offset

There are several occurrence of magic number 0x200 as the descriptor
offset within mono sparse image file. This is not the case for images
with separate descriptor file. So a field is added to BDRVVmdkState to
hold the correct value....

333c574d 07/19/2011 04:39 pm Fam Zheng

VMDK: flush multiple extents

Flush all the file that referenced by the image.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

b3976d3c 07/19/2011 04:39 pm Fam Zheng

VMDK: introduce VmdkExtent

Introduced VmdkExtent array into BDRVVmdkState, enable holding multiple
image extents for multiple file image support.

Signed-off-by: Fam Zheng <>
Reviewed-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

16372ff0 06/08/2011 11:39 am Alexander Graf

vmdk: fix endianness bugs

The vmdk code is sloppy when handling the header descriptor during
creation of an image. Fix all header accesses in the create path to
either store native endianness or convert it when appropriate.

Reported-by: Yury Tsarev <>...

80465c50 11/24/2010 06:31 pm Kevin Wolf

block: Remove unused s->hd in various drivers

All drivers use bs->file instead of s->hd for quite a while now, so it's time
to remove s->hd.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

205ef796 11/04/2010 01:52 pm Kevin Wolf

block: Allow bdrv_flush to return errors

This changes bdrv_flush to return 0 on success and -errno in case of failure.
It's a requirement for implementing proper error handle in users of bdrv_flush.

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

b8852e87 06/22/2010 03:38 pm Kevin Wolf

vmdk: Use bdrv_(p)write_sync for metadata writes

Use bdrv_(p)write_sync to ensure metadata integrity in case of a crash.

Signed-off-by: Kevin Wolf <>

c336500d 05/03/2010 11:07 am Kevin Wolf

vmdk: Fix COW

When trying to do COW, VMDK wrote the data back to the backing file. This
problem was revealed by the patch that made backing files read-only. This patch
does not only fix the problem, but also simplifies the VMDK code a bit.

This fixes the backing file qemu-iotests cases for VMDK....

9949f97e 05/03/2010 11:07 am Kevin Wolf

vmdk: Clean up backing file handling

VMDK is doing interesting things when it needs to open a backing file. This
patch changes that part to look more like in other drivers. The nice side
effect is that the file name isn't needed any more in the open function....

6511ef77 05/03/2010 11:07 am Kevin Wolf

vmdk: Convert to bdrv_open

It's a format driver, so implement bdrv_open instead of bdrv_file_open.

Signed-off-by: Kevin Wolf <>

66f82cee 05/03/2010 11:07 am Kevin Wolf

block: Open the underlying image file in generic code

Format drivers shouldn't need to bother with things like file names, but rather
just get an open BlockDriverState for the underlying protocol. This patch
introduces this behaviour for bdrv_open implementation. For protocols which...

d6e9098e 04/23/2010 05:08 pm Kevin Wolf

Replace calls of old bdrv_open

What is known today as bdrv_open2 becomes the new bdrv_open. All remaining
callers of the old function are converted to the new one. In some places they
even know the right format, so they should have used bdrv_open2 from the...

b781cce5 03/09/2010 07:23 pm Juan Quintela

vmdk: return errno instead of -1

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

53c2e716 03/09/2010 07:23 pm Juan Quintela

vmdk: make vmdk_snapshot_create return -errno

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

a161329b 03/09/2010 07:23 pm Juan Quintela

vmdk: fix double free

fail_gd error case would also free rgd_buf that was already freed

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

3829cb46 03/09/2010 07:23 pm Juan Quintela

vmdk: share cleanup code

cleanup code is identical for error/success cases. Only difference
are goto labels.

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>