[libvirt] [PATCH v7 2/6] add fuse support for libvirt lxc

Richard W.M. Jones rjones at redhat.com
Tue Nov 6 08:34:24 UTC 2012


On Tue, Nov 06, 2012 at 02:07:18PM +0800, Gao feng wrote:
> +static int
> +virLXCControllerSetupFuse(virLXCControllerPtr ctrl)
> +{
> +    int try = 0;
> +    virThread thread;
> +    if (virThreadCreate(&thread, true, lxcRegisterFuse,
> +                        (void *)ctrl->def) < 0)
> +        return -1;
> +    /*
> +     * because libvirt_lxc may use fuse filesystem before fuse being
> +     * mounted by the thread. so wait 3 seconds in libvirt_lxc. if fuse
> +     * is not mounted in 3 seconds, libvirt_lxc will exit.
> +     */
> +    while (try++ < 2) {
> +        if (lxcRegisterFuseSuccess())
> +            return 0;
> +
> +        sleep(1);
> +    }
> +
> +    return -1;
> +}

This code seems like it is bound to cause trouble.  Can you explain
why the arbitrary wait is required here?

> diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
> new file mode 100644
> index 0000000..42107d7
> --- /dev/null
> +++ b/src/lxc/lxc_fuse.c
> @@ -0,0 +1,157 @@
> +/*
> + * Copyright (C) 2012 Fujitsu Limited.
> + *
> + * lxc_fuse.c: fuse filesystem support for libvirt lxc
[...]

The basic empty directory fuse filesystem seems fine.  I see
that patch 5/6 adds one(?) file to this directory, also fine.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the libvir-list mailing list