[sheepdog] [PATCH 1/2] collie: add command 'collie vdi rollback'

levin li levin108 at gmail.com
Fri Aug 31 09:23:01 CEST 2012


On 08/31/2012 03:03 PM, MORITA Kazutaka wrote:
> At Fri, 31 Aug 2012 14:59:43 +0800,
> levin li wrote:
>>
>> On 08/31/2012 02:38 PM, MORITA Kazutaka wrote:
>>> At Fri, 31 Aug 2012 14:25:04 +0800,
>>> levin li wrote:
>>>>
>>>> On 08/31/2012 02:10 PM, MORITA Kazutaka wrote:
>>>>> At Fri, 31 Aug 2012 13:53:29 +0800,
>>>>> levin li wrote:
>>>>>>
>>>>>> On 08/31/2012 12:17 PM, MORITA Kazutaka wrote:
>>>>>>> At Thu, 30 Aug 2012 13:59:54 +0800,
>>>>>>> levin li wrote:
>>>>>>>>
>>>>>>>> From: levin li <xingke.lwp at taobao.com>
>>>>>>>>
>>>>>>>> With this command we can rollback a cloned VDI to any specified
>>>>>>>> snapshot, or easily reset to its parent VDI, the usage is easy.
>>>>>>>>
>>>>>>>> To rollback to a specified snapshot:
>>>>>>>>
>>>>>>>> $ collie vdi rollback -s 1 base_vdi clone_vdi
>>>>>>>
>>>>>>> Do we need to go back to a snapshot of another vdi?
>>>>>>>
>>>>>>> What I thought was like follows:
>>>>>>>
>>>>>>>   $ collie vdi rollback -h
>>>>>>>   Usage: collie vdi check [-s snapshot] <vdiname>
>>>>>>>
>>>>>>>   $ collie vdi create test 4G
>>>>>>>   $ collie vdi snapshot test -s snap1
>>>>>>>   $ collie vdi snapshot test -s snap2
>>>>>>>   $ collie vdi tree test
>>>>>>>   test---[2012-08-31 13:05]---[2012-08-31 13:06]---(you are here)
>>>>>>>   $ collie vdi list test
>>>>>>>     Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
>>>>>>>   s test         1  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:05   7c2b25     1         snap1
>>>>>>>   s test         2  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:06   7c2b26     1         snap2
>>>>>>>     test         3  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:07   7c2b27     1              
>>>>>>>
>>>>>>>   $ collie vdi rollback test -s snap1
>>>>>>>   $ collie vdi tree test
>>>>>>>   test---[2012-08-31 13:05]-+-[2012-08-31 13:06]---[2012-08-31 13:07]
>>>>>>>                             `-(you are here)
>>>>>>>   $ collie vdi list test
>>>>>>>     Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
>>>>>>>   s test         1  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:05   7c2b25     1         snap1
>>>>>>>   s test         2  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:06   7c2b26     1         snap2
>>>>>>>   s test         3  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:07   7c2b27     1              
>>>>>>>     test         4  4.0 GB  4.0 MB  0.0 MB 2012-08-31 13:08   7c2b28     1              
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Kazutaka
>>>>>>>
>>>>>>
>>>>>> Maybe I misunderstood you, but this patch can do more than you expected,
>>>>>> it's no harm for users to rollback a VDI to any snapshot if they choose to.
>>>>>
>>>>> I've tried, but it doesn't work well.
>>>>>
>>>>> $ collie vdi create test 4G
>>>>> $ collie vdi snapshot test -s snap1
>>>>> $ collie vdi snapshot test -s snap2
>>>>> $ collie vdi rollback test -s snap1  <- Can you support this usage?
>>>>> Segmentation fault                   <- Please fix this
>>>>> $ collie vdi rollback test test -s snap1
>>>>> Can not rollback a non-cloned VDI    <- We want to a rollback command even if
>>>>>                                         the vdi is not a cloned one
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Kazutaka
>>>>>
>>>>
>>>> I'll fix the segment fault, but it doesn't support the usage like this:
>>>>
>>>> $ collie vdi rollback test -s snap1
>>
>> Well, I must make one thing clear, what do you mean by this command,
>> you want to rollback which VDI to which snapshot ? I think the usage
>> is confusing.
> 
> From the current vdi to the specified snapshot.
> 
> My example doesn't help you?
> 
>>   $ collie vdi rollback -h
>>   Usage: collie vdi check [-s snapshot] <vdiname>
>>
>>   $ collie vdi create test 4G
>>   $ collie vdi snapshot test -s snap1
>>   $ collie vdi snapshot test -s snap2
>>   $ collie vdi tree test
>>   test---[2012-08-31 13:05]---[2012-08-31 13:06]---(you are here)
>>   $ collie vdi list test
>>     Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
>>   s test         1  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:05   7c2b25     1         snap1
>>   s test         2  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:06   7c2b26     1         snap2
>>     test         3  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:07   7c2b27     1              
>>
>>   $ collie vdi rollback test -s snap1
>>   $ collie vdi tree test
>>   test---[2012-08-31 13:05]-+-[2012-08-31 13:06]---[2012-08-31 13:07]
>>                             `-(you are here)
>>   $ collie vdi list test
>>     Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
>>   s test         1  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:05   7c2b25     1         snap1
>>   s test         2  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:06   7c2b26     1         snap2
>>   s test         3  4.0 GB  0.0 MB  0.0 MB 2012-08-31 13:07   7c2b27     1              
>>     test         4  4.0 GB  4.0 MB  0.0 MB 2012-08-31 13:08   7c2b28     1              

OK, I got the point of CURRENT VDI, but there's another problem, I never thought of
rolling back a snapshot to its parent or other, take think of this:

snap1 is the root snapshot, then we start snap1 with QEMU and it creates another snapshot
snap2 which creates its own object A, and A is not included in snap1, then user may clones
a new VDI clone1 from snap2, it derives from snap2 together with object A, but now if we
rollback snap2 to snap1 and the object A is lost, how can clone1 find this object, is it right?

So that's why I only allow user to rollback a cloned VDI.

thanks,

levin



More information about the sheepdog mailing list