[sheepdog] [PATCH v2] new feature of changing the replica number of existing cluster/vdi
Ruoyu
liangry at ucweb.com
Wed May 21 08:10:18 CEST 2014
On 2014年05月21日 11:23, Liu Yuan wrote:
> On Wed, May 21, 2014 at 09:25:52AM +0800, Ruoyu wrote:
>> On 2014年05月20日 15:13, Liu Yuan wrote:
>>> On Mon, May 19, 2014 at 03:34:59PM +0800, Ruoyu wrote:
>>>> 1. To set the replica number of cluster:
>>>> dog cluster copies <num>
>>>>
>>>> 2. To set the replica number of standalone vdi who has neither
>>>> parent nor children:
>>>> dog vdi copies <vdiname> <num>
>>> Does 'standalone vdi' include cloned vdi?
>> No.
>>> I'd suggest having a new sub command for this:
>>>
>>> dog alter cluster-copy
>>> dog alter vdi-copy
>>>
>>> Then it would be more extensible to add more options like
>>> dog alter node-weight (which might be useful if some node is near out of space)
>> OK.
Another question, can I make read_vdi_obj() extern because I want to
call it in newly added file alter.c?
>>>> 3. To set the replica number of shared vdi who has parent or children,
>>>> please run dog vdi clone command with -R (--root) option first:
>>>> dog vdi clone -s <snapshot> -R <src vdi> <dst vdi>
>>>> It will deep copy a brand new standalone vdi base on source vdi
>>>> so that we can run dog vdi copies to change destinate vdi's
>>>> replica number later.
>>> What is whole procedure to alter'a vdi copy policy that has either parent or
>>> children?
>> Clone a standalone vdi first, and then alter or change replica
>> number of the new vdi.
> I don't understand it. Suppose we have a snapshot named base and new_vdi is the
> active vdi.
>
> base->new_vdi
> |
> --> clone
>
> So you mean we firstly clone the base and then we can alther the copy policy of
> new_vdi?
We have to clone a brand new vdi first because of data consistency.
Suppose we have a vdi named orig_vdi and its snapshot named base_snap:
base_snap -> orig_vdi
The actual procedure of my solution:
1. clone a brand new vdi nothing share with the old ones, that is,
base_snap and orig_vdi.
base_snap -> orig_vdi
|
--> new_vdi
This step use a new option -R (--root). Therefore, new_vdi's
parent_vdi_id is 0, prealloc is enabled and its replica number is equal
to orig_vdi's replica number.
2. use dog vdi copies, that is, dog alter vdi-copy to change new_vdi's
replica number.
3. delete base_snap and orig_vdi if you want to.
The reason is as below.
On last Friday, Hitoshi wrote:
I think changing copy number of vdi is dangerous. Assume that we are
changing copy number of VDI A from 3 to 2 which has a snapshot B.
Your cluster_set_vdi_copies() starts recovery process but it cannot
change a number of copies actually because some of A's objects would
have B's VID (B has younger VID), and get_vdi_copy_number() returns
copy number based on VID part of OID. It introduces inconsistency.
So I think you should forbid changing a number of copies when VDI has
a parent or children. The changing would be similar to exporting VDI
with qemu-img once and backporting with different number of
copies. But the procedure requires lots of temporal space for storing
disk image (which can be few TBs), so preparing a new command which
can change a number of copies without requireing temporal space would
be worthful.
Thanks,
Hitoshi
>
> Thanks
> Yuan
More information about the sheepdog
mailing list