1. 16 5月, 2012 3 次提交
  2. 01 5月, 2012 1 次提交
  3. 30 3月, 2012 1 次提交
  4. 27 3月, 2012 2 次提交
    • D
      Add support for setting init argv for LXC · c91cff25
      Daniel P. Berrange 提交于
      Pass argv to the init binary of LXC, using a new <initarg> element.
      
      * docs/formatdomain.html.in: Document <os> usage for containers
      * docs/schemas/domaincommon.rng: Add <initarg> element
      * src/conf/domain_conf.c, src/conf/domain_conf.h: parsing and
        formatting of <initarg>
      * src/lxc/lxc_container.c: Setup LXC argv
      * tests/Makefile.am, tests/lxcxml2xmldata/lxc-systemd.xml,
        tests/lxcxml2xmltest.c, tests/testutilslxc.c,
        tests/testutilslxc.h: Test parsing/formatting of LXC related
        XML parts
      c91cff25
    • D
      Detect location fo selinux mount point · eb8f31c1
      Daniel P. Berrange 提交于
      The SELinux mount point moved from /selinux to /sys/fs/selinux
      when systemd came along.
      
      * configure.ac: Probe for SELinux mount point
      * src/lxc/lxc_container.c: Use SELinux mount point determined
        by configure.ac
      eb8f31c1
  5. 16 3月, 2012 1 次提交
    • D
      Add support for forcing a private network namespace for LXC guests · 10a8b1f9
      Daniel P. Berrange 提交于
      If no <interface> elements are included in an LXC guest XML
      description, then the LXC guest will just see the host's
      network interfaces. It is desirable to be able to hide the
      host interfaces, without having to define any guest interfaces.
      
      This patch introduces a new feature flag <privnet/> to allow
      forcing of a private network namespace for LXC. In the future
      I also anticipate that we will add <privuser/> to force a
      private user ID namespace.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Add support
        for <privnet/> feature. Auto-set <privnet> if any <interface>
        devices are defined
      * src/lxc/lxc_container.c: Honour request for private network
        namespace
      10a8b1f9
  6. 15 3月, 2012 1 次提交
  7. 29 2月, 2012 1 次提交
  8. 09 2月, 2012 1 次提交
  9. 04 2月, 2012 1 次提交
  10. 03 2月, 2012 3 次提交
    • M
      Fixed connection definition for non-SELinux builds · 32f881c6
      Martin Kletzander 提交于
      This patch fixes the access of variable "con" in two files where the
      variable was declared only on SELinux builds and thus the build failed
      without SELinux. It's a rather nasty fix but helps fix the build
      quickly and without any major changes to the code.
      32f881c6
    • D
      Set a security context on /dev and /dev/pts mounts · 5df67cdc
      Daniel P. Berrange 提交于
      To allow the container to access /dev and /dev/pts when under
      sVirt, set an explicit mount option. Also set a max size on
      the /dev mount to prevent DOS on memory usage
      
      * src/lxc/lxc_container.c: Set /dev mount context
      * src/lxc/lxc_controller.c: Set /dev/pts mount context
      5df67cdc
    • D
      Add support for sVirt in the LXC driver · 0f01192e
      Daniel P. Berrange 提交于
      For the sake of backwards compat, LXC guests are *not*
      confined by default. This is because it is not practical
      to dynamically relabel containers using large filesystem
      trees. Applications can create confined containers though,
      by giving suitable XML configs
      
      * src/Makefile.am: Link libvirt_lxc to security drivers
      * src/lxc/libvirtd_lxc.aug, src/lxc/lxc_conf.h,
        src/lxc/lxc_conf.c, src/lxc/lxc.conf,
        src/lxc/test_libvirtd_lxc.aug: Config file handling for
        security driver
      * src/lxc/lxc_driver.c: Wire up security driver functions
      * src/lxc/lxc_controller.c: Add a '--security' flag to
        specify which security driver to activate
      * src/lxc/lxc_container.c, src/lxc/lxc_container.h: Set
        the process label just before exec'ing init.
      0f01192e
  11. 25 1月, 2012 2 次提交
  12. 18 1月, 2012 1 次提交
    • D
      Fix startup of LXC containers with filesystems containing symlinks · c53ba61b
      Daniel P. Berrange 提交于
      Given an LXC guest with a root filesystem path of
      
        /export/lxc/roots/helloworld/root
      
      During startup, we will pivot the root filesystem to end up
      at
      
        /.oldroot/export/lxc/roots/helloworld/root
      
      We then try to open
      
        /.oldroot/export/lxc/roots/helloworld/root/dev/pts
      
      Now consider if '/export/lxc' is an absolute symlink pointing
      to '/media/lxc'. The kernel will try to open
      
        /media/lxc/roots/helloworld/root/dev/pts
      
      whereas it should be trying to open
      
        /.oldroot//media/lxc/roots/helloworld/root/dev/pts
      
      To deal with the fact that the root filesystem can be moved,
      we need to resolve symlinks in *any* part of the filesystem
      source path.
      
      * src/libvirt_private.syms, src/util/util.c,
        src/util/util.h: Add virFileResolveAllLinks to resolve
        all symlinks in a path
      * src/lxc/lxc_container.c: Resolve all symlinks in filesystem
        paths during startup
      c53ba61b
  13. 15 11月, 2011 2 次提交
    • D
      Move LXC veth.c code into shared utility APIs · 428cffb1
      Daniel P. Berrange 提交于
      Move the virNetDevSetName and virNetDevSetNamespace APIs out
      of LXC's veth.c and into virnetdev.c.
      
      Move the remaining content of the file to src/util/virnetdevveth.c
      
      * src/lxc/veth.c: Rename to src/util/virnetdevveth.c
      * src/lxc/veth.h: Rename to src/util/virnetdevveth.h
      * src/util/virnetdev.c, src/util/virnetdev.h: Add
        virNetDevSetName and virNetDevSetNamespace
      * src/lxc/lxc_container.c, src/lxc/lxc_controller.c,
        src/lxc/lxc_driver.c: Update include paths
      428cffb1
    • D
      Rename the LXC veth management APIs and delete duplicated APIs · 29b242ad
      Daniel P. Berrange 提交于
      The src/lxc/veth.c file contains APIs for managing veth devices,
      but some of the APIs duplicate stuff from src/util/virnetdev.h.
      Delete thed duplicate APIs and rename the remaining ones to
      follow virNetDevVethXXXX
      
      * src/lxc/veth.c, src/lxc/veth.h: Rename APIs & delete duplicates
      * src/lxc/lxc_container.c, src/lxc/lxc_controller.c,
        src/lxc/lxc_driver.c: Update for API renaming
      29b242ad
  14. 12 11月, 2011 1 次提交
    • E
      build: drop useless dirent.h includes · e55ec69d
      Eric Blake 提交于
      * .gnulib: Update to latest, for improved syntax-check.
      * src/lxc/lxc_container.c (includes): Drop unused include.
      * src/network/bridge_driver.c: Likewise.
      * src/node_device/node_device_linux_sysfs.c: Likewise.
      * src/openvz/openvz_driver.c: Likewise.
      * src/qemu/qemu_conf.c: Likewise.
      * src/storage/storage_backend_iscsi.c: Likewise.
      * src/storage/storage_backend_mpath.c: Likewise.
      * src/uml/uml_conf.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      e55ec69d
  15. 03 11月, 2011 1 次提交
    • D
      Add support for multiple consoles in LXC · 0f31f7b7
      Daniel P. Berrange 提交于
      Currently the LXC controller only supports setup of a single
      text console. This is wired up to the container init's stdio,
      as well as /dev/console and /dev/tty1. Extending support for
      multiple consoles, means wiring up additional PTYs to /dev/tty2,
      /dev/tty3, etc, etc. The LXC controller is passed multiple open
      file handles, one for each console requested.
      
      * src/lxc/lxc_container.c, src/lxc/lxc_container.h: Wire up
        all the /dev/ttyN links required to symlink to /dev/pts/NN
      * src/lxc/lxc_container.h: Open more container side /dev/pts/NN
        devices, and adapt event loop to handle I/O from all consoles
      * src/lxc/lxc_driver.c: Setup multiple host side PTYs
      0f31f7b7
  16. 02 11月, 2011 5 次提交
    • D
      Add support for probing filesystem with libblkid · 26798492
      Daniel P. Berrange 提交于
      The LXC code for mounting container filesystems from block devices
      tries all filesystems in /etc/filesystems and possibly those in
      /proc/filesystems. The regular mount binary, however, first tries
      using libblkid to detect the format. Add support for doing the same
      in libvirt, since Fedora's /etc/filesystems is missing many formats,
      most notably ext4 which is the default filesystem Fedora uses!
      
      * src/Makefile.am: Link libvirt_lxc to libblkid
      * src/lxc/lxc_container.c: Probe filesystem format with libblkid
      26798492
    • D
      Fix error message when failing to detect filesystem · 68285356
      Daniel P. Berrange 提交于
      If we looped through /etc/filesystems trying to mount with each
      type and failed all options, we forget to actually raise an
      error message.
      
      * src/lxc/lxc_container.c: Raise error if unable to detect
        the filesystems. Also fix existing error message
      68285356
    • D
      Workaround for broken kernel autofs mounts · 878cc33a
      Daniel P. Berrange 提交于
      The kernel automounter is mostly broken wrt to containers. Most
      notably if you start a new filesystem namespace and then attempt
      to unmount any autofs filesystem, it will typically fail with a
      weird error message like
      
        Failed to unmount '/.oldroot/sys/kernel/security':Too many levels of symbolic links
      
      Attempting to detach the autofs mount using umount2(MNT_DETACH)
      will also fail with the same error. Therefore if we get any error on
      unmount()ing a filesystem from the old root FS when starting a
      container, we must immediately break out and detach the entire
      old root filesystem (ignoring any mounts below it).
      
      This has the effect of making the old root filesystem inaccessible
      to anything inside the container, but at the cost that the mounts
      live on in the kernel until the container exits. Given that SystemD
      uses autofs by default, we need LXC to be robust this scenario and
      thus this tradeoff is worthwhile.
      
      * src/lxc/lxc_container.c: Detach root filesystem if any umount
        operation fails.
      878cc33a
    • D
      Correctly handle '*' in /etc/filesystems · a02f57fa
      Daniel P. Berrange 提交于
      The /etc/filesystems file can contain a '*' on the last line to
      indicate that /proc/filessystems should be tried next. We have
      a check that this '*' only occurs on the last line. Unfortunately
      when we then start reading /proc/filesystems, we mistakenly think
      we've seen '*' in /proc/filesystems and fail
      
      * src/lxc/lxc_container.c: Skip '*' validation when we're reading
        /proc/filesystems
      a02f57fa
    • D
      Ensure errno is valid when returning from lxcContainerWaitForContinue · 065ecf51
      Daniel P. Berrange 提交于
      Only some of the return paths of lxcContainerWaitForContinue will
      have set errno. In other paths we need to set it manually to avoid
      the caller getting a random stale errno value
      
      * src/lxc/lxc_container.c: Set errno in lxcContainerWaitForContinue
      065ecf51
  17. 25 10月, 2011 1 次提交
    • E
      waitpid: improve safety · 69d044c0
      Eric Blake 提交于
      Based on a report by Coverity.  waitpid() can leak resources if it
      fails with EINTR, so it should never be used without checking return
      status.  But we already have a helper function that does that, so
      use it in more places.
      
      * src/lxc/lxc_container.c (lxcContainerAvailable): Use safer
      virWaitPid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput, virtTestMain):
      Likewise.
      * src/libvirt.c (virConnectAuthGainPolkit): Simplify with virCommand.
      69d044c0
  18. 11 10月, 2011 1 次提交
    • E
      maint: typo fixes · dbbe16c2
      Eric Blake 提交于
      I noticed a couple typos in recent commits, and fixed the remaining
      instances of them.
      
      * docs/internals/command.html.in: Fix spelling errors.
      * include/libvirt/libvirt.h.in (virConnectDomainEventCallback):
      Likewise.
      * python/libvirt-override.py (virEventAddHandle): Likewise.
      * src/lxc/lxc_container.c (lxcContainerChild): Likewise.
      * src/util/hash.c (virHashCreateFull): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalMakeVol): Likewise.
      * src/esx/esx_driver.c (esxFormatVMXFileName): Likewise.
      * src/vbox/vbox_tmpl.c (vboxIIDIsEqual_v3_x): Likewise.
      dbbe16c2
  19. 04 10月, 2011 1 次提交
    • D
      Allow passing of command line args to LXC container · 652f8871
      Daniel P. Berrange 提交于
      When booting a virtual machine with a kernel/initrd it is possible
      to pass command line arguments using the <cmdline>...args...</cmdline>
      element in the guest XML. These appear to the kernel / init process
      in /proc/cmdline.
      
      When booting a container we do not have a custom /proc/cmdline,
      but we can easily set an environment variable for it. Ideally
      we could pass individual arguments to the init process as a
      regular set of 'char *argv[]' parameters, but that would involve
      libvirt parsing the <cmdline> XML text. This can easily be added
      later, even if we add the env variable now
      
      * docs/drvlxc.html.in: Document env variables passed to LXC
      * src/conf/domain_conf.c: Add <cmdline> to be parsed for
        guests of type='exe'
      * src/lxc/lxc_container.c: Set LIBVIRT_LXC_CMDLINE env var
      652f8871
  20. 27 9月, 2011 1 次提交
  21. 02 9月, 2011 1 次提交
    • S
      Create ptmx as a device · c1665ba8
      Serge Hallyn 提交于
      Hi,
      
      I'm seeing an issue with udev and libvirt-lxc.  Libvirt-lxc creates
      /dev/ptmx as a symlink to /dev/pts/ptmx.  When udev starts up, it
      checks the device type, sees ptmx is 'not right', and replaces it
      with a 'proper' ptmx.
      
      In lxc, /dev/ptmx is bind-mounted from /dev/pts/ptmx instead of being
      symlinked, so udev sees the right device type and leaves it alone.
      
      A patch like the following seems to work for me.  Would there be
      any objections to this?
      
      >From 4c5035de52de7e06a0de9c5d0bab8c87a806cba7 Mon Sep 17 00:00:00 2001
      From: Ubuntu <ubuntu@domU-12-31-39-14-F0-B3.compute-1.internal>
      Date: Wed, 31 Aug 2011 18:15:54 +0000
      Subject: [PATCH 1/1] make ptmx a bind mount rather than symlink
      
      udev on some systems checks the device type of /dev/ptmx, and replaces it if
      not as expected.  The symlink created by libvirt-lxc therefore gets replaced.
      By creating it as a bind mount, the device type is correct and udev leaves it
      alone.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      c1665ba8
  22. 24 8月, 2011 1 次提交
    • E
      maint: fix comment typos · 3a52b864
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal): Fix typo.
      * src/conf/domain_event.c (virDomainEventDispatchMatchCallback):
      Likewise.
      * daemon/libvirtd.c (daemonRunStateInit): Likewise.
      * src/lxc/lxc_container.c (lxcContainerChildMountSort): Likewise.
      * src/util/virterror.c (virCopyError, virRaiseErrorFull): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprSound): Likewise.
      3a52b864
  23. 08 8月, 2011 3 次提交
    • D
      Allow use of file images for LXC container filesystems · 5f5c6fde
      Daniel P. Berrange 提交于
      A previous commit gave the LXC driver the ability to mount
      block devices for the container filesystem. Through use of
      the loopback device functionality, we can build on this to
      support use of plain file images for LXC filesytems.
      
      By setting the LO_FLAGS_AUTOCLEAR flag we can ensure that
      the loop device automatically disappears when the container
      dies / shuts down
      
      * src/lxc/lxc_container.c: Raise error if we see a file
        based filesystem, since it should have been turned into
        a loopback device already
      * src/lxc/lxc_controller.c: Rewrite any filesystems of
        type=file, into type=block, by binding the file image
        to a free loop device
      5f5c6fde
    • D
      Allow use of block devices for guest filesystem · 77791dc0
      Daniel P. Berrange 提交于
      Currently the LXC driver can only populate filesystems from
      host filesystems, using bind mounts. This patch allows host
      block devices to be mounted. It autodetects the filesystem
      format at mount time, and adds the block device to the cgroups
      ACL. Example usage is
      
          <filesystem type='block' accessmode='passthrough'>
            <source dev='/dev/sda1'/>
            <target dir='/home'/>
          </filesystem>
      
      * src/lxc/lxc_container.c: Mount block device filesystems
      * src/lxc/lxc_controller.c: Add block device filesystems
        to cgroups ACL
      77791dc0
    • D
      Don't mount /dev for application containers · b6bd2d34
      Daniel P. Berrange 提交于
      An application container shouldn't get a private /dev. Fix
      the regression from 6d37888e
      
      * src/lxc/lxc_container.c: Don't mount /dev for app containers
      b6bd2d34
  24. 22 7月, 2011 4 次提交
    • D
      Honour filesystem readonly flag & make special FS readonly · b3ad9b9b
      Daniel P. Berrange 提交于
      A container should not be allowed to modify stuff in /sys
      or /proc/sys so make them readonly. Make /selinux readonly
      so that containers think that selinux is disabled.
      
      Honour the readonly flag when mounting container filesystems
      from the guest XML config
      
      * src/lxc/lxc_container.c: Support readonly mounts
      b3ad9b9b
    • D
      Refactor mounting of special filesystems · 6d37888e
      Daniel P. Berrange 提交于
      Even in non-virtual root filesystem mode we should be mounting
      more than just a new /proc. Refactor lxcContainerMountBasicFS
      so that it does everything except for /dev and /dev/pts moving
      that into lxcContainerMountDevFS. Pass in a source prefix
      to lxcContainerMountBasicFS() so it can be used in both shared
      root and private root modes.
      
      * src/lxc/lxc_container.c: Unify mounting code for special
        filesystems
      6d37888e
    • D
      Pull code for doing a bind mount into separate method · 66a00e61
      Daniel P. Berrange 提交于
      The bind mount setup is about to get more complicated.
      To avoid having to deal with several copies, pull it
      out into a separate lxcContainerMountFSBind method.
      
      Also pull out the iteration over container filesystems,
      so that it will be easier to drop in support for non-bind
      mount filesystems
      
      * src/lxc/lxc_container.c: Pull bind mount code out into
        lxcContainerMountFSBind
      66a00e61
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089