1. 10 12月, 2013 13 次提交
    • C
      Added domain start/stop/define/undefine event unit tests · b775b48e
      Cédric Bosdonnat 提交于
      These unit tests are aiming at providing some help during the domain
      events refactoring.
      b775b48e
    • M
      spec: clean up libvirtd and virtlockd service mgmt · 81764660
      Michael Chapman 提交于
      - systemctl and the %systemd_* RPM macros can take multiple unit names
        in the one invocation. Make use of this to avoid repeated systemd
        daemon reloads.
      
      - virtlockd was only properly enabled and disabled when using systemd,
        but when systemd RPM macros were not available (e.g. on Fedora < 18).
        Make sure it's enabled when systemd RPM macros are present, or when
        using initscripts.
      
      - Always use "reload" on virtlockd, not "condrestart". This allows it to
        cleanly re-execute itself without losing running state. Ignore any
        error should the reload fail.
      
      - Move the reloading of virtlockd and libvirtd via their initscripts
        into the daemon package's %postun scriptlet. These services must be
        restarted after all of the libvirt-daemon-driver-* packages have
        been upgraded during the same RPM transaction.
      
      - Add a %triggerpostun executed only when upgrading an older
        libvirt-daemon. As an older package would only reload libvirtd during
        %post, and the newer package would only reload libvirtd during
        %postun, such an upgrade would not reload libvirtd at all without the
        trigger.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      81764660
    • M
      virtlockd: use common exit path when out-of-memory · f1b17525
      Michael Chapman 提交于
      Also use a distinct, valid exit status for daemon re-execution failure.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      f1b17525
    • M
      virtlockd: treat SIGHUP like SIGUSR1 · 8355d42d
      Michael Chapman 提交于
      SIGHUP is commonly used to instruct a daemon to reload its config. For
      now we should handle it in virtlockd just like SIGUSR1, rather than
      having it kill the process.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      8355d42d
    • M
      virtlockd: improve initscripts · 59d6e65d
      Michael Chapman 提交于
      - Use SIGUSR1, not SIGHUP, on reload. At present, virtlockd only
        responds to the former.
      
      - Fix PID file for virtlockd.
      
      - Do not start virtlockd in any runlevels by default. It needs to be
        explicitly selected in libvirt's qemu.conf anyway, so there is no
        need to have it running on all systems regardless.
      
      - Fix chkconfig priorities to ensure virtlockd is started before
        libvirtd is started, and stopped after libvirtd is stopped.
      
      - Add "Should-Start: virtlockd" to the libvirtd initscript's LSB header,
        for the same reason.
      
      - Add "Default-Stop" to both libvirtd and virtlockd initscripts. LSB
        does not guarantee that this defaults to the inverse of
        "Default-Start".
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      59d6e65d
    • M
      virtlockd: improve systemd units · 1163fa36
      Michael Chapman 提交于
      - Pass VIRTLOCKD_ARGS through to virtlockd.
      
      - Use SIGUSR1, not SIGHUP, in ExecReload. At present, virtlockd only
        responds to the former.
      
      - Have "systemctl enable virtlockd.service" enable virtlockd.socket,
        rather than throw an error.
      
      - Make virtlockd.socket wanted by sockets.target, rather than
        multi-user.target. This is consistent with other socket units in
        Fedora, and it ensures that the socket is available before libvirtd is
        started.
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      1163fa36
    • M
      conf: don't format memtune with unlimited values · ea130e3b
      Martin Kletzander 提交于
      When changing memtune limits to unlimited with AFFECT_CONFIG, the
      values in virDomainDef are set to PARAM_UNLIMITED, which causes the
      whole <memtune> to be formatted.  This can be changed in all drivers,
      but it also makes sense to use the default (0) as another value for
      "unlimited", since zero memory limit makes no sense.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      ea130e3b
    • M
      8d7c668e
    • M
      qemu: Report VIR_DOMAIN_MEMORY_PARAM_UNLIMITED properly · 0c2fdd7b
      Martin Kletzander 提交于
      For dead domains that have no memtune limits, we return 0 instead of
      "unlimited", this patch fixes it to return PARAM_UNLIMITED.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      0c2fdd7b
    • M
      cgroups: Redefine what "unlimited" means wrt memory limits · 231656bb
      Martin Kletzander 提交于
      Since kernel 3.12 (commit 34ff8dc08956098563989d8599840b130be81252 in
      linux-stable.git in particular) the value for 'unlimited' in cgroup
      memory limits changed from LLONG_MAX to ULLONG_MAX.  Due to rather
      unfortunate choice of our VIR_DOMAIN_MEMORY_PARAM_UNLIMITED constant
      (which we transfer as an unsigned long long in Kibibytes), we ended up
      with the situation described below (applies to x86_64):
      
       - 2^64-1 (ULLONG_MAX) -- "unlimited" in kernel = 3.12
      
       - 2^63-1 (LLONG_MAX) -- "unlimited" in kernel < 3.12
       - 2^63-1024 -- our PARAM_UNLIMITED scaled to Bytes
      
       - 2^53-1 -- our PARAM_UNLIMITED unscaled (in Kibibytes)
      
      This means that when any number within (2^63-1, 2^64-1] is read from
      memory cgroup, we are transferring that number instead of "unlimited".
      Unfortunately, changing VIR_DOMAIN_MEMORY_PARAM_UNLIMITED would break
      ABI compatibility and thus we have to resort to a different solution.
      
      With this patch every value greater than PARAM_UNLIMITED means
      "unlimited".  Even though this may seem misleading, we are already in
      such unclear situation when running 3.12 kernel with memory limits set
      to 2^63.
      
      One example showing most of the problems at once (with kernel 3.12.2):
       # virsh memtune asdf --hard-limit 9007199254740991 --swap-hard-limit -1
       # echo 12345678901234567890 >\
      /sys/fs/cgroup/memory/machine/asdf.libvirt-qemu/memory.soft_limit_in_bytes
       # virsh memtune asdf
       hard_limit     : 18014398509481983
       soft_limit     : 12056327051986884
       swap_hard_limit: 18014398509481983
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      231656bb
    • C
      qemu: hotplug: Fix adding USB devices to the driver list · 586b0ed8
      Cole Robinson 提交于
      We were unconditionally removing the device from the host list, when it
      should only be done on error.
      
      This fixes USB collision detection when hotplugging the same device to
      two guests.
      586b0ed8
    • C
      qemu: hotplug: Fix double free on USB collision · 5953a737
      Cole Robinson 提交于
      If we hit a collision, we free the USB device while it is still part
      of our temporary USBDeviceList. When the list is unref'd, the device
      is free'd again.
      
      Make the initial device freeing dependent on whether it is present
      in the temporary list or not.
      5953a737
    • C
      qemu: hotplug: Only label hostdev after checking device conflicts · ee414b5d
      Cole Robinson 提交于
      Similar to what Jiri did for cgroup setup/teardown in 05e149f9, push
      it all into the device handler functions so we can do the necessary prep
      work before claiming the device.
      
      This also fixes hotplugging USB devices by product/vendor (virt-manager's
      default behavior):
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1016511
      ee414b5d
  2. 09 12月, 2013 1 次提交
  3. 07 12月, 2013 6 次提交
  4. 06 12月, 2013 8 次提交
  5. 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