1. 08 12月, 2011 6 次提交
    • E
      build: fix build with older libxml2 · f59a9417
      Eric Blake 提交于
      On RHEL 5, with libxml2-2.6.26, the build failed with:
      virsh.c: In function 'vshNodeIsSuperset':
      virsh.c:11951: warning: implicit declaration of function 'xmlChildElementCount'
      
      (or if warnings aren't errors, a link failure later on).
      
      * src/util/xml.h (virXMLChildElementCount): New prototype.
      * src/util/xml.c (virXMLChildElementCount): New function.
      * src/libvirt_private.syms (xml.h): Export it.
      * tools/virsh.c (vshNodeIsSuperset): Use it.
      f59a9417
    • D
      Fix updating of haveTheBuck in RPC client to be race-free · e9708637
      Daniel P. Berrange 提交于
      When one thread passes the buck to another thread, it uses
      virCondSignal to wake up the target thread. The variable
      'haveTheBuck' is not updated in a race-free manner when
      this occurs. The current thread sets it to false, and the
      woken up thread sets it to true. There is a window where
      a 3rd thread can come in and grab the buck.
      
      Even if this didn't lead to crashes & deadlocks, this would
      still result in unfairness in the buckpassing algorithm.
      
      A better solution is to *never* set haveTheBuck to false
      when we're passing the buck. Only set it to false when there
      is no further thread waiting for the buck.
      
      * src/rpc/virnetclient.c: Only set haveTheBuck to false
        if no thread is waiting
      e9708637
    • D
      Revert fd066925 · 50a4f49c
      Daniel P. Berrange 提交于
      Commit fd066925 tried to fix
      a race condition in
      
        commit fa959500
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Fri Nov 11 15:28:41 2011 +0000
      
          Explicitly track whether the buck is held in remote client
      
      Unfortunately there is a second race condition whereby the
      event loop can trigger due to incoming data to read. Revert
      this fix, so a complete fix for the problem can be cleanly
      applied
      
      * src/rpc/virnetclient.c: Revert fd066925
      50a4f49c
    • J
      Prevent crash of libvirtd when attaching to existing qemu process · 28423019
      Jim Fehlig 提交于
      With security_driver set to "none" in /etc/libvirt/qemu.conf,
      libvirtd would crash when attempted to attach to an existing
      qemu process.  Only copy the security model if it actually exists.
      28423019
    • C
      Add documentation for <disk><source type="dir"> · 8d16201f
      Christophe Fergeau 提交于
      8d16201f
    • C
      Fix typo in virDomainResume API doc · 9fdfd8b6
      Christophe Fergeau 提交于
      It's referring to virSuspendDomain instead of
      virDomainSuspend.
      9fdfd8b6
  2. 07 12月, 2011 4 次提交
    • J
      qemu: Ignore shutdown event from destroyed domain · 97652044
      Jiri Denemark 提交于
      During virDomainDestroy, QEMU may emit SHUTDOWN event as a response to
      SIGTERM and since domain object is still locked, the event is processed
      after the domain is destroyed. We need to ignore this event in such case
      to avoid changing domain state from shutoff to shutdown.
      97652044
    • O
      npiv: Expose fabric_name outside · cc17f092
      Osier Yang 提交于
      This patch is to expose the fabric_name of fc_host class, which
      might be useful for users who wants to known which fabric the
      (v)HBA connects to.
      
      The patch also adds the missed capabilities' XML schema of scsi_host,
      (of course, with fabric_wwn added), and update the documents
      (docs/formatnode.html.in)
      cc17f092
    • D
    • D
      Improve error reporting when libvirtd is not installed · 13c881dc
      Daniel P. Berrange 提交于
      Currently if you try to connect to a local libvirtd when
      libvirtd is not in $PATH, you'll get an error
      
        error: internal error invalid use of command API
      
      This is because remoteFindDaemonPath() returns NULL, which
      causes us to pass NULL into virNetSocketConnectUNIX which
      in turn causes us to pass NULL into virCommandNewArgList.
      
      Adding missing error checks improves this to
      
        error: internal error Unable to locate libvirtd daemon in $PATH
      
      * src/remote/remote_driver.c: Report error if libvirtd
        cannot be found
      * src/rpc/virnetsocket.c: Report error if caller requested
        spawning of daemon, but provided no binary path
      13c881dc
  3. 06 12月, 2011 4 次提交
    • E
      spec: fix sanlock dependency · d336dbdb
      Eric Blake 提交于
      * libvirt.spec.in (with_sanlock): On RHEL, don't force sanlock
      on architectures where it isn't available.
      d336dbdb
    • E
      spec: add dmidecode as prereq · e7dfa468
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=754909 complains that
      because libvirt didn't require dmidecode, that the logs are noisy
      and virConnectGetSysinfo needlessly fails.  Even 'virt-what' requires
      dmidecode, so it's not that onerous of a dependency.  We may be
      able to drop this in the future when we move to parsing sysfs data,
      but for now, listing the dependency will help matters.
      
      * libvirt.spec.in (Requires): Sort Requires before BuildRequires.
      Add dmidecode.
      e7dfa468
    • E
      build: reduce warnings from older gcc · f17e0e21
      Eric Blake 提交于
      Older gcc warns (on every file!) that -Wabi and -Wdeprecated only
      make sense on C++ projects.  Newer gcc accepts these warnings for
      C, but it is not clear that they can do anything useful, so it
      is easier to just drop the warnings altogether.
      
      * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Silence
      -Wabi and -Wdeprecated on older gcc.
      Reported by Peter Krempa.
      f17e0e21
    • J
      examples: Update event tests for shutdown event · 9bfa132c
      Jiri Denemark 提交于
      9bfa132c
  4. 05 12月, 2011 6 次提交
    • D
      Fix incorrect symbols for virtime.h module breaking Mingw32 · b265beda
      Daniel P. Berrange 提交于
      The Mingw32 linker highlighted that the symbols for virtime.h
      declared in libvirt_private.syms were incorrect
      
      * src/libvirt_private.syms: Fix virtime.h symbols
      b265beda
    • J
      qemu: Rework handling of shutdown event · 38527c9a
      Jiri Denemark 提交于
      When QEMU guest finishes its shutdown sequence, qemu stops virtual CPUs
      and when started with -no-shutdown waits for us to kill it using
      SGITERM. Since QEMU is flushing its internal buffers, some time may pass
      before QEMU actually dies. We mistakenly used "paused" state (and
      events) for this which is quite confusing since users may see a domain
      going to pause while they expect it to shutdown. Since we already have
      "shutdown" state with "the domain is being shut down" semantics, we
      should use it for this state.
      
      However, the state didn't have a corresponding event so I created one
      and called its detail as VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED (guest OS
      finished its shutdown sequence) with the intent to add
      VIR_DOMAIN_EVENT_SHUTDOWN_STARTED in the future if we have a
      sufficiently capable guest agent that can notify us when guest OS starts
      to shutdown.
      38527c9a
    • G
      remote_driver: don't fail if keepalive check fails · 8fcee135
      Guido Günther 提交于
      Otherwise connections to older libvirt abort with:
      
      $ virsh -c qemu+ssh://host.example.com/system list
      error: invalid connection pointer in virDrvSupportsFeature
      error: failed to connect to the hypervisor
      
      Tested against 0.8.3 and 0.9.8-rc2.
      8fcee135
    • J
      Add support for QEMU 1.0 · dd8e8956
      Jiri Denemark 提交于
      dd8e8956
    • P
      python: Expose binding for virNodeGetMemoryStats() · 17c77955
      Peter Krempa 提交于
      This patch adds binding for virNodeGetMemoryStats method of libvirtd.
      Return value is represented as a python dictionary mapping field
      names to values.
      17c77955
    • P
      python: Expose binding for virNodeGetCPUStats() · 49556023
      Peter Krempa 提交于
      This patch adds binding for virNodeGetCPUStats method of libvirtd.
      Return value is represented as a python dictionary mapping field names
      to values.
      49556023
  5. 04 12月, 2011 4 次提交
    • E
      maint: fix improper use of 'an' · 3a9ce767
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=648855 mentioned a
      misuse of 'an' where 'a' is proper; that has since been fixed,
      but a search found other problems (some were a spelling error for
      'and', while most were fixed by 'a').
      
      * daemon/stream.c: Fix grammar.
      * src/conf/domain_conf.c: Likewise.
      * src/conf/domain_event.c: Likewise.
      * src/esx/esx_driver.c: Likewise.
      * src/esx/esx_vi.c: Likewise.
      * src/rpc/virnetclient.c: Likewise.
      * src/rpc/virnetserverprogram.c: Likewise.
      * src/storage/storage_backend_fs.c: Likewise.
      * src/util/conf.c: Likewise.
      * src/util/dnsmasq.c: Likewise.
      * src/util/iptables.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * src/xen/xs_internal.c: Likewise.
      * tools/virsh.c: Likewise.
      3a9ce767
    • E
      build: require more tools from maintainers · 2b094d56
      Eric Blake 提交于
      We want our tarballs to be complete - this means that any
      generated file that gets shipped as part of the tarball so that
      ordinary users don't have to rebuild it must be something
      that the maintainer can generate.  There have been various
      reports of random build failures when using libvirt.git
      instead of a tarball, and often it is due to missing a
      maintainer-specific tool to produce one of these generated
      files.  This patch raises the bar for what you must have
      installed to build libvirt.git, but does not impact what
      you can get away with for building tarballs.
      
      Note: It still remains possible to do a successful 'make dist'
      without these tools, when starting from a release tarball.
      
      * bootstrap.conf (buildreq): Add tools that maintainers need for a
      successful 'make dist' from a fresh git checkout.
      2b094d56
    • E
      command: handle empty buffer argument correctly · 2b045d39
      Eric Blake 提交于
      virBufferContentAndReset (intentionally) returns NULL for a buffer
      with no content, but it is feasible to invoke a command with an
      explicit empty string.
      
      * src/util/command.c (virCommandAddEnvBuffer): Reject empty string.
      (virCommandAddArgBuffer): Allow explicit empty argument.
      * tests/commandtest.c (test9): Test it.
      * tests/commanddata/test9.log: Adjust.
      2b045d39
    • E
      build: fix build on Cygwin · c74a2a03
      Eric Blake 提交于
      The RPC fixups needed on Linux are also needed on cygwin, and
      worked without further tweaking to the list of fixups.  Also,
      unlike BSD, Cygwin exports 'struct ifreq', but unlike Linux,
      Cygwin lacks the ioctls that we were using 'struct ifreq' to
      access.  This patch allows compilation under cygwin.
      
      * src/rpc/genprotocol.pl: Also perform fixups on cygwin.
      * src/util/virnetdev.c (HAVE_STRUCT_IFREQ): Also require AF_PACKET
      definition.
      * src/util/virnetdevbridge.c (virNetDevSetupControlFull): Only
      compile if SIOCBRADDBR works.
      c74a2a03
  6. 03 12月, 2011 2 次提交
    • E
      build: fix build at -O2 on rawhide · 75da3200
      Eric Blake 提交于
      I had previously tested commit 059d746d with -O intentionally omitted
      from my CFLAGS; but that means that I missed out on this warning
      from gcc 4.6.2 when optimizations are enabled:
      
      util/buf.c: In function 'virBufferGetIndent':
      util/buf.c:86:1: error: function might be candidate for attribute 'pure' [-Werror=suggest-attribute=pure]
      
      While it is probably a good idea to add the attributes and silence
      this warning, it's also invasive; 'make -k' found more than 75 such
      complaints.  And it doesn't help that gcc 4.6.2 is still buggy
      (coreutils reported a case where gcc 4.6.2 incorrectly suggested
      marking a function pure that incremented a global variable; fixed
      in gcc 4.7).  So the best fix for now is to disable the warning.
      
      It also doesn't help that I stumbled across another problem - gcc
      documents that -Wsuggest-attribute=pure only warns if you use -O,
      or if you use -fipa-pure-const.  But in practice, when I omitted -O
      but added -fipa-pure-const, the warnings are fickle - I got warnings
      for simple compilation that disappeared when I also added -fPIC.
      And the way libtool compiles things is with -fPIC first, then without
      -fPIC but with errors sent to /dev/null - which meant that without
      disabling -Wsuggest-attribute=pure, I got a compile error with no
      message.  :(  See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10197
      
      * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Silence
      -Wsuggest-attribute warnings for now.
      75da3200
    • S
      apparmor: allow tunnelled migrations. · 4cfdbfc4
      Serge Hallyn 提交于
      The pathname for the pipe for tunnelled migration is unresolvable.  The
      libvirt apparmor driver therefore refuses access, causing migration to
      fail.  If we can't resolve the path, the worst that can happen is that
      we should have given permission to the file but didn't.  Otherwise
      (especially since this is a /proc/$$/fd/N file) the file is already open
      and libvirt won't be refused access by apparmor anyway.
      
      Also adjust virt-aa-helper to allow access to the
      *.tunnelmigrate.dest.name files.
      
      For more information, see https://launchpad.net/bugs/869553.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      4cfdbfc4
  7. 02 12月, 2011 9 次提交
    • P
      client: Check if other thread claims it has the buck before claiming it. · fd066925
      Peter Krempa 提交于
      Originaly, the code checked if another client is the queue and infered
      ownership of the buck from that. Commit fa959500
      added a separate variable to track the buck. That caused, that a new
      call might enter claiming it has the buck, while another thread was
      signalled to take the buck. This ends in two threads claiming they hold
      the buck and entering poll(). This happens due to a race on waking up
      threads on the client lock mutex.
      
      This caused multi-threaded clients to hang, most prominently visible and
      reproducible on python based clients, like virt-manager.
      
      This patch causes threads, that have been signalled to take the buck to
      re-check if buck is held by another thread.
      fd066925
    • S
      Update of filters to handle multiple IP addresses · 8c309caf
      Stefan Berger 提交于
      With fragments borrowed from David Steven's previous submission and some
      further modifications:
      
      A set of modifications to filters to handle multiple IP addresses
      (and MAC addresses) per interface.
      
      Also:
      - enable DHCP traffic from VM to any DHCP server
      - will require an update to a libvirt-tck data file
      Signed-off-by: NDavid L Stevens <dlstevens@us.ibm.com>
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      8c309caf
    • E
      virsh: translate net-info help · 77e62f13
      Eric Blake 提交于
      Reported by kato.tomoyuki@jp.fujitsu.com at
      https://bugzilla.redhat.com/show_bug.cgi?id=749564
      
      * tools/virsh.c (info_network_info): Mark string for translation.
      77e62f13
    • E
      maint: typo fixes · a6997934
      Eric Blake 提交于
      Many of these were mentioned by Yuri Chornoivan in:
      https://bugzilla.redhat.com/show_bug.cgi?id=669506
      
      * src/esx/esx_vi.c (esxVI_WaitForTaskCompletion): Fix spelling.
      * src/conf/netdev_vport_profile_conf.c
      (virNetDevVPortProfileParse): Likewise.
      * src/xen/xend_internal.c (xenDaemonDomainSetVcpusFlags):
      Likewise.
      * src/xen/xm_internal.c (xenXMDomainSetVcpusFlags): Likewise.
      * src/esx/esx_util.c (esxUtil_ResolveHostname): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemBuild): Likewise.
      * daemon/libvirtd.conf: Likewise.
      * src/util/logging.c (virLogMessage): Likewise.
      * src/uml/uml_conf.c (umlBuildCommandLineNet): Likewise.
      * src/vmx/vmx.c (virVMXFormatEthernet): Likewise.
      a6997934
    • E
      build: update to latest gnulib · 059d746d
      Eric Blake 提交于
      * .gnulib: Update to latest, for improved 'make syntax-check' and
      compiler warnings.
      * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS):
      Re-silence -Wformat-nonliteral.
      * cfg.mk (_test_script_regex): Recognize our test scripts.
      * gnulib/local/lib/*.diff: Drop, now that gnulib has this.
      * tests/virsh-optparse: Fix use of compare.
      * tests/virsh-schedinfo: Likewise.
      059d746d
    • E
      build: properly skip tests · da8061ee
      Eric Blake 提交于
      I got this failure on FreeBSD:
      
      shunloadtest.c: In function 'main':
      shunloadtest.c:150: error: 'EXIT_AM_SKIP' undeclared (first use in this function)
      
      but inspection showed several other problems, all fixed here.
      
      * tests/domainsnapshotxml2xmltest.c [!WITH_QEMU]: Ensure
      EXIT_AM_SKIP is defined.
      * tests/esxutilstest.c [!WITH_ESX]: Likewise.
      * tests/openvzutilstest.c [!WITH_OPENVZ]: Likewise.
      * tests/qemuargv2xmltest.c [!WITH_QEMU]: Likewise.
      * tests/qemuhelptest.c [!WITH_QEMU]: Likewise.
      * tests/qemuxml2argvtest.c [!WITH_QEMU]: Likewise.
      * tests/qemuxml2xmltest.c [!WITH_QEMU]: Likewise.
      * tests/qemuxmlnstest.c [!WITH_QEMU]: Likewise.
      * tests/shunloadtest.c [!linux]: Likewise.
      * tests/vmx2xmltest.c [!WITH_VMX]: Likewise.
      * tests/xml2vmxtest.c [!WITH_VMX]: Likewise.
      da8061ee
    • D
      Avoid crash in shunloadtest · 24d97928
      Daniel P. Berrange 提交于
      For unknown reasons, the shunloadtest will crash on Fedora 16
      inside dlopen()
      
       (gdb) bt
       #0  0x00000000000050e6 in ?? ()
       #1  0x00007ff61a77b9d5 in floor () from /lib64/libm.so.6
       #2  0x00007ff61e522963 in _dl_relocate_object () from /lib64/ld-linux-x86-64.so.2
       #3  0x00007ff61e5297e6 in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
       #4  0x00007ff61e525006 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
       #5  0x00007ff61e52917a in _dl_open () from /lib64/ld-linux-x86-64.so.2
       #6  0x00007ff61e0f6f26 in dlopen_doit () from /lib64/libdl.so.2
       #7  0x00007ff61e525006 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
       #8  0x00007ff61e0f752f in _dlerror_run () from /lib64/libdl.so.2
       #9  0x00007ff61e0f6fc1 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2
       #10 0x0000000000400a15 in main (argc=<optimized out>, argv=<optimized out>) at shunloadtest.c:105
      
      Changing from RTLD_NOW to RTLD_LAZY avoids this problem,
      but quite possibly does not fix the root cause.
      
      * shunloadtest.c: s/NOW/LAZY/
      24d97928
    • D
      Fix build for platforms lacking struct ifreq · 949e1091
      Daniel P. Berrange 提交于
      This ought to fix the build if you have net/if.h but do
      not have struct ifreq
      
      * configure.ac: Check for struct ifreq in net/if.h
      * src/util/virnetdev.c: Conditionalize to avoid use of
        struct ifreq if it does not exist
      949e1091
    • E
      build: fix 'make dist' without dtrace · 55d76a72
      Eric Blake 提交于
      probes.h can only be generated on Linux, and then only with dtrace
      installed.  If it is part of the tarball, then either 'make dist'
      will fail if you don't have that setup, or we would have to start
      keeping probes.h in libvirt.git.  Since we only need it to be
      generated when dtrace is in use, it's better to avoid shipping
      it in the first place, and avoid tracking it in git.
      
      Meanwhile, there is a build dependency - since the RPC code is
      generated, it can be built early; but when dtrace is enabled, we
      must ensure probes.h is built even earlier.  Commit 1afcfbdd tried
      to fix this, but did so in a way that added probes.h into the
      tarball, and broke VPATH as well.  Commit ecbca767 fixed VPATH,
      but didn't fix the more fundamental problem.  This patch solves
      the issue by adding a dependency instead.
      
      Tested with 'make dist' in a clean VPATH builds, for both
      './configure --without-dtrace' and './configure --with-dtrace';
      all configurations were able to correctly build a tarball, and
      the dtrace configuration no longer sticks probes.h in the tarball.
      
      * src/Makefile.am (REMOTE_DRIVER_GENERATED): Don't ship probes.h;
      rather, make it a dependency.
      55d76a72
  8. 01 12月, 2011 5 次提交
    • L
      Fix a logic error for setting block I/O · ac6b368d
      Lei Li 提交于
      Fix a logic error, the initial value of ret = -1, if just set --config,
      it will goto endjob directly without doing its really job here.
      Signed-off-by: NLei Li <lilei@linux.vnet.ibm.com>
      ac6b368d
    • D
      Don't use undocumented __isleap macro · b0ed1227
      Daniel P. Berrange 提交于
      The glibc time.h header has an undocumented __isleap macro
      that we are using. Since it is undocumented & does not appear
      on any other OS, stop using it and just define the macro in
      libvirt code instead.
      
      * src/util/virtime.c: Remove __isleap usage
      b0ed1227
    • M
      virsh: Allow other escape characters for console · 7a796485
      Michal Privoznik 提交于
      Currently virsh supports only ^] as escape character for console.
      However, some users might want to use something else. This patch
      creates such ability by specifying '-e' switch on virsh command
      line.
      7a796485
    • P
      bridge_driver: Don't define network if XML contains more IPv4 adreses. · 0763a26d
      Peter Krempa 提交于
      Only one IPv4 DHCP definition is supported. Originally the code checked
      for a multiple definition and returned an error, but the new domain
      definition was already added to networks. This patch moves the check
      before the newly defined network is added to active networks.
      
       *src/network/bridge_driver.c: networkDefine(): - move multiple IPv4
                                                        addresses check before
                                                        definition is used.
      0763a26d
    • E
      spec: mark directories in /var/run as ghosts · 764574f7
      Eric Blake 提交于
      We have several directories that are created on the fly, and which
      only contain state relevant to a running libvirtd process (all
      located in /var/run).  Since the directories are created as needed,
      and make no sense without a running libvirtd, we want them deleted
      if libvirt is uninstalled.  And in F15 and newer, /var/run is on
      tmpfs (forcing us to recreate on the fly); which means that someone
      trying to verify a complete rpm will fail if the directory does not
      currently exist because libvirtd has not been started since boot.
      The solution, then, is to mark the directories as %ghost, so that
      rpm knows that we own them and will clean it up if libvirt is
      uninstalled, but will no longer create the directory for us at
      install, nor complain at verify time if the directory does not exist.
      
      See https://bugzilla.redhat.com/show_bug.cgi?id=656611.
      
      * libvirt.spec.in (%files): Add %ghost to temporary directories
      that we don't install, but want cleaned up on libvirt removal.
      764574f7