1. 07 6月, 2016 1 次提交
  2. 11 2月, 2016 1 次提交
    • M
      dbus: Don't unref NULL messages · 862298a2
      Michal Privoznik 提交于
      Apparently we are not the only ones with dumb free functions
      because dbus_message_unref() does not accept NULL either. But if
      I were to vote, this one is even more evil. Instead of returning
      an error just like we do it immediately dereference any pointer
      passed and thus crash you app. Well done DBus!
      
        Program received signal SIGSEGV, Segmentation fault.
        [Switching to Thread 0x7f878ebda700 (LWP 31264)]
        0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        (gdb) bt
        #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
        #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
        #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
        #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
        #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
        (gdb) frame 2
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        228         dbus_message_unref(reply);
        (gdb) p reply
        $1 = (DBusMessage *) 0x0
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      862298a2
  3. 06 2月, 2016 1 次提交
  4. 05 2月, 2016 1 次提交
    • M
      systemd: Modernize machine naming · c3bd0019
      Martin Kletzander 提交于
      So, systemd-machined has this philosophy that machine names are like
      hostnames and hence should follow the same rules.  But we always allowed
      international characters in domain names.  Thus we need to modify the
      machine name we are passing to systemd.
      
      In order to change some machine names that we will be passing to systemd,
      we also need to call TerminateMachine at the end of a lifetime of a
      domain.  Even for domains that were started with older libvirt.  That
      can be achieved thanks to virSystemdGetMachineNameByPID().  And because
      we can change machine names, we can get rid of the inconsistent and
      pointless escaping of domain names when creating machine names.
      
      So this patch modifies the naming in the following way.  It creates the
      name as <drivername>-<id>-<name> where invalid hostname characters are
      stripped out of the name and if the resulting name is longer, it
      truncates it to 64 characters.  That way we can start domains we
      couldn't start before.  Well, at least on systemd.
      
      To make it work all together, the machineName (which is needed only with
      systemd) is saved in domain's private data.  That way the generation is
      moved to the driver and we don't need to pass various unnecessary
      arguments to cgroup functions.
      
      The only thing this complicates a bit is the scope generation when
      validating a cgroup where we must check both old and new naming, so a
      slight modification was needed there.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1282846Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      c3bd0019
  5. 03 2月, 2016 2 次提交
  6. 27 11月, 2015 1 次提交
  7. 26 11月, 2015 1 次提交
  8. 21 10月, 2015 1 次提交
  9. 22 7月, 2015 1 次提交
    • P
      cgroup: Drop resource partition from virSystemdMakeScopeName · 88f6c007
      Peter Krempa 提交于
      The scope name, even according to our docs is
      "machine-$DRIVER\x2d$VMNAME.scope" virSystemdMakeScopeName would use the
      resource partition name instead of "machine-" if it was specified thus
      creating invalid scope paths.
      
      This makes libvirt drop cgroups for a VM that uses custom resource
      partition upon reconnecting since the detected scope name would not
      match the expected name generated by virSystemdMakeScopeName.
      
      The error is exposed by the following log entry:
      
      debug : virCgroupValidateMachineGroup:302 : Name 'machine-qemu\x2dtestvm.scope' for controller 'cpu' does not match 'testvm', 'testvm.libvirt-qemu' or 'machine-test-qemu\x2dtestvm.scope'
      
      for a "/machine/test" resource and "testvm" vm.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1238570
      88f6c007
  10. 27 1月, 2015 1 次提交
    • D
      systemd: don't report an error if the guest is already terminated · b3e4401d
      Daniel P. Berrange 提交于
      In many cases where we invoke virSystemdTerminateMachine the
      process(es) will have already gone away on their own accord.
      In these cases we log an error message that the machine does
      not exist. We should catch this particular error and simply
      ignore it, so we don't pollute the logs.
      b3e4401d
  11. 26 1月, 2015 2 次提交
    • D
      systemd: avoid string comparisons on dbus error messages · 2d8b59c0
      Daniel P. Berrange 提交于
      Add a virDBusErrorIsUnknownMethod helper so that callers
      don't need todo string comparisons themselves to detect
      standard error names.
      2d8b59c0
    • D
      systemd: fix build without dbus · d13b586a
      Daniel P. Berrange 提交于
      The virDBusMethodCall method has a DBusError as one of its
      parameters. If the caller wants to pass a non-NULL value
      for this, it immediately makes the calling code require
      DBus at build time. This has led to breakage of non-DBus
      builds several times. It is desirable that only the virdbus.c
      file should need WITH_DBUS conditionals, so we must ideally
      remove the DBusError parameter from the method.
      
      We can't simply raise a libvirt error, since the whole point
      of this parameter is to give the callers a way to check if
      the error is one they want to ignore, without having the logs
      polluted with an error message. So, we add a virErrorPtr
      parameter which the caller can then either ignore or raise
      using the new virReportErrorObject method.
      
      This new method is distinct from virSetError in that it
      ensures the logging hooks are run.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d13b586a
  12. 15 1月, 2015 1 次提交
    • D
      Add support for systemd-machined CreateMachineWithNetwork · 318df5a0
      Daniel P. Berrange 提交于
      systemd-machined introduced a new method CreateMachineWithNetwork
      that obsoletes CreateMachine. It expects to be given a list of
      VETH/TAP device indexes for the host side device(s) associated
      with a container/machine.
      
      This falls back to the old CreateMachine method when the new
      one is not supported.
      318df5a0
  13. 03 7月, 2014 1 次提交
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
  14. 15 4月, 2014 2 次提交
    • J
      Fix virsystemdtest without SYSTEMD_DAEMON · 6077be46
      Ján Tomko 提交于
      Commit 48976981 fixed the build without dbus by only building
      the virSystemdPMSupportTarget with SYSTEMD_DAEMON.
      
      Introduce a virDBusMessageUnref wrapper for dbus_message_unref
      to let virsystemd.c build without dbus, while still allowing
      virsystemdtest to run without SYSTEM_DAEMON.
      6077be46
    • M
      build: Don't use code with dbus_message_unref when built without dbus · 48976981
      Martin Kletzander 提交于
      In order to do that, virNodeSuspendSupportsTargetPMUtils() and
      virSystemdPMSupportTarget() are created even when pm-utils and dbus
      are compiled out, respectively, but in that case returning -2 meaning
      "unavailable" (this return code was already used for unavailability
      before).  Error is reported in virNodeSuspendSupportsTarget() only if
      both functions returned -2, otherwise the error (or success) is properly
      propagated up the stack.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      48976981
  15. 12 4月, 2014 1 次提交
  16. 25 3月, 2014 1 次提交
  17. 21 3月, 2014 1 次提交
  18. 18 3月, 2014 1 次提交
  19. 04 3月, 2014 1 次提交
  20. 24 2月, 2014 2 次提交
    • M
      virNetServerRun: Notify systemd that we're accepting clients · 68954fb2
      Michal Privoznik 提交于
      Systemd does not forget about the cases, where client service needs to
      wait for daemon service to initialize and start accepting new clients.
      Setting a dependency in client is not enough as systemd doesn't know
      when the daemon has initialized itself and started accepting new
      clients. However, it offers a mechanism to solve this. The daemon needs
      to call a special systemd function by which the daemon tells "I'm ready
      to accept new clients". This is exactly what we need with
      libvirtd-guests (client) and libvirtd (daemon). So now, with this
      change, libvirt-guests.service is invoked not any sooner than
      libvirtd.service calls the systemd notify function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      68954fb2
    • M
      virSystemdCreateMachine: Set dependencies for slices · ba79e387
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1031696
      
      When creating a new domain, we let systemd know about it by calling
      CreateMachine() function via dbus. Systemd then creates a scope and
      places domain into it. However, later when the host is shutting
      down, systemd computes the shutdown order to see what processes can
      be shut down in parallel. And since we were not setting
      dependencies at all, the slices (and thus domains) were most likely
      killed before libvirt-guests.service. So user domains that had to
      be saved, shut off, whatever were in fact killed.  This problem can
      be solved by letting systemd know that scopes we're creating must
      not be killed before libvirt-guests.service.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      ba79e387
  21. 14 10月, 2013 1 次提交
    • D
      Don't ignore all dbus connection errors · 6bd88600
      Daniel P. Berrange 提交于
      Previous commit
      
        commit 7ada155c
        Author: Gao feng <gaofeng@cn.fujitsu.com>
        Date:   Wed Sep 11 11:15:02 2013 +0800
      
          DBus: introduce virDBusIsServiceEnabled
      
      Made the cgroups code fallback to non-systemd based setup
      when dbus is not running. It was too big a hammer though,
      as it did not check what error code was received when the
      dbus connection failed. Thus it silently ignored serious
      errors from dbus such as "too many client connections",
      which should always be treated as fatal.
      
      We only want to ignore errors if the dbus unix socket does
      not exist, or if nothing is listening on it.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6bd88600
  22. 30 9月, 2013 1 次提交
  23. 17 9月, 2013 1 次提交
    • J
      Free slicename in virSystemdCreateMachine · 09b48562
      Ján Tomko 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1008619
      
      1,003 bytes in 1 blocks are definitely lost in loss record 599 of 635
      ==404== by 0x50728A7: virBufferAddChar (virbuffer.c:185)
      ==404== by 0x50BC466: virSystemdEscapeName (virsystemd.c:67)
      ==404== by 0x50BC6B2: virSystemdMakeSliceName (virsystemd.c:108)
      ==404== by 0x50BC870: virSystemdCreateMachine (virsystemd.c:169)
      ==404== by 0x5078267: virCgroupNewMachine (vircgroup.c:1498)
      09b48562
  24. 11 9月, 2013 1 次提交
  25. 19 8月, 2013 1 次提交
  26. 01 8月, 2013 1 次提交
  27. 24 7月, 2013 1 次提交
  28. 22 7月, 2013 1 次提交