1. 10 3月, 2017 1 次提交
    • M
      qemuProcessHandleMonitorEOF: Disable namespace for domain · e915942b
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1430634
      
      If a qemu process has died, we get EOF on its monitor. At this
      point, since qemu process was the only one running in the
      namespace kernel has already cleaned the namespace up. Any
      attempt of ours to enter it has to fail.
      
      This really happened in the bug linked above. We've tried to
      attach a disk to qemu and while we were in the monitor talking to
      qemu it just died. Therefore our code tried to do some roll back
      (e.g. deny the device in cgroups again, restore labels, etc.).
      However, during the roll back (esp. when restoring labels) we
      still thought that domain has a namespace. So we used secdriver's
      transactions. This failed as there is no namespace to enter.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e915942b
  2. 09 3月, 2017 4 次提交
    • P
      conf: store "autoGenerated" for graphics listen in status XML · cd4a8b93
      Pavel Hrdina 提交于
      When libvirtd is started we call qemuDomainRecheckInternalPaths
      to detect whether a domain has VNC socket path generated by libvirt
      based on option from qemu.conf.  However if we are parsing status XML
      for running domain the existing socket path can be generated also if
      the config XML uses the new <listen type='socket'/> element without
      specifying any socket.
      
      The current code doesn't make difference how the socket was generated
      and always marks it as "fromConfig".  We need to store the
      "autoGenerated" value in the status XML in order to preserve that
      information.
      
      The difference between "fromConfig" and "autoGenerated" is important
      for migration, because if the socket is based on "fromConfig" we don't
      print it into the migratable XML and we assume that user has properly
      configured qemu.conf on both hosts.  However if the socket is based
      on "autoGenerated" it means that a new feature was used and therefore
      we need to leave the socket in migratable XML to make sure that if
      this feature is not supported on destination the migration will fail.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      cd4a8b93
    • J
      qemu: Rename variable · b2e5de96
      John Ferlan 提交于
      Rename 'secretUsageType' to 'usageType' since it's superfluous in an
      API qemu*Secret*
      b2e5de96
    • J
      qemu: Introduce qemuDomainSecretInfoTLSNew · 7c2b7891
      John Ferlan 提交于
      Building upon the qemuDomainSecretInfoNew, create a helper which will
      build the secret used for TLS.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      7c2b7891
    • J
      qemu: Introduce qemuDomainSecretInfoNew · c9a7b7b6
      John Ferlan 提交于
      Create a helper which will create the secinfo used for disks, hostdevs,
      and chardevs.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      c9a7b7b6
  3. 07 3月, 2017 2 次提交
  4. 06 3月, 2017 1 次提交
    • M
      qemu: Enforce qemuSecurity wrappers · 4da534c0
      Michal Privoznik 提交于
      Now that we have some qemuSecurity wrappers over
      virSecurityManager APIs, lets make sure everybody sticks with
      them. We have them for a reason and calling virSecurityManager
      API directly instead of wrapper may lead into accidentally
      labelling a file on the host instead of namespace.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      4da534c0
  5. 21 2月, 2017 1 次提交
    • M
      qemu: Fix deadlock across fork() in QEMU driver · e22de286
      Marc Hartmayer 提交于
      The functions in virCommand() after fork() must be careful with regard
      to accessing any mutexes that may have been locked by other threads in
      the parent process. It is possible that another thread in the parent
      process holds the lock for the virQEMUDriver while fork() is called.
      This leads to a deadlock in the child process when
      'virQEMUDriverGetConfig(driver)' is called and therefore the handshake
      never completes between the child and the parent process. Ultimately
      the virDomainObjectPtr will never be unlocked.
      
      It gets much worse if the other thread of the parent process, that
      holds the lock for the virQEMUDriver, tries to lock the already locked
      virDomainObject. This leads to a completely unresponsive libvirtd.
      
      It's possible to reproduce this case with calling 'virsh start XXX'
      and 'virsh managedsave XXX' in a tight loop for multiple domains.
      
      This commit fixes the deadlock in the same way as it is described in
      commit 61b52d2e.
      Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
      Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      e22de286
  6. 20 2月, 2017 4 次提交
  7. 15 2月, 2017 2 次提交
    • M
      qemu_conf: Check for namespaces availability more wisely · b57bd206
      Michal Privoznik 提交于
      The bare fact that mnt namespace is available is not enough for
      us to allow/enable qemu namespaces feature. There are other
      requirements: we must copy all the ACL & SELinux labels otherwise
      we might grant access that is administratively forbidden or vice
      versa.
      At the same time, the check for namespace prerequisites is moved
      from domain startup time to qemu.conf parser as it doesn't make
      much sense to allow users to start misconfigured libvirt just to
      find out they can't start a single domain.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b57bd206
    • A
      qemu: Call chmod() after mknod() · ee6ec782
      Andrea Bolognani 提交于
      mknod() is affected my the current umask, so we're not
      guaranteed the newly-created device node will have the
      right permissions.
      
      Call chmod(), which is not affected by the current umask,
      immediately afterwards to solve the issue.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1421036
      ee6ec782
  8. 13 2月, 2017 1 次提交
  9. 09 2月, 2017 1 次提交
  10. 08 2月, 2017 6 次提交
  11. 07 2月, 2017 5 次提交
  12. 26 1月, 2017 2 次提交
  13. 22 1月, 2017 1 次提交
  14. 20 1月, 2017 1 次提交
    • M
      qemu: set default vhost-user ifname · 57b5e27d
      Michal Privoznik 提交于
      Based on work of Mehdi Abaakouk <sileht@sileht.net>.
      
      When parsing vhost-user interface XML and no ifname is found we
      can try to fill it in in post parse callback. The way this works
      is we try to make up interface name from given socket path and
      then ask openvswitch whether it knows the interface.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      57b5e27d
  15. 17 1月, 2017 1 次提交
  16. 13 1月, 2017 1 次提交
    • M
      qemu: Copy SELinux labels for namespace too · 93a062c3
      Michal Privoznik 提交于
      When creating new /dev/* for qemu, we do chown() and copy ACLs to
      create the exact copy from the original /dev. I though that
      copying SELinux labels is not necessary as SELinux will chose the
      sane defaults. Surprisingly, it does not leaving namespace with
      the following labels:
      
      crw-rw-rw-. root root system_u:object_r:tmpfs_t:s0     random
      crw-------. root root system_u:object_r:tmpfs_t:s0     rtc0
      drwxrwxrwt. root root system_u:object_r:tmpfs_t:s0     shm
      crw-rw-rw-. root root system_u:object_r:tmpfs_t:s0     urandom
      
      As a result, domain is unable to start:
      
      error: internal error: process exited while connecting to monitor: Error in GnuTLS initialization: Failed to acquire random data.
      qemu-kvm: cannot initialize crypto: Unable to initialize GNUTLS library: Failed to acquire random data.
      
      The solution is to copy the SELinux labels as well.
      Reported-by: NAndrea Bolognani <abologna@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      93a062c3
  17. 12 1月, 2017 4 次提交
  18. 11 1月, 2017 1 次提交
  19. 10 1月, 2017 1 次提交