qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMU monitor.
@ 2006-12-26 15:49 Igor Lvovsky
  2006-12-26 17:24 ` Anthony Liguori
  0 siblings, 1 reply; 5+ messages in thread
From: Igor Lvovsky @ 2006-12-26 15:49 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 628 bytes --]

  Hi,

This patch completes the previous one and allows the snapshot (VMDK style) creation from the QEMU monitor (Ctrl+Alt+2).

 

To clarify, the previous patch implements the snapshot capabilities according to the "Virtual Disk Format 1.0" document.

http://lists.gnu.org/archive/html/qemu-devel/2006-12/msg00311.html

 

Implemented features:

1.	Create snapshot.
2.	CID concept to prevent snapshots chain inconsistency.
3.	Snapshots read/write capabilities.

 

The whole chain (base image and snapshots) created by QEMU can be loaded from the VMware workstation and vice versa.

 

Igor Lvovsky.


[-- Attachment #1.2: Type: text/html, Size: 3963 bytes --]

[-- Attachment #2: vmdk-support2.diff --]
[-- Type: application/octet-stream, Size: 1944 bytes --]

Index: monitor.c
===================================================================
RCS file: /sources/qemu/qemu/monitor.c,v
retrieving revision 1.58
diff -u -r1.58 monitor.c
--- monitor.c	22 Dec 2006 14:11:31 -0000	1.58
+++ monitor.c	26 Dec 2006 15:08:25 -0000
@@ -361,6 +361,51 @@
     eject_device(bs, force);
 }
 
+int vmdk_snapshot_create(BlockDriverState *bs);
+
+static void do_snapshot(const char *hda, const char *hdb,
+                        const char *hdc, const char *hdd)
+{
+
+    if (!strcmp(hda,"hda")) {
+        if (vmdk_snapshot_create(bs_table[0]) == -1)
+            term_printf("hda snapshot fail\n");
+    }
+
+    if (hdb) {
+        if (!strcmp(hdb,"hdb")) {
+            if (bs_table[1]) {
+                if (vmdk_snapshot_create(bs_table[1]) == -1)
+                    term_printf("hdb snapshot fail\n");
+            }else {
+                term_printf("hdb not exist\n");
+            }
+        }
+    }
+
+    if (hdc) {
+        if (!strcmp(hdc,"hdc")) {
+            if (bs_table[2]) {
+                if (vmdk_snapshot_create(bs_table[2]) == -1)
+                    term_printf("hdc snapshot fail\n");
+            }else {
+                term_printf("hdc not exist\n");
+            }
+        }
+    }
+
+    if (hdd) {
+        if (!strcmp(hdd,"hdd")) {
+            if (bs_table[3]) {
+                if (vmdk_snapshot_create(bs_table[3]) == -1)
+                    term_printf("hdd snapshot fail\n");
+            }else {
+                term_printf("hdd not exist\n");
+            }
+        }
+    }
+}
+
 static void do_change(const char *device, const char *filename)
 {
     BlockDriverState *bs;
@@ -1218,6 +1263,8 @@
 #endif
      { "stopcapture", "i", do_stop_capture,
        "capture index", "stop capture" },
+     { "create_snapshot", "ss?s?s?", do_snapshot, 
+       "hda [hdb] [hdc] [hdd]", "create snapshot of one or more images (VMDK format)" },
     { NULL, NULL, }, 
 };
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMU monitor.
  2006-12-26 15:49 [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMU monitor Igor Lvovsky
@ 2006-12-26 17:24 ` Anthony Liguori
  2007-01-09 10:28   ` [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor Igor Lvovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2006-12-26 17:24 UTC (permalink / raw)
  To: qemu-devel

Hi Igor,

Out of curiousity, why didn't you use the new snapshot infrastructure 
that Fabrice introduced in CVS?  Shouldn't the CID just map directly to 
a snapshot tag?

Regards,

Anthony Liguori

Igor Lvovsky wrote:
>
>   Hi,
>
> This patch completes the previous one and allows the snapshot (VMDK 
> style) creation from the QEMU monitor (Ctrl+Alt+2).
>
>  
>
> To clarify, the previous patch implements the snapshot capabilities 
> according to the "Virtual Disk Format 1.0" document.
>
> http://lists.gnu.org/archive/html/qemu-devel/2006-12/msg00311.html
>
>  
>
> Implemented features:
>
>    1. Create snapshot.
>    2. CID concept to prevent snapshots chain inconsistency.
>    3. Snapshots read/write capabilities.
>
>  
>
> The whole chain (base image and snapshots) created by QEMU can be 
> loaded from the VMware workstation and vice versa.
>
>  
>
> Igor Lvovsky.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>   

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor.
  2006-12-26 17:24 ` Anthony Liguori
@ 2007-01-09 10:28   ` Igor Lvovsky
  2007-01-09 16:20     ` Anthony Liguori
  2007-01-09 19:40     ` Fabrice Bellard
  0 siblings, 2 replies; 5+ messages in thread
From: Igor Lvovsky @ 2007-01-09 10:28 UTC (permalink / raw)
  To: qemu-devel

Hi Anthony,

I wrote the patch before Fabrice introduced his solution and I didn't look at it before I sent my patch (my mistake). 
But you are right; the new snapshot infrastructure can be useful.
I'll modify my code for new approach and I hope Fabrice will accept it.

As for CID, I think that snapshot tag it's something else.
The CID in VMDK is value updated on the first write every time the virtual disk is opened.

By the way, I have a question:
I want to use the standard pread()/pwrite() functions instead of 
pair:
	lseek()
	read() / write()

I know that this may do some problem for Windows implementation,
but I can use some kind of define for Windows case.
A question is if it's acceptable.
	
		Regards,
	Igor Lvovsky




-----Original Message-----
From: qemu-devel-bounces+igor.lvovsky=qumranet.com@nongnu.org [mailto:qemu-devel-bounces+igor.lvovsky=qumranet.com@nongnu.org] On Behalf Of Anthony Liguori
Sent: Tuesday, December 26, 2006 7:25 PM
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor.

Hi Igor,

Out of curiousity, why didn't you use the new snapshot infrastructure 
that Fabrice introduced in CVS?  Shouldn't the CID just map directly to 
a snapshot tag?

Regards,

Anthony Liguori

Igor Lvovsky wrote:
>
>   Hi,
>
> This patch completes the previous one and allows the snapshot (VMDK 
> style) creation from the QEMU monitor (Ctrl+Alt+2).
>
>  
>
> To clarify, the previous patch implements the snapshot capabilities 
> according to the "Virtual Disk Format 1.0" document.
>
> http://lists.gnu.org/archive/html/qemu-devel/2006-12/msg00311.html
>
>  
>
> Implemented features:
>
>    1. Create snapshot.
>    2. CID concept to prevent snapshots chain inconsistency.
>    3. Snapshots read/write capabilities.
>
>  
>
> The whole chain (base image and snapshots) created by QEMU can be 
> loaded from the VMware workstation and vice versa.
>
>  
>
> Igor Lvovsky.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>   



_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor.
  2007-01-09 10:28   ` [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor Igor Lvovsky
@ 2007-01-09 16:20     ` Anthony Liguori
  2007-01-09 19:40     ` Fabrice Bellard
  1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2007-01-09 16:20 UTC (permalink / raw)
  To: qemu-devel

Igor Lvovsky wrote:
> Hi Anthony,
>
> I wrote the patch before Fabrice introduced his solution and I didn't look at it before I sent my patch (my mistake). 
> But you are right; the new snapshot infrastructure can be useful.
> I'll modify my code for new approach and I hope Fabrice will accept it.
>   

Excellent.

> As for CID, I think that snapshot tag it's something else.
> The CID in VMDK is value updated on the first write every time the virtual disk is opened.
>   

I see.

> By the way, I have a question:
> I want to use the standard pread()/pwrite() functions instead of 
> pair:
> 	lseek()
> 	read() / write()
>   

Why do you want to use p{read,write}()?  If you are concerned about 
performance, you can simply cache the current file offset and only call 
lseek() conditionally.

> I know that this may do some problem for Windows implementation,
> but I can use some kind of define for Windows case.
> A question is if it's acceptable.
>   

Normally, guards for Windows specific stuff is okay but if there isn't a 
compelling reason to write non-portable code than I'd at least always be 
in favor of writing the portable version :-)

Regards,

Anthony Liguori

> 		Regards,
> 	Igor Lvovsky
>
>
>
>
> -----Original Message-----
> From: qemu-devel-bounces+igor.lvovsky=qumranet.com@nongnu.org [mailto:qemu-devel-bounces+igor.lvovsky=qumranet.com@nongnu.org] On Behalf Of Anthony Liguori
> Sent: Tuesday, December 26, 2006 7:25 PM
> To: qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor.
>
> Hi Igor,
>
> Out of curiousity, why didn't you use the new snapshot infrastructure 
> that Fabrice introduced in CVS?  Shouldn't the CID just map directly to 
> a snapshot tag?
>
> Regards,
>
> Anthony Liguori
>
> Igor Lvovsky wrote:
>   
>>   Hi,
>>
>> This patch completes the previous one and allows the snapshot (VMDK 
>> style) creation from the QEMU monitor (Ctrl+Alt+2).
>>
>>  
>>
>> To clarify, the previous patch implements the snapshot capabilities 
>> according to the "Virtual Disk Format 1.0" document.
>>
>> http://lists.gnu.org/archive/html/qemu-devel/2006-12/msg00311.html
>>
>>  
>>
>> Implemented features:
>>
>>    1. Create snapshot.
>>    2. CID concept to prevent snapshots chain inconsistency.
>>    3. Snapshots read/write capabilities.
>>
>>  
>>
>> The whole chain (base image and snapshots) created by QEMU can be 
>> loaded from the VMware workstation and vice versa.
>>
>>  
>>
>> Igor Lvovsky.
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Qemu-devel mailing list
>> Qemu-devel@nongnu.org
>> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>>   
>>     
>
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>   

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor.
  2007-01-09 10:28   ` [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor Igor Lvovsky
  2007-01-09 16:20     ` Anthony Liguori
@ 2007-01-09 19:40     ` Fabrice Bellard
  1 sibling, 0 replies; 5+ messages in thread
From: Fabrice Bellard @ 2007-01-09 19:40 UTC (permalink / raw)
  To: qemu-devel

Ideally, it would be better to use bdrv_pread() and bdrv_pwrite() (see 
how they are used in block-qcow*.c).

Regards,

Fabrice.

Igor Lvovsky wrote:
> Hi Anthony,
> 
> I wrote the patch before Fabrice introduced his solution and I didn't look at it before I sent my patch (my mistake). 
> But you are right; the new snapshot infrastructure can be useful.
> I'll modify my code for new approach and I hope Fabrice will accept it.
> 
> As for CID, I think that snapshot tag it's something else.
> The CID in VMDK is value updated on the first write every time the virtual disk is opened.
> 
> By the way, I have a question:
> I want to use the standard pread()/pwrite() functions instead of 
> pair:
> 	lseek()
> 	read() / write()
> 
> I know that this may do some problem for Windows implementation,
> but I can use some kind of define for Windows case.
> A question is if it's acceptable.
> 	
> 		Regards,
> 	Igor Lvovsky
> 
> 
> 
> 
> -----Original Message-----
> From: qemu-devel-bounces+igor.lvovsky=qumranet.com@nongnu.org [mailto:qemu-devel-bounces+igor.lvovsky=qumranet.com@nongnu.org] On Behalf Of Anthony Liguori
> Sent: Tuesday, December 26, 2006 7:25 PM
> To: qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor.
> 
> Hi Igor,
> 
> Out of curiousity, why didn't you use the new snapshot infrastructure 
> that Fabrice introduced in CVS?  Shouldn't the CID just map directly to 
> a snapshot tag?
> 
> Regards,
> 
> Anthony Liguori
> 
> Igor Lvovsky wrote:
> 
>>  Hi,
>>
>>This patch completes the previous one and allows the snapshot (VMDK 
>>style) creation from the QEMU monitor (Ctrl+Alt+2).
>>
>> 
>>
>>To clarify, the previous patch implements the snapshot capabilities 
>>according to the "Virtual Disk Format 1.0" document.
>>
>>http://lists.gnu.org/archive/html/qemu-devel/2006-12/msg00311.html
>>
>> 
>>
>>Implemented features:
>>
>>   1. Create snapshot.
>>   2. CID concept to prevent snapshots chain inconsistency.
>>   3. Snapshots read/write capabilities.
>>
>> 
>>
>>The whole chain (base image and snapshots) created by QEMU can be 
>>loaded from the VMware workstation and vice versa.
>>
>> 
>>
>>Igor Lvovsky.
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>Qemu-devel mailing list
>>Qemu-devel@nongnu.org
>>http://lists.nongnu.org/mailman/listinfo/qemu-devel
>>  
> 
> 
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-01-09 19:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-26 15:49 [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMU monitor Igor Lvovsky
2006-12-26 17:24 ` Anthony Liguori
2007-01-09 10:28   ` [Qemu-devel] [PATCH] Create the VMDK snapshot from the QEMUmonitor Igor Lvovsky
2007-01-09 16:20     ` Anthony Liguori
2007-01-09 19:40     ` Fabrice Bellard

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).