1. 01 5月, 2011 1 次提交
  2. 30 4月, 2011 7 次提交
    • M
      nwfilter: Fix memory leak in the ebtables subdriver · 0e7c7b8b
      Matthias Bolte 提交于
      Call shutdown functions for all subcomponents in nwfilterDriverShutdown.
      
      Make sure that this shutdown functions can safely be called multiple times
      and independent from the actual subcomponents state.
      0e7c7b8b
    • M
      feecc9f3
    • M
      Fix memory leak in __virExec · 9d50b323
      Matthias Bolte 提交于
      Commit e0d014f2 made binary potentially allocated on the heap.
      It was freed in the parent in the error path, but not in the success path
      that doesn't goto the cleanup label.
      
      Found by 'make -C tests valgrind'.
      9d50b323
    • E
      hash: fix memory leak regression · 701bee01
      Eric Blake 提交于
      Commit 1671d1dc introduced a memory leak in virHashFree, and
      wholesale table corruption in virHashRemoveSet (elements not
      requested to be freed are lost).
      
      * src/util/hash.c (virHashFree): Free bucket array.
      (virHashRemoveSet): Don't lose elements.
      * tests/hashtest.c (testHashCheckForEachCount): New method.
      (testHashCheckCount): Expose the bug.
      701bee01
    • C
      docs: Document <filesystem> device · 41a7835f
      Cole Robinson 提交于
      Tried to dredge through old changelogs and commits to come up with it, so
      may not be completely accurate.
      
      v2:
      Drop ambiguous 'containers'
      Use same mail archive for all links
      41a7835f
    • E
      build: fix getcwd portability problems · e39c46a5
      Eric Blake 提交于
      * bootstrap.conf (gnulib_modules): Add getcwd-lgpl.
      * tests/commandtest.c (checkoutput): Drop unused cwd.
      * tests/commandhelper.c (main): Let getcwd malloc.
      * tests/testutils.c (virTestMain): Likewise.
      * tools/virsh.c (cmdPwd): Likewise.
      (virshCmds): Expose cmdPwd and cmdCd on mingw.
      e39c46a5
    • E
      tests: simplify common setup · 20986e58
      Eric Blake 提交于
      A few of the tests were missing basic sanity checks, while most
      of them were doing copy-and-paste initialization (in fact, some
      of them pasted the argc > 1 check more than once!).  It's much
      nicer to do things in one common place, and minimizes the size of
      the next patch that fixes getcwd usage.
      
      * tests/testutils.h (EXIT_AM_HARDFAIL): New define.
      (progname, abs_srcdir): Define for all tests.
      (VIRT_TEST_MAIN): Change callback signature.
      * tests/testutils.c (virtTestMain): Do more common init.
      * tests/commandtest.c (mymain): Simplify.
      * tests/cputest.c (mymain): Likewise.
      * tests/esxutilstest.c (mymain): Likewise.
      * tests/eventtest.c (mymain): Likewise.
      * tests/hashtest.c (mymain): Likewise.
      * tests/networkxml2xmltest.c (mymain): Likewise.
      * tests/nodedevxml2xmltest.c (myname): Likewise.
      * tests/nodeinfotest.c (mymain): Likewise.
      * tests/nwfilterxml2xmltest.c (mymain): Likewise.
      * tests/qemuargv2xmltest.c (mymain): Likewise.
      * tests/qemuhelptest.c (mymain): Likewise.
      * tests/qemuxml2argvtest.c (mymain): Likewise.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      * tests/qparamtest.c (mymain): Likewise.
      * tests/sexpr2xmltest.c (mymain): Likewise.
      * tests/sockettest.c (mymain): Likewise.
      * tests/statstest.c (mymain): Likewise.
      * tests/storagepoolxml2xmltest.c (mymain): Likewise.
      * tests/storagevolxml2xmltest.c (mymain): Likewise.
      * tests/virbuftest.c (mymain): Likewise.
      * tests/virshtest.c (mymain): Likewise.
      * tests/vmx2xmltest.c (mymain): Likewise.
      * tests/xencapstest.c (mymain): Likewise.
      * tests/xmconfigtest.c (mymain): Likewise.
      * tests/xml2sexprtest.c (mymain): Likewise.
      * tests/xml2vmxtest.c (mymain): Likewise.
      20986e58
  3. 29 4月, 2011 5 次提交
    • E
      build: avoid test warnings on mingw · 63956ca0
      Eric Blake 提交于
      * .gnulib: Update to latest, for getaddrinfo fixes.
      Reported by Matthias Bolte.
      63956ca0
    • E
      virsh: avoid compiler warning on mingw · c63ec6e3
      Eric Blake 提交于
      We don't use gnulib's sanitizations for vfprintf, but vshDebug
      was used with %zu, which means that it would fail on mingw.
      Thank goodness the compiler indirectly caught this for us :)
      
      virsh.c: In function 'vshDebug':
      virsh.c:12105:5: warning: function might be possible candidate for
      'ms_printf' format attribute [-Wmissing-format-attribute]
      
      since mingw <stdio.h> hasn't yet added gcc attributes to vfprintf.
      
      * tools/virsh.c (vshDebug): Avoid vfprintf.
      (vshPrintExtra): Use lighter-weight fputs.
      Reported by Matthias Bolte.
      c63ec6e3
    • K
      libvirt/qemu - support persistent update of disks · f37c29c8
      KAMEZAWA Hiroyuki 提交于
      Support update of disks by MODIFY_CONFIG
      
      This patch includes changes for qemu's disk to support
      virDomainUpdateDeviceFlags() with VIR_DOMAIN_DEVICE_MODIFY_CONFIG.
      
      This patch adds support for CDROM/foppy disk types.
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      
      * src/qemu/qemu_driver.c
      (qemuDomainUpdateDeviceConfig): support cdrom/floppy.
      f37c29c8
    • J
      Xen: Do not generate net ifname if domain is inactive · 578391e1
      Jim Fehlig 提交于
      V2: Use virAsprintf instead of snprintf/strdup
      
      The xend driver will generate a virDomainNetDef ifname if one is not
      specified in xend sexpr, even if domain is inactive.  The result is
      network interface XML containing 'vif-1.Y' on dev attribute of target
      element, e.g.
      
        <interface type='bridge'>
          <target dev='vif-1.0'/>
          ...
      
      This patch changes the behavior to only generate the ifname if not
      specified in xend sexpr *and* domain is not inactive (id != -1).
      578391e1
    • Y
      xen: check if device is assigned to guest before reattaching · a8891666
      Yufang Zhang 提交于
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=664059
      
      Reattaching pci device back to host without destroying guest or
      detaching device from guest would cause host to crash. This patch adds
      a check before doing device reattach. If the device is being assigned
      to guest, libvirt refuses to reattach device to host. The patch only
      works for Xen, for it just checks xenstore to get pci device
      information.
      Signed-off-by: NYufang Zhang <yuzhang@redhat.com>
      a8891666
  4. 28 4月, 2011 9 次提交
    • L
      network: fix return value of hostsFileWrite · f7bd72fa
      Laine Stump 提交于
      The lone caller to hostsFileWrite (and the callers for at least 3
      levels up the return stack) assume that the return value will be < 0
      on failure. However, hostsFileWrite returns 0 on success, and a
      positive errno on failure. This patch changes hostsFileWrite to return
      -errno on failure.
      f7bd72fa
    • E
      maint: fix comment typos · a372c405
      Eric Blake 提交于
      * src/esx/esx_driver.c: Fix spelling of 'relative'.
      * src/util/util.c: Likewise.
      a372c405
    • J
      build: Use pkg-config for libssh2 check · 3a552132
      Jiri Denemark 提交于
      Currently the build fails if /usr/local/include does not exist since
      its use is hardcoded in configure.ac
      3a552132
    • J
      build: Ignore old audit library · 14c8dc84
      Jiri Denemark 提交于
      Check for audit_encode_nv_string in libaudit so that ancient audit
      library is ignored rather than trying to compile with libaudit support
      and failing.
      14c8dc84
    • O
      util: Initialize hooks at daemon shutdown if no hooks defined · 32398e12
      Osier Yang 提交于
      We support to initialize the hooks at daemon reload if there is no
      hooks script is defined, we should also support initialize the hooks
      at daemon shutdown if no hooks is defined.
      
      To address bz: https://bugzilla.redhat.com/show_bug.cgi?id=688859
      32398e12
    • W
      fix virsh's regression · 2225a491
      Wen Congyang 提交于
      This patch does the following things:
      1. The return value of cmdSchedInfoUpdate() can be -1, 0 and 1. So the
         type of return value should be int not bool.(This function is not a
         entry of a virsh command, but the name of this function likes cmdXXX)
      
      2. The type of cmdSchedinfo()'s, cmdFreecell()'s, cmdPoolList()'s and
         cmdVolList()'s return value is bool not int, so change the type of
         variable ret_val, func_ret and functionReturn.
      
      3. Add a variable functionReturn for cmdMigrate(), cmdAttachInterface(),
         cmdDetachInterface(), cmdAttachDisk() and cmdDetachDisk() to save the
         return value.
      
      4. Change the type of variable ret in the function cmdAttachDevice(),
         cmdDetachDevice(), cmdUpdateDevice(), cmdAttachInterface(),
         cmdDetachInterface(), cmdAttachDisk() and cmdDetachDisk() to int, as
         we use it to save the return value of virXXX() and the type of virXXX()'s
         return value is int not bool.
      
      5. Do some cleanup when virBuff.error is 1.
      
      The bug 1-4 were introduced by commit b56fa5bb.
      2225a491
    • K
      libvirt/qemu - support persistent attach/detach disks · ab9102c2
      KAMEZAWA Hiroyuki 提交于
      Support changes of disks by MODIFY_CONFIG for qemu.
      
      This patch includes patches for qemu's disk to support
      virDomainAt(De)tachDeviceFlags with VIR_DOMAIN_DEVICE_MODIFY_CONFIG.
      
      Other devices can be added incrementally.
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      
      * /src/conf/domain_conf.c
      (virDomainDiskIndexByName): returns array index of disk in vmdef.
      (virDomainDiskRemoveByName): removes a disk which has the name in vmdef.
      * src/qemu/qemu_driver.c
      (qemuDomainAttachDeviceConfig): add support for Disks.
      (qemuDomainDetachDeviceConfig): add support for Disks.
      ab9102c2
    • K
      libvirt/qemu - support persistent modification of devices · da1eba6b
      KAMEZAWA Hiroyuki 提交于
      This patch adds functions for modify domain's persistent definition.
      To do error recovery in easy way, we use a copy of vmdef and update it.
      
      The whole sequence will be:
      
        make a copy of domain definition.
      
        if (flags & MODIFY_CONFIG)
            update copied domain definition
        if (flags & MODIF_LIVE)
            do hotplug.
        if (no error)
            save copied one to the file and update cached definition.
        else
            discard copied definition.
      
      This patch is mixuture of Eric Blake's work and mine.
      From: Eric Blake <eblake@redhat.com>
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      
      (virDomainObjCopyPersistentDef): make a copy of persistent vm definition
      (qemuDomainAttach/Detach/UpdateDeviceConfig) : callbacks. now empty
      (qemuDomainModifyDeviceFlags): add support for MODIFY_CONFIG and MODIFY_CURRENT
      da1eba6b
    • E
      build: fix 32-bit test failure · 8a6e30f1
      Eric Blake 提交于
      Same fix as commit 1fc288e1.
      
      * tests/hashtest.c (testHashRemoveForEach): Use correct format.
      8a6e30f1
  5. 27 4月, 2011 9 次提交
    • J
      util: Simplify hash implementation · 1671d1dc
      Jiri Denemark 提交于
      So far first entries for each hash key are stored directly in the hash
      table while other entries mapped to the same key are linked through
      pointers. As a result of that, the code is cluttered with special
      handling for the first items.
      
      This patch makes all entries (even the first ones) linked through
      pointers, which significantly simplifies the code and makes it more
      maintainable.
      1671d1dc
    • J
      tests: More unit tests for internal hash APIs · 91e12a50
      Jiri Denemark 提交于
      This adds several tests for remaining hash APIs (custom
      hasher/comparator functions are not covered yet, though).
      
      All tests pass both before and after the "Simplify hash implementation".
      91e12a50
    • O
      build: Fix problem of building Python bindings · 53cb23f4
      Osier Yang 提交于
      If one specify "--with-python=yes" but no python-devel package
      is installed, we ignore it with just a notice message, which
      doesn't give clear guide to user.
      53cb23f4
    • W
      release PCI address only when we have ensured it successfully · 968fd011
      Wen Congyang 提交于
      Steps to reproduce this bug:
      1. # cat net.xml # 00:03.0 has been used
          <interface type='network'>
            <mac address='52:54:00:04:72:f3'/>
            <source network='default'/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
          </interface>
      
      2. # virsh attach-device vm1 net.xml
         error: Failed to attach device from net.xml
         error: internal error unable to reserve PCI address 0:0:3
      
      3. # virsh attach-device vm1 net.xml
         error: Failed to attach device from net.xml
         error: internal error unable to execute QEMU command 'device_add': Device 'rtl8139' could not be initialized
      
      The reason of this bug is that: we can not reserve PCI address 0:0:3 because it has
      been used, but we release PCI address when we reserve it failed.
      968fd011
    • H
      free memory properly in cleanup patch · 3c132638
      Hu Tao 提交于
      virsh schedinfo inactive-domain will trigger the problem.
      3c132638
    • W
      free buf->content when vsnprintf() failed · 6fee3da2
      Wen Congyang 提交于
      When buf->error is 1, we do not return buf->content in the function
      virBufferContentAndReset(). So we should free buf->content when
      vsnprintf() failed.
      6fee3da2
    • M
      esx: Fix dynamic dispatch for CastFromAnyType functions · 4a9019af
      Matthias Bolte 提交于
      This was broken by the refactoring in ac1e6586. It resulted in a
      segfault for 'virsh vol-dumpxml' and related volume functions.
      
      Before the refactoring all users of the ESX_VI__TEMPLATE__DISPATCH
      macro dispatched on the item type, as the item is the input to all those
      functions.
      
      Commit ac1e6586 made the dynamically dispatched CastFromAnyType
      functions use this macro too, but this functions dispatched on the
      actual type of the AnyType object. The item is the output of the
      CastFromAnyType functions.
      
      This difference was missed in the refactoring, making CastFromAnyType
      functions dereferencing the item pointer that is NULL at the time of
      the dispatch.
      4a9019af
    • M
      Move call to virReportOOMError into virFileBuildPath · 3ba5d77f
      Matthias Bolte 提交于
      Suggested by Daniel P. Berrange
      3ba5d77f
    • E
      build: use gnulib passfd for simpler SCM_RIGHTS code · 59a5981d
      Eric Blake 提交于
      * .gnulib: Update to latest for passfd fixes.
      * bootstrap.conf (gnulib_modules): Add passfd.
      * src/util/util.c (virFileOpenAs): Simplify.
      59a5981d
  6. 26 4月, 2011 6 次提交
    • J
      qemu: Add flags checking in DomainCoreDump · 1c842378
      Jiri Denemark 提交于
      1c842378
    • M
      Make crash and live flags mutually exclusive in virDomainCoreDump · d9b46a0d
      Mark Wu 提交于
      They don't make any sense when used together.
      d9b46a0d
    • G
      Make sure DNSMASQ_STATE_DIR exists · bf5e3f65
      Guido Günther 提交于
      otherwise the directory returned by networkDnsmasqLeaseFileName will not
      be created if ipdef->nhosts == 0 in networkBuildDnsmasqArgv.
      bf5e3f65
    • M
      Fix small memory leaks in config parsing related functions · bf130d2c
      Matthias Bolte 提交于
      Found by 'make -C tests valgrind'.
      
      xen_xm.c: Dummy allocation via virDomainChrDefNew is directly
      overwritten and lost. Free 'script' in success path too.
      
      vmx.c: Free virtualDev_string in success path too.
      
      domain_conf.c: Free compression in success path too.
      bf130d2c
    • M
      Add virDomainEventRebootNew · 14a961ca
      Matthias Bolte 提交于
      This will be used in the ESX driver event handling.
      14a961ca
    • E
      build: make VIR_FREE do some type checking · 90d761ee
      Eric Blake 提交于
      We can exploit the fact that gcc warns about int-to-pointer conversion
      in ternary cond?(void*):(int) in order to prevent future mistakes of
      calling VIR_FREE on a scalar lvalue.  For example, between commits
      158ba873 and 802e2df9, we would have had this warning:
      
      cc1: warnings being treated as errors
      remote.c: In function 'remoteDispatchListNetworks':
      remote.c:3684:70: error: pointer/integer type mismatch in conditional expression
      
      There are still a number of places that malloc into a const char*;
      while it would probably be worth scrubbing them to use char*
      instead, that is a separate patch, so we have to cast away const
      in VIR_FREE for now.
      
      * src/util/memory.h (VIR_FREE): Make gcc warn about integers.
      Iteratively developed from a patch by Christophe Fergeau.
      90d761ee
  7. 25 4月, 2011 1 次提交
    • E
      threads: add one-time initialization support · 99de5990
      Eric Blake 提交于
      mingw lacks the counterpart to PTHREAD_MUTEX_INITIALIZER, so the
      best we can do is portably expose once-only runtime initialization.
      
      * src/util/threads.h (virOnceControlPtr): New opaque type.
      (virOnceFunc): New callback type.
      (virOnce): New prototype.
      * src/util/threads-pthread.h (virOnceControl): Declare.
      (VIR_ONCE_CONTROL_INITIALIZER): Define.
      * src/util/threads-win32.h (virOnceControl)
      (VIR_ONCE_CONTROL_INITIALIZER): Likewise.
      * src/util/threads-pthread.c (virOnce): Implement in pthreads.
      * src/util/threads-win32.c (virOnce): Implement in WIN32.
      * src/libvirt_private.syms: Export it.
      99de5990
  8. 24 4月, 2011 2 次提交