1. 22 1月, 2017 1 次提交
  2. 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
  3. 17 1月, 2017 1 次提交
  4. 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
  5. 12 1月, 2017 4 次提交
  6. 11 1月, 2017 1 次提交
  7. 10 1月, 2017 4 次提交
  8. 05 1月, 2017 2 次提交
  9. 04 1月, 2017 4 次提交
    • M
      qemuDomainCreateDevice: Be more careful about device path · dd78da09
      Michal Privoznik 提交于
      Again, not something that I'd hit, but there is a chance in
      theory that this might bite us. Currently the way we decide
      whether or not to create /dev entry for a device is by marching
      first four characters of path with "/dev". This might be not
      enough. Just imagine somebody has a disk image stored under
      "/devil/path/to/disk". We ought to be matching against "/dev/".
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      dd78da09
    • M
      qemuDomainAttachDeviceMknodHelper: Don't unlink() so often · ce01a2b1
      Michal Privoznik 提交于
      Not that I'd encounter any bug here, but the code doesn't look
      100% correct. Imagine, somebody is trying to attach a device to a
      domain, and the device's /dev entry already exists in the qemu
      namespace. This is handled gracefully and the control continues
      with setting up ACLs and calling security manager to set up
      labels. Now, if any of these steps fail, control jump on the
      'cleanup' label and unlink() the file straight away. Even when it
      was not us who created the file in the first place. This can be
      possibly dangerous.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      ce01a2b1
    • M
      qemu: Handle EEXIST gracefully in qemuDomainCreateDevice · 3aae99fe
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1406837
      
      Imagine you have a domain configured in such way that you are
      assigning two PCI devices that fall into the same IOMMU group.
      With mount namespace enabled what happens is that for the first
      PCI device corresponding /dev/vfio/X entry is created and when
      the code tries to do the same for the second mknod() fails as
      /dev/vfio/X already exists:
      
      2016-12-21 14:40:45.648+0000: 24681: error :
      qemuProcessReportLogError:1792 : internal error: Process exited
      prior to exec: libvirt: QEMU Driver error : Failed to make device
      /var/run/libvirt/qemu/windoze.dev//vfio/22: File exists
      
      Worse, by default there are some devices that are created in the
      namespace regardless of domain configuration (e.g. /dev/null,
      /dev/urandom, etc.). If one of them is set as backend for some
      guest device (e.g. rng, chardev, etc.) it's the same story as
      described above.
      
      Weirdly, in attach code this is already handled.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3aae99fe
    • J
      qemu: Don't assume secret provided for LUKS encryption · 7f7d9904
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1405269
      
      If a secret was not provided for what was determined to be a LUKS
      encrypted disk (during virStorageFileGetMetadata processing when
      called from qemuDomainDetermineDiskChain as a result of hotplug
      attach qemuDomainAttachDeviceDiskLive), then do not attempt to
      look it up (avoiding a libvirtd crash) and do not alter the format
      to "luks" when adding the disk; otherwise, the device_add would
      fail with a message such as:
      
         "unable to execute QEMU command 'device_add': Property 'scsi-hd.drive'
          can't find value 'drive-scsi0-0-0-0'"
      
      because of assumptions that when the format=luks that libvirt would have
      provided the secret to decrypt the volume.
      
      Access to unlock the volume will thus be left to the application.
      7f7d9904
  10. 20 12月, 2016 1 次提交
  11. 16 12月, 2016 1 次提交
  12. 15 12月, 2016 13 次提交
  13. 08 12月, 2016 1 次提交
  14. 01 12月, 2016 1 次提交
    • L
      qemu: propagate virQEMUDriver object to qemuDomainDeviceCalculatePCIConnectFlags · 9b0848d5
      Laine Stump 提交于
      If libvirtd is running unprivileged, it can open a device's PCI config
      data in sysfs, but can only read the first 64 bytes. But as part of
      determining whether a device is Express or legacy PCI,
      qemuDomainDeviceCalculatePCIConnectFlags() will be updated in a future
      patch to call virPCIDeviceIsPCIExpress(), which tries to read beyond
      the first 64 bytes of the PCI config data and fails with an error log
      if the read is unsuccessful.
      
      In order to avoid creating a parallel "quiet" version of
      virPCIDeviceIsPCIExpress(), this patch passes a virQEMUDriverPtr down
      through all the call chains that initialize the
      qemuDomainFillDevicePCIConnectFlagsIterData, and saves the driver
      pointer with the rest of the iterdata so that it can be used by
      qemuDomainDeviceCalculatePCIConnectFlags(). This pointer isn't used
      yet, but will be used in an upcoming patch (that detects Express vs
      legacy PCI for VFIO assigned devices) to examine driver->privileged.
      9b0848d5
  15. 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
  16. 23 11月, 2016 2 次提交
    • N
      qemu: agent: fix unsafe agent access · aaf2992d
      Nikolay Shirokovskiy 提交于
      qemuDomainObjExitAgent is unsafe.
      
      First it accesses domain object without domain lock.
      Second it uses outdated logic that goes back to commit 79533da1 of
      year 2009 when code was quite different. (unref function
      instead of unreferencing only unlocked and disposed object
      in case of last reference and leaved unlocking to the caller otherwise).
      Nowadays this logic may lead to disposing locked object
      i guess.
      
      Another problem is that the callers of qemuDomainObjEnterAgent
      use domain object again (namely priv->agent) without domain lock.
      
      This patch address these two problems.
      
      qemuDomainGetAgent is dropped as unused.
      aaf2992d
    • N
      qemu: drop write-only agentStart · 3c1c5678
      Nikolay Shirokovskiy 提交于
      3c1c5678
  17. 22 11月, 2016 1 次提交