[Sheepdog] [PATCH v3] sheep: change snapshot/clone flow

HaiTing Yao yaohaiting.wujue at gmail.com
Mon Apr 23 05:37:11 CEST 2012


On Sat, Apr 21, 2012 at 4:56 AM, MORITA Kazutaka
<morita.kazutaka at gmail.com>wrote:

> At Fri, 20 Apr 2012 14:40:26 +0800,
>  yaohaiting.wujue at gmail.com wrote:
> >
> > From: HaiTing Yao <wujue.yht at taobao.com>
> >
> > When create snapshot for source VDI, the new created VDI used as source
> > VDI, and the old source VDI used as snapshot. This flow make users
> > confused about VDI and snapshot relation. The snapshot metadata maybe is
> > stored on multi-VDI, so need read multi VDIs inode to get snapshot list.
> >
> > When create snapshot, we does not need change new created VDI to source
> > VDI. The source VDI just need use snapshot VDI ID as its object data ID.
> >
> > Show one example.
> >
> > Before modification:
> >
> >   Name        Id    Size    Used  Shared    Creation time   VDI id   Tag
> > s v1           1   64 MB   20 MB  0.0 MB 2012-03-26 16:55   709128
> > s v1           2   64 MB  0.0 MB   20 MB 2012-03-26 16:56   709129   sn3
> >   v1           3   64 MB  0.0 MB   20 MB 2012-03-26 16:56   70912a
> >
> > After modification:
> >
> >   Name        Id    Size    Used  Shared    Creation time   VDI id   Tag
> >   v1           0   64 MB   20 MB  0.0 MB 2012-03-27 11:06   709128
> > s v1           1   64 MB  0.0 MB   20 MB 2012-03-27 11:06   709129
> > s v1           2   64 MB  0.0 MB   20 MB 2012-03-27 11:07   70912a   sn3
> >
> > Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
> > ---
> >  collie/common.c          |    2 +-
> >  collie/vdi.c             |   33 ++++++++++++++++++++++-----------
> >  include/sheepdog_proto.h |    6 ++++--
> >  sheep/vdi.c              |   18 ++++++++++--------
> >  4 files changed, 37 insertions(+), 22 deletions(-)
>
> Your patch breaks the relationship between VDI snapshots.
> For example:
> ==
>  $ collie cluster format -c 1
>
>  $ qemu-img create sheepdog:test 4G
>  $ qemu-img snapshot -c tag1 sheepdog:test
>  $ qemu-img snapshot -c tag2 sheepdog:test
>  $ qemu-img snapshot -c tag3 sheepdog:test
>
>  $ qemu-img create sheepdog:test2 4G
>  $ qemu-img snapshot -c tag1 sheepdog:test2
>  $ qemu-img snapshot -c tag2 sheepdog:test2
>  $ qemu-io -c "write 0 512" sheepdog:test2:1
>  $ qemu-img snapshot -c tag3 sheepdog:test2
>
>  $ collie vdi tree
> ==
>
> and the expected output is:
> ==
>  test---[2012-04-21 05:51]---[2012-04-21 05:51]---[2012-04-21
> 05:51]---(you are here)
>  test2---[2012-04-21 05:51]-+-[2012-04-21 05:51]---[2012-04-21 05:51]
>                             `-[2012-04-21 05:51]---(you are here)
> ==
>

I think you have applied my block/sheepdog.c patch for qemu project. There
is still something to do. qemu-img is still having some problem with object
cache when there is snapshot. The work is on the progress by Liuyuan as I
knew. Perhaps you can shutdown object cache temporarily by this:

void do_io_request(struct work *work)

        dprintf("%x, %" PRIx64" , %u\n", opcode, oid, epoch);
       + hdr->flags = hdr->flags & ~SD_FLAG_CMD_CACHE;
        if (hdr->flags & SD_FLAG_CMD_RECOVERY)

Then the display like this

[wujue.yht at v134092.sqa.cm4 ~]$ clv
  Name        Id    Size    Used  Shared    Creation time   VDI id  Tag
  v1           0  1.0 GB  0.0 MB  0.0 MB 2012-04-23 10:45   709128
  img1         0  1.0 GB  0.0 MB  0.0 MB 2012-04-23 10:46   9e028f
s img1         1  1.0 GB  0.0 MB  0.0 MB 2012-04-23 10:46   9e0290  img1-sn1
s img1         2  1.0 GB  0.0 MB  0.0 MB 2012-04-23 10:47   9e0291  img1-sn2
s img1         3  1.0 GB  0.0 MB  0.0 MB 2012-04-23 10:47   9e0292  img1-sn3
  img2         0  1.0 GB  0.0 MB  0.0 MB 2012-04-23 10:47   9e0442
[wujue.yht at v134092.sqa.cm4 ~]$ ./collie vdi tree
v1---(you are here)
img1---(you are here)-+-[2012-04-23 10:46]
                      |-[2012-04-23 10:47]
                      `-[2012-04-23 10:47]
img2---(you are here)
The snapshots will not display on one line, because all of snapshots belong
to base VDI now and there is no direct relation between snapshots. I am not
sure of this. Do we need display them on one line?

Because the base VDI never be changed, the postion identified by 'you are
here' always follows base VDI after my change. Do we expect this?


>
> BTW, How about displaying the current Id as zero and removing VDI id
> from the output of 'collie vdi list'?  VDI IDs are used for internal
> purpose only, so I think we don't need to display them here.  I'd like
> to avoid changing the VDI structure if possible.
>

Yes, I also think VDI ID is for internal purpose and we need not to display
here.  The   snap id of base VDI is zero now.


>
> Thanks,
>
> Kazutaka
>

BTW, since we change the inode structure, how about increse the
SD_PROTO_VER?

With this patch, the precious data can not be clued properly. If customers
need use precious data, I can supply a tool to upgrade.

Thanks
Haiting
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20120423/bfc8c237/attachment-0003.html>


More information about the sheepdog mailing list