1. 12 11月, 2011 7 次提交
    • E
      API: remote support for VIR_TYPED_PARAM_STRING · 40624d32
      Eric Blake 提交于
      Send and receive string typed parameters across RPC.  This also
      completes the back-compat mentioned in the previous patch - the
      only time we have an older client talking to a newer server is
      if RPC is in use, so filtering out strings during RPC prevents
      returning an unknown type to the older client.
      
      * src/remote/remote_protocol.x (remote_typed_param_value): Add
      another union value.
      * daemon/remote.c (remoteDeserializeTypedParameters): Handle
      strings on rpc.
      (remoteSerializeTypedParameters): Likewise; plus filter out
      strings when replying to older clients.  Adjust callers.
      * src/remote/remote_driver.c (remoteFreeTypedParameters)
      (remoteSerializeTypedParameters)
      (remoteDeserializeTypedParameters): Handle strings on rpc.
      * src/rpc/gendispatch.pl: Properly clean up typed arrays.
      * src/remote_protocol-structs: Update.
      Based on an initial patch by Hu Tao, with feedback from
      Daniel P. Berrange.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      40624d32
    • E
      API: add VIR_TYPED_PARAM_STRING · a218c81d
      Eric Blake 提交于
      This allows strings to be transported between client and server
      in the context of name-type-value virTypedParameter functions.
      For compatibility,
      
          o new clients will not send strings to old servers, based on
            a feature check
          o new servers will not send strings to old clients without the
            flag VIR_TYPED_PARAM_STRING_OKAY; this will be enforced at
            the RPC layer in the next patch, so that drivers need not
            worry about it in general.  The one exception is that
            virDomainGetSchedulerParameters lacks a flags argument, so
            it must not return a string; drivers that forward that
            function on to virDomainGetSchedulerParametersFlags will
            have to pay attention to the flag.
          o the flag VIR_TYPED_PARAM_STRING_OKAY is set automatically,
            based on a feature check (so far, no driver implements it),
            so clients do not have to worry about it
      
      Future patches can then enable the feature on a per-driver basis.
      
      This patch also ensures that drivers can blindly strdup() field
      names (previously, a malicious client could stuff 80 non-NUL bytes
      into field and cause a read overrun).
      
      * src/libvirt_internal.h (VIR_DRV_FEATURE_TYPED_PARAM_STRING): New
      driver feature.
      * src/libvirt.c (virTypedParameterValidateSet)
      (virTypedParameterSanitizeGet): New helper functions.
      (virDomainSetMemoryParameters, virDomainSetBlkioParameters)
      (virDomainSetSchedulerParameters)
      (virDomainSetSchedulerParametersFlags)
      (virDomainGetMemoryParameters, virDomainGetBlkioParameters)
      (virDomainGetSchedulerParameters)
      (virDomainGetSchedulerParametersFlags, virDomainBlockStatsFlags):
      Use them.
      * src/util/util.h (virTypedParameterArrayClear): New helper
      function.
      * src/util/util.c (virTypedParameterArrayClear): Implement it.
      * src/libvirt_private.syms (util.h): Export it.
      Based on an initial patch by Hu Tao, with feedback from
      Daniel P. Berrange.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a218c81d
    • E
      util: fix compile error on debian · 329b2b28
      Eli Qiao 提交于
      Add virnetdev.h,virnetdevbridge.h,virnetdevtap.h to private symbols,
      since debian linker no longer allows transitive link resolution
      Signed-off-by: NEli Qiao <taget@linux.vnet.ibm.com>
      329b2b28
    • E
      qemu: fix domjobabort regression · 61f2b6ba
      Eric Blake 提交于
      This reverts commit ef1065cf; see also this bug report:
      https://bugzilla.redhat.com/show_bug.cgi?id=751900
      
      In qemu 0.15.1 and earlier, during migration to file, the
      qemu_savevm_state_begin and qemu_savevm_state_iterate methods
      will both process as much migration data as possible until either
      
        1. The file descriptor returns EAGAIN
        2. The bandwidth rate limit is reached
      
      If we set the rate limit to ULONG_MAX, test 2 never becomes true. We're
      passing a plain file descriptor to QEMU and POSIX does not support EAGAIN on
      regular files / block devices, so test 1 never becomes true either.
      
      In the 'virsh save --bypass-cache' case, we pass a pipe instead of a
      regular fd, but using a pipe adds I/O overhead, so always passing a
      pipe just so qemu can see EAGAIN doesn't seem nice.
      
      The ultimate fix needs to come from qemu - background migration must
      respect asynchronous abort requests, or else periodically return
      control to the main handling loop without an EAGAIN and without
      waiting to hit an insanely large amount of data.  But until a
      version of qemu is fixed to support "unlimited" data rates while
      still allowing cancellation, the best we can do is avoid the
      automatic use of unlimited rates from within libvirt (users can
      still explicitly change the migration rates, if they are aware that
      they are giving up the ability to cancel a job).
      
      Reverting the lone use of QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX is
      the simplest patch; this slows migration back down to a default
      32M/sec cap, but also ensures that the main qemu processing loop
      will still be responsive to cancellation requests.  Hopefully
      upstream qemu will provide us a means of safely using unlimited
      speed, including a runtime probe of that capability.
      
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Revert attempt
      to use unlimited migration bandwidth when migrating to file.
      Signed-off-by: NDaniel Veillard <veillard@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      61f2b6ba
    • H
      fix two bugs in bridge_driver.c · d3da21d6
      Hu Tao 提交于
      steps to reproduce:
      
      1. having a network xml file(named default.xml) like this one:
      
      <network>
        <name>default</name>
        <uuid>c5322c4c-81d0-4985-a363-ad6389780d89</uuid>
        <bridge name="virbr0" />
        <forward/>
        <ip address="192.168.122.1" netmask="255.255.255.0">
          <dhcp>
            <range start="192.168.122.2" end="192.168.122.254" />
          </dhcp>
        </ip>
      </network>
      
      in /etc/libvirt/qemu/networks/, and mark it as autostart:
      
      $ ls -l /etc/libvirt/qemu/networks/autostart
      total 0
      lrwxrwxrwx 1 root root 14 Oct 12 14:02 default.xml -> ../default.xml
      
      2. start libvirtd and the device virbr0 is not automatically up.
      
      The reason is that the function virNetDevExists is now returns 1 if
      the device exists, comparing to the former one returns 0 if the device
      exists. But with only this fix will cause a segmentation fault(the same
      steps as above)  that is fixed by the second chunk of code.
      d3da21d6
    • 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
    • E
      xenapi: remove unused variable · 787b0a22
      Eric Blake 提交于
        CC     libvirt_driver_xenapi_la-xenapi_driver.lo
      xenapi/xenapi_driver.c: In function 'xenapiDomainGetVcpus':
      xenapi/xenapi_driver.c:1209:21: error: variable 'cpus' set but not used [-Werror=unused-but-set-variable]
      
      * src/xenapi/xenapi_driver.c (xenapiDomainGetVcpus): Silence
      compiler warning.
      787b0a22
  2. 11 11月, 2011 3 次提交
  3. 10 11月, 2011 16 次提交
    • D
      Disable numactl on ARM architectures too · a132fb09
      Daniel P. Berrange 提交于
      * libvirt.spec.in: Disable numactl on ARM
      a132fb09
    • D
      Add libvirt confdir to files section in mingw32 spec · 091fa6a8
      Daniel P. Berrange 提交于
      * mingw32-libvirt.spec.in: Ensure we own the confdir
      091fa6a8
    • E
      nwfilter: simplify execution of ebiptables scripts · 3b7122c0
      Eric Blake 提交于
      It's not worth even worrying about a temporary file, unless we
      ever expect the script to exceed maximum command-line argument
      length limits.
      
      * src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesExecCLI):
      Run the commands as an argument to /bin/sh, rather than worrying
      about a temporary file.
      (ebiptablesWriteToTempFile): Delete unused function.
      3b7122c0
    • E
      nwfilter: avoid failure with noexec /tmp · bd6083c9
      Eric Blake 提交于
      If /tmp is mounted with the noexec flag (common on security-conscious
      systems), then nwfilter will fail to initialize, because we cannot
      run any temporary script via virRun("/tmp/script"); but we _can_
      use "/bin/sh /tmp/script".  For that matter, using /tmp risks collisions
      with other unrelated programs; we already have /var/run/libvirt as a
      dedicated temporary directory for use by libvirt.
      
      * src/nwfilter/nwfilter_ebiptables_driver.c
      (ebiptablesWriteToTempFile): Use internal directory, not /tmp;
      drop attempts to make script executable; and detect close error.
      (ebiptablesExecCLI): Switch to virCommand, and invoke the shell to
      read the script, rather than requiring an executable script.
      bd6083c9
    • 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
      Santize naming of socket address APIs · 4c544e6c
      Daniel P. Berrange 提交于
      The socket address APIs in src/util/network.h either take the
      form  virSocketAddrXXX, virSocketXXX or virSocketXXXAddr.
      
      Sanitize this so everything is virSocketAddrXXXX, and ensure
      that the virSocketAddr parameter is always the first one.
      
      * src/util/network.c, src/util/network.h: Santize socket
        address API naming
      * src/conf/domain_conf.c, src/conf/network_conf.c,
        src/conf/nwfilter_conf.c, src/network/bridge_driver.c,
        src/nwfilter/nwfilter_ebiptables_driver.c,
        src/nwfilter/nwfilter_learnipaddr.c,
        src/qemu/qemu_command.c, src/rpc/virnetsocket.c,
        src/util/dnsmasq.c, src/util/iptables.c,
        src/util/virnetdev.c, src/vbox/vbox_tmpl.c: Update for
        API renaming
      4c544e6c
    • 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
      Remove usage of brctl command line tool · c1df2c14
      Daniel P. Berrange 提交于
      Convert the virNetDevBridgeSetSTP and virNetDevBridgeSetSTPDelay
      to use ioctls instead of spawning brctl.
      
      Implement the virNetDevBridgeGetSTP and virNetDevBridgeGetSTPDelay
      methods which were declared in the header but never existed
      
      * src/util/bridge.c: Convert to use bridge ioctls instead of brctl
      c1df2c14
    • D
      Add an API for retrieving the MAC address of an interface · ccc24347
      Daniel P. Berrange 提交于
      * src/util/bridge.c, src/util/bridge.h: Add virNetDevGetMAC
      ccc24347
    • D
      Expose MTU management APIs · dfb454ce
      Daniel P. Berrange 提交于
      The MTU management APIs are useful to other code inside libvirt,
      so should be exposed as non-static APIs.
      
      * src/util/bridge.c, src/util/bridge.h: Expose virNetDevSetMTU,
        virNetDevSetMTUFromDevice & virNetDevGetMTU
      dfb454ce
    • D
      Turn two int parameters into bools in bridge APIs · d8a62d95
      Daniel P. Berrange 提交于
      * src/util/bridge.c, src/util/bridge.h: s/int/bool/ in
        virNetDevSetOnline and virNetDevBridgeSetSTP
      d8a62d95
    • 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
    • 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
  4. 09 11月, 2011 4 次提交
  5. 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
  6. 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
  7. 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
  8. 04 11月, 2011 3 次提交
    • 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