1. 28 11月, 2011 4 次提交
  2. 24 11月, 2011 2 次提交
  3. 19 11月, 2011 2 次提交
    • D
      Add support for interfaces with type=direct to LXC · bfe952c9
      Daniel P. Berrange 提交于
      Support creation of macvlan devices for LXC containers. Do not
      allow setting of bandwidth controls or vport profiles due to the
      complication that there is no host side visible device to work
      with.
      
      * src/lxc/lxc_driver.c: Support type=direct interfaces
      bfe952c9
    • D
      Refactor LXC network setup to allow future enhancements · f3b1b9b1
      Daniel P. Berrange 提交于
      The current lxcSetupInterfaces() method directly performs setup
      of the bridge devices. Since it will shortly need to also create
      macvlan devices, move the bridge related code into a separate
      method
      
      * src/lxc/lxc_driver.c: Split lxcSetupInterfaces() to create a
        new lxcSetupInterfaceBridge()
      f3b1b9b1
  4. 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
  5. 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
  6. 10 11月, 2011 5 次提交
    • D
      Adjust naming of network device bandwidth management APIs · 0eee075d
      Daniel P. Berrange 提交于
      Rename virBandwidth to virNetDevBandwidth, and virRate to
      virNetDevBandwidthRate.
      
      * src/util/network.c, src/util/network.h: Rename bandwidth
        structs and APIs
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/conf/network_conf.c, src/conf/network_conf.h,
        src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/util/macvtap.c,
        src/util/macvtap.h, tools/virsh.c: Update for API changes.
      0eee075d
    • D
      Split bridge.h into three separate files · e49c9bf2
      Daniel P. Berrange 提交于
      Following the renaming of the bridge management APIs, we can now
      split the source file into 3 corresponding pieces
      
       * src/util/virnetdev.c: APIs for any type of network interface
       * src/util/virnetdevbridge.c: APIs for bridge interfaces
       * src/util/virnetdevtap.c: APIs for TAP interfaces
      
      * src/util/virnetdev.c, src/util/virnetdev.h,
        src/util/virnetdevbridge.c, src/util/virnetdevbridge.h,
        src/util/virnetdevtap.c, src/util/virnetdevtap.h: Copied
        from bridge.{c,h}
      * src/util/bridge.c, src/util/bridge.h: Split into 3 pieces
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/openvz/openvz_driver.c, src/qemu/qemu_command.c,
        src/qemu/qemu_conf.h, src/uml/uml_conf.c, src/uml/uml_conf.h,
        src/uml/uml_driver.c: Update #include directives
      e49c9bf2
    • D
      Rename all brXXXX APIs to follow new convention · dced27c8
      Daniel P. Berrange 提交于
      The existing brXXX APIs in src/util/bridge.h are renamed to
      follow one of three different conventions
      
       - virNetDevXXX       - operations for any type of interface
       - virNetDevBridgeXXX - operations for bridge interfaces
       - virNetDevTapXXX    - operations for tap interfaces
      
      * src/util/bridge.h, src/util/bridge.c: Rename all APIs
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Update for API renaming
      dced27c8
    • D
      Make all brXXX APIs raise errors, instead of returning errnos · 4f4fd8f7
      Daniel P. Berrange 提交于
      Currently every caller of the brXXX APIs has to store the returned
      errno value and then raise an error message. This results in
      inconsistent error messages across drivers, additional burden on
      the callers and makes the error reporting inaccurate since it is
      hard to distinguish different scenarios from 1 errno value.
      
      * src/util/bridge.c: Raise errors instead of returning errnos
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Remove error reporting code
      4f4fd8f7
    • D
      Remove 'brControl' object · 6cfeb9a7
      Daniel P. Berrange 提交于
      The bridge management APIs in src/util/bridge.c require a brControl
      object to be passed around. This holds the file descriptor for the
      control socket. This extra object complicates use of the API for
      only a minor efficiency gain, which is in turn entirely offset by
      the need to fork/exec the brctl command for STP configuration.
      
      This patch removes the 'brControl' object entirely, instead opening
      the control socket & closing it again within the scope of each method.
      
      The parameter names for the APIs are also made to consistently use
      'brname' for bridge device name, and 'ifname' for an interface
      device name. Finally annotations are added for non-NULL parameters
      and return check validation
      
      * src/util/bridge.c, src/util/bridge.h: Remove brControl object
        and update API parameter names & annotations.
      * src/lxc/lxc_driver.c, src/network/bridge_driver.c,
        src/uml/uml_conf.h, src/uml/uml_conf.c, src/uml/uml_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_conf.h,
        src/qemu/qemu_driver.c: Remove reference to 'brControl' object
      6cfeb9a7
  7. 09 11月, 2011 2 次提交
  8. 04 11月, 2011 1 次提交
    • E
      lxc: avoid use-after-free · 04d2a7f2
      Eric Blake 提交于
      I got this weird failure:
      
      error: Failed to start domain simple
      error: internal error cannot mix caller fds with blocking execution
      
      and tracked it down to a use-after-free - virCommandSetOutputFD
      was storing the address of a stack-local variable, which then
      went out of scope before the virCommandRun that dereferenced it.
      
      Bug introduced in commit 451cfd05 (0.9.2).
      
      * src/lxc/lxc_driver.c (lxcBuildControllerCmd): Move log fd
      registration...
      (lxcVmStart): ...to caller.
      04d2a7f2
  9. 03 11月, 2011 8 次提交
    • E
      lxc: use common code for process cleanup · 8aee48bd
      Eric Blake 提交于
      Based on a Coverity report - the return value of waitpid() should
      always be checked, to avoid problems with leaking resources.
      
      * src/lxc/lxc_controller.c (lxcControllerRun): Use simpler virPidAbort.
      8aee48bd
    • D
      Fix default console type setting · 209c2880
      Daniel P. Berrange 提交于
      The default console type may vary based on the OS type. ie a Xen
      paravirt guests wants a 'xen' console, while a fullvirt guests
      wants a 'serial' console.
      
      A plain integer default console type in the capabilities does
      not suffice. Instead introduce a callback that is passed the
      OS type.
      
      * src/conf/capabilities.h: Use a callback for default console
        type
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Use callback
        for default console type. Add missing LXC/OpenVZ console types.
      * src/esx/esx_driver.c, src/libxl/libxl_conf.c,
        src/lxc/lxc_conf.c, src/openvz/openvz_conf.c,
        src/phyp/phyp_driver.c, src/qemu/qemu_capabilities.c,
        src/uml/uml_conf.c, src/vbox/vbox_tmpl.c,
        src/vmware/vmware_conf.c, src/xen/xen_hypervisor.c,
        src/xenapi/xenapi_driver.c: Set default console type callback
      209c2880
    • D
      Set aliases for LXC/UML console devices · 8866eed0
      Daniel P. Berrange 提交于
      To allow virDomainOpenConsole to access non-primary consoles,
      device aliases are required to be set. Until now only the QEMU
      driver has done this. Update LXC & UML to set aliases for any
      console devices
      
      * src/lxc/lxc_driver.c, src/uml/uml_driver.c: Set aliases
        for console devices
      8866eed0
    • 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
    • D
      Rewrite LXC I/O forwarding to use main event loop · 86b53e59
      Daniel P. Berrange 提交于
      The current I/O code for LXC uses a hand crafted event loop
      to forward I/O between the container & host app, based on
      epoll to handle EOF on PTYs. This event loop is not easily
      extensible to add more consoles, or monitor other types of
      file descriptors.
      
      Remove the custom event loop and replace it with a normal
      libvirt event loop. When detecting EOF on a PTY, disable
      the event watch on that FD, and fork off a background thread
      that does a edge-triggered epoll() on the FD. When the FD
      finally shows new incoming data, the thread re-enables the
      watch on the FD and exits.
      
      When getting EOF from a read() on the PTY, the existing code
      would do waitpid(WNOHANG) to see if the container had exited.
      Unfortunately there is a race condition, because even though
      the process has closed its stdio handles, it might still
      exist.
      
      To deal with this the new event loop uses a SIG_CHILD handler
      to perform the waitpid only when the container is known to
      have actually exited.
      
      * src/lxc/lxc_controller.c: Rewrite the event loop to use
        the standard APIs.
      86b53e59
    • D
      Allow multiple consoles per virtual guest · 0873b688
      Daniel P. Berrange 提交于
      While Xen only has a single paravirt console, UML, and
      QEMU both support multiple paravirt consoles. The LXC
      driver can also be trivially made to support multiple
      consoles. This patch extends the XML to allow multiple
      <console> elements in the XML. It also makes the UML
      and QEMU drivers support this config.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Allow
        multiple <console> devices
      * src/lxc/lxc_driver.c, src/xen/xen_driver.c,
        src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c: Update for
        internal API changes
      * src/security/security_selinux.c, src/security/virt-aa-helper.c:
        Only label consoles that aren't a copy of the serial device
      * src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
        src/qemu/qemu_process.c, src/uml/uml_conf.c,
        src/uml/uml_driver.c: Support multiple console devices
      * tests/qemuxml2xmltest.c, tests/qemuxml2argvtest.c: Extra
        tests for multiple virtio consoles. Set QEMU_CAPS_CHARDEV
        for all console /channel tests
      * tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.args,
        tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args
        tests/qemuxml2argvdata/qemuxml2argv-console-virtio.args: Update
        for correct chardev syntax
      * tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.args,
        tests/qemuxml2argvdata/qemuxml2argv-console-virtio-many.xml: New
        test file
      0873b688
    • E
      lxc: allow getting < max typed parameters · f4e584de
      Eric Blake 提交于
      Allow the user to call with nparams too small, per API documentation.
      Also, libvirt.c filters out nparams of 0 for scheduler parameters.
      
      * src/lxc/lxc_driver.c (lxcDomainGetMemoryParameters): Allow fewer
      than max.
      (lxcGetSchedulerParametersFlags): Drop redundant check.
      f4e584de
    • E
      API: document scheduler parameter names · 319992d4
      Eric Blake 提交于
      Document the parameter names that will be used by
      virDomain{Get,Set}SchedulerParameters{,Flags}, rather than
      hard-coding those names in each driver, to match what is
      done with memory, blkio, and blockstats parameters.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_SCHEDULER_CPU_SHARES)
      (VIR_DOMAIN_SCHEDULER_VCPU_PERIOD)
      (VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, VIR_DOMAIN_SCHEDULER_WEIGHT)
      (VIR_DOMAIN_SCHEDULER_CAP, VIR_DOMAIN_SCHEDULER_RESERVATION)
      (VIR_DOMAIN_SCHEDULER_LIMIT, VIR_DOMAIN_SCHEDULER_SHARES): New
      field name macros.
      * src/qemu/qemu_driver.c (qemuSetSchedulerParametersFlags)
      (qemuGetSchedulerParametersFlags): Use new defines.
      * src/test/test_driver.c (testDomainGetSchedulerParamsFlags)
      (testDomainSetSchedulerParamsFlags): Likewise.
      * src/xen/xen_hypervisor.c (xenHypervisorGetSchedulerParameters)
      (xenHypervisorSetSchedulerParameters): Likewise.
      * src/xen/xend_internal.c (xenDaemonGetSchedulerParameters)
      (xenDaemonSetSchedulerParameters): Likewise.
      * src/lxc/lxc_driver.c (lxcSetSchedulerParametersFlags)
      (lxcGetSchedulerParametersFlags): Likewise.
      * src/esx/esx_driver.c (esxDomainGetSchedulerParametersFlags)
      (esxDomainSetSchedulerParametersFlags): Likewise.
      * src/libxl/libxl_driver.c (libxlDomainGetSchedulerParametersFlags)
      (libxlDomainSetSchedulerParametersFlags): Likewise.
      319992d4
  10. 02 11月, 2011 6 次提交
    • D
      Don't overwrite error message during VM cleanup · 9d201a5c
      Daniel P. Berrange 提交于
      If an LXC VM fails to start, quite a few cleanup paths will
      result in the original error message being overwritten. Some
      other cleanup paths also forgot to actually terminate the VM.
      
      * src/lxc/lxc_driver.c: Ensure VM is terminated on startup
        failure and preserve original error
      9d201a5c
    • 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
  11. 27 10月, 2011 3 次提交
  12. 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
  13. 20 10月, 2011 1 次提交
  14. 19 10月, 2011 1 次提交
    • D
      Add support for autodestroy of guests to the LXC and UML drivers · 02e92dc4
      Daniel P. Berrange 提交于
      We recently added support for VIR_DOMAIN_START_AUTODESTROY and
      an impl to the QEMU driver. It is very desirable to support in
      other drivers, so this adds it to LXC and UML
      
      * src/lxc/lxc_conf.h, src/lxc/lxc_driver.c,
        src/uml/uml_conf.h, src/uml/uml_driver.c: Wire up autodestroy
        functions
      02e92dc4
  15. 13 10月, 2011 1 次提交