1. 19 3月, 2011 5 次提交
    • L
      network driver: log error and abort network startup when radvd isn't found · b538cdd5
      Laine Stump 提交于
      This is detailed in:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=688957
      
      Since radvd is executed by daemonizing it, the attempt to exec the
      radvd binary doesn't happen until after libvirtd has already received
      an exit code from the intermediate forked process, so no error is
      detected or logged by __virExec().
      
      We can't require radvd as a prerequisite for the libvirt package (many
      installations don't use IPv6, so they don't need it), so instead we
      add in a check to verify there is an executable radvd binary prior to
      trying to exec it.
      b538cdd5
    • J
      openvz: fix a simple bug in openvzListDefinedDomains() · 9db5679b
      Jean-Baptiste Rouault 提交于
      This patch adds missing curly brackets to an if
      statement in openvzListDefinedDomains()
      9db5679b
    • E
      build: translate changes in previous patch · 0d9e81f3
      Eric Blake 提交于
      * po/POTFILES.in: Add src/util/hash.c for 'make syntax-check'.
      0d9e81f3
    • D
      Fix delayed event delivery when SASL is active · 635523f7
      Daniel P. Berrange 提交于
      When SASL is active, it was possible that we read and decoded
      more data off the wire than we initially wanted. The loop
      processing this data terminated after only one message to
      avoid delaying the calling thread, but this could delay
      event delivery. As long as there is decoded SASL data in
      memory, we must process it, before returning to the poll()
      event loop.
      
      This is a counterpart to the same kind of issue solved in
      
        commit 68d2c348
      
      in a different area of the code
      
      * src/remote/remote_driver.c: Process all pending SASL data
      635523f7
    • D
      Ensure binary is resolved wrt $PATH in virExec · e0d014f2
      Daniel P. Berrange 提交于
      virExec would only resolved the binary to $PATH if no env
      variables were being set. Since there is no execvep() API
      in POSIX, we use virFindFileInPath to manually resolve
      the binary and then use execv() instead of execvp().
      e0d014f2
  2. 18 3月, 2011 14 次提交
    • J
      Add libxenlight driver · 2b84e445
      Jim Fehlig 提交于
      Add a new xen driver based on libxenlight [1], which is the primary
      toolstack starting with Xen 4.1.0.  The driver is stateful and runs
      privileged only.
      
      Like the existing xen-unified driver, the libxenlight driver is
      accessed with xen:// URI.  Driver selection is based on the status
      of xend.  If xend is running, the libxenlight driver will not load
      and xen:// connections are handled by xen-unified.  If xend is not
      running *and* the libxenlight driver is available, xen://
      connections are deferred to the libxenlight driver.
      
      V6:
       - Address several code style issues noted by Daniel Veillard
       - Make drive work with xen:/// URI
       - Hold domain object reference while domain is injected in
         libvirt event loop.  Race found and fixed by Markus Groß.
      
      V5:
       - Ensure events are unregistered when domain private data
         is destroyed.  Discovered and fixed by Markus Groß.
      
      V4:
       - Handle restart of libvirtd, reconnecting to previously
         started domains
       - Rebased to current master
       - Tested against Xen 4.1 RC7-pre (c/s 22961:c5d121fd35c0)
      
      V3:
        - Reserve vnc port within driver when autoport=yes
      
      V2:
        - Update to Xen 4.1 RC6-pre (c/s 22940:5a4710640f81)
        - Rebased to current master
        - Plug memory leaks found by Stefano Stabellini and valgrind
        - Handle SHUTDOWN_crash domain death event
      
      [1] http://lists.xensource.com/archives/html/xen-devel/2009-11/msg00436.html
      2b84e445
    • J
      util: Forbid calling hash APIs from iterator callback · fba550f6
      Jiri Denemark 提交于
      Calling most hash APIs is not safe from inside of an iterator callback.
      Exceptions are APIs that do not modify the hash table and removing
      current hash entry from virHashFroEach callback.
      
      This patch make all APIs which are not safe fail instead of just relying
      on the callback being nice not calling any unsafe APIs.
      fba550f6
    • J
      qemu: Fix copy&paste error messages in text monitor · c3ad755f
      Jiri Denemark 提交于
      c3ad755f
    • W
      do not unref obj in qemuDomainObjExitMonitor* · d5df67be
      Wen Congyang 提交于
      Steps to reproduce this bug:
      # cat test.sh
        #! /bin/bash -x
        virsh start domain
        sleep 5
        virsh qemu-monitor-command domain 'cpu_set 2 online' --hmp
      # while true; do ./test.sh ; done
      
      Then libvirtd will crash.
      
      The reason is that:
      we add a reference of obj when we open the monitor. We will reduce this
      reference when we free the monitor.
      
      If the reference of monitor is 0, we will free monitor automatically and
      the reference of obj is reduced.
      
      But in the function qemuDomainObjExitMonitorWithDriver(), we reduce this
      reference again when the reference of monitor is 0.
      
      It will cause the obj be freed in the function qemuDomainObjEndJob().
      
      Then we start the domain again, and libvirtd will crash in the function
      virDomainObjListSearchName(), because we pass a null pointer(obj->def->name)
      to strcmp().
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      d5df67be
    • W
      qemu: check driver name while attaching disk · e2aec53b
      Wen Congyang 提交于
      This bug was reported by Shi Jin(jinzishuai@gmail.com):
      =============
      # virsh attach-disk RHEL6RC /var/lib/libvirt/images/test3.img vdb \
              --driver file --subdriver qcow2
      Disk attached successfully
      
      # virsh save RHEL6RC /var/lib/libvirt/images/memory.save
      Domain RHEL6RC saved to /var/lib/libvirt/images/memory.save
      
      # virsh restore /var/lib/libvirt/images/memory.save
      error: Failed to restore domain from /var/lib/libvirt/images/memory.save
      error: internal error unsupported driver name 'file'
             for disk '/var/lib/libvirt/images/test3.img'
      =============
      
      We check the driver name when we start or restore VM, but we do
      not check it while attaching a disk. This adds the same check on disk
      driverName used in qemuBuildCommandLine to qemudDomainAttachDevice.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      e2aec53b
    • D
      Improve logging documentation including the debug buffer · 08ddbe61
      Daniel Veillard 提交于
      * docs/logging.html.in: document the fact that starting from
        0.9.0 the server logs goes to libvirtd.log instead of syslog
        by default, describe the debug buffer, restructure the page
        and add a couple more examples
      08ddbe61
    • D
      Avoid taking lock in libvirt debug dump · 10598dd5
      Daniel Veillard 提交于
      As pointed out, locking the buffer from the signal handler
      cannot been guaranteed to be safe, so to avoid any hazard
      we prefer the trade off of dumping logs possibly messed up
      by concurrent logging activity rather than risk a daemon
      crash.
      
      * src/util/logging.c: change virLogEmergencyDumpAll() to not
        take any lock on the log buffer but reset buffer content variables
        to an empty set before starting the actual dump.
      10598dd5
    • W
      unlock the monitor when unwatching the monitor · 9741f346
      Wen Congyang 提交于
      Steps to reproduce this bug:
      # virsh qemu-monitor-command domain 'cpu_set 2 online' --hmp
      The domain has 2 cpus, and we try to set the third cpu online.
      The qemu crashes, and this command will hang.
      
      The reason is that the refs is not 1 when we unwatch the monitor.
      We lock the monitor, but we do not unlock it. So virCondWait()
      will be blocked.
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      9741f346
    • H
      Add vim configuration that makes vim auto-indent code · 838f6696
      Hu Tao 提交于
      838f6696
    • H
      Make virDomainObjParseNode() static · d6917156
      Hu Tao 提交于
      Make virDomainObjParseNode() static since it is called only
      in one file.
      d6917156
    • N
      virsh: fix memtune's help message for swap_hard_limit · 78ba748e
      Nikunj A. Dadhania 提交于
      * Correct the documentation for cgroup: the swap_hard_limit indicates
        mem+swap_hard_limit.
      * Change cgroup private apis to: virCgroupGet/SetMemSwapHardLimit
      Signed-off-by: NNikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
      78ba748e
    • A
      Add PCI sysfs reset access · 2090b0f5
      Alex Williamson 提交于
      I'm proposing we make use of $PCIDIR/reset in qemu-kvm to reset
      devices on VM reset.  We need to add it to libvirt's list of
      files that get ownership for device assignment.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      2090b0f5
    • J
      Support Xen sysctl v8, domctl v7 · b24b442b
      Jim Fehlig 提交于
      xen-unstable c/s 21118:28e5409e3fb3 bumped sysctl version to 8.
      xen-unstable c/s 21212:de94884a669c introduced CPU pools feature,
      adding another member to xen_domctl_getdomaininfo struct.  Add a
      corresponding domctl v7 struct in xen hypervisor sub-driver and
      detect sysctl v8 during initialization.
      b24b442b
    • M
      remote: Add missing virCondDestroy calls · 55fb3866
      Matthias Bolte 提交于
      The virCond of the remote_thread_call struct was leaked in some
      places. This results in leaking the underlying mutex. Which in turn
      leaks a handle on Windows.
      
      Reported by Aliaksandr Chabatar and Ihar Smertsin.
      55fb3866
  3. 17 3月, 2011 2 次提交
    • E
      build: improve rpm generation for distro backports · 80e6200f
      Eric Blake 提交于
      When building for an older distro, it's convenient to just
      tell rpmbuild to define dist (for example, to .el6_0), rather
      than also remembering to define rhel to 6.
      
      * libvirt.spec.in: Guess %{rhel} based on %{dist}.
      Based on an idea by Jiri Denemark.
      80e6200f
    • L
      macvtap: log an error if on failure to connect to netlink socket · 12775d94
      Laine Stump 提交于
      A bug in libnl (see https://bugzilla.redhat.com/show_bug.cgi?id=677724
      and https://bugzilla.redhat.com/show_bug.cgi?id=677725) makes it very
      easy to create a failure to connect to the netlink socket when trying
      to open a macvtap network device ("type='direct'" in domain interface
      XML). When that error occurred (during a call to libnl's nl_connect()
      from libvirt's nlComm(), there was no log message, leading virsh (for
      example) to report "unknown error".
      
      There were two other cases in nlComm where an error in a libnl
      function might return with failure but no error reported. In all three
      cases, this patch logs a message which will hopefully be more useful.
      
      Note that more detailed information about the failure might be
      available from libnl's nl_geterror() function, but it calls
      strerror(), which is not threadsafe, so we can't use it.
      12775d94
  4. 16 3月, 2011 4 次提交
    • O
      storage: Fix a problem which will cause libvirtd crashed · 98a4e5a3
      Osier Yang 提交于
      If pool xml has no definition for "port", then "Segmentation fault"
      happens when jumping to "cleanup:" to do "VIR_FREE(port)", as "port"
      was not initialized in this situation.
      
      * src/conf/storage_conf.c
      98a4e5a3
    • E
      qemu: support migration to fd · 100bba06
      Eric Blake 提交于
      * src/qemu/qemu_monitor.h (qemuMonitorMigrateToFd): New
      prototype.
      * src/qemu/qemu_monitor.c (qemuMonitorMigrateToFd): New function.
      100bba06
    • E
      qemu: improve efficiency of dd during snapshots · 8e42c50b
      Eric Blake 提交于
      POSIX states about dd:
      
      If the bs=expr operand is specified and no conversions other than
      sync, noerror, or notrunc are requested, the data returned from each
      input block shall be written as a separate output block; if the read
      returns less than a full block and the sync conversion is not
      specified, the resulting output block shall be the same size as the
      input block. If the bs=expr operand is not specified, or a conversion
      other than sync, noerror, or notrunc is requested, the input shall be
      processed and collected into full-sized output blocks until the end of
      the input is reached.
      
      Since we aren't using conv=sync, there is no zero-padding, but our
      use of bs= means that a short read results in a short write.  If
      instead we use ibs= and obs=, then short reads are collected and dd
      only has to do a single write, which can make dd more efficient.
      
      * src/qemu/qemu_monitor.c (qemuMonitorMigrateToFile):
      Avoid 'dd bs=', since it can cause short writes.
      8e42c50b
    • E
      virsh: allow empty string arguments · 6eaa4ee4
      Eric Blake 提交于
      "virsh connect ''" should try to connect to the default connection,
      but the previous patch made it issue a warning about an invalid URI.
      
      * tools/virsh.c (VSH_OFLAG_EMPTY_OK): New option flag.
      (vshCommandOptString): Per the declaration, value is required to
      be non-NULL.  Honor new flag.
      (opts_connect): Allow empty string connection.
      6eaa4ee4
  5. 15 3月, 2011 15 次提交
    • W
      ce81bc5c
    • D
      Change message for VIR_FROM_RPC error domain · a9c32b5d
      Daniel P. Berrange 提交于
      The VIR_FROM_RPC error domain is used generically for any RPC
      problem, not simply XML-RPC problems.
      
      * src/util/virterror.c: s/XML-RPC/RPC/
      a9c32b5d
    • D
      Add compat function for geteuid() · bd82db40
      Daniel P. Berrange 提交于
      * configure.ac: Check for geteuid()
      * src/util/util.h: Compat for geteuid()
      bd82db40
    • D
      Fix misc bugs in virCommandPtr · 2a2a00eb
      Daniel P. Berrange 提交于
      The virCommandNewArgs() method would free the virCommandPtr
      if it failed to add the args. This meant errors reported in
      virCommandAddArgSet() were lost. Simply removing the check
      for errors from the constructor means they can be reported
      correctly later
      
      The virCommandAddEnvPassCommon() method failed to check for
      errors before reallocating the cmd->env array, causing a
      potential SEGV if cmd was NULL
      
      The virCommandAddArgSet() method needs to validate that at
      least 1 element in 'val's parameter is non-NULL, otherwise
      code like
      
          cmd = virCommandNew(binary)
          virCommandAddAtg(cmd, "foo")
      
      Would end up trying todo  execve("foo"), if binary was
      NULL.
      2a2a00eb
    • D
      Add virSetBlocking() to allow O_NONBLOCK to be toggle on or off · 2737b6c2
      Daniel P. Berrange 提交于
      The virSetNonBlock() API only allows enabling non-blocking
      operations. It doesn't allow turning blocking back on. Add
      a new API to allow arbitrary toggling.
      
      * src/libvirt_private.syms, src/util/util.h
        src/util/util.c: Add virSetBlocking
      2737b6c2
    • E
      qemu: use more appropriate error · 30a50fc3
      Eric Blake 提交于
      Fixes bug in commit acacced8
      
      * src/qemu/qemu_command.c (qemuBuildCommandLine):
      s/INVALID_ARG/CONFIG_UNSUPPORTED/.
      Reported by Daniel P. Berrange.
      30a50fc3
    • J
      fc4c8199
    • T
      libvirt: fix a simple bug in virDomainSetMemoryFlags() · e5d46c08
      Taku Izumi 提交于
      This patch fix a simple bug in virDomainSetMemoryFlags function.
      The patch sent before lacks the consideration of the case
      where the driver doesn't support virDomainSetMemoryFlags API.
      Signed-off-by: NTaku Izumi <izumi.taku@jp.fujitsu.com>
      e5d46c08
    • D
      Make LXC container startup/shutdown/I/O more robust · 4e3117ae
      Daniel P. Berrange 提交于
      The current LXC I/O controller looks for HUP to detect
      when a guest has quit. This isn't reliable as during
      initial bootup it is possible that 'init' will close
      the console and let mingetty re-open it. The shutdown
      of containers was also flakey because it only killed
      the libvirt I/O controller and expected container
      processes to gracefully follow.
      
      Change the I/O controller such that when it see HUP
      or an I/O error, it uses kill($PID, 0) to see if the
      process has really quit.
      
      Change the container shutdown sequence to use the
      virCgroupKillPainfully function to ensure every
      really goes away
      
      This change makes the use of the 'cpu', 'devices'
      and 'memory' cgroups controllers compulsory with
      LXC
      
      * docs/drvlxc.html.in: Document that certain cgroups
        controllers are now mandatory
      * src/lxc/lxc_controller.c: Check if PID is still
        alive before quitting on I/O error/HUP
      * src/lxc/lxc_driver.c: Use virCgroupKillPainfully
      4e3117ae
    • D
      Allow to dynamically set the size of the debug buffer · b16f47ab
      Daniel Veillard 提交于
      This is the part allowing to dynamically resize the debug log
      buffer from it's default 64kB size. The buffer is now dynamically
      allocated.
      It adds a new API virLogSetBufferSize() which resizes the buffer
      If passed a zero size, the buffer is deallocated and we do the small
      optimization of not formatting messages which are not output anymore.
      On the daemon side, it just adds a new option log_buffer_size to
      libvirtd.conf and call virLogSetBufferSize() if needed
      * src/util/logging.h src/util/logging.c src/libvirt_private.syms:
        make buffer dynamic and add virLogSetBufferSize() internal API
      * daemon/libvirtd.conf: document the new log_buffer_size option
      * daemon/libvirtd.c: read and use the new log_buffer_size option
      b16f47ab
    • E
      qemu: consolidate duplicated monitor migration code · 1c5dc4c6
      Eric Blake 提交于
      * src/qemu/qemu_monitor_text.h (qemuMonitorTextMigrate): Declare
      in place of individual monitor commands.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONMigrate): Likewise.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextMigrateToHost)
      (qemuMonitorTextMigrateToCommand, qemuMonitorTextMigrateToFile)
      (qemuMonitorTextMigrateToUnix): Delete.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONMigrateToHost)
      (qemuMonitorJSONMigrateToCommand, qemuMonitorJSONMigrateToFile)
      (qemuMonitorJSONMigrateToUnix): Delete.
      * src/qemu/qemu_monitor.c (qemuMonitorMigrateToHost)
      (qemuMonitorMigrateToCommand, qemuMonitorMigrateToFile)
      (qemuMonitorMigrateToUnix): Consolidate shared code.
      1c5dc4c6
    • E
      qemu: use lighter-weight fd:n on incoming tunneled migration · c7af07ac
      Eric Blake 提交于
      Outgoing migration still uses a Unix socket and or exec netcat until
      the next patch.
      
      * src/qemu/qemu_migration.c (qemuMigrationPrepareTunnel):
      Replace Unix socket with simpler pipe.
      Suggested by Paolo Bonzini.
      c7af07ac
    • E
      maint: make spacing in .sh files easier · e004a8d9
      Eric Blake 提交于
      Commit 7f193757 renamed libvirt-guests.init from .in to .sh, which
      made it slip past sc_TAB_in_indentation.  I nearly reintroduced a
      tab, so I'm pushing this to prevent that from happening.
      
      * cfg.mk (sc_TAB_in_indentation): Update rule to include .sh files.
      * .dir-locals.el: List spacing preference for .sh files.
      e004a8d9
    • O
      qemu: Check the unsigned integer overflow · acacced8
      Osier Yang 提交于
      As perhaps other hypervisor drivers use different capacity units,
      do the checking in qemu driver instead of in conf/domain_conf.c.
      acacced8
    • M
      Fix performance problem of virStorageVolCreateXMLFrom() · 9bfde346
      Minoru Usui 提交于
      This patch changes zerobuf variable from array to VIR_ALLOC_N().
      Signed-off-by: NMinoru Usui <usui@mxm.nes.nec.co.jp>
      9bfde346