1. 13 4月, 2016 8 次提交
  2. 11 4月, 2016 2 次提交
  3. 10 4月, 2016 1 次提交
    • R
      qemu: fix build without gnutls installed · acb63aaf
      Roman Bogorodskiy 提交于
      Move including of gnutls/gnutls.h in qemu/qemu_domain.c under the
      "ifdef WITH_GNUTLS" check because otherwise it fails like this:
      
        CC       qemu/libvirt_driver_qemu_impl_la-qemu_domain.lo
      qemu/qemu_domain.c:50:10: fatal error: 'gnutls/gnutls.h' file not found
      
      in case if gnutls is not installed on the system.
      acb63aaf
  4. 08 4月, 2016 2 次提交
  5. 07 4月, 2016 10 次提交
    • A
      qemu: Explicitly check for gnutls_rnd() · 2d23d145
      Andrea Bolognani 提交于
      Our use of gnutls_rnd(), introduced with commit ad7520e8, is
      conditional to the availability of the <gnutls/crypto.h> header
      file.
      
      Such check, however, turns out not to be strict enough, as there
      are some versions of GnuTLS (eg. 2.8.5 from CentOS 6) that provide
      the header file, but not the function itself, which was introduced
      only in GnuTLS 2.12.0.
      
      Introduce an explicit check for the function.
      2d23d145
    • P
      qemu: perf: Fix crash/memory corruption on failed VM start · 03e8d5fb
      Peter Krempa 提交于
      The new perf code didn't bother to clear a pointer in 'priv' causing a
      double free or other memory corruption goodness if a VM failed to start.
      
      Clear the pointer after freeing the memory.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1324757
      03e8d5fb
    • P
      qemu: alias: Fix calculation of memory device aliases · be6e92f5
      Peter Krempa 提交于
      For device hotplug, the new alias ID needs to be checked in the list
      rather than using the count of devices. Unplugging a device that is not
      last in the array will make further hotplug impossible due to alias
      collision.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1324551
      be6e92f5
    • P
      qemu: alias: Fix calculation of RNG device aliases · bd19b4b2
      Peter Krempa 提交于
      For device hotplug, the new alias ID needs to be checked in the list
      rather than using the count of devices. Unplugging a device that is not
      last in the array will make further hotplug impossible due to alias
      collision.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1324551
      bd19b4b2
    • J
      secret: Introduce virSecretGetSecretString · 2844de6f
      John Ferlan 提交于
      Commit id 'fb2bd208' essentially copied the qemuGetSecretString
      creating an libxlGetSecretString.  Rather than have multiple copies
      of the same code, create src/secret/secret_util.{c,h} files and
      place the common function in there.
      
      Modify the the build in order to build the module as a library
      which is then pulled in by both the qemu and libxl drivers for
      usage from both qemu_command.c and libxl_conf.c
      2844de6f
    • J
      qemu: Introduce qemuBuildMasterKeyCommandLine · d8a8cae3
      John Ferlan 提交于
      If the -object secret capability exists, then get the path to the
      masterKey file and provide that to qemu. Checking for the existence
      of the file before passing to qemu could be done, but causes issues
      in mock test environment.
      
      Since the qemuDomainObjPrivate is not available when building the
      command line, the qemuBuildHasMasterKey API will have to suffice
      as the primary arbiter for whether the capability exists in order
      to find/return the path to the master key for usage.
      
      Created the qemuDomainGetMasterKeyAlias API which will be used by
      later patches to define the 'keyid' (eg, masterKey) to be used by
      other secrets to provide the id to qemu for the master key.
      d8a8cae3
    • J
      qemu: Create domain master key · ad7520e8
      John Ferlan 提交于
      Add a masterKey and masterKeyLen to _qemuDomainObjPrivate to store a
      random domain master key and its length in order to support the ability
      to encrypt/decrypt sensitive data shared between libvirt and qemu. The
      key will be base64 encoded and written to a file to be used by the
      command line building code to share with qemu.
      
      New API's from this patch:
      
        qemuDomainGetMasterKeyFilePath:
          Return a path to where the key is located
      
        qemuDomainWriteMasterKeyFile: (private)
          Open (create/trunc) the masterKey path and write the masterKey
      
        qemuDomainMasterKeyReadFile:
          Using the master key path, open/read the file, and store the
          masterKey and masterKeyLen. Expected use only from qemuProcessReconnect
      
        qemuDomainGenerateRandomKey: (private)
          Generate a random key using available algorithms
      
          The key is generated either from the gnutls_rnd function if it
          exists or a less cryptographically strong mechanism using
          virGenerateRandomBytes
      
         qemuDomainMasterKeyRemove:
          Remove traces of the master key, remove the *KeyFilePath
      
        qemuDomainMasterKeyCreate:
          Generate the domain master key and save the key in the location
          returned by qemuDomainGetMasterKeyFilePath.
      
          This API will first ensure the QEMU_CAPS_OBJECT_SECRET is set
          in the capabilities. If not, then there's no need to generate
          the secret or file.
      
      The creation of the key will be attempted from qemuProcessPrepareHost
      once the libDir directory structure exists.
      
      The removal of the key will handled from qemuProcessStop just prior
      to deleting the libDir tree.
      
      Since the key will not be written out to the domain object XML file,
      the qemuProcessReconnect will read the saved file and restore the
      masterKey and masterKeyLen.
      ad7520e8
    • J
      qemu: Add capability bit for qemu secret object · d125685a
      John Ferlan 提交于
      Add a capability bit for the qemu secret object.
      
      Adjust the 2.6.0-1 caps/replies to add the secret object. For the
      .replies it's take from the '{"execute":"qom-list-types"}' output.
      d125685a
    • J
      qemu: Tear down the cgroup before reattach device to host · 2fbf29a5
      John Ferlan 提交于
      When a hostdev is attached to the guest (and removed from the host),
      the order of operations is call qemuHostdevPreparePCIDevices to remove
      the device from the host, call qemuSetupHostdevCgroup to setup the cgroups,
      and virSecurityManagerSetHostdevLabel to set the labels.
      
      When the device is removed from the guest, the code didn't use the
      reverse order leading to possible issues (especially if the path to
      the device no longer exists). This patch will move the call to
      qemuTeardownHostdevCgroup to prior to reattaching the device to
      the host.
      2fbf29a5
    • J
      qemu: Restore label before reattach device to host · 409de00e
      John Ferlan 提交于
      When a hostdev is attached to the guest (and removed from the host),
      the order of operations is call qemuHostdevPreparePCIDevices to remove
      the device from the host, call qemuSetupHostdevCgroup to setup the cgroups,
      and virSecurityManagerSetHostdevLabel to set the labels.
      
      When the device is removed from the guest, the code didn't use the
      reverse order leading to possible issues (especially if the path to
      the device no longer exists). This patch will move the call to
      virSecurityManagerRestoreHostdevLabel to prior to reattaching the
      device to the host.
      409de00e
  6. 06 4月, 2016 1 次提交
  7. 05 4月, 2016 6 次提交
  8. 04 4月, 2016 4 次提交
    • L
      qemu: fix alias name for <interface type='hostdev'> · 8f74f527
      Laine Stump 提交于
      Starting with commit f8e712fe, if you start a domain that has an
      <interface type='hostdev' (or that has <interface type='network'>
      where the network is a pool of devices for hostdev assignment), when
      you later try to add *another* interface (of any kind) with hotplug,
      the function qemuAssignDeviceNetAlias() fails as soon as it sees a
      "hostdevN" alias in the list of interfaces), causing the attach to
      fail.
      
      This is because (starting with f8e712fe) the device alias names are
      assigned during the new function qemuProcessPrepareDomain(), which is
      called *before* networkAllocateActualDevice() (which is called from
      qemuProcessPrepareHost(), which is called from
      qemuProcessLaunch()). Prior to that commit,
      networkAllocateActualDevice() was called first.
      
      The problem with this is that the alias for interfaces that are really
      a hostdev (<interface type='hostdev'>) is of the form "hostdevN" (just
      like other hostdevs), while other interfaces are "netN". But if you
      don't know that the interface is going to be a hostdev at the time you
      assign the alias name, you can't name it differently. (As far as I've
      seen so far, the change in name by itself wouldn't have been a problem
      (other than just an outwardly noticeable change in behavior) except
      for the abovementioned failure to attach/detach new interfaces.
      
      Rather than take the chance that there may be other not-yet-revealed
      problems associated with changing the alias name, this patch changes
      the way that aliases are assigned to restore the old behavior.
      
      Old: In the past, assigning an alias to an interface was skipped if it
      was seen that the interface was type='hostdev' - we knew that the
      hostdev part of the interface was also in the list of hostdevs (that's
      part of what happens in networkAllocateActualDevice()) and it would be
      assigned when all the other hostdev aliases were assigned.
      
      New: When assigning an alias to an interface, we haven't yet called
      networkAllocateActualDevice() to construct the hostdev part of the
      interface, so we can't just wait for the loop that creates aliases for
      all the hostdevs (there's nothing on that list for this device
      yet!). Instead we handle it immediately in the loop creating interface
      aliases, by calling the new function networkGetActualType() to
      determine if it is going to be hostdev, and if so calling
      qemuAssignDeviceHostdevAlias() instead.
      
      Some adjustments have to be made to both
      qemuAssignDeviceHostdevAlias() and to qemuAssignDeviceNetAlias() to
      accommodate this. In both of them, an error return from
      qemuDomainDeviceAliasIndex() is no longer considered an error; instead
      it's just ignored (because it almost certainly means that the alias
      string for the device was "net" when we expected "hostdev" or vice
      versa). in qemuAssignDeviceHostdevAlias() we have to look at all
      interface aliases for hostdevN in addition to looking at all hostdev
      aliases (this wasn't necessary in the past, because both the interface
      entry and the hostdev entry for the device already pointed at the
      device info; no longer the case since the hostdev entry hasn't yet
      been setup).
      
      Fortunately the buggy behavior hasn't yet been in any official release
      of libvirt.
      8f74f527
    • L
      qemu: change args to qemuAssignDeviceHostdevAlias() · f09c7139
      Laine Stump 提交于
      In certain cases, we need to assign a hostdevN-style alias in a case
      when we don't have a virDomainHostdevDefPtr (instead we have a
      virDomainNetDefPtr). Since qemuAssignDeviceHostdevAlias() doesn't use
      anything in the virDomainHostdevDef except the alias string itself
      anyway, this patch just changes the arguments to pass a pointer to the
      alias pointer instead.
      f09c7139
    • M
      qemu: Clear generated private paths · d558fb34
      Martin Kletzander 提交于
      The paths have the domain ID in them.  Without cleaning them, they would
      contain the same ID even after multiple restarts.  That could cause
      various problems, e.g. with access.
      
      Add function qemuDomainClearPrivatePaths() for this as a counterpart of
      qemuDomainSetPrivatePaths().
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      d558fb34
    • M
      qemu: Simplify calls to qemuDomainSetPrivatePaths · 1893b6df
      Martin Kletzander 提交于
      Since commit 9dca74ee, the function can take driver and a vm, no
      need to overcomplicate.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      1893b6df
  9. 01 4月, 2016 2 次提交
  10. 31 3月, 2016 4 次提交