[Libguestfs] [PATCH v2] daemon: Move lvmetad to early in the appliance boot process.

Richard W.M. Jones rjones at redhat.com
Tue May 29 19:39:24 UTC 2018


On Thu, May 24, 2018 at 04:54:49PM +0200, Pino Toscano wrote:
> On Thursday, 24 May 2018 16:01:22 CEST Richard W.M. Jones wrote:
> > When the daemon starts up it creates a fresh (empty) LVM configuration
> > and starts up lvmetad (which depends on the LVM configuration).
> > 
> > However this appears to cause problems: Some types of PV seem to
> > require lvmetad and don't work without it
> > (https://bugzilla.redhat.com/show_bug.cgi?id=1581810).  If we don't
> > start lvmetad earlier, the device nodes are not created.
> > 
> > Therefore move the whole initialization step into appliance/init.
> > 
> > Two further changes had to be made:
> > 
> > Now we are using lvmetad all the time, using vgchange is incorrect.
> > With lvmetad activated early we must use ‘pvscan --cache --activate ay’
> > to scan all disks for PVs and activate any VGs on them (although the
> > documentation is complex, confusing and contradictory so I'm not
> > completely sure about this).
> > 
> > The ‘lvm_system_dir’ local variable in ‘daemon/lvm-filter.c’
> > previously contained the path of the directory above $LVM_SYSTEM_DIR
> > (eg. $LVM_SYSTEM_DIR = "/etc/lvm", lvm_system_dir = "/etc").  As this
> > was highly confusing, I have changed it so the local variable and the
> > environment variable have identical contents.  This involved removing
> > the ‘lvm/’ component from a couple of paths since it is now included
> > in the local variable.
> > ---
> 
> Mostly LGTM, but there is one thing to fix:
> 
> > +  lvm_system_dir = getenv ("LVM_SYSTEM_DIR");
> > +  if (!lvm_system_dir)
> > +    lvm_system_dir = "/etc/lvm";
> > +  fprintf (stderr, "lvm_system_dir = %s\n", lvm_system_dir);
> 
> The pointer returned by getenv() can change, so it will be better to
> duplicate its result, and store that instead for the daemon lifetime.

I pushed this, with a small change to ensure that it strdups the
string in this function.

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list