1. 08 2月, 2016 9 次提交
  2. 05 2月, 2016 3 次提交
    • 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
    • J
      conf: add caps to virDomainSnapshotDefFormat · b8b03f64
      Joao Martins 提交于
      The virDomainSnapshotDefFormat calls into virDomainDefFormat,
      so should be providing a non-NULL virCapsPtr instance. On the
      qemu driver we change qemuDomainSnapshotWriteMetadata to also
      include caps since it calls virDomainSnapshotDefFormat.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      b8b03f64
    • D
      conf: add caps to virDomainObjFormat/SaveStatus · 1036ddad
      Daniel P. Berrange 提交于
      The virDomainObjFormat and virDomainSaveStatus methods
      both call into virDomainDefFormat, so should be providing
      a non-NULL virCapsPtr instance.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1036ddad
  3. 04 2月, 2016 3 次提交
  4. 03 2月, 2016 6 次提交
  5. 01 2月, 2016 2 次提交
  6. 28 1月, 2016 2 次提交
  7. 27 1月, 2016 2 次提交
    • L
      util: keep/use a bitmap of in-use macvtap devices · 370608b4
      Laine Stump 提交于
      This patch creates two bitmaps, one for macvlan device names and one
      for macvtap. The bitmap position is used to indicate that libvirt is
      currently using a device with the name macvtap%d/macvlan%d, where %d
      is the position in the bitmap. When requested to create a new
      macvtap/macvlan device, libvirt will now look for the first clear bit
      in the appropriate bitmap and derive the device name from that rather
      than just starting at 0 and counting up until one works.
      
      When libvirtd is restarted, the qemu driver code that reattaches to
      active domains calls the appropriate function to "re-reserve" the
      device names as it is scanning the status of running domains.
      
      Note that it may seem strange that the retry counter now starts at
      8191 instead of 5. This is because we now don't do a "pre-check" for
      the existence of a device once we've reserved it in the bitmap - we
      move straight to creating it; although very unlikely, it's possible
      that someone has a running system where they have a large number of
      network devices *created outside libvirt* named "macvtap%d" or
      "macvlan%d" - such a setup would still allow creating more devices
      with the old code, while a low retry max in the new code would cause a
      failure. Since the objective of the retry max is just to prevent an
      infinite loop, and it's highly unlikely to do more than 1 iteration
      anyway, having a high max is a reasonable concession in order to
      prevent lots of new failures.
      370608b4
    • P
      device: cleanup input device code · 36785c7e
      Pavel Hrdina 提交于
      The current code was a little bit odd.  At first we've removed all
      possible implicit input devices from domain definition to add them later
      back if there was any graphics device defined while parsing XML
      description.  That's not all, while formating domain definition to XML
      description we at first ignore any input devices with bus different to
      USB and VIRTIO and few lines later we add implicit input devices to XML.
      
      This seems to me as a lot of code for nothing.  This patch may look
      to be more complicated than original approach, but this is a preferred
      way to modify/add driver specific stuff only in those drivers and not
      deal with them in common parsing/formating functions.
      
      The update is to add those implicit input devices into config XML to
      follow the real HW configuration visible by guest OS.
      
      There was also inconsistence between our behavior and QEMU's in the way,
      that in QEMU there is no way how to disable those implicit input devices
      for x86 architecture and they are available always, even without graphics
      device.  This applies also to XEN hypervisor.  VZ driver already does its
      part by putting correct implicit devices into live XML.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      36785c7e
  8. 26 1月, 2016 4 次提交
    • D
      qemu: add reporting of vCPU wait time · 511e7c5b
      Daniel P. Berrange 提交于
      The VIR_DOMAIN_STATS_VCPU flag to virDomainListGetStats
      enables reporting of stats about vCPUs. Currently we
      only report the cumulative CPU running time and the
      execution state.
      
      This adds reporting of the wait time - time the vCPU
      wants to run, but the host scheduler has something else
      running ahead of it.
      
      The data is reported per-vCPU eg
      
      $ virsh domstats --vcpu demo
       Domain: 'demo'
         vcpu.current=4
         vcpu.maximum=4
         vcpu.0.state=1
         vcpu.0.time=1420000000
         vcpu.0.wait=18403928
         vcpu.1.state=1
         vcpu.1.time=130000000
         vcpu.1.wait=10612111
         vcpu.2.state=1
         vcpu.2.time=110000000
         vcpu.2.wait=12759501
         vcpu.3.state=1
         vcpu.3.time=90000000
         vcpu.3.wait=21825087
      
      In implementing this I notice our reporting of CPU execute
      time has very poor granularity, since we are getting it
      from /proc/$PID/stat. As a future enhancement we should
      prefer to get CPU execute time from /proc/$PID/schedstat
      or /proc/$PID/sched (if either exist on the running kernel)
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      511e7c5b
    • P
      (qemu|lxc)DomainGetCPUStats: Clean up · 51f07d8f
      Peter Krempa 提交于
      Remove unnecessary condition and variable.
      51f07d8f
    • P
      qemu: process: Disallow VMs with 0 vcpus · b3c91b8a
      Peter Krempa 提交于
      Counterintuitively the user would end up with a VM with maximum number
      of vCPUs available.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1290324
      b3c91b8a
    • P
      qemu: process: refactor and rename qemuValidateCpuMax to qemuValidateCpuCount · adca15cf
      Peter Krempa 提交于
      Next patch will add minimum checking, so use a more generic name.
      Refactor return values to the commonly used semantics.
      adca15cf
  9. 25 1月, 2016 2 次提交
  10. 21 1月, 2016 2 次提交
  11. 19 1月, 2016 1 次提交
    • M
      qemuProcessReadLog: Fix memmove arguments · 105b51f4
      Michal Privoznik 提交于
      So I can observe this crasher that with freshly started daemon
      (and virtlogd enabled) I am trying to startup a domain that
      immediately dies (because it's said to use huge pages but I
      haven't allocated a single one in the pool). Hardly reproducible
      with -O0 or under valgrind. But I just got lucky:
      
      ==20469== Invalid write of size 8
      ==20469==    at 0x4C2E99B: memcpy@GLIBC_2.2.5 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==20469==    by 0x217EDD07: qemuProcessReadLog (qemu_process.c:1670)
      ==20469==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
      ==20469==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
      ==20469==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)
      ==20469==    by 0x217F71A4: qemuProcessStart (qemu_process.c:5152)
      ==20469==    by 0x21846582: qemuDomainObjStart (qemu_driver.c:7396)
      ==20469==    by 0x218467DE: qemuDomainCreateWithFlags (qemu_driver.c:7450)
      ==20469==    by 0x21846845: qemuDomainCreate (qemu_driver.c:7468)
      ==20469==    by 0x5611CD0: virDomainCreate (libvirt-domain.c:6753)
      ==20469==    by 0x125D9A: remoteDispatchDomainCreate (remote_dispatch.h:3613)
      ==20469==    by 0x125CB7: remoteDispatchDomainCreateHelper (remote_dispatch.h:3589)
      ==20469==  Address 0x27a52ad0 is 0 bytes after a block of size 5,584 alloc'd
      ==20469==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==20469==    by 0x9B8D1DB: xdr_string (in /lib64/libc-2.21.so)
      ==20469==    by 0x563B39C: xdr_virLogManagerProtocolNonNullString (log_protocol.c:24)
      ==20469==    by 0x563B6B7: xdr_virLogManagerProtocolDomainReadLogFileRet (log_protocol.c:123)
      ==20469==    by 0x164B34: virNetMessageDecodePayload (virnetmessage.c:407)
      ==20469==    by 0x5682360: virNetClientProgramCall (virnetclientprogram.c:379)
      ==20469==    by 0x563B30E: virLogManagerDomainReadLogFile (log_manager.c:272)
      ==20469==    by 0x217CD613: qemuDomainLogContextRead (qemu_domain.c:2485)
      ==20469==    by 0x217EDC76: qemuProcessReadLog (qemu_process.c:1660)
      ==20469==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
      ==20469==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
      ==20469==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)
      
      This points to memmove() in qemuProcessReadLog(). Imagine we just
      read the following string from qemu:
      
      "abc\n2016-01-18T09:40:44.022744Z qemu-system-x86_64: Error\n"
      
      After the first pass of the while() loop in the
      qemuProcessReadLog() (in which we have taken the false branch in
      the if) @buf still points to the beginning of the string,
      @filter_next points to the beginning of the second line.  So we
      start second iteration because there is yet another newline
      character at the end. In this iteration @eol points to it
      actually. Now, the control gets inside true branch of if(). Just
      to remind you:
      
      got = 58
      filter_next = buf + 5,
      eol = buf + 58.
      
      Therefore skip = 54 which is correct. The message we want to skip
      is 54 bytes long. However:
      
      memmove(filter_next, eol + 1, (got - skip) +1);
      
      which is
      
      memmove(filter_next, eol + 1, 5)
      
      is obviously wrong as there is only one byte we can access, not 5!
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      105b51f4
  12. 15 1月, 2016 3 次提交
  13. 14 1月, 2016 1 次提交