* [Qemu-devel] VMDK development plan for Summer of Code 2011 @ 2011-05-29 13:19 Fam Zheng 2011-06-01 4:29 ` Stefan Hajnoczi 0 siblings, 1 reply; 10+ messages in thread From: Fam Zheng @ 2011-05-29 13:19 UTC (permalink / raw) To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi Hi all, As a project of Google Summer of Code 2011, I'm now working on improving VMDK image support. There are many subformats of VMDK virtual disk, some of which have separate descriptor file and others don't, some allocate space at once and some others grow dynamically, some have optional data compression. The current support of VMDK format is very limited, i.e. qemu now supports single file images, but couldn't recognize the widely used multi-file types. We have planned to add such support to VMDK block driver and enable more image types, and the working timeline is set in weeks (#1 to #7) as: [#1] Monolithic flat layout support [#2] Implement compression and Stream-Optimized Compressed Sparse Extents support. [#3] Improve ESX Server Sparse Extents support. [#4] Debug and test. Collect virtual disks with various versions and options, test qemu-img with them. By now some patches may be ready to deliver. [#5, 6] Add multi-file support (2GB extent formats) [#7] Clean up and midterm evaluation. According to the above schedule, several formats will be added till mid-term evaluation of GSoC. The development has been in progress for a week, and we'll soon have a patch ready for monolithic flat format. I have also created a project blog for progress update: http://warm.la/soc The project code is found at: https://github.com/famousz/qemu-vmdk And my mentor is Stefan Hajnoczi, who is doing a great job give the guidance. Any suggestion or problem report about the development or using VMDK image with qemu is welcome. Thanks. -- Best regards! Fam Zheng ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-05-29 13:19 [Qemu-devel] VMDK development plan for Summer of Code 2011 Fam Zheng @ 2011-06-01 4:29 ` Stefan Hajnoczi 2011-06-01 8:49 ` Alexander Graf 0 siblings, 1 reply; 10+ messages in thread From: Stefan Hajnoczi @ 2011-06-01 4:29 UTC (permalink / raw) To: Fam Zheng; +Cc: Kevin Wolf, qemu-devel On Sun, May 29, 2011 at 2:19 PM, Fam Zheng <famcool@gmail.com> wrote: > As a project of Google Summer of Code 2011, I'm now working on > improving VMDK image support. There are many subformats of VMDK > virtual disk, some of which have separate descriptor file and others > don't, some allocate space at once and some others grow dynamically, > some have optional data compression. The current support of VMDK > format is very limited, i.e. qemu now supports single file images, but > couldn't recognize the widely used multi-file types. We have planned > to add such support to VMDK block driver and enable more image types, > and the working timeline is set in weeks (#1 to #7) as: > > [#1] Monolithic flat layout support > [#2] Implement compression and Stream-Optimized Compressed Sparse > Extents support. > [#3] Improve ESX Server Sparse Extents support. > [#4] Debug and test. Collect virtual disks with various versions and > options, test qemu-img with them. By now some patches may be ready to > deliver. > [#5, 6] Add multi-file support (2GB extent formats) > [#7] Clean up and midterm evaluation. Thanks to Fam's work, we'll hopefully support the latest real-world VMDK files in qemu-img convert within the next few months. If anyone has had particular VMDK "problem files" which qemu-img cannot handle, please reply, they would make interesting test cases. Stefan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-06-01 4:29 ` Stefan Hajnoczi @ 2011-06-01 8:49 ` Alexander Graf 2011-06-01 9:11 ` Kevin Wolf 0 siblings, 1 reply; 10+ messages in thread From: Alexander Graf @ 2011-06-01 8:49 UTC (permalink / raw) To: Stefan Hajnoczi; +Cc: Kevin Wolf, Fam Zheng, qemu-devel On 01.06.2011, at 06:29, Stefan Hajnoczi wrote: > On Sun, May 29, 2011 at 2:19 PM, Fam Zheng <famcool@gmail.com> wrote: >> As a project of Google Summer of Code 2011, I'm now working on >> improving VMDK image support. There are many subformats of VMDK >> virtual disk, some of which have separate descriptor file and others >> don't, some allocate space at once and some others grow dynamically, >> some have optional data compression. The current support of VMDK >> format is very limited, i.e. qemu now supports single file images, but >> couldn't recognize the widely used multi-file types. We have planned >> to add such support to VMDK block driver and enable more image types, >> and the working timeline is set in weeks (#1 to #7) as: >> >> [#1] Monolithic flat layout support >> [#2] Implement compression and Stream-Optimized Compressed Sparse >> Extents support. >> [#3] Improve ESX Server Sparse Extents support. >> [#4] Debug and test. Collect virtual disks with various versions and >> options, test qemu-img with them. By now some patches may be ready to >> deliver. >> [#5, 6] Add multi-file support (2GB extent formats) >> [#7] Clean up and midterm evaluation. > > Thanks to Fam's work, we'll hopefully support the latest real-world > VMDK files in qemu-img convert within the next few months. > > If anyone has had particular VMDK "problem files" which qemu-img > cannot handle, please reply, they would make interesting test cases. There is one very useful use-case of VMDK files that we currently don't support: remapping. A vmdk file can specify that it really is backed by a raw block device, but only for certain chunks, while other chunks of it can be mapped read-only or zero. That is very useful when passing in a host disk to the guest and you want to be sure that you don't break other partitions than the one you're playing with. It can also shadow map those chunks. For example on the case above, the MBR is COW (IIRC) for the image, so you can install a bootloader in there. Alex ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-06-01 8:49 ` Alexander Graf @ 2011-06-01 9:11 ` Kevin Wolf 2011-06-01 9:13 ` Alexander Graf 0 siblings, 1 reply; 10+ messages in thread From: Kevin Wolf @ 2011-06-01 9:11 UTC (permalink / raw) To: Alexander Graf; +Cc: Stefan Hajnoczi, qemu-devel, Fam Zheng Am 01.06.2011 10:49, schrieb Alexander Graf: > > On 01.06.2011, at 06:29, Stefan Hajnoczi wrote: > >> On Sun, May 29, 2011 at 2:19 PM, Fam Zheng <famcool@gmail.com> wrote: >>> As a project of Google Summer of Code 2011, I'm now working on >>> improving VMDK image support. There are many subformats of VMDK >>> virtual disk, some of which have separate descriptor file and others >>> don't, some allocate space at once and some others grow dynamically, >>> some have optional data compression. The current support of VMDK >>> format is very limited, i.e. qemu now supports single file images, but >>> couldn't recognize the widely used multi-file types. We have planned >>> to add such support to VMDK block driver and enable more image types, >>> and the working timeline is set in weeks (#1 to #7) as: >>> >>> [#1] Monolithic flat layout support >>> [#2] Implement compression and Stream-Optimized Compressed Sparse >>> Extents support. >>> [#3] Improve ESX Server Sparse Extents support. >>> [#4] Debug and test. Collect virtual disks with various versions and >>> options, test qemu-img with them. By now some patches may be ready to >>> deliver. >>> [#5, 6] Add multi-file support (2GB extent formats) >>> [#7] Clean up and midterm evaluation. >> >> Thanks to Fam's work, we'll hopefully support the latest real-world >> VMDK files in qemu-img convert within the next few months. >> >> If anyone has had particular VMDK "problem files" which qemu-img >> cannot handle, please reply, they would make interesting test cases. > > There is one very useful use-case of VMDK files that we currently don't support: remapping. > > A vmdk file can specify that it really is backed by a raw block device, but only for certain chunks, while other chunks of it can be mapped read-only or zero. That is very useful when passing in a host disk to the guest and you want to be sure that you don't break other partitions than the one you're playing with. > > It can also shadow map those chunks. For example on the case above, the MBR is COW (IIRC) for the image, so you can install a bootloader in there. Hm, wondering if that's something to consider for qcow2v3, too... Do you think it's still useful when doing this on a cluster granularity? It would only work for well-aligned partitions then, but I think that shouldn't be a problem for current OSes. Basically, additionally to the three cluster types "read from this image", "COW from backing file" and "zero cluster" we could introduce a fourth one "read/write to backing file". Kevin ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-06-01 9:11 ` Kevin Wolf @ 2011-06-01 9:13 ` Alexander Graf 2011-06-01 22:11 ` Stefan Hajnoczi 0 siblings, 1 reply; 10+ messages in thread From: Alexander Graf @ 2011-06-01 9:13 UTC (permalink / raw) To: Kevin Wolf; +Cc: Stefan Hajnoczi, qemu-devel, Fam Zheng On 01.06.2011, at 11:11, Kevin Wolf wrote: > Am 01.06.2011 10:49, schrieb Alexander Graf: >> >> On 01.06.2011, at 06:29, Stefan Hajnoczi wrote: >> >>> On Sun, May 29, 2011 at 2:19 PM, Fam Zheng <famcool@gmail.com> wrote: >>>> As a project of Google Summer of Code 2011, I'm now working on >>>> improving VMDK image support. There are many subformats of VMDK >>>> virtual disk, some of which have separate descriptor file and others >>>> don't, some allocate space at once and some others grow dynamically, >>>> some have optional data compression. The current support of VMDK >>>> format is very limited, i.e. qemu now supports single file images, but >>>> couldn't recognize the widely used multi-file types. We have planned >>>> to add such support to VMDK block driver and enable more image types, >>>> and the working timeline is set in weeks (#1 to #7) as: >>>> >>>> [#1] Monolithic flat layout support >>>> [#2] Implement compression and Stream-Optimized Compressed Sparse >>>> Extents support. >>>> [#3] Improve ESX Server Sparse Extents support. >>>> [#4] Debug and test. Collect virtual disks with various versions and >>>> options, test qemu-img with them. By now some patches may be ready to >>>> deliver. >>>> [#5, 6] Add multi-file support (2GB extent formats) >>>> [#7] Clean up and midterm evaluation. >>> >>> Thanks to Fam's work, we'll hopefully support the latest real-world >>> VMDK files in qemu-img convert within the next few months. >>> >>> If anyone has had particular VMDK "problem files" which qemu-img >>> cannot handle, please reply, they would make interesting test cases. >> >> There is one very useful use-case of VMDK files that we currently don't support: remapping. >> >> A vmdk file can specify that it really is backed by a raw block device, but only for certain chunks, while other chunks of it can be mapped read-only or zero. That is very useful when passing in a host disk to the guest and you want to be sure that you don't break other partitions than the one you're playing with. >> >> It can also shadow map those chunks. For example on the case above, the MBR is COW (IIRC) for the image, so you can install a bootloader in there. > > Hm, wondering if that's something to consider for qcow2v3, too... Do you > think it's still useful when doing this on a cluster granularity? It > would only work for well-aligned partitions then, but I think that > shouldn't be a problem for current OSes. Well, we could always just hack around for bits where it overlaps. When passing in a differently aligned partition for example, we could just declare the odd sector as COW sector and copy the contents over :). Though that might not be what the user really wants. Hrm. > Basically, additionally to the three cluster types "read from this > image", "COW from backing file" and "zero cluster" we could introduce a > fourth one "read/write to backing file". Yup, sounds very much straight forward! Then all we need is some tool to create such a qcow file :) Alex ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-06-01 9:13 ` Alexander Graf @ 2011-06-01 22:11 ` Stefan Hajnoczi 2011-06-06 9:50 ` Kevin Wolf 0 siblings, 1 reply; 10+ messages in thread From: Stefan Hajnoczi @ 2011-06-01 22:11 UTC (permalink / raw) To: Alexander Graf; +Cc: Kevin Wolf, Fam Zheng, qemu-devel On Wed, Jun 1, 2011 at 10:13 AM, Alexander Graf <agraf@suse.de> wrote: > > On 01.06.2011, at 11:11, Kevin Wolf wrote: > >> Am 01.06.2011 10:49, schrieb Alexander Graf: >>> >>> On 01.06.2011, at 06:29, Stefan Hajnoczi wrote: >>> >>>> On Sun, May 29, 2011 at 2:19 PM, Fam Zheng <famcool@gmail.com> wrote: >>>>> As a project of Google Summer of Code 2011, I'm now working on >>>>> improving VMDK image support. There are many subformats of VMDK >>>>> virtual disk, some of which have separate descriptor file and others >>>>> don't, some allocate space at once and some others grow dynamically, >>>>> some have optional data compression. The current support of VMDK >>>>> format is very limited, i.e. qemu now supports single file images, but >>>>> couldn't recognize the widely used multi-file types. We have planned >>>>> to add such support to VMDK block driver and enable more image types, >>>>> and the working timeline is set in weeks (#1 to #7) as: >>>>> >>>>> [#1] Monolithic flat layout support >>>>> [#2] Implement compression and Stream-Optimized Compressed Sparse >>>>> Extents support. >>>>> [#3] Improve ESX Server Sparse Extents support. >>>>> [#4] Debug and test. Collect virtual disks with various versions and >>>>> options, test qemu-img with them. By now some patches may be ready to >>>>> deliver. >>>>> [#5, 6] Add multi-file support (2GB extent formats) >>>>> [#7] Clean up and midterm evaluation. >>>> >>>> Thanks to Fam's work, we'll hopefully support the latest real-world >>>> VMDK files in qemu-img convert within the next few months. >>>> >>>> If anyone has had particular VMDK "problem files" which qemu-img >>>> cannot handle, please reply, they would make interesting test cases. >>> >>> There is one very useful use-case of VMDK files that we currently don't support: remapping. >>> >>> A vmdk file can specify that it really is backed by a raw block device, but only for certain chunks, while other chunks of it can be mapped read-only or zero. That is very useful when passing in a host disk to the guest and you want to be sure that you don't break other partitions than the one you're playing with. >>> >>> It can also shadow map those chunks. For example on the case above, the MBR is COW (IIRC) for the image, so you can install a bootloader in there. >> >> Hm, wondering if that's something to consider for qcow2v3, too... Do you >> think it's still useful when doing this on a cluster granularity? It >> would only work for well-aligned partitions then, but I think that >> shouldn't be a problem for current OSes. > > Well, we could always just hack around for bits where it overlaps. When passing in a differently aligned partition for example, we could just declare the odd sector as COW sector and copy the contents over :). Though that might not be what the user really wants. Hrm. > >> Basically, additionally to the three cluster types "read from this >> image", "COW from backing file" and "zero cluster" we could introduce a >> fourth one "read/write to backing file". > > Yup, sounds very much straight forward! Then all we need is some tool to create such a qcow file :) If we want to implement mini-device mapper why not do it as a separate BlockDriver? This could be useful for non-qcow2 cases like *safely* passing through a physical disk with a guarantee that you won't destroy the MBR. Also if we do it outside of an image format we don't need to worry about clusters and can do sector-granularity mapping. In fact, if we want mini-device mapper, that could be used to implement the VMDK multi-file support too. So if Fam writes a generic BlockDriver extent mapper we can use it from VMDK but also from command-line options that tie together qcow2, qed, raw, etc images. Stefan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-06-01 22:11 ` Stefan Hajnoczi @ 2011-06-06 9:50 ` Kevin Wolf 2011-06-06 10:53 ` Stefan Hajnoczi 0 siblings, 1 reply; 10+ messages in thread From: Kevin Wolf @ 2011-06-06 9:50 UTC (permalink / raw) To: Stefan Hajnoczi; +Cc: Fam Zheng, Alexander Graf, qemu-devel Am 02.06.2011 00:11, schrieb Stefan Hajnoczi: > On Wed, Jun 1, 2011 at 10:13 AM, Alexander Graf <agraf@suse.de> wrote: >> >> On 01.06.2011, at 11:11, Kevin Wolf wrote: >> >>> Am 01.06.2011 10:49, schrieb Alexander Graf: >>>> >>>> On 01.06.2011, at 06:29, Stefan Hajnoczi wrote: >>>> >>>>> On Sun, May 29, 2011 at 2:19 PM, Fam Zheng <famcool@gmail.com> wrote: >>>>>> As a project of Google Summer of Code 2011, I'm now working on >>>>>> improving VMDK image support. There are many subformats of VMDK >>>>>> virtual disk, some of which have separate descriptor file and others >>>>>> don't, some allocate space at once and some others grow dynamically, >>>>>> some have optional data compression. The current support of VMDK >>>>>> format is very limited, i.e. qemu now supports single file images, but >>>>>> couldn't recognize the widely used multi-file types. We have planned >>>>>> to add such support to VMDK block driver and enable more image types, >>>>>> and the working timeline is set in weeks (#1 to #7) as: >>>>>> >>>>>> [#1] Monolithic flat layout support >>>>>> [#2] Implement compression and Stream-Optimized Compressed Sparse >>>>>> Extents support. >>>>>> [#3] Improve ESX Server Sparse Extents support. >>>>>> [#4] Debug and test. Collect virtual disks with various versions and >>>>>> options, test qemu-img with them. By now some patches may be ready to >>>>>> deliver. >>>>>> [#5, 6] Add multi-file support (2GB extent formats) >>>>>> [#7] Clean up and midterm evaluation. >>>>> >>>>> Thanks to Fam's work, we'll hopefully support the latest real-world >>>>> VMDK files in qemu-img convert within the next few months. >>>>> >>>>> If anyone has had particular VMDK "problem files" which qemu-img >>>>> cannot handle, please reply, they would make interesting test cases. >>>> >>>> There is one very useful use-case of VMDK files that we currently don't support: remapping. >>>> >>>> A vmdk file can specify that it really is backed by a raw block device, but only for certain chunks, while other chunks of it can be mapped read-only or zero. That is very useful when passing in a host disk to the guest and you want to be sure that you don't break other partitions than the one you're playing with. >>>> >>>> It can also shadow map those chunks. For example on the case above, the MBR is COW (IIRC) for the image, so you can install a bootloader in there. >>> >>> Hm, wondering if that's something to consider for qcow2v3, too... Do you >>> think it's still useful when doing this on a cluster granularity? It >>> would only work for well-aligned partitions then, but I think that >>> shouldn't be a problem for current OSes. >> >> Well, we could always just hack around for bits where it overlaps. When passing in a differently aligned partition for example, we could just declare the odd sector as COW sector and copy the contents over :). Though that might not be what the user really wants. Hrm. >> >>> Basically, additionally to the three cluster types "read from this >>> image", "COW from backing file" and "zero cluster" we could introduce a >>> fourth one "read/write to backing file". >> >> Yup, sounds very much straight forward! Then all we need is some tool to create such a qcow file :) > > If we want to implement mini-device mapper why not do it as a separate > BlockDriver? This could be useful for non-qcow2 cases like *safely* > passing through a physical disk with a guarantee that you won't > destroy the MBR. Also if we do it outside of an image format we don't > need to worry about clusters and can do sector-granularity mapping. > > In fact, if we want mini-device mapper, that could be used to > implement the VMDK multi-file support too. So if Fam writes a generic > BlockDriver extent mapper we can use it from VMDK but also from > command-line options that tie together qcow2, qed, raw, etc images. Does it really work for Alex' case, where you have some parts of an image file that you want to be COW and other parts that write directly to the backing file? Or to put it in a more general way: Does it work when you reference an image more than once? Wouldn't you have to open the same image twice? Kevin ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-06-06 9:50 ` Kevin Wolf @ 2011-06-06 10:53 ` Stefan Hajnoczi 2011-06-06 11:08 ` Kevin Wolf 0 siblings, 1 reply; 10+ messages in thread From: Stefan Hajnoczi @ 2011-06-06 10:53 UTC (permalink / raw) To: Kevin Wolf; +Cc: Fam Zheng, Alexander Graf, qemu-devel On Mon, Jun 6, 2011 at 10:50 AM, Kevin Wolf <kwolf@redhat.com> wrote: > Am 02.06.2011 00:11, schrieb Stefan Hajnoczi: >> On Wed, Jun 1, 2011 at 10:13 AM, Alexander Graf <agraf@suse.de> wrote: >>> >>> On 01.06.2011, at 11:11, Kevin Wolf wrote: >>> >>>> Am 01.06.2011 10:49, schrieb Alexander Graf: >>>>> >>>>> On 01.06.2011, at 06:29, Stefan Hajnoczi wrote: >>>>> >>>>>> On Sun, May 29, 2011 at 2:19 PM, Fam Zheng <famcool@gmail.com> wrote: >>>>>>> As a project of Google Summer of Code 2011, I'm now working on >>>>>>> improving VMDK image support. There are many subformats of VMDK >>>>>>> virtual disk, some of which have separate descriptor file and others >>>>>>> don't, some allocate space at once and some others grow dynamically, >>>>>>> some have optional data compression. The current support of VMDK >>>>>>> format is very limited, i.e. qemu now supports single file images, but >>>>>>> couldn't recognize the widely used multi-file types. We have planned >>>>>>> to add such support to VMDK block driver and enable more image types, >>>>>>> and the working timeline is set in weeks (#1 to #7) as: >>>>>>> >>>>>>> [#1] Monolithic flat layout support >>>>>>> [#2] Implement compression and Stream-Optimized Compressed Sparse >>>>>>> Extents support. >>>>>>> [#3] Improve ESX Server Sparse Extents support. >>>>>>> [#4] Debug and test. Collect virtual disks with various versions and >>>>>>> options, test qemu-img with them. By now some patches may be ready to >>>>>>> deliver. >>>>>>> [#5, 6] Add multi-file support (2GB extent formats) >>>>>>> [#7] Clean up and midterm evaluation. >>>>>> >>>>>> Thanks to Fam's work, we'll hopefully support the latest real-world >>>>>> VMDK files in qemu-img convert within the next few months. >>>>>> >>>>>> If anyone has had particular VMDK "problem files" which qemu-img >>>>>> cannot handle, please reply, they would make interesting test cases. >>>>> >>>>> There is one very useful use-case of VMDK files that we currently don't support: remapping. >>>>> >>>>> A vmdk file can specify that it really is backed by a raw block device, but only for certain chunks, while other chunks of it can be mapped read-only or zero. That is very useful when passing in a host disk to the guest and you want to be sure that you don't break other partitions than the one you're playing with. >>>>> >>>>> It can also shadow map those chunks. For example on the case above, the MBR is COW (IIRC) for the image, so you can install a bootloader in there. >>>> >>>> Hm, wondering if that's something to consider for qcow2v3, too... Do you >>>> think it's still useful when doing this on a cluster granularity? It >>>> would only work for well-aligned partitions then, but I think that >>>> shouldn't be a problem for current OSes. >>> >>> Well, we could always just hack around for bits where it overlaps. When passing in a differently aligned partition for example, we could just declare the odd sector as COW sector and copy the contents over :). Though that might not be what the user really wants. Hrm. >>> >>>> Basically, additionally to the three cluster types "read from this >>>> image", "COW from backing file" and "zero cluster" we could introduce a >>>> fourth one "read/write to backing file". >>> >>> Yup, sounds very much straight forward! Then all we need is some tool to create such a qcow file :) >> >> If we want to implement mini-device mapper why not do it as a separate >> BlockDriver? This could be useful for non-qcow2 cases like *safely* >> passing through a physical disk with a guarantee that you won't >> destroy the MBR. Also if we do it outside of an image format we don't >> need to worry about clusters and can do sector-granularity mapping. >> >> In fact, if we want mini-device mapper, that could be used to >> implement the VMDK multi-file support too. So if Fam writes a generic >> BlockDriver extent mapper we can use it from VMDK but also from >> command-line options that tie together qcow2, qed, raw, etc images. > > Does it really work for Alex' case, where you have some parts of an > image file that you want to be COW and other parts that write directly > to the backing file? > > Or to put it in a more general way: Does it work when you reference an > image more than once? Wouldn't you have to open the same image twice? Here is an example of booting from a physical disk: [mbr][/dev/zero][/dev/sda] mbr is a COW image based on /dev/sda. /dev/zero is used to protect the first partition would be. The guest only sees zeroes and writes are ignored because the guest should never access this region. /dev/sda is the extent containing the second partition (actually we could just open /dev/sda2). Here we have the case that you mentioned with /dev/sda open as the read-only backing file for mbr and as read-write for the second partition. The question is are raw images safe for multiple opens when at least one is read-write? I think the answer for raw is yes. It is not safe to open non-raw image files multiple times. I'm also wondering if the -blockdev backing_file=<backing> option that has been discussed could be used in non-raw cases. Instead of opening backing files by name, specify the backing file block device on the command-line so that the same BlockDriverState is shared, avoiding inconsistencies. The multiple opener issue is orthogonal to device mapper support. Stefan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-06-06 10:53 ` Stefan Hajnoczi @ 2011-06-06 11:08 ` Kevin Wolf 2011-06-06 11:12 ` Stefan Hajnoczi 0 siblings, 1 reply; 10+ messages in thread From: Kevin Wolf @ 2011-06-06 11:08 UTC (permalink / raw) To: Stefan Hajnoczi; +Cc: Fam Zheng, Alexander Graf, qemu-devel Am 06.06.2011 12:53, schrieb Stefan Hajnoczi: > On Mon, Jun 6, 2011 at 10:50 AM, Kevin Wolf <kwolf@redhat.com> wrote: >> Am 02.06.2011 00:11, schrieb Stefan Hajnoczi: >>> On Wed, Jun 1, 2011 at 10:13 AM, Alexander Graf <agraf@suse.de> wrote: >>>> >>>> On 01.06.2011, at 11:11, Kevin Wolf wrote: >>>> >>>>> Am 01.06.2011 10:49, schrieb Alexander Graf: >>>>>> There is one very useful use-case of VMDK files that we currently don't support: remapping. >>>>>> >>>>>> A vmdk file can specify that it really is backed by a raw block device, but only for certain chunks, while other chunks of it can be mapped read-only or zero. That is very useful when passing in a host disk to the guest and you want to be sure that you don't break other partitions than the one you're playing with. >>>>>> >>>>>> It can also shadow map those chunks. For example on the case above, the MBR is COW (IIRC) for the image, so you can install a bootloader in there. >>>>> >>>>> Hm, wondering if that's something to consider for qcow2v3, too... Do you >>>>> think it's still useful when doing this on a cluster granularity? It >>>>> would only work for well-aligned partitions then, but I think that >>>>> shouldn't be a problem for current OSes. >>>> >>>> Well, we could always just hack around for bits where it overlaps. When passing in a differently aligned partition for example, we could just declare the odd sector as COW sector and copy the contents over :). Though that might not be what the user really wants. Hrm. >>>> >>>>> Basically, additionally to the three cluster types "read from this >>>>> image", "COW from backing file" and "zero cluster" we could introduce a >>>>> fourth one "read/write to backing file". >>>> >>>> Yup, sounds very much straight forward! Then all we need is some tool to create such a qcow file :) >>> >>> If we want to implement mini-device mapper why not do it as a separate >>> BlockDriver? This could be useful for non-qcow2 cases like *safely* >>> passing through a physical disk with a guarantee that you won't >>> destroy the MBR. Also if we do it outside of an image format we don't >>> need to worry about clusters and can do sector-granularity mapping. >>> >>> In fact, if we want mini-device mapper, that could be used to >>> implement the VMDK multi-file support too. So if Fam writes a generic >>> BlockDriver extent mapper we can use it from VMDK but also from >>> command-line options that tie together qcow2, qed, raw, etc images. >> >> Does it really work for Alex' case, where you have some parts of an >> image file that you want to be COW and other parts that write directly >> to the backing file? >> >> Or to put it in a more general way: Does it work when you reference an >> image more than once? Wouldn't you have to open the same image twice? > > Here is an example of booting from a physical disk: > > [mbr][/dev/zero][/dev/sda] > > mbr is a COW image based on /dev/sda. > > /dev/zero is used to protect the first partition would be. The guest > only sees zeroes and writes are ignored because the guest should never > access this region. > > /dev/sda is the extent containing the second partition (actually we > could just open /dev/sda2). > > Here we have the case that you mentioned with /dev/sda open as the > read-only backing file for mbr and as read-write for the second > partition. The question is are raw images safe for multiple opens > when at least one is read-write? I think the answer for raw is yes. > It is not safe to open non-raw image files multiple times. Yes, it would work for raw images. But should we really introduce concepts that only work with raw images? > I'm also wondering if the -blockdev backing_file=<backing> option that > has been discussed could be used in non-raw cases. Instead of opening > backing files by name, specify the backing file block device on the > command-line so that the same BlockDriverState is shared, avoiding > inconsistencies. > > The multiple opener issue is orthogonal to device mapper support. Well, no. If the only use case for the device mapper thing means that we need to open images twice, there's no point in implementing it without solving the multiple opener problem first. Kevin ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] VMDK development plan for Summer of Code 2011 2011-06-06 11:08 ` Kevin Wolf @ 2011-06-06 11:12 ` Stefan Hajnoczi 0 siblings, 0 replies; 10+ messages in thread From: Stefan Hajnoczi @ 2011-06-06 11:12 UTC (permalink / raw) To: Kevin Wolf; +Cc: Fam Zheng, Alexander Graf, qemu-devel On Mon, Jun 6, 2011 at 12:08 PM, Kevin Wolf <kwolf@redhat.com> wrote: > Am 06.06.2011 12:53, schrieb Stefan Hajnoczi: >> On Mon, Jun 6, 2011 at 10:50 AM, Kevin Wolf <kwolf@redhat.com> wrote: >>> Am 02.06.2011 00:11, schrieb Stefan Hajnoczi: >>>> On Wed, Jun 1, 2011 at 10:13 AM, Alexander Graf <agraf@suse.de> wrote: >>>>> >>>>> On 01.06.2011, at 11:11, Kevin Wolf wrote: >>>>> >>>>>> Am 01.06.2011 10:49, schrieb Alexander Graf: >>>>>>> There is one very useful use-case of VMDK files that we currently don't support: remapping. >>>>>>> >>>>>>> A vmdk file can specify that it really is backed by a raw block device, but only for certain chunks, while other chunks of it can be mapped read-only or zero. That is very useful when passing in a host disk to the guest and you want to be sure that you don't break other partitions than the one you're playing with. >>>>>>> >>>>>>> It can also shadow map those chunks. For example on the case above, the MBR is COW (IIRC) for the image, so you can install a bootloader in there. >>>>>> >>>>>> Hm, wondering if that's something to consider for qcow2v3, too... Do you >>>>>> think it's still useful when doing this on a cluster granularity? It >>>>>> would only work for well-aligned partitions then, but I think that >>>>>> shouldn't be a problem for current OSes. >>>>> >>>>> Well, we could always just hack around for bits where it overlaps. When passing in a differently aligned partition for example, we could just declare the odd sector as COW sector and copy the contents over :). Though that might not be what the user really wants. Hrm. >>>>> >>>>>> Basically, additionally to the three cluster types "read from this >>>>>> image", "COW from backing file" and "zero cluster" we could introduce a >>>>>> fourth one "read/write to backing file". >>>>> >>>>> Yup, sounds very much straight forward! Then all we need is some tool to create such a qcow file :) >>>> >>>> If we want to implement mini-device mapper why not do it as a separate >>>> BlockDriver? This could be useful for non-qcow2 cases like *safely* >>>> passing through a physical disk with a guarantee that you won't >>>> destroy the MBR. Also if we do it outside of an image format we don't >>>> need to worry about clusters and can do sector-granularity mapping. >>>> >>>> In fact, if we want mini-device mapper, that could be used to >>>> implement the VMDK multi-file support too. So if Fam writes a generic >>>> BlockDriver extent mapper we can use it from VMDK but also from >>>> command-line options that tie together qcow2, qed, raw, etc images. >>> >>> Does it really work for Alex' case, where you have some parts of an >>> image file that you want to be COW and other parts that write directly >>> to the backing file? >>> >>> Or to put it in a more general way: Does it work when you reference an >>> image more than once? Wouldn't you have to open the same image twice? >> >> Here is an example of booting from a physical disk: >> >> [mbr][/dev/zero][/dev/sda] >> >> mbr is a COW image based on /dev/sda. >> >> /dev/zero is used to protect the first partition would be. The guest >> only sees zeroes and writes are ignored because the guest should never >> access this region. >> >> /dev/sda is the extent containing the second partition (actually we >> could just open /dev/sda2). >> >> Here we have the case that you mentioned with /dev/sda open as the >> read-only backing file for mbr and as read-write for the second >> partition. The question is are raw images safe for multiple opens >> when at least one is read-write? I think the answer for raw is yes. >> It is not safe to open non-raw image files multiple times. > > Yes, it would work for raw images. But should we really introduce > concepts that only work with raw images? > >> I'm also wondering if the -blockdev backing_file=<backing> option that >> has been discussed could be used in non-raw cases. Instead of opening >> backing files by name, specify the backing file block device on the >> command-line so that the same BlockDriverState is shared, avoiding >> inconsistencies. >> >> The multiple opener issue is orthogonal to device mapper support. > > Well, no. If the only use case for the device mapper thing means that we > need to open images twice, there's no point in implementing it without > solving the multiple opener problem first. Protecting physical disk partitions is one use case, the other use case was for implementing VMDK multi-file support, which is why I mentioned Fam. Stefan ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-06-06 11:12 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-05-29 13:19 [Qemu-devel] VMDK development plan for Summer of Code 2011 Fam Zheng 2011-06-01 4:29 ` Stefan Hajnoczi 2011-06-01 8:49 ` Alexander Graf 2011-06-01 9:11 ` Kevin Wolf 2011-06-01 9:13 ` Alexander Graf 2011-06-01 22:11 ` Stefan Hajnoczi 2011-06-06 9:50 ` Kevin Wolf 2011-06-06 10:53 ` Stefan Hajnoczi 2011-06-06 11:08 ` Kevin Wolf 2011-06-06 11:12 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).