1. 27 9月, 2011 1 次提交
  2. 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
  3. 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
  4. 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
  5. 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
  6. 14 7月, 2011 1 次提交
    • E
      lxc: reject unknown flags · 5037cea5
      Eric Blake 提交于
      * src/lxc/lxc_driver.c (lxcOpen, lxcDomainSetMemoryParameters)
      (lxcDomainGetMemoryParameters): Reject unknown flags.
      * src/lxc/lxc_container.c (lxcContainerStart): Rename flags to
      cflags to reflect that it is not tied to libvirt.
      5037cea5
  7. 06 7月, 2011 1 次提交
    • M
      Fix return value semantic of virFileMakePath · e123e1ee
      Matthias Bolte 提交于
      Some callers expected virFileMakePath to set errno, some expected
      it to return an errno value. Unify this to return 0 on success and
      -1 on error. Set errno to report detailed error information.
      
      Also optimize virFileMakePath if stat fails with an errno different
      from ENOENT.
      e123e1ee
  8. 08 6月, 2011 5 次提交
  9. 12 5月, 2011 1 次提交
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
  10. 11 5月, 2011 2 次提交
  11. 05 4月, 2011 1 次提交
    • D
      Enable use of -Wmissing-noreturn · 329e9dc6
      Daniel P. Berrange 提交于
      * src/internal.h: Define a ATTRIBUTE_NO_RETURN annotation
      * src/lxc/lxc_container.c: Annotate lxcContainerDummyChild
        with ATTRIBUTE_NO_RETURN
      * tests/eventtest.c: Mark async thread as ATTRIBUTE_NO_RETURN
      * m4/virt-compile-warnings.m4: Enable -Wmissing-noreturn
      329e9dc6
  12. 24 2月, 2011 1 次提交
    • D
      Allow 32-on-64 execution for LXC guests · 4f2094a8
      Daniel P. Berrange 提交于
      Using the 'personality(2)' system call, we can make a container
      on an x86_64 host appear to be i686. Likewise for most other
      Linux 64bit arches.
      
      * src/lxc/lxc_conf.c: Fill in 32bit capabilities for x86_64 hosts
      * src/lxc/lxc_container.h, src/lxc/lxc_container.c: Add API to
        check if an arch has a 32bit alternative
      * src/lxc/lxc_controller.c: Set the process personality when
        starting guest
      4f2094a8
  13. 23 2月, 2011 1 次提交
    • D
      Expose name + UUID to LXC containers via env variables · 6704e3fd
      Daniel P. Berrange 提交于
      When spawning 'init' in the container, set
      
        LIBVIRT_LXC_UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
        LIBVIRT_LXC_NAME=YYYYYYYYYYYY
      
      to allow guest software to detect & identify that they
      are in a container
      
      * src/lxc/lxc_container.c: Set LIBVIRT_LXC_UUID and
        LIBVIRT_LXC_NAME env vars
      6704e3fd
  14. 21 2月, 2011 1 次提交
    • E
      maint: kill all remaining uses of old DEBUG macro · 994e7567
      Eric Blake 提交于
      Done mechanically with:
      $ git grep -l '\bDEBUG0\? *(' | xargs -L1 sed -i 's/\bDEBUG0\? *(/VIR_&/'
      
      followed by manual deletion of qemudDebug in daemon/libvirtd.c, along
      with a single 'make syntax-check' fallout in the same file, and the
      actual deletion in src/util/logging.h.
      
      * src/util/logging.h (DEBUG, DEBUG0): Delete.
      * daemon/libvirtd.h (qemudDebug): Likewise.
      * global: Change remaining clients over to VIR_DEBUG counterpart.
      994e7567
  15. 09 2月, 2011 1 次提交
    • S
      Don't use CLONE_NEWUSER for now · 28209ca0
      Serge E. Hallyn 提交于
      Until now, user namespaces have not done much, but (for that
      reason) have been innocuous to glob in with other CLONE_
      flags.  Upcoming userns development, however, will make tasks
      cloned with CLONE_NEWUSER far more restricted.  In particular,
      for some time they will be unable to access files with anything
      other than the world access perms.
      
      This patch assumes that noone really needs the user namespaces
      to be enabled.  If that is wrong, then we can try a more
      baroque patch where we create a file owned by a test userid with
      700 perms and, if we can't access it after setuid'ing to that
      userid, then return 0.  Otherwise, assume we are using an
      older, 'harmless' user namespace implementation.
      
      Comments appreciated.  Is it ok to do this?
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      28209ca0
  16. 29 1月, 2011 1 次提交
  17. 11 11月, 2010 1 次提交
    • D
      Fix LXC container console device setup · 2fbec002
      Daniel P. Berrange 提交于
      The /dev/console device inside the container must NOT map
      to the real /dev/console device node, since this allows the
      container control over the current host console. A fun side
      effect of this is that starting a container containing a
      real Fedora OS will kill off your X server.
      
      Remove the /dev/console node, and replace it with a symlink
      to the primary console TTY
      
      * src/lxc/lxc_container.c: Replace /dev/console with a
        symlink to /dev/pty/0
      * src/lxc/lxc_controller.c: Remove /dev/console from cgroups
        ACL
      2fbec002
  18. 10 11月, 2010 1 次提交
    • S
      bye to close(), welcome to VIR_(FORCE_)CLOSE() · 60ae1c34
      Stefan Berger 提交于
      Using automated replacement with sed and editing I have now replaced all
      occurrences of close() with VIR_(FORCE_)CLOSE() except for one, of
      course. Some replacements were straight forward, others I needed to pay
      attention. I hope I payed attention in all the right places... Please
      have a look. This should have at least solved one more double-close
      error.
      60ae1c34
  19. 30 7月, 2010 1 次提交
    • R
      lxc: Fix return values of veth.c functions · 938f2dbd
      Ryota Ozaki 提交于
      Previously, the functions in src/lxc/veth.c could sometimes return
      positive values on failure rather than -1. This made accurate error
      reporting difficult, and led to one failure to catch an error in a
      calling function.
      
      This patch makes all the functions in veth.c consistently return 0 on
      success, and -1 on failure. It also fixes up the callers to the veth.c
      functions where necessary.
      
      Note that this patch may be related to the bug:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=607496.
      
      It will not fix the bug, but should unveil what happens.
      
      * po/POTFILES.in - add veth.c, which previously had no translatable strings
      * src/lxc/lxc_controller.c
      * src/lxc/lxc_container.c
      * src/lxc/lxc_driver.c    - fixup callers to veth.c, and remove error logs,
                                  as they are now done in veth.c
      * src/lxc/veth.c - make all functions consistently return -1 on error.
      * src/lxc/veth.h - use ATTRIBUTE_NONNULL to protect against NULL args.
      938f2dbd
  20. 29 6月, 2010 1 次提交
    • R
      lxc: Fix error handlings in lxcContainerRenameAndEnableInterfaces · df8225ac
      Ryota Ozaki 提交于
      The function is expected to return negative value on failure,
      however, it returns positive value when either setInterfaceName
      or vethInterfaceUpOrDown fails. Because the function returns
      the return value of either as is, however, the two functions
      may return positive value on failure.
      
      The patch fixes the defects and add error messages.
      df8225ac
  21. 19 5月, 2010 1 次提交
  22. 18 3月, 2010 1 次提交
    • E
      maint: make Red Hat copyright notices consistent · 0a336335
      Eric Blake 提交于
      Spell out 'Red Hat, Inc.':
       git grep -i 'Copyright.*Red Hat' | grep -v Inc
      
      Include (C) consistently:
       git grep -i 'Copyright [^(].*Red Hat'
      
      * src/lxc/lxc_container.c: Update copyright formatting.
      * src/node_device/node_device_udev.c: Likewise.
      * src/node_device/node_device_udev.h: Likewise.
      * src/xen/xend_internal.h: Likewise.
      * src/xen/xm_internal.c: Likewise.
      * src/xen/xm_internal.h: Likewise.
      * tests/xmconfigtest.c: Likewise.
      * tests/object-locking.ml: Likewise.
      * tools/virt-pki-validate.in: Likewise.
      * tools/virt-xml-validate.in: Likewise.
      0a336335
  23. 10 3月, 2010 1 次提交
  24. 05 3月, 2010 1 次提交
    • D
      Tweak container initialization to make upstart/init happier · b70a1f45
      Daniel P. Berrange 提交于
      Upstart crashes & burns in a heap if $TERM environment variable
      is missing. Presumably the kernel always sets this when booting
      init on a real machine, so libvirt should set it for containers
      too.
      
      To make a typical inittab / mingetty setup happier, we need to
      symlink the primary console /dev/pts/0 to /dev/tty1.
      
      Improve logging in certain scenarios to make troubleshooting
      easier
      
      * src/lxc/lxc_container.c: Create /dev/tty1 and set $TERM
      b70a1f45
  25. 10 2月, 2010 1 次提交
  26. 09 2月, 2010 2 次提交
  27. 26 1月, 2010 1 次提交
  28. 21 1月, 2010 1 次提交
    • L
      Fix uses of virFileMakePath · 623bc48a
      Laine Stump 提交于
      * src/lxc/lxc_container.c src/lxc/lxc_controller.c src/lxc/lxc_driver.c
        src/network/bridge_driver.c src/qemu/qemu_driver.c
        src/uml/uml_driver.c: virFileMakePath returns 0 for success, or the
        value of errno on failure, so error checking should be to test
        if non-zero, not if lower than 0
      623bc48a
  29. 13 11月, 2009 1 次提交
    • D
      Remove capng_lock() call when spawning LXC container init process · e6cbadd5
      Daniel P. Berrange 提交于
      The capng_lock() call sets the SECURE_NO_SETUID_FIXUP and SECURE_NOROOT
      bits on the process. This prevents the kernel granting capabilities to
      processes with an effective UID of 0, or with setuid programs. This is
      not actually what we want in the container init process. It should be
      allowed to run setuid processes & keep capabilities when root. All that
      is required is masking a handful of dangerous capabilities from the
      bounding set.
      
      * src/lxc/lxc_container.c: Remove bogus capng_lock() call.
      e6cbadd5