[libvirt] [PATCH 7/7] locking: Implement lock failure action in sanlock driver

Daniel P. Berrange berrange at redhat.com
Mon Oct 8 13:01:30 UTC 2012


On Thu, Sep 27, 2012 at 04:41:37PM +0200, Jiri Denemark wrote:
> While the changes to sanlock driver should be stable, the actual
> implementation of sanlock_helper is supposed to be replaced in the
> future. However, before we can implement a better sanlock_helper, we
> need an administrative interface to libvirtd so that the helper can just
> pass a "leases lost" event to the particular libvirt driver and
> everything else will be taken care of internally. This approach will
> also allow libvirt to pass such event to applications and use
> appropriate reasons when changing domain states.
> 
> The temporary implementation handles all actions directly by calling
> appropriate libvirt APIs (which among other things means that it needs
> to know the credentials required to connect to libvirtd).


> +static int
> +getCredentials(const char *driver)
> +{
> +    virConfPtr conf = NULL;
> +    char *path;
> +    int ret = -1;
> +
> +    if (virAsprintf(&path, "%s/libvirt/%s-sanlock.conf",
> +                    SYSCONFDIR, driver) < 0)
> +        return -1;
> +
> +    if (!(conf = virConfReadFile(path, 0))) {
> +        ret = 0;
> +        goto cleanup;
> +    }
> +
> +    if (getConfig(conf, "helper_login", &login) < 0 ||
> +        getConfig(conf, "helper_password", &password) < 0 ||

Libvirt already has support built-in for loading usernames and
passwords from a configuration file, so I don't think we need
to duplicate that in the sanlock config file. This is just a
documentation task to describe where to put the login info
for sanlock to use it.

> +
> +    if (virAsprintf(&uri, "%s:///%s",
> +                    driver,
> +                    STREQ(driver, "qemu") ? "system" : "") < 0)
> +        goto cleanup;

This seems rather dubious to me and re-inforces my opinion that
we should be passing the full URI, not the driver name.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list