On Tue, Mar 19, 2013 at 10:17:59AM -0400, John Ferlan wrote:
On 03/15/2013 12:32 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange(a)redhat.com>
>
> The LXC controller is closing loop devices as soon as the
> container has started. This is fine if the loop device
> was setup as a mounted filesystem, but if we're just passing
> through the loop device as a disk, nothing else is keeping
> it open. Thus we must keep the loop device FDs open for as
> long the libvirt_lxc process is running.
>
> Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
> ---
> src/lxc/lxc_controller.c | 20 +++-----------------
> 1 file changed, 3 insertions(+), 17 deletions(-)
>
> diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
> index c433fb1..9545df3 100644
> --- a/src/lxc/lxc_controller.c
> +++ b/src/lxc/lxc_controller.c
> @@ -199,22 +199,12 @@ error:
> }
>
>
> -static int virLXCControllerCloseLoopDevices(virLXCControllerPtr ctrl,
> - bool force)
> +static int virLXCControllerCloseLoopDevices(virLXCControllerPtr ctrl)
> {
> size_t i;
>
> - for (i = 0 ; i < ctrl->nloopDevs ; i++) {
> - if (force) {
> - VIR_FORCE_CLOSE(ctrl->loopDevFds[i]);
> - } else {
> - if (VIR_CLOSE(ctrl->loopDevFds[i]) < 0) {
> - virReportSystemError(errno, "%s",
> - _("Unable to close loop device"));
> - return -1;
> - }
> - }
> - }
> + for (i = 0 ; i < ctrl->nloopDevs ; i++)
> + VIR_FORCE_CLOSE(ctrl->loopDevFds[i]);
>
> return 0;
> }
> @@ -1616,10 +1606,6 @@ virLXCControllerRun(virLXCControllerPtr ctrl)
>
> /* Now the container is fully setup... */
>
> - /* ...we can close the loop devices... */
> - if (virLXCControllerCloseLoopDevices(ctrl, false) < 0)
> - goto cleanup;
> -
> /* ...and reduce our privileges */
> if (lxcControllerClearCapabilities() < 0)
> goto cleanup;
>
Doesn't the call to virLXCControllerCloseLoopDevices() in
virLXCControllerStopInit() need to lose the ", true" parameter?
Yes, of course :-)
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 :|