image file will be created automaticly, file name is formated as: sprintf(image_file, "%s.raw", snapshot_file);
I just add ".raw" to the file name of #1 in you comments as file name of #2. On Wed, Mar 7, 2012 at 21:10, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Thu, Mar 1, 2012 at 2:49 AM, Dong Xu Wang <wdon...@linux.vnet.ibm.com> > wrote: >> From: Dong Xu Wang <wdon...@linux.vnet.ibm.com> >> >> We can not use raw to support snapshot_file, but add-cow can do this. >> >> CC: Marcelo Tosatti <mtosa...@redhat.com> >> CC: Kevin Wolf <kw...@redhat.com> >> CC: Stefan Hajnoczi <stefa...@linux.vnet.ibm.com> >> Signed-off-by: Dong Xu Wang <wdon...@linux.vnet.ibm.com> >> --- >> blockdev.c | 53 >> ++++++++++++++++++++++++++++++++++++++++++---- >> docs/live-block-ops.txt | 8 ++++++- >> 2 files changed, 55 insertions(+), 6 deletions(-) >> >> diff --git a/blockdev.c b/blockdev.c >> index d78aa51..c820fcb 100644 >> --- a/blockdev.c >> +++ b/blockdev.c >> @@ -687,12 +687,55 @@ void qmp_blockdev_snapshot_sync(const char *device, >> const char *snapshot_file, >> return; >> } >> >> - ret = bdrv_img_create(snapshot_file, format, bs->filename, >> - bs->drv->format_name, NULL, -1, flags); >> - if (ret) { >> - error_set(errp, QERR_UNDEFINED_ERROR); >> - return; >> + if (strcmp(format, "add-cow")) { >> + ret = bdrv_img_create(snapshot_file, format, bs->filename, >> + bs->drv->format_name, NULL, -1, flags); >> + if (ret) { >> + error_set(errp, QERR_UNDEFINED_ERROR); >> + return; >> + } > > I'm confused here because I thought we need three files: > 1. The .add-cow file containing the bitmap > 2. The cow image file containing allocated sectors > 3. The backing file containing the original image > > We're only passing in snapshot_file and bs->filename. How will #2, > the cow file, be created? > > Stefan >