[Libguestfs] [PATCH 2/3] New API: lvm_scan, deprecate vgscan (RHBZ#1602353).

Richard W.M. Jones rjones at redhat.com
Thu Jul 19 14:56:17 UTC 2018


On Thu, Jul 19, 2018 at 10:52:23AM +0200, Pino Toscano wrote:
> On Wednesday, 18 July 2018 15:37:24 CEST Richard W.M. Jones wrote:
> > The old vgscan API literally ran vgscan.  When we switched to using
> > lvmetad (in commit dd162d2cd56a2ecf4bcd40a7f463940eaac875b8) this
> > stopped working because lvmetad now ignores plain vgscan commands
> > without the --cache option.
> > 
> > We documented that vgscan would rescan PVs, VGs and LVs, but without
> > activating them.
> > 
> > I have introduced a new API (lvm_scan) which scans or rescans PVs, VGs
> > and LVs.  It has an optional activate parameter allowing activation of
> > any new LVs that are found.
> > 
> > With lvmetad this nicely maps to the single command:
> > 
> >  pvscan --cache [--activate ay]
> > ---
> 
> lvm_scan seems basically vgscan + activate -- wouldn't be better to just
> add the "activate" optarg to vgscan? After all, if vgscan is deprecated,
> and users should migrate to lvm_scan, they can just add a new optarg.

That's possible but "vgscan" is very misnamed and so I took the
opportunity to rename the concept.

Users shouldn't need to change what they were doing.  By making vgscan
be an alias for lvm_scan, old code which was doing:

  guestfs_vgscan (g);
  guestfs_vg_activate_all (g);

still works.  New code can do lvm_scan (true) which has the same effect.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list