1. 10 11月, 2011 3 次提交
    • 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
    • E
      build: fix mingw build of gnulib openpty · 85cf8d38
      Eric Blake 提交于
      Commit f7bd00c1 pulled in a gnulib module that fails to compile
      on mingw.  Work around it while waiting for an upstream gnulib fix.
      
      * gnulib/local/lib/pty.in.h (openpty): Provide forward
      declarations of opaque structs not present on mingw.
      * gnulib/local/lib/openpty.c (openpty): Provide stub for mingw.
      85cf8d38
    • E
      build: allow for local gnulib diffs · 676fdf8c
      Eric Blake 提交于
      Commit f7bd00c1 pulled in a gnulib module that fails to compile
      on mingw.  While it would be nice to pull in a newer version of
      .gnulib that fixes this, it is difficult to backport any .gnulib
      update to older releases.  So, it makes sense to take advantage
      of gnulib-tool's ability to support local diffs, where we can
      apply specific diffs in our use of gnulib without waiting for
      upstream gnulib to pick up those changes, as well as avoiding
      a wholesale .gnulib update.  The existence of local diffs will
      also make it easier to backport fixes against a tarball (as long
      as a tarball and libvirt.git share the same .gnulib commit, then
      the tarball can be patched by applying the same local diffs as
      a post-release libvirt.git commit, without having to rerun an
      entire gnulib-tool bootstrap).
      
      This patch introduces the framework for supporting local diffs,
      without actually introducing any.
      
      * bootstrap.conf (local_gl_dir): New variable.
      * autogen.sh (bootstrap_hash): Hash any local diffs, to force a
      re-bootstrap if just diffs change.
      * cfg.mk (_update_required): Likewise.
      676fdf8c
  2. 09 11月, 2011 4 次提交
  3. 08 11月, 2011 2 次提交
    • D
      Release of libvirt-0.9.7 · ab4823a0
      Daniel Veillard 提交于
      * confiure.ac docs/news.html.in libvirt.spec.in: update for release
      * po/*.po*: update localizations and rebuilt
      ab4823a0
    • E
      build: fix build on platforms without ptsname_r · f7bd00c1
      Eric Blake 提交于
      MacOS lacks ptsname_r, and gnulib doesn't (yet) provide it.
      But we can avoid it altogether, by using gnulib openpty()
      instead.  Note that we do _not_ want the pt_chown module;
      gnulib uses it only to implement a replacement openpty() if
      the system lacks both openpty() and granpt(), but all
      systems that we currently port to either have at least one of
      openpty() and/or grantpt(), or lack ptys altogether.  That is,
      we aren't porting to any system that requires us to deal with
      the hassle of installing a setuid pt_chown helper just to use
      gnulib's ability to provide openpty() on obscure platforms.
      
      * .gnulib: Update to latest, for openpty fixes
      * bootstrap.conf (gnulib_modules): Add openpty, ttyname_r.
      (gnulib_tool_option_extras): Exclude pt_chown module.
      * src/util/util.c (virFileOpenTty): Rewrite in terms of openpty
      and ttyname_r.
      * src/util/util.h (virFileOpenTtyAt): Delete dead prototype.
      f7bd00c1
  4. 07 11月, 2011 2 次提交
    • D
      Add missing defaultConsoleTargetType callback for AppArmour · 07bf96ee
      Daniel P. Berrange 提交于
      Every instance of virCapsPtr must have the defaultConsoleTargetType
      field set.
      
      * src/security/virt-aa-helper.c: Add defaultConsoleTargetType to
        virCapsPtr
      07bf96ee
    • D
      Fix sending/receiving of FDs when stream returns EAGAIN · b2c62316
      Daniel P. Berrange 提交于
      The code calling sendfd/recvfd was mistakenly assuming those
      calls would never block. They can in fact return EAGAIN and
      this is causing us to drop the client connection when blocking
      ocurrs while sending/receiving FDs.
      
      Fixing this is a little hairy on the incoming side, since at
      the point where we see the EAGAIN, we already thought we had
      finished receiving all data for the packet. So we play a little
      trick to reset bufferOffset again and go back into polling for
      more data.
      
      * src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Update
        virNetSocketSendFD/RecvFD to return 0 on EAGAIN, or 1
        on success
      * src/rpc/virnetclient.c: Move decoding of header & fds
        out of virNetClientCallDispatch and into virNetClientIOHandleInput.
        Handling blocking when sending/receiving FDs
      * src/rpc/virnetmessage.h: Add a 'donefds' field to track
        how many FDs we've sent / received
      * src/rpc/virnetserverclient.c: Handling blocking when
        sending/receiving FDs
      b2c62316
  5. 05 11月, 2011 3 次提交
    • E
      build: silence compiler warning on BSD · 4d970fd2
      Eric Blake 提交于
      Building on 64-bit FreeBSD 8.2 complained about a cast between
      a pointer and a smaller integer.  Going through an intermediate
      cast shuts up the compiler.
      
      * src/util/threads-pthread.c (virThreadSelfID): Silence a warning.
      4d970fd2
    • E
      build: fix linking on BSD · 9d86cbcf
      Eric Blake 提交于
      While building on FreeBSD (and after fixing a ptsname_r link error),
      I got this failure:
      
      ./.libs/libvirt_util.a(libvirt_util_la-threads.o)(.text+0x240): In function `virThreadCreate':
      util/threads-pthread.c:185: undefined reference to `pthread_create'
      
      It turns out that gnulib used only pthread_join for LIB_PTHREAD,
      but on FreeBSD, libc provides that (as a stub function); whereas
      the more complex pthread_create really does require -pthread,
      which gnulib tracked under [LT]LIBMULTITHREAD.
      
      * configure.ac (LIBS): Check LIBMULTITHREAD alongside LIB_PTHREAD.
      * src/Makefile.am (THREAD_LIBS): New variable.
      (libvirt_util_la_LIBADD, libvirt_lxc_LDADD): Use it.
      9d86cbcf
    • L
      remote: fix mingw32 build · 53c91e99
      Laine Stump 提交于
      tty is initialized, and later set in code that is compiled for all
      platforms, but is only used in a section that's inside #ifndef WIN32.
      53c91e99
  6. 04 11月, 2011 5 次提交
    • 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
    • D
      Fix naming of constant for disk event · 26ff8996
      Daniel P. Berrange 提交于
      All constants related to events should have a prefix of
      VIR_DOMAIN_EVENT_
      
      * include/libvirt/libvirt.h.in, src/qemu/qemu_domain.c:
        Rename VIR_DOMAIN_DISK_CHANGE_MISSING_ON_START to
        VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START
      26ff8996
    • J
      conf: Don't free uninitialized pointer · 15fd90b6
      Jiri Denemark 提交于
      This causes libvirtd to crash when both <boot dev='...'/> and <boot
      order='...'/> are used in one domain XML. Introduced by
      5fa3d775
      15fd90b6
    • E
      build: fix deep VPATH builds · 5d4b0c4c
      Eric Blake 提交于
      I ran into the following build failure:
      $ mkdir -p build1 build2/a/very/deep/hierarcy
      $ cd build2/a/very/deep/hierarcy
      $ ../../../../../configure && make
      $ cd ../../../../build1
      $ ../configure && make
      ...
      ../../src/remote/remote_protocol.c:7:55: fatal error: ../../../../../src/remote/remote_protocol.h: No such file or directory
      
      Turns out that we were sometimes generating the remote_protocol.c
      file with information from the VPATH build, which is bad, since
      any file shipped in the tarball should be idempotent no matter how
      deep the VPATH build tree that created it.
      
      * src/rpc/genprotocol.pl: Don't embed VPATH into generated file.
      5d4b0c4c
    • P
      doc: Add <deviceboot> capability. · 2d9931d2
      Philipp Hahn 提交于
      Allow /capabilities/guest/features/deviceboot.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      2d9931d2
  7. 03 11月, 2011 17 次提交
    • 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
      Default console target type with no <target> element · 876c8b3b
      Daniel P. Berrange 提交于
      When no <target> element was set at all, the default console
      target type was not being honoured
      
      * src/conf/domain_conf.c: Set default target type for consoles
        with no <target>
      876c8b3b
    • 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
      Fix crash formatting virtio console · 5990d921
      Daniel P. Berrange 提交于
      qemuBuildVirtioSerialPortDevStr was mistakenly accessing the
      target.name field in the virDomainChrDef object for chardevs
      belonging to a console. Those chardevs only have port set,
      and if there's > 1 console, the > 1port number results in
      trying to access a target.name with address 0x1
      
      * src/qemu/qemu_command.c: Fix target.name handling and
        make code more robust wrt error reporting
      
      * src/qemu/qemu_command.c: Conditionally access target.name
      5990d921
    • 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
    • D
      Remove translations in socket test case · b0a510ad
      Daniel P. Berrange 提交于
      The test case errors should not be translated since they're only
      targetted at developers, not users.
      
      * tests/virnetsockettest.c: Remove error reporting with translations
      b0a510ad
    • G
      virnetsockettest: Use a temporary directory in /tmp · 745c3e79
      Guido Günther 提交于
      to avoid exceeding UNIX_PATH_MAX
      745c3e79
    • G
    • E
      xen: allow getting < max typed parameters · fbae3d6f
      Eric Blake 提交于
      Allow the user to call with nparams too small, per API documentation.
      
      * src/xen/xen_hypervisor.c (xenHypervisorGetSchedulerParameters):
      Allow fewer than max.
      * src/xen/xend_internal.c (xenDaemonGetSchedulerParameters):
      Likewise.
      fbae3d6f
    • E
      test: drop redundant check · 6d897fc6
      Eric Blake 提交于
      libvirt.c guarantees that nparams is non-zero for scheduler parameters.
      
      * src/test/test_driver.c (testDomainGetSchedulerParamsFlags): Drop
      redundant check.  Avoid strcpy.
      6d897fc6
    • 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
      libxl: allow getting < max typed parameters · 13679547
      Eric Blake 提交于
      Allow the user to call with nparams too small, per API documentation.
      
      * src/libxl/libxl_driver.c
      (libxlDomainGetSchedulerParametersFlags): Allow fewer than max.
      13679547
    • E
      esx: allow getting < max typed parameters · 6b98a4b2
      Eric Blake 提交于
      Allow the user to call with nparams too small, per API documentation.
      
      * src/esx/esx_driver.c (esxDomainGetMemoryParameters): Drop
      redundant check.
      (esxDomainGetSchedulerParametersFlags): Allow fewer than max.
      6b98a4b2
    • 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
  8. 02 11月, 2011 4 次提交
    • D
      Fix off-by-one printing month in logging code · 26b74307
      Daniel P. Berrange 提交于
      The field 'mon' in 'struct tm' gives months 0-11, where as
      humans tend to expect months 1-12. Thus the month number
      needing adjusting by 1
      
      * src/util/logging.c: Use human friendly month number
      26b74307
    • D
      Add missing param initialization in qemuDomainBlockStatsFlags · f4786c18
      Daniel P. Berrange 提交于
      * src/qemu/qemu_driver.c: Fix use of uninitialized 'params'
      f4786c18
    • W
      fix crash when starting network · 7ab1c25c
      Wen Congyang 提交于
      commit 27908453 introduces a regression, and it will
      cause libvirt crashed when starting network.
      
      The reason is that tapfd may be NULL, but we dereference
      it without checking whether it is NULL.
      7ab1c25c
    • E
      qemu: allow getting < max typed parameters · 97656536
      Eric Blake 提交于
      Since all virTypedParameter APIs allow us to return the number
      of slots we actually populated, we should allow the user to
      call with nparams too small (without overrunning their array)
      or too large (ignoring the tail of the array that we can't fill),
      rather than requiring that they get things exactly right.
      
      Making this change will make it easier for a future patch to
      introduce VIR_TYPED_PARAM_STRING, with filtering in libvirt.c
      rather than in every single driver, since users already have
      to be prepared for *nparams to be smaller on exit than on entry.
      
      * src/qemu/qemu_driver.c (qemuDomainGetBlkioParameters)
      (qemuDomainGetMemoryParameters): Allow variable nparams on entry.
      (qemuGetSchedulerParametersFlags): Drop redundant check.
      (qemudDomainBlockStats, qemudDomainBlockStatsFlags): Rename...
      (qemuDomainBlockStats, qemuDomainBlockStatsFlags): ...to this.
      Don't return unavailable stats.
      97656536