kvm tool: add QCOW verions 1 read/write support
PATCH v2 1/1 kvm tool: add QCOW verions 1 read/write support
The patch only implements the basic read write support for QCOW version 1 images. Many of the QCOW features are not implmented, for example
- image creation
- snapshot
- copy-on-write
- encryption
Renamed the file CREDITS-Git to CREDITS and added QEMU credits to CREDITS file.
--- tools/kvm/CREDITS | 46 ++++++ tools/kvm/Makefile | 2 + tools/kvm/disk-image.c | 7 + tools/kvm/include/kvm/qcow.h | 55 +++++++ tools/kvm/include/linux/byteorder.h | 7 + tools/kvm/include/linux/types.h | 19 +++ tools/kvm/qcow.c | 99 ++++++++++++ tools/kvm/qcow1.c | 301 +++++++++++++++++++++++++++++++++++ 8 files changed, 536 insertions(+), 0 deletions(-) create mode 100644 tools/kvm/CREDITS create mode 100644 tools/kvm/include/kvm/qcow.h create mode 100644 tools/kvm/include/linux/byteorder.h create mode 100644 tools/kvm/qcow.c create mode 100644 tools/kvm/qcow1.c
tools/kvm/CREDITS new file +46 -0
@@ -0,0 +1,46 @@ +Perf/Git: +Most of the infrastructure that 'perf' uses here has been reused +from the Git project, as of version: + + 66996ec: Sync with 1.6.2.4 + +Here is an (incomplete!) list of main contributors to those files +in util/* and elsewhere: + + Alex Riesen + Christian Couder + Dmitry Potapov + Jeff King + Johannes Schindelin + Johannes Sixt + Junio C Hamano + Linus Torvalds + Matthias Kestenholz + Michal Ostrowski + Miklos Vajna + Petr Baudis + Pierre Habouzit + René Scharfe + Samuel Tardieu + Shawn O. Pearce + Steffen Prohaska + Steve Haslam + +Thanks guys! + +The full history of the files can be found in the upstream Git commits. + + +QEMU +The source code of the QEMU was referenced while developing the QCOW support +for the kvm tool. The relevant QEMU commits were + +66f82ce block: Open the underlying image file in generic code +ea2384d new disk image layer + +Here is a possibly incomplete list of main contributors + Kevin Wolf <[email protected]> + Fabrice Bellard + Stefan Hajnoczi <[email protected]> + +Thanks a lot all!
tools/kvm/Makefile +2 -0
@@ -34,6 +34,8 @@ OBJS += util/strbuf.o OBJS += kvm-help.o OBJS += kvm-cmd.o OBJS += kvm-run.o +OBJS += qcow.o +OBJS += qcow1.o DEPS := $(patsubst %.o,%.d,$(OBJS))
tools/kvm/disk-image.c +7 -0
@@ -13,6 +13,9 @@#include <unistd.h> #include <fcntl.h> +#include <linux/types.h> +#include <kvm/qcow.h> +struct disk_image *disk_image__new (int fd,uint64_t size,struct disk_image_operations *ops) {struct disk_image *self;
@@ -131,6 +134,10 @@ struct disk_image *disk_image__open(const char *filename, bool readonly)if (fd <0 )return NULL ; + self =qcow_probe (fd); +if (self) +return self; + self =raw_image__probe (fd, readonly);if (self)return self;
tools/kvm/include/kvm/qcow.h new file +55 -0
55 lines not on this page · raw message
tools/kvm/include/linux/byteorder.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef __BYTE_ORDER_H__ +#define __BYTE_ORDER_H__ + +#include <asm/byteorder.h> +#include <linux/byteorder/generic.h> + +#endif
tools/kvm/include/linux/types.h +19 -0
@@ -27,4 +27,23 @@ typedef __s16 s16;typedef __u8 u8 ;typedef __s8 s8 ; +#ifdef __CHECKER__ +#define __bitwise__ __attribute__((bitwise)) +#else +#define __bitwise__ +#endif +#ifdef __CHECK_ENDIAN__ +#define __bitwise __bitwise__ +#else +#define __bitwise +#endif + + +typedef __u16 __bitwise __le16 ; +typedef __u16 __bitwise __be16 ; +typedef __u32 __bitwise __le32 ; +typedef __u32 __bitwise __be32 ; +typedef __u64 __bitwise __le64 ; +typedef __u64 __bitwise __be64 ; +#endif /* LINUX_TYPES_H */
tools/kvm/qcow.c new file +99 -0
99 lines not on this page · raw message
tools/kvm/qcow1.c new file +301 -0
301 lines not on this page · raw message
Signature · 1 line
1.7.1
Pekka Enberg
AppliedQuoted 2 lines · Prasad Joshi
The patch only implements the basic read write support for QCOW version 1 images. Many of the QCOW features are not implmented, for example
Applied, thanks!
Pekka
PATCH 1/1 kvm tool: Remove unused variables from the QCOW code
Newer versions of GCC notice the following unused variables:
qcow.c: In function ‘qcow_read_l1_table’:
qcow.c:56:7: error: variable ‘page_offset’ set but not used [-Werror=unused-but-set-variable] qcow.c:54:6: error: variable ‘map_offset’ set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make: *** [qcow.o] Error 1
Remove them.
---
tools/kvm/qcow.c +0 -6
@@ -51,9 +51,6 @@ int qcow_read_l1_table(struct qcow *q)struct qcow1_header *h = q->header;struct qcow_table *table;u64 table_offset; -u64 map_offset; -const long page_size =sysconf (_SC_PAGESIZE); -long page_offset;u32 l1_i; q->table = table =calloc (1 ,sizeof (struct qcow_table ));
@@ -63,9 +60,6 @@ int qcow_read_l1_table(struct qcow *q) table->table_size =qcow1_get_table_size (q); table_offset = h->l1_table_offset; - map_offset = table_offset & page_size; - page_offset = table_offset & (~page_size); - table->l1_table =calloc (table->table_size,sizeof (u64));if (!table->l1_table) goto error;
Am 13.04.2011 21:26, schrieb Prasad Joshi:
Quoted 6 lines
The patch only implements the basic read write support for QCOW version 1 images. Many of the QCOW features are not implmented, for example
- image creation
- snapshot
- copy-on-write
- encryption
Yay, more forks, more code duplication!
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
If you shared code, you also wouldn't have to use an obsolete, but simple-to-implement format, but could use some of the better maintained formats of qemu, like qcow2.
Also at least your qcow1.c is lacking the copyright header. Please add this, otherwise you're violating the license.
Kevin
Quoted 2 lines · Kevin Wolf
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.
AFAICT it's not a copy, it's a reimplementation - and he credited you in the CREDITS file, for providing a reference implementation. But we can credit you to the header as well - Pekka?
Thanks,
Ingo
Am 14.04.2011 10:07, schrieb Ingo Molnar:
Quoted 9 lines · Kevin Wolf
Quoted 3 lines
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.AFAICT it's not a copy, it's a reimplementation - and he credited you in the CREDITS file, for providing a reference implementation. But we can credit you to the header as well - Pekka?
It's actually not my code, but Fabrice's. I compared get_cluster_offset() and it looks similar enough to me to qualify as a modified copy.
Kevin
Quoted 2 lines · Kevin Wolf
Quoted 2 lines
Quoted 2 lines
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.
Am 14.04.2011 10:07, schrieb Ingo Molnar:
Quoted 3 lines
Quoted 3 lines
AFAICT it's not a copy, it's a reimplementation - and he credited you in the CREDITS file, for providing a reference implementation. But we can credit you to the header as well - Pekka?
Quoted 3 lines · Kevin Wolf
It's actually not my code, but Fabrice's. I compared
get_cluster_offset()and it looks similar enough to me to qualify as a modified copy.
It's actually me who asked to drop the license banners from the file and move it to CREDITS. Parasd, mind sending a patch that adds it back to the files?
Pekka
Am 14.04.2011 10:15, schrieb Pekka Enberg:
Quoted 9 lines · Kevin Wolf
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.Am 14.04.2011 10:07, schrieb Ingo Molnar:
Quoted 3 lines
Quoted 3 lines
AFAICT it's not a copy, it's a reimplementation - and he credited you in the CREDITS file, for providing a reference implementation. But we can credit you to the header as well - Pekka?
Quoted 8 lines
Quoted 3 lines · Kevin Wolf
It's actually not my code, but Fabrice's. I compared
get_cluster_offset()and it looks similar enough to me to qualify as a modified copy.It's actually me who asked to drop the license banners from the file and move it to CREDITS. Parasd, mind sending a patch that adds it back to the files?
Heh, I just saw your mail from yesterday. Missed it because I wasn't CCed on v1. The license is pretty clear about it:
* The above copyright notice and this permission notice shall be
included in
* all copies or substantial portions of the Software.
You could discuss if it would be enough to copy the license text into CREDITS, but leaving it in the file is the usual and expected way.
Anyway, license issues are not my favourite topic, I would rather discuss ways of sharing code instead of creating more unmergeable forks. Don't you feel that it will hurt both sides if you continue this way?
Kevin
Quoted 19 lines · Kevin Wolf
Am 14.04.2011 10:15, schrieb Pekka Enberg:
Quoted 9 lines · Kevin Wolf
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.Am 14.04.2011 10:07, schrieb Ingo Molnar:
Quoted 3 lines
Quoted 3 lines
AFAICT it's not a copy, it's a reimplementation - and he credited you in the CREDITS file, for providing a reference implementation. But we can credit you to the header as well - Pekka?
Quoted 8 lines
Quoted 3 lines · Kevin Wolf
It's actually not my code, but Fabrice's. I compared
get_cluster_offset()and it looks similar enough to me to qualify as a modified copy.It's actually me who asked to drop the license banners from the file and move it to CREDITS. Parasd, mind sending a patch that adds it back to the files?
Quoted 6 lines
Heh, I just saw your mail from yesterday. Missed it because I wasn't CCed on v1. The license is pretty clear about it:
* The above copyright notice and this permission notice shall be
included in
* all copies or substantial portions of the Software.
Note that Prasad's v0 patch did not include this copyright notice - because he wrote the file from scratch. I asked him to attribute the Qemu reference implementation in any case - which he understood as copying the copyright license verbatim.
Thanks,
Ingo
Quoted 25 lines · Ingo Molnar
Quoted 22 lines · Kevin Wolf
Am 14.04.2011 10:15, schrieb Pekka Enberg:
Quoted 9 lines · Kevin Wolf
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.Am 14.04.2011 10:07, schrieb Ingo Molnar:
Quoted 3 lines
Quoted 3 lines
AFAICT it's not a copy, it's a reimplementation - and he credited you in the CREDITS file, for providing a reference implementation. But we can credit you to the header as well - Pekka?
Quoted 8 lines
Quoted 3 lines · Kevin Wolf
It's actually not my code, but Fabrice's. I compared
get_cluster_offset()and it looks similar enough to me to qualify as a modified copy.It's actually me who asked to drop the license banners from the file and move it to CREDITS. Parasd, mind sending a patch that adds it back to the files?
Heh, I just saw your mail from yesterday. Missed it because I wasn't CCed on v1. The license is pretty clear about it:
Quoted 9 lines
Quoted 3 lines
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.Note that Prasad's v0 patch did not include this copyright notice - because he wrote the file from scratch. I asked him to attribute the Qemu reference implementation in any case - which he understood as copying the copyright license verbatim.
Oh God. I was walking to university on seventh cloud, hoping to work on caching the l2 table. Now I find myslef under the controversy.
Frankly speaking I am very new to understand the intricacies of licensing, I won't mind copying the copyright notice in the code if it is necessary. I am also okay with attributing the code to developers of QEMU.
Speaking about the code of finding the cluster offset is so basic, that I thought it should be implemented the way it is done in the QEMU. But none of the code is copied from the QEMU sources. The complete code is written from scratch with QEMU sources as a reference. I avoid sending the first few versions of the patches on KVM mailing list, the code contains lots of structural mistakes and needs revisions. I don;t want to flood mailing list with those revisions. The kvm tool community is kind enough to guide me in improving the code, when infact any one of them can write the code in lesser time than mine.
Forgive me for my lack of knowledge, I hope this problem would be solved soon.
Thanks and Regards,
Prasad
Quoted 4 lines
Thanks,
Ingo
Quoted 4 lines · Prasad Joshi
Speaking about the code of finding the cluster offset is so basic, that I thought it should be implemented the way it is done in the QEMU. But none of the code is copied from the QEMU sources. The complete code is written from scratch with QEMU sources as a reference. [...]
I think we should put that info into a prominent place in the source file together with a very prominent acknowledgement to the Qemu implementation as well.
Thanks,
Ingo
Quoted 2 lines · Prasad Joshi
Oh God. I was walking to university on seventh cloud, hoping to work on caching the l2 table. Now I find myslef under the controversy.
Again, it's my fault, not yours. I asked to remove the license banner on top of qcow1.c because it doesn't contain any copied code. I will fix it up. Thanks!
Pekka
Quoted 7 lines · Kevin Wolf
Am 14.04.2011 10:07, schrieb Ingo Molnar:
Quoted 6 lines · Kevin Wolf
Quoted 3 lines
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.
Quoted 7 lines
Quoted 3 lines
AFAICT it's not a copy, it's a reimplementation - and he credited you in the CREDITS file, for providing a reference implementation. But we can credit you to the header as well - Pekka?
It's actually not my code, but Fabrice's. I compared
get_cluster_offset()and it looks similar enough to me to qualify as a modified copy.
Well, i asked Prasad whether he copied any code and he said no (so it's not a copy AFAICT) - but i nevertheless asked him to add proper attribution in any case because he used it as a reference.
Thanks,
Ingo
Quoted 3 lines · Kevin Wolf
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Quoted 3 lines · Kevin Wolf
If you shared code, you also wouldn't have to use an obsolete, but simple-to-implement format, but could use some of the better maintained formats of qemu, like qcow2.
We're adding QCOW2 too and hopefully other non-QEMU formats as well.
Quoted 2 lines · Kevin Wolf
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.
Thanks, will fix!
Pekka
Am 14.04.2011 10:21, schrieb Pekka Enberg:
Quoted 7 lines · Kevin Wolf
Quoted 3 lines
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Okay. I might not consider it wise, but in the end it's your decision. I'm just curious why you think this is the better way?
Kevin
Hi Kevin!
Am 14.04.2011 10:21, schrieb Pekka Enberg:
Quoted 7 lines
Quoted 7 lines · Kevin Wolf
Quoted 3 lines
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Quoted 2 lines · Kevin Wolf
Okay. I might not consider it wise, but in the end it's your decision. I'm just curious why you think this is the better way?
Well, how would you go about sharing the code without copying in practical terms? We're aiming for standalone tool in tools/kvm of the Linux kernel so I don't see how we could do that.
Pekka
Quoted 11 lines · Pekka Enberg
Hi Kevin!
Am 14.04.2011 10:21, schrieb Pekka Enberg:
Quoted 7 lines
Quoted 7 lines · Kevin Wolf
Quoted 3 lines
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Quoted 7 lines
Quoted 2 lines · Kevin Wolf
Okay. I might not consider it wise, but in the end it's your decision. I'm just curious why you think this is the better way?
Well, how would you go about sharing the code without copying in practical terms? We're aiming for standalone tool in
tools/kvmof the Linux kernel so I don't see how we could do that.
You mean you would not be ok with linking with anything other then glibc?
Quoted 6 lines
Pekka
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Am 14.04.2011 10:32, schrieb Pekka Enberg:
Quoted 11 lines
Hi Kevin!
Am 14.04.2011 10:21, schrieb Pekka Enberg:
Quoted 7 lines
Quoted 7 lines · Kevin Wolf
Quoted 3 lines
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Quoted 7 lines
Quoted 2 lines · Kevin Wolf
Okay. I might not consider it wise, but in the end it's your decision. I'm just curious why you think this is the better way?
Well, how would you go about sharing the code without copying in practical terms? We're aiming for standalone tool in
tools/kvmof the Linux kernel so I don't see how we could do that.
Well, copying in itself is not a big problem as long as the copies are kept in sync. It's a bit painful, but manageable. Implementing every image format twice (and implementing image formats in a reliable and performing way isn't trivial) is much more painful.
If you take the approach of "getting inspired" by qemu and then writing your own code, the code will read pretty much the same, but be different enough that a diff between both trees is useless and a patch against one tree is meaningless for the other one.
The block drivers are relatively isolated in qemu, so I think they wouldn't pull in too many dependencies.
Kevin
Quoted 25 lines · Kevin Wolf
Am 14.04.2011 10:32, schrieb Pekka Enberg:
Quoted 11 lines
Hi Kevin!
Am 14.04.2011 10:21, schrieb Pekka Enberg:
Quoted 7 lines
Quoted 7 lines · Kevin Wolf
Quoted 3 lines
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Quoted 7 lines
Quoted 2 lines · Kevin Wolf
Okay. I might not consider it wise, but in the end it's your decision. I'm just curious why you think this is the better way?
Well, how would you go about sharing the code without copying in practical terms? We're aiming for standalone tool in
tools/kvmof the Linux kernel so I don't see how we could do that.Well, copying in itself is not a big problem as long as the copies are kept in sync. It's a bit painful, but manageable. Implementing every image format twice (and implementing image formats in a reliable and performing way isn't trivial) is much more painful.
Quoted 7 lines
If you take the approach of "getting inspired" by qemu and then writing your own code, the code will read pretty much the same, but be different enough that a diff between both trees is useless and a patch against one tree is meaningless for the other one.
The block drivers are relatively isolated in qemu, so I think they wouldn't pull in too many dependencies.
Are you suggesting to turn QEMU's block drivers into a reasonably general-purpose library?
Am 14.04.2011 11:26, schrieb Markus Armbruster:
Quoted 32 lines
Quoted 30 lines · Kevin Wolf
Am 14.04.2011 10:32, schrieb Pekka Enberg:
Quoted 11 lines
Hi Kevin!
Am 14.04.2011 10:21, schrieb Pekka Enberg:
Quoted 7 lines
Quoted 7 lines · Kevin Wolf
Quoted 3 lines
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Quoted 7 lines
Quoted 2 lines · Kevin Wolf
Okay. I might not consider it wise, but in the end it's your decision. I'm just curious why you think this is the better way?
Well, how would you go about sharing the code without copying in practical terms? We're aiming for standalone tool in
tools/kvmof the Linux kernel so I don't see how we could do that.Well, copying in itself is not a big problem as long as the copies are kept in sync. It's a bit painful, but manageable. Implementing every image format twice (and implementing image formats in a reliable and performing way isn't trivial) is much more painful.
If you take the approach of "getting inspired" by qemu and then writing your own code, the code will read pretty much the same, but be different enough that a diff between both trees is useless and a patch against one tree is meaningless for the other one.
Quoted 5 lines
Quoted 2 lines
The block drivers are relatively isolated in qemu, so I think they wouldn't pull in too many dependencies.
Are you suggesting to turn QEMU's block drivers into a reasonably general-purpose library?
I would hesitate to turn it into an external library, because I really don't feel like maintaining API compatibility across versions. That's simply not doable with the block layer as of today. For the long term it's something that we may consider, but would certainly require some serious work.
If some changes are needed to make it more reusable in the short term (while still copying the code over), I probably wouldn't be opposed to that.
Kevin
Quoted 39 lines · Kevin Wolf
Am 14.04.2011 11:26, schrieb Markus Armbruster:
Quoted 32 lines
Quoted 30 lines · Kevin Wolf
Am 14.04.2011 10:32, schrieb Pekka Enberg:
Quoted 11 lines
Hi Kevin!
Am 14.04.2011 10:21, schrieb Pekka Enberg:
Quoted 7 lines
Quoted 7 lines · Kevin Wolf
Quoted 3 lines
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Quoted 7 lines
Quoted 2 lines · Kevin Wolf
Okay. I might not consider it wise, but in the end it's your decision. I'm just curious why you think this is the better way?
Well, how would you go about sharing the code without copying in practical terms? We're aiming for standalone tool in
tools/kvmof the Linux kernel so I don't see how we could do that.Well, copying in itself is not a big problem as long as the copies are kept in sync. It's a bit painful, but manageable. Implementing every image format twice (and implementing image formats in a reliable and performing way isn't trivial) is much more painful.
If you take the approach of "getting inspired" by qemu and then writing your own code, the code will read pretty much the same, but be different enough that a diff between both trees is useless and a patch against one tree is meaningless for the other one.
Quoted 5 lines
Quoted 2 lines
The block drivers are relatively isolated in qemu, so I think they wouldn't pull in too many dependencies.
Are you suggesting to turn QEMU's block drivers into a reasonably general-purpose library?
Quoted 8 lines
I would hesitate to turn it into an external library, because I really don't feel like maintaining API compatibility across versions. That's simply not doable with the block layer as of today. For the long term it's something that we may consider, but would certainly require some serious work.
If some changes are needed to make it more reusable in the short term (while still copying the code over), I probably wouldn't be opposed to that.
Unless we make QEMU's block drivers usable outside QEMU (and that means at least a static library without API guarantees), we can hardly chide others for reimplementing them.
Quoted 32 lines · Markus Armbruster
Quoted 30 lines · Kevin Wolf
Am 14.04.2011 10:32, schrieb Pekka Enberg:
Quoted 11 lines
Hi Kevin!
Am 14.04.2011 10:21, schrieb Pekka Enberg:
Quoted 7 lines
Quoted 7 lines · Kevin Wolf
Quoted 3 lines
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
No we haven't and we're not planning to copy QEMU code as-is but re-implement support for formats we're interested in.
Quoted 7 lines
Quoted 2 lines · Kevin Wolf
Okay. I might not consider it wise, but in the end it's your decision. I'm just curious why you think this is the better way?
Well, how would you go about sharing the code without copying in practical terms? We're aiming for standalone tool in
tools/kvmof the Linux kernel so I don't see how we could do that.Well, copying in itself is not a big problem as long as the copies are kept in sync. It's a bit painful, but manageable. Implementing every image format twice (and implementing image formats in a reliable and performing way isn't trivial) is much more painful.
If you take the approach of "getting inspired" by qemu and then writing your own code, the code will read pretty much the same, but be different enough that a diff between both trees is useless and a patch against one tree is meaningless for the other one.
Quoted 5 lines
Quoted 2 lines
The block drivers are relatively isolated in qemu, so I think they wouldn't pull in too many dependencies.
Are you suggesting to turn QEMU's block drivers into a reasonably general-purpose library?
This is useful not just for native kvm, but also for people writing tools or automating their KVM setups.
Stefan
Quoted 6 lines · Kevin Wolf
Well, copying in itself is not a big problem as long as the copies are kept in sync. It's a bit painful, but manageable. Implementing every image format twice (and implementing image formats in a reliable and performing way isn't trivial) is much more painful.
Quoted 7 lines
If you take the approach of "getting inspired" by qemu and then writing your own code, the code will read pretty much the same, but be different enough that a diff between both trees is useless and a patch against one tree is meaningless for the other one.
The block drivers are relatively isolated in qemu, so I think they wouldn't pull in too many dependencies.
The block layer has some interesting bits though that I can understand wanting to avoid (like aio emulation).
In the very least, we've learned the hard way that getting an image format right is very hard. A good test suite is worth it's weight in gold for something like this. When taking the approach of starting fresh, doing test driven development is definitely worth considering.
Regards,
Anthony Liguori
Quoted 5 lines
Kevin
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Why QCOW1? (was: [PATCH v2] kvm tool: add QCOW verions 1 read/write support)
In reply to Kevin WolfQuoted 14 lines · Kevin Wolf
Am 13.04.2011 21:26, schrieb Prasad Joshi:
Quoted 6 lines
The patch only implements the basic read write support for QCOW version 1 images. Many of the QCOW features are not implmented, for example
- image creation
- snapshot
- copy-on-write
- encryptionYay, more forks, more code duplication!
Have you thought about a way to actually share code with qemu instead of repeating Xen's mistake of copying code, modifying it until merges are no longer possible and then let it bitrot?
Quoted 6 lines
If you shared code, you also wouldn't have to use an obsolete, but simple-to-implement format, but could use some of the better maintained formats of qemu, like qcow2.
Also at least your
qcow1.cis lacking the copyright header. Please add this, otherwise you're violating the license.
As discussed already, reimplementing rather than sharing can be excused, because the existing code is not ready for sharing.
What hasn't been discussed much is the other half of Kevin's remark: why QCOW1? Does anyone still use that old hag in anger? The format people actually use is QCOW2, and it is properly maintained.
Even for little-used QOW formats, there are more interesting choices:
QED and FVD.
Re: Why QCOW1? (was: [PATCH v2] kvm tool: add QCOW verions 1 read/write support)
Quoted 2 lines · Markus Armbruster
What hasn't been discussed much is the other half of Kevin's remark: why QCOW1?
QCOW1 was simpler to implement as the first non-raw image format.
Pekka
Re: Why QCOW1? (was: [PATCH v2] kvm tool: add QCOW verions 1 read/write support)
Quoted 5 lines · Pekka Enberg
Quoted 2 lines · Markus Armbruster
What hasn't been discussed much is the other half of Kevin's remark: why QCOW1?
QCOW1 was simpler to implement as the first non-raw image format.
Why even use a non-raw image format? The current implementation only does sparse files, but POSIX sparse raw files gives you the same feature.
Besides, why not use btrfs or device-mapper instead of doing image formats, which ultimately duplicate file system and volume management code in userspace?
Stefan
Re: Why QCOW1? (was: [PATCH v2] kvm tool: add QCOW verions 1 read/write support)
Quoted 3 lines · Stefan Hajnoczi
Why even use a non-raw image format? The current implementation only does sparse files, but POSIX sparse raw files gives you the same feature.
Because people have existing images they want to boot to?
Re: Why QCOW1? (was: [PATCH v2] kvm tool: add QCOW verions 1 read/write support)
Quoted 6 lines · Pekka Enberg
Quoted 3 lines · Stefan Hajnoczi
Why even use a non-raw image format? The current implementation only does sparse files, but POSIX sparse raw files gives you the same feature.
Because people have existing images they want to boot to?
People don't have existing QCOW1 images they want to boot from :).
They have vmdk, vhd, vdi, or qcow2. You can use qemu-img to convert them to raw. You can use qemu-nbd if you are desperate to boot from or inspect them in-place.
But I think the natural path for a native Linux KVM tool is to fully exploit file systems and block layer features in Linux instead of implementing a userspace block layer.
Stefan
Re: Why QCOW1? (was: [PATCH v2] kvm tool: add QCOW verions 1 read/write support)
Quoted 9 lines · Stefan Hajnoczi
People don't have existing QCOW1 images they want to boot from :).
They have vmdk, vhd, vdi, or qcow2. You can use qemu-img to convert them to raw. You can use qemu-nbd if you are desperate to boot from or inspect them in-place.
But I think the natural path for a native Linux KVM tool is to fully exploit file systems and block layer features in Linux instead of implementing a userspace block layer.
For optimum performance, sure, but we want to support non-native images for usability reasons.
Re: Why QCOW1?
In reply to Stefan HajnocziAm 15.04.2011 14:05, schrieb Stefan Hajnoczi:
Quoted 10 lines · Pekka Enberg
Quoted 6 lines · Stefan Hajnoczi
Quoted 3 lines
Why even use a non-raw image format? The current implementation only does sparse files, but POSIX sparse raw files gives you the same feature.
Because people have existing images they want to boot to?
People don't have existing QCOW1 images they want to boot from :).
Quoted 7 lines
They have vmdk, vhd, vdi, or qcow2. You can use qemu-img to convert them to raw. You can use qemu-nbd if you are desperate to boot from or inspect them in-place.
But I think the natural path for a native Linux KVM tool is to fully exploit file systems and block layer features in Linux instead of implementing a userspace block layer.
As a normal user, I can deal with files, but I can't write to block devices or mount file systems. I'm sure that there are use cases that don't require file-based formats, but I'm also relatively sure that they are a minority (at least if you also take convenience into consideration).
Kevin
Re: Why QCOW1?
In reply to Pekka EnbergQuoted 5 lines · Pekka Enberg
Quoted 3 lines · Stefan Hajnoczi
Why even use a non-raw image format? The current implementation only does sparse files, but POSIX sparse raw files gives you the same feature.
Because people have existing images they want to boot to?
Since this project is trying to be so integrated into the kernel, why not add support for image files directly to the kernel? Add a qcow1/qcow2/qed block device type such that you can use normal tools (like mount) to work with the image files.
Regards,
Anthony Liguori
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html