All of lore.kernel.org
 help / color / mirror / Atom feed
* pvchange returns 5 when the other vg is exported
@ 2016-03-10 10:23 Liuhua Wang
  2016-03-10 19:39 ` David Teigland
  0 siblings, 1 reply; 3+ messages in thread
From: Liuhua Wang @ 2016-03-10 10:23 UTC (permalink / raw)
  To: lvm-devel

Hi List,

I did test as below it is ok:
    vgcreate vg1 /dev/vdb1
    vgcreate vg2 /dev/vdb2
    vgexport vg1
    pvchange -u /dev/vdb2 

But there is problem with the follwoing sequence:
    vgcreate vg1 /dev/vdb1
    vgcreate vg2 /dev/vdb2
    vgexport vg2
    pvchange -u /dev/vdb1 
    Volume group vg2 is exported
    Cannot process volume group vg2
    Replacing dev /dev/vdb1 pvid YvlMvgQ0RngwY7Xmqb7w3MBaKkyqvOg0 with dev /dev/vdb1 pvid TK1Y3yunbJ3pw7nK4SWx6ZtyKg1onpZL
    Physical volume "/dev/vdb1" changed
    1 physical volume changed / 0 physical volumes not changed

The reason is that:
    pvchange()->process_each_pv()-> _process_pvs_in_vgs()->
    vg = vg_read(cmd, vg_name, vg_uuid, read_flags, lockd_state);
    if (_ignore_vg(vg, vg_name, NULL, read_flags, &skip, &notfound)) {
        stack;
        ret_max = ECMD_FAILED;
        if (!skip)
            goto endvg;
        /* Drop through to eliminate a clustered VG's PVs from the devices list */
    }

   Because vg2 is exported and vg2 locates on the head of list, firstly vg_read(vg2) 
   will cause set read error and cause ignore_vg() to return 1 (read_error != SUCCESS)
   
   Then ret_max remains ECMD_FAILED(5) and is returned. I don't think returning error
   is expected since vg2 has no relationship with /dev/vdb1.

Attached is the output of `pvchange -u /dev/vdb1 -vvvv`

Thank you very much.

Best regards,
Liuhua 





-- 
---
Liuhua Wang
-------------- next part --------------
  LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home system -wi-ao----  3.00g                                                    
  root system -wi-ao---- 10.00g                                                    
  swap system -wi-ao----  2.00g                                                    

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

* pvchange returns 5 when the other vg is exported
  2016-03-10 10:23 pvchange returns 5 when the other vg is exported Liuhua Wang
@ 2016-03-10 19:39 ` David Teigland
  2016-03-11  7:35   ` Liuhua Wang
  0 siblings, 1 reply; 3+ messages in thread
From: David Teigland @ 2016-03-10 19:39 UTC (permalink / raw)
  To: lvm-devel

On Thu, Mar 10, 2016 at 06:23:26PM +0800, Liuhua Wang wrote:
> Hi List,
> 
> I did test as below it is ok:
>     vgcreate vg1 /dev/vdb1
>     vgcreate vg2 /dev/vdb2
>     vgexport vg1
>     pvchange -u /dev/vdb2 
> 
> But there is problem with the follwoing sequence:
>     vgcreate vg1 /dev/vdb1
>     vgcreate vg2 /dev/vdb2
>     vgexport vg2
>     pvchange -u /dev/vdb1 
>     Volume group vg2 is exported
>     Cannot process volume group vg2
>     Replacing dev /dev/vdb1 pvid YvlMvgQ0RngwY7Xmqb7w3MBaKkyqvOg0 with dev /dev/vdb1 pvid TK1Y3yunbJ3pw7nK4SWx6ZtyKg1onpZL
>     Physical volume "/dev/vdb1" changed
>     1 physical volume changed / 0 physical volumes not changed
> 
> The reason is that:
>     pvchange()->process_each_pv()-> _process_pvs_in_vgs()->
>     vg = vg_read(cmd, vg_name, vg_uuid, read_flags, lockd_state);
>     if (_ignore_vg(vg, vg_name, NULL, read_flags, &skip, &notfound)) {
>         stack;
>         ret_max = ECMD_FAILED;
>         if (!skip)
>             goto endvg;
>         /* Drop through to eliminate a clustered VG's PVs from the devices list */
>     }
> 
>    Because vg2 is exported and vg2 locates on the head of list, firstly vg_read(vg2) 
>    will cause set read error and cause ignore_vg() to return 1 (read_error != SUCCESS)
>    
>    Then ret_max remains ECMD_FAILED(5) and is returned. I don't think returning error
>    is expected since vg2 has no relationship with /dev/vdb1.

Thanks, I've fixed this here:
https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=0f10823ec910c0a6015b20580f5aa26f209cea04

Dave



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

* pvchange returns 5 when the other vg is exported
  2016-03-10 19:39 ` David Teigland
@ 2016-03-11  7:35   ` Liuhua Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Liuhua Wang @ 2016-03-11  7:35 UTC (permalink / raw)
  To: lvm-devel

Hi David,

On Thu, Mar 10, 2016 at 01:39:37PM -0600, David Teigland wrote:
> > 
> >    Because vg2 is exported and vg2 locates on the head of list, firstly vg_read(vg2) 
> >    will cause set read error and cause ignore_vg() to return 1 (read_error != SUCCESS)
> >    
> >    Then ret_max remains ECMD_FAILED(5) and is returned. I don't think returning error
> >    is expected since vg2 has no relationship with /dev/vdb1.
> 
> Thanks, I've fixed this here:
> https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=0f10823ec910c0a6015b20580f5aa26f209cea04

I tested the patch works. Thanks a lot!
---
Best,
Liuhua



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

end of thread, other threads:[~2016-03-11  7:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 10:23 pvchange returns 5 when the other vg is exported Liuhua Wang
2016-03-10 19:39 ` David Teigland
2016-03-11  7:35   ` Liuhua Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.