Status Update: Vmdk open and Qemu-img Info on Multi File Images

The BlockDriver of vmdk is defined as

1
2
3
4
5
6
7
8
9
10
11
12
13
14
static BlockDriver bdrv_vmdk = {
    .format_name = "vmdk",
    .instance_size = sizeof(BDRVVmdkState),
    .bdrv_probe = vmdk_probe,
    .bdrv_open = vmdk_open,
    .bdrv_read = vmdk_read,
    .bdrv_write = vmdk_write,
    .bdrv_close = vmdk_close,
    .bdrv_create = vmdk_create,
    .bdrv_flush = vmdk_flush,
    .bdrv_is_allocated = vmdk_is_allocated,

    .create_options = vmdk_create_options,
};

Bdrv_* functions are to be modified to add support of new formats. Now probe and open are ready to process mono flat images, others are left dummy functions for now. And original code for mono sparse format is temporarily commented out because there are a number of trivial changes to migrate them to new state structure. I think firstly enable mono flat handling before sparse is a smoother start.

The remaining work of today and tomorrow are the six other functions (read, write, close, etc.), which are quite plain ones too.

After implementing bdrv_open, here comes one issue in qemu-img.c. When running qemu-img info on image file, a “file size” is printed where the value is how host system thinks of the file size. This value generally represents how much host OS file system space the VM disk takes. In our case of multiple file as one VM disk, only descriptor file’s size is counted by qemu-img.c:get_allocated_file_size. If we want to show the total size of multiple file image, this logic has to be updated.

Comments