1. 08 12月, 2016 1 次提交
    • M
      qemu: Create hugepage path on per domain basis · f55afd83
      Michal Privoznik 提交于
      If you've ever tried running a huge page backed guest under
      different user than in qemu.conf, you probably failed. Problem is
      even though we have corresponding APIs in the security drivers,
      there's no implementation and thus we don't relabel the huge page
      path. But even if we did, so far all of the domains share the
      same path:
      
         /hugepageMount/libvirt/qemu
      
      Our only option there would be to set 0777 mode on the qemu dir
      which is totally unsafe. Therefore, we can create dir on
      per-domain basis, i.e.:
      
         /hugepageMount/libvirt/qemu/domainName
      
      and chown domainName dir to the user that domain is configured to
      run under.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f55afd83
  2. 25 11月, 2016 1 次提交
    • M
      virstring: Unify string list function names · c2a5a4e7
      Michal Privoznik 提交于
      We have couple of functions that operate over NULL terminated
      lits of strings. However, our naming sucks:
      
      virStringJoin
      virStringFreeList
      virStringFreeListCount
      virStringArrayHasString
      virStringGetFirstWithPrefix
      
      We can do better:
      
      virStringListJoin
      virStringListFree
      virStringListFreeCount
      virStringListHasString
      virStringListGetFirstWithPrefix
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c2a5a4e7
  3. 22 11月, 2016 1 次提交
  4. 09 11月, 2016 1 次提交
  5. 20 10月, 2016 1 次提交
    • J
      conf: Introduce {default|chardev}_tls_x509_secret_uuid · 3b668bb5
      John Ferlan 提交于
      Add a new qemu.conf variables to store the UUID for the secret that could
      be used to present credentials to access the TLS chardev.  Since this will
      be a server level and it's possible to use some sort of default, introduce
      both the default and chardev logic at the same time making the setting of
      the chardev check for it's own value, then if not present checking whether
      the default value had been set.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      3b668bb5
  6. 19 9月, 2016 2 次提交
    • M
      qemu: Introduce qemuGetHupageMemPath · eef8b263
      Michal Privoznik 提交于
      Now that we have two same implementations for getting path for
      huge pages backed guest memory, lets merge them into one function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      eef8b263
    • M
      qemuBuildMemoryBackendStr: Don't crash if no hugetlbfs is mounted · 647db05e
      Michal Privoznik 提交于
      When trying to migrate a huge page enabled guest, I've noticed
      the following crash. Apparently, if no specific hugepages are
      requested:
      
        <memoryBacking>
          <hugepages/>
        </memoryBacking>
      
      and there are no hugepages configured on the destination, we try
      to dereference a NULL pointer.
      
      Program received signal SIGSEGV, Segmentation fault.
      0x00007fcc907fb20e in qemuGetHugepagePath (hugepage=0x0) at qemu/qemu_conf.c:1447
      1447        if (virAsprintf(&ret, "%s/libvirt/qemu", hugepage->mnt_dir) < 0)
      (gdb) bt
      #0  0x00007fcc907fb20e in qemuGetHugepagePath (hugepage=0x0) at qemu/qemu_conf.c:1447
      #1  0x00007fcc907fb2f5 in qemuGetDefaultHugepath (hugetlbfs=0x0, nhugetlbfs=0) at qemu/qemu_conf.c:1466
      #2  0x00007fcc907b4afa in qemuBuildMemoryBackendStr (size=4194304, pagesize=0, guestNode=0, userNodeset=0x0, autoNodeset=0x0, def=0x7fcc70019070, qemuCaps=0x7fcc70004000, cfg=0x7fcc5c011800, backendType=0x7fcc95087228, backendProps=0x7fcc95087218,
          force=false) at qemu/qemu_command.c:3297
      #3  0x00007fcc907b4f91 in qemuBuildMemoryCellBackendStr (def=0x7fcc70019070, qemuCaps=0x7fcc70004000, cfg=0x7fcc5c011800, cell=0, auto_nodeset=0x0, backendStr=0x7fcc70020360) at qemu/qemu_command.c:3413
      #4  0x00007fcc907c0406 in qemuBuildNumaArgStr (cfg=0x7fcc5c011800, def=0x7fcc70019070, cmd=0x7fcc700040c0, qemuCaps=0x7fcc70004000, auto_nodeset=0x0) at qemu/qemu_command.c:7470
      #5  0x00007fcc907c5fdf in qemuBuildCommandLine (driver=0x7fcc5c07b8a0, logManager=0x7fcc70003c00, def=0x7fcc70019070, monitor_chr=0x7fcc70004bb0, monitor_json=true, qemuCaps=0x7fcc70004000, migrateURI=0x7fcc700199c0 "defer", snapshot=0x0,
          vmop=VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START, standalone=false, enableFips=false, nodeset=0x0, nnicindexes=0x7fcc95087498, nicindexes=0x7fcc950874a0, domainLibDir=0x7fcc700047c0 "/var/lib/libvirt/qemu/domain-1-fedora") at qemu/qemu_command.c:9547
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      647db05e
  7. 13 9月, 2016 1 次提交
    • L
      qemu: fix improper initialization of cgroupControllers bitmap · 02760153
      Laine Stump 提交于
      virQEMUDriverConfigNew() always initializes the bitmap in its
      cgroupControllers member to -1 (i.e. all 1's).
      
      Prior to commit a9331394, if qemu.conf had a line with
      "cgroup_controllers", cgroupControllers would get reset to 0 before
      going through a loop setting a bit for each named cgroup controller.
      commit a9331394 left out the "reset to 0" part, so cgroupControllers
      would always be -1; if you didn't want a controller included, there
      was no longer a way to make that happen.
      
      This was discovered by users who were using qemu commandline
      passthrough to use the "input-linux" method of directing
      keyboard/mouse input to a virtual machine:
      
       https://www.redhat.com/archives/vfio-users/2016-April/msg00105.html
      
      Here's the first report I found of the problem encountered after
      upgrading libvirt beyond v2.0.0:
      
       https://www.redhat.com/archives/vfio-users/2016-August/msg00053.html
      
      Thanks to sL1pKn07 SpinFlo <sl1pkn07@gmail.com> for bringing the
      problem up in IRC, and then taking the time to do a git bisect and
      find the patch that started the problem.
      02760153
  8. 09 9月, 2016 2 次提交
    • J
      conf: Introduce chartcp_tls_x509_cert_dir · 3f60a9c3
      John Ferlan 提交于
      Add a new TLS X.509 certificate type - "chardev". This will handle the
      creation of a TLS certificate capability (and possibly repository) for
      properly configured character device TCP backends.
      
      Unlike the vnc and spice there is no "listen" or "passwd" associated. The
      credentials eventually will be handled via a libvirt secret provided to
      a specific backend.
      
      Make use of the default verify option as well.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      3f60a9c3
    • J
      conf: Add new default TLS X.509 certificate default directory · c12cb5ed
      John Ferlan 提交于
      Rather than specify perhaps multiple TLS X.509 certificate directories,
      let's create a "default" directory which can then be used if the service
      (e.g. for now vnc and spice) does not supply a default directory.
      
      Since the default for vnc and spice may have existed before without being
      supplied, the default check will first check if the service specific path
      exists and if so, set the cfg entry to that; otherwise, the default will
      be set to the (now) new defaultTLSx509certdir.
      
      Additionally add a "default_tls_x509_verify" entry which can also be used
      to force the peer verification option (for vnc it's a x509verify option).
      Add/alter the macro for the option being found in the config file to accept
      the default value.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      c12cb5ed
  9. 06 9月, 2016 2 次提交
    • D
      qemu: allow turning off QEMU guest RAM dump globally · 90e178f8
      Daniel P. Berrange 提交于
      We already have the ability to turn off dumping of guest
      RAM via the domain XML. This is not particularly useful
      though, as it is under control of the management application.
      What is needed is a way for the sysadmin to turn off guest
      RAM defaults globally, regardless of whether the mgmt app
      provides its own way to set this in the domain XML.
      
      So this adds a 'dump_guest_core' option in /etc/libvirt/qemu.conf
      which defaults to false. ie guest RAM will never be included in
      the QEMU core dumps by default. This default is different from
      historical practice, but is considered to be more suitable as
      a default because
      
       a) guest RAM can be huge and so inflicts a DOS on the host
          I/O subsystem when dumping core for QEMU crashes
      
       b) guest RAM can contain alot of sensitive data belonging
          to the VM owner. This should not generally be copied
          around inside QEMU core dumps submitted to vendors for
          debugging
      
       c) guest RAM contents are rarely useful in diagnosing
          QEMU crashes
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      90e178f8
    • D
      qemu: add a max_core setting to qemu.conf for core dump size · fa1ce979
      Daniel P. Berrange 提交于
      Currently the QEMU processes inherit their core dump rlimit
      from libvirtd, which is really suboptimal. This change allows
      their limit to be directly controlled from qemu.conf instead.
      fa1ce979
  10. 10 8月, 2016 1 次提交
  11. 04 8月, 2016 1 次提交
  12. 12 7月, 2016 1 次提交
  13. 14 6月, 2016 1 次提交
    • J
      driver config: Introduce virFirmware object · fda5a98e
      Jim Fehlig 提交于
      The virQEMUDriverConfig object contains lists of
      loader:nvram pairs to advertise firmwares supported by
      by the driver, and qemu_conf.c contains code to populate
      the lists, all of which is useful for other drivers too.
      
      To avoid code duplication, introduce a virFirmware object
      to encapsulate firmware details and switch the qemu driver
      to use it.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      fda5a98e
  14. 09 6月, 2016 1 次提交
  15. 09 5月, 2016 1 次提交
    • P
      util: Replace virDomainDiskSourceIsBlockType with a new helper · 3ec7bb35
      Peter Krempa 提交于
      For disks sources described by a libvirt volume we don't need to do a
      complicated check since virStorageTranslateDiskSourcePool already
      correctly determines the actual disk type.
      
      Replace the checks using a new accessor that does not open-code the
      whole logic.
      3ec7bb35
  16. 28 4月, 2016 1 次提交
  17. 18 2月, 2016 1 次提交
  18. 26 11月, 2015 1 次提交
    • D
      qemu: add support for sending QEMU stdout/stderr to virtlogd · 0d968ad7
      Daniel P. Berrange 提交于
      Currently the QEMU stdout/stderr streams are written directly to
      a regular file (eg /var/log/libvirt/qemu/$GUEST.log). While those
      can be rotated by logrotate (using copytruncate option) this is
      not very efficient. It also leaves open a window of opportunity
      for a compromised/broken QEMU to DOS the host filesystem by
      writing lots of text to stdout/stderr.
      
      This makes it possible to connect the stdout/stderr file handles
      to a pipe that is provided by virtlogd. The virtlogd daemon will
      read from this pipe and write data to the log file, performing
      file rotation whenever a pre-determined size limit is reached.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0d968ad7
  19. 22 9月, 2015 1 次提交
  20. 14 8月, 2015 1 次提交
  21. 04 8月, 2015 1 次提交
    • J
      conf: Allow error reporting in virDomainDiskSourceIsBlockType · 36025c55
      John Ferlan 提交于
      Rather than provide a somewhat generic error message when the API
      returns false, allow the caller to supply a "report = true" option
      in order to cause virReportError's to describe which of the 3 paths
      that can cause failure.
      
      Some callers don't care about what caused the failure, they just want
      to have a true/false - for those, calling with report = false should
      be sufficient.
      36025c55
  22. 29 7月, 2015 1 次提交
    • E
      qemu: Adjust VM id allocation · b2960501
      Erik Skultety 提交于
      Our atomic increment (virAtomicIntInc) uses (if available) gcc
      __sync_add_and_fetch builtin. In qemu driver though, we'd profit more
      from __sync_fetch_and_add builtin. To keep it simplistic, this patch
      adjusts qemu driver initialization rather than adding a new atomic
      increment macro.
      b2960501
  23. 10 7月, 2015 1 次提交
  24. 09 7月, 2015 6 次提交
  25. 18 6月, 2015 1 次提交
    • P
      qemu: 'privileged' flag is not really configuration · 0b416434
      Peter Krempa 提交于
      The privileged flag will not change while the configuration might
      change. Make the 'privileged' flag member of the driver again and mark
      it immutable. Should that ever change add an accessor that will group
      reads of the state.
      0b416434
  26. 24 4月, 2015 3 次提交
  27. 21 4月, 2015 1 次提交
    • C
      qemu: Always refresh capabilities if no <guests> found · 95546c43
      Cole Robinson 提交于
      - Remove all qemu emulators
      - Restart libvirtd
      - Install qemu emulators
      - Call 'virsh version' -> errors
      
      The only thing that will force the qemu driver to refresh it's cached
      capablities info is an explict API call to GetCapabilities.
      
      However in the case when the initial caps lookup at driver connect didn't
      find a single qemu emulator to poll, the driver is effectively useless
      and really can't do anything until it's populated some qemu capabilities
      info.
      
      With the above steps, the user would have to either know about the
      magic refresh capabilities call, or restart libvirtd to pick up the
      changes.
      
      Instead, this patch changes things so that every time a part of th
      driver requests access to capabilities info, check to see if
      we've previously seen any emulators. If not, force a refresh.
      
      In the case of 'still no emulators found', this is still very quick, so
      I can't think of a downside.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1000116
      95546c43
  28. 22 2月, 2015 1 次提交
  29. 29 1月, 2015 2 次提交
    • M
      qemu: Add AAVMF to the list of known UEFIs · 436dcf0b
      Michal Privoznik 提交于
      Well, even though users can pass the list of UEFI:NVRAM pairs at the
      configure time, we may maintain the list of widely available UEFI
      ourselves too. And as arm64 begin to rises, OVMF was ported there too.
      With a slight name change - it's called AAVMF, with AAVMF_CODE.fd
      being the UEFI firmware and AAVMF_VARS.fd being the NVRAM store file.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      436dcf0b
    • M
      qemu: Allow UEFI paths to be specified at compile time · bc03a231
      Michal Privoznik 提交于
      Up until now there are just two ways how to specify UEFI paths to
      libvirt. The first one is editing qemu.conf, the other is editing
      qemu_conf.c and recompile which is not that fancy. So, new
      configure option is introduced: --with-loader-nvram which takes a
      list of pairs of UEFI firmware and NVRAM store. This way, the
      compiled in defaults can be passed during compile time without
      need to change the code itself.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      bc03a231