1. 06 12月, 2013 6 次提交
  2. 05 12月, 2013 12 次提交
    • M
      virThreadPoolFree: Set n(Prio)Workers after the pool is locked · e925aad3
      Michal Privoznik 提交于
      In 78839da0 I am trying to join the worker threads. However, I can't
      sipmly reuse pool->nWorkers (same applies for pool->nPrioWorkers),
      because of the following flow that is currently implemented:
      
      1) the main thread executing virThreadPoolFree sets pool->quit = true,
      wakes up all the workers and wait on pool->quit_cond.
      
      2) A worker is woken up and see quit request. It immediately jumps of
      the while() loop and decrements pool->nWorkers (or pool->nPrioWorkers in
      case of priority worker). The last thread signalizes pool->quit_cond.
      
      3) Main thread is woken up, with both pool->nWorkers and
      pool->nPrioWorkers being zero.
      
      So there's a need to copy the original value of worker thread counts
      into local variables. However, these need to set *after* the check for
      pool being NULL (dereferencing a NULL is no no). And for safety they can
      be set right after the pool is locked.
      Reported-by: NJohn Ferlan <jferlan@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e925aad3
    • P
      qemu: Fix indentation in qemuTranslateDiskSourcePool · 90f9ccb4
      Peter Krempa 提交于
      Commit e1a4d08b was pushed with bad
      indentation the iSCSI pool translation code.
      90f9ccb4
    • P
      domainsnapshotxml2xmltest: Add test case for empty driver element · 2cb2abc0
      Peter Krempa 提交于
      Commit 5a66c667 fixed a NULL dereference
      if the disk driver element was empty. Add a test for this case.
      2cb2abc0
    • P
      domainsnapshotxml2xmltest: Add existing files as new tests · a686115c
      Peter Krempa 提交于
      There were plenty snapshot XMLs in the tests/domainsnapshotxml2xmlin
      directory that actually weren't used in XML testing. The upgraded
      domainsnapshotxml2xml test now allows us to use them.
      a686115c
    • P
      domainsnapshotxml2xml: Move files with conflicting names · 630adbe0
      Peter Krempa 提交于
      The new tests that will be added later would collide with files of
      existing tests. Move and rename those files.
      630adbe0
    • P
      domainsnapshotxml2xmltest: Allow for better testing of snapshots · 11daad9a
      Peter Krempa 提交于
      Until now the test was only testing redefinition of snapshot XMLs stored
      in tests/domainsnapshotxml2xmlout. This patch adds new infrastructure to
      allow testing of files that may differ and will allow to utilize files
      in tests/domainsnapshotxml2xmlin as new tests too.
      11daad9a
    • P
      domainsnapshotxml2xmltest: Clean up labels and use bool instead of int · af75de30
      Peter Krempa 提交于
      The 'internal' variable holds only two states; convert it to a boolean
      and the 'fail' label should be called 'cleanup'. This patch also fixes a
      minor memory leak of driver capabilities in case the XML config object
      can't be allocated.
      af75de30
    • A
      configure: Resolve compile issue in configure.ac · 62774afb
      Adam Walters 提交于
      This patch resolves a compile issue caused by the
      removal of examples/domsuspend code in commit
      5eb4b042. This issue
      is only seen in a fresh checkout, but causes the build
      and configure to fail.
      62774afb
    • W
      qemuAgentDispose: Reset lastError · 36ae35f0
      Wangyufei (James) 提交于
      When an error occurred in qemuAgentIO, it will be saved in mon->lastError,
      but it will not be freed at the end.  Present since commit c160ce33;
      and compare to commit 9cc8a5af fixing the same problem in qemu_monitor.c.
      
      ==22219== 54 bytes in 1 blocks are definitely lost in loss record 982 of 1,379
      ==22219==    at 0x4C26B9B: malloc (vg_replace_malloc.c:263)
      ==22219==    by 0x8520521: strdup (in /lib64/libc-2.11.3.so)
      ==22219==    by 0x52E99CB: virStrdup (virstring.c:554)
      ==22219==    by 0x52B44C4: virCopyError (virerror.c:195)
      ==22219==    by 0x52B5123: virCopyLastError (virerror.c:312)
      ==22219==    by 0x10905877: qemuAgentIO (qemu_agent.c:660)
      ==22219==    by 0x52B6122: virEventPollDispatchHandles (vireventpoll.c:501)
      ==22219==    by 0x52B7AEA: virEventPollRunOnce (vireventpoll.c:647)
      ==22219==    by 0x52B5C1B: virEventRunDefaultImpl (virevent.c:274)
      ==22219==    by 0x54181FD: virNetServerRun (virnetserver.c:1112)
      ==22219==    by 0x11EF4D: main (libvirtd.c:1513)
      Signed-off-by: NZhou Yimin <zhouyimin@huawei.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      36ae35f0
    • N
      Fix memory leak in qemuBuildDriveStr() · f386d323
      Nehal J Wani 提交于
      This patch fixes memory leaks reported by valgrind on running
      qemuxml2argvtest; introduced in commit 0df53f04.
      
      Most of them are of the form:
      
      ==24777== 15 bytes in 1 blocks are definitely lost in loss record 39 of 129
      ==24777==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
      ==24777==    by 0x341F485E21: strdup (strdup.c:42)
      ==24777==    by 0x4CADE5F: virStrdup (virstring.c:554)
      ==24777==    by 0x4362B6: qemuBuildDriveStr (qemu_command.c:3848)
      ==24777==    by 0x43EF73: qemuBuildCommandLine (qemu_command.c:8500)
      ==24777==    by 0x426670: testCompareXMLToArgvHelper (qemuxml2argvtest.c:350)
      ==24777==    by 0x427C01: virtTestRun (testutils.c:138)
      ==24777==    by 0x41DDB5: mymain (qemuxml2argvtest.c:658)
      ==24777==    by 0x4282A2: virtTestMain (testutils.c:593)
      ==24777==    by 0x341F421A04: (below main) (libc-start.c:225)
      ==24777==
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f386d323
    • P
      maint: Kill usage of atoi() · df36af58
      Peter Krempa 提交于
      Kill the use of atoi() and introduce syntax check to forbid it and it's
      friends (atol, atoll, atof, atoq).
      
      Also fix a typo in variable name holding the cylinders count of a disk
      pool (apparently unused).
      
      examples/domsuspend/suspend.c will need a larger scale refactor as the
      whole example file is broken thus it will be exempted from the syntax
      check for now.
      df36af58
    • P
      examples: Remove broken bad example · 5eb4b042
      Peter Krempa 提交于
      The domsuspend example code is a really old and bad exmample of (how not
      to use) the libvirt API. Remove it as it's apparent that nobody tried to
      use it. It was broken and nobody complained.
      5eb4b042
  3. 04 12月, 2013 9 次提交
    • D
      Don't overwrite errors from virConfReadFile · d75d8b46
      Daniel P. Berrange 提交于
      The SELinux security driver would overwrite errors from the
      virConfReadFile function.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d75d8b46
    • M
      virThreadPoolFree: Join worker threads · 78839da0
      Michal Privoznik 提交于
      Even though currently we are freeing the pool of worker threads at the
      daemon very end, nothing holds us back in joining the worker threads.
      Moreover, we avoid leaks like this:
      
      ==26697== 1,680 bytes in 5 blocks are possibly lost in loss record 913 of 942
      ==26697==    at 0x4C2BDE4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==26697==    by 0x4011131: allocate_dtv (in /lib64/ld-2.16.so)
      ==26697==    by 0x401176D: _dl_allocate_tls (in /lib64/ld-2.16.so)
      ==26697==    by 0x8499602: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.16.so)
      ==26697==    by 0x52F53E9: virThreadCreate (virthreadpthread.c:188)
      ==26697==    by 0x52F5D4F: virThreadPoolNew (virthreadpool.c:221)
      ==26697==    by 0x53F30DB: virNetServerNew (virnetserver.c:377)
      ==26697==    by 0x11C6ED: main (libvirtd.c:1366)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      78839da0
    • S
      qemu: fix live pinning to memory node on NUMA system · 81fae6b9
      Shivaprasad G Bhat 提交于
      Ever since the subcpusets(vcpu,emulator) were introduced, the parent
      cpuset cannot be modified to remove the nodes that are in use by the
      subcpusets.
      The fix is to break the memory node modification into three steps:
       1. assign new nodes into the parent,
       2. change the nodes in the child nodes,
       3. remove the old nodes on the parent node.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1009880Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      81fae6b9
    • J
      storage_driver: Resolve Coverity CHECKED_RETURN warning · 37a02bab
      John Ferlan 提交于
      The storageRegister() didn't check the return from the
      virRegisterStorageDriver() like other callers did, so Coverity
      flagged it.  Just check the return and handle.
      37a02bab
    • J
      bridge_driver: Resolve Coverity CHECKED_RETURN warning · b17168cb
      John Ferlan 提交于
      The networkRegister() didn't check the return status of the
      virRegisterNetworkDriver() call like other callers, so just
      check and handle here as well.
      b17168cb
    • J
      950a493b
    • J
      virnetserverclient: Remove Coverity DEADCODE warning · 643b5f84
      John Ferlan 提交于
      The x509dname is only set inside a WITH_GNUTLS conditional, so
      when used/check later on for NULL, Coverity detects this is not
      possible.  Added WITH_GNUTLS around uses to remove message
      643b5f84
    • J
      nwfilter: Remove Coverity DEADCODE warning · 5a298ec0
      John Ferlan 提交于
      The nwfilterStateInitialize() would only assign sysbus inside
      a WITH_DBUS conditional, thus leaving a subsequent check for sysbus
      and nwfilterDriverInstallDBusMatches() as a no-op
      
      Rather than try to add WITH_DBUS conditions which ended up conflicting
      with the usage of HAVE_FIREWALLD conditionals, just remove the WITH_DBUS
      since virdbus.c has entry points for with and without conditions.
      5a298ec0
    • M
      src: Align make output · 2e1ced57
      Michal Privoznik 提交于
      The make inserts six spaces instead of four:
      
        GEN      access/viraccessapichecklxc.h
        GEN    hyperv/hyperv_wmi.generated.h
        GEN      access/viraccessapichecklxc.c
        GEN    hyperv/hyperv_wmi.generated.c
        GEN    hyperv/hyperv_wmi_classes.generated.typedef
        GEN    hyperv/hyperv_wmi_classes.generated.h
        GEN    hyperv/hyperv_wmi_classes.generated.c
        GEN      libvirt_access_qemu.xml
        GEN      libvirt_access.syms
        GEN      libvirt_access_lxc.xml
        GEN      libvirt_access_qemu.syms
        GEN      libvirt_access_lxc.syms
        GEN      libvirt_qemu.def
        GEN    esx/esx_vi_types.generated.typedef
        GEN    esx/esx_vi_types.generated.typeenum
        GEN    esx/esx_vi_types.generated.typetostring
        GEN    esx/esx_vi_types.generated.typefromstring
        GEN    esx/esx_vi_types.generated.h
        GEN    esx/esx_vi_types.generated.c
        GEN    esx/esx_vi_methods.generated.h
        GEN    esx/esx_vi_methods.generated.c
        GEN    esx/esx_vi_methods.generated.macro
        GEN    esx/esx_vi.generated.h
        GEN    esx/esx_vi.generated.c
        GEN      libvirt_lxc.def
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2e1ced57
  4. 03 12月, 2013 13 次提交
    • L
      qemu: report error on attempt to live change virtio-net queues · 5e12641e
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1029732
      
      The BZ asked for the capability to change the number of queues used by
      a virtio-net device while the device is in use. Because the number of
      queues can only be set at the time the device is created, that isn't
      possible. However, libvirt also shouldn't be silently reporting
      success when someone tries to change the number of queues. So this
      patch flags that as an error (just as attempts to change any of the
      other virtio-specific parameters already do).
      5e12641e
    • M
      daemon: Run virStateCleanup conditionally · a602e90b
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1033061
      
      Currently, initialization of drivers is done in a separate thread. This
      is done for several reasons: a driver that is initialized may require
      running event loop, it may take ages to initialize driver (e.g. due to
      autostarting domains). While the thread is spawn and run, the main()
      continues its execution. However, if something goes bad, or the event
      loop is just exited (e.g. due to a --timeout or SIGINT) we try to
      cleanup all the drivers. So we have two threads running Initialize() and
      Cleanup() concurrently. This may result in accessing stale pointers -
      e.g. netcf driver will free() itself in stateCleanup callback, while the
      init thread may come, open a dummy connection in order to autostart some
      domains and voilà: do_open() iterates over interface drivers and
      accesses stale netcf driver.
      
      The fix consists in not running stateCleanup if the init thread is still
      running.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      a602e90b
    • L
      tests: add forgotten boot-strict test files · 9f6f2fa4
      Laine Stump 提交于
      These *should* have been pushed in commit
      96fddee3.
      9f6f2fa4
    • L
      qemu: add "-boot strict" to commandline whenever possible · 96fddee3
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=888635
      
      (which was already closed as CANTFIX because the qemu "-boot strict"
      commandline option wasn't available at the time).
      
      Problem: you couldn't have a domain that used PXE to boot, but also
      had an un-bootable disk device *even if that disk wasn't listed in the
      boot order*, because if PXE timed out (e.g. due to the bridge
      forwarding delay), the BIOS would move on to the next target, which
      would be the unbootable disk device (again - even though it wasn't
      given a boot order), and get stuck at a "BOOT DISK FAILURE, PRESS ANY
      KEY" message until a user intervened.
      
      The solution available since sometime around QEMU 1.5, is to add
      "-boot strict=on" to *every* qemu command. When this is done, if any
      devices have a boot order specified, then QEMU will *only* attempt to
      boot from those devices that have an explicit boot order, ignoring the
      rest.
      96fddee3
    • L
      qemu: default to vfio for nodedev-detach · 47b9aae0
      Laine Stump 提交于
      This patch resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1035188
      
      Commit f094aaac changed the PCI device assignment in qemu domains
      to default to using VFIO rather than legacy KVM device assignment
      (when VFIO is available). It didn't change which driver was used by
      default for virNodeDeviceDetachFlags(), though, so that API (and the
      virsh nodedev-detach command) was still binding to the pci-stub
      driver, used by legacy KVM assignment, by default.
      
      This patch publicizes (only within the qemu module, though, so no
      additions to the symbol exports are needed) the functions that check
      for presence of KVM and VFIO device assignment, then uses those
      functions to decide what to do when no driver is specified for
      virNodeDeviceDetachFlags(); if the vfio driver is loaded, the device
      will be bound to vfio-pci, or if legacy KVM assignment is supported on
      this system, the device will be bound to pci-stub; if neither method
      is available, the detach will fail.
      47b9aae0
    • P
      qemu: snapshots: Declare supported and unsupported snapshot configs · 26fb96d8
      Peter Krempa 提交于
      Currently the snapshot code did not check if it actually supports
      snapshots on various disk backends for domains. To avoid future problems
      add checkers that whitelist the supported configurations.
      26fb96d8
    • P
      qemu: Clear old translated pool source · bdeb0f01
      Peter Krempa 提交于
      Clear the old data to avoid leaking it when attempting to re-translate a
      pool on the same domain object.
      bdeb0f01
    • P
      qemu: Refactor disk source string formatting · 0df53f04
      Peter Krempa 提交于
      This patch adds function qemuGetDriveSourceString to produce
      qemu-compatible disk source strings that will enable to reuse the code
      and refactors building of the qemu commandline of disks to use this new
      helper.
      0df53f04
    • P
      qemu: Unify formatting of RBD sources · b384e2b4
      Peter Krempa 提交于
      b384e2b4
    • P
      qemu: Split out NBD command generation · d94fd0c9
      Peter Krempa 提交于
      d94fd0c9
    • P
      eaa1539b
    • P
      qemu: Use qemuBuildNetworkDriveURI to handle http/ftp and friends · 078a1025
      Peter Krempa 提交于
      Prepare the function to integrate other protocols and start folding
      other network protocols into a common place.
      078a1025
    • P
      qemu: Simplify call pattern of qemuBuildDriveURIString · 927ddae1
      Peter Krempa 提交于
      Automatically assign secret type from the disk source definition and
      pull in adding of the comma. Then update callers to keep generated
      output the same.
      927ddae1