1. 16 5月, 2018 1 次提交
  2. 11 5月, 2018 1 次提交
    • M
      qemu: Generate pr cmd line at startup · 13fe558f
      Michal Privoznik 提交于
      For command line we need two things:
      
      1) -object pr-manager-helper,id=$alias,path=$socketPath
      2) -drive file.pr-manager=$alias
      
      In -object pr-manager-helper we tell qemu which socket to connect
      to, then in -drive file-pr-manager we just reference the object
      the drive in question should use.
      
      For managed PR helper the alias is always "pr-helper0" and socket
      path "${vm->priv->libDir}/pr-helper0.sock".
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      13fe558f
  3. 04 5月, 2018 1 次提交
  4. 20 3月, 2018 1 次提交
    • J
      qemu: Don't assign alias to disabled balloon device · 1554eafb
      Jiri Denemark 提交于
      <memballoon model='none'/> is the only way to disable balloon driver
      since libvirt will add one automatically if the memballoon element is
      missing. In other words, there's no balloon device if model is 'none'
      and generating an alias for it makes no sense. The alias will be ignored
      when parsing the XML and it will disappear once libvirtd is restarted.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      1554eafb
  5. 13 3月, 2018 1 次提交
  6. 09 2月, 2018 1 次提交
    • D
      conf: expand network device callbacks to cover resolving NIC type · a455d41e
      Daniel P. Berrangé 提交于
      Currently the QEMU driver will call directly into the network driver
      impl to modify resolve the atual type of NICs with type=network. It
      has todo this before it has allocated the actual NIC. This introduces
      a callback system to allow us to decouple the QEMU driver from the
      network driver.
      
      This is a short term step, as it ought to be possible to achieve the
      same end goal by simply querying XML via the public network API. The
      QEMU code in question though, has no virConnectPtr conveniently
      available at this time.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      a455d41e
  7. 01 2月, 2018 3 次提交
    • J
      qemu: Update qemuDomainFindSCSIControllerModel return · 5b5bff35
      John Ferlan 提交于
      Now that the controller model is updated during post parse callback,
      this code no longer needs to fetch the model based on the capabilities
      and can just return the model directly if the controller is found.
      
      Removal of @qemuCaps cascades through various callers which are now
      updated to not pass the capabilities.
      5b5bff35
    • J
      qemu: Introduce qemuDomainFindSCSIControllerModel · 6ae6ffd8
      John Ferlan 提交于
      Rather than repeat multiple steps in order to find the SCSI
      controller model, let's combine them into one helper that will
      return either the model from the definition or the default
      model based on the capabilities.
      
      This patch adds an extra check/error that the controller
      that's being found actually exists. This just clarifies that
      the error was because the controller doesn't exist rather
      than the more generic error that we were unable to determine
      the model from qemuDomainSetSCSIControllerModel when a -1
      was passed in and the capabilities were unable to find one.
      6ae6ffd8
    • J
      conf: Rework and rename virDomainDeviceFindControllerModel · 932862b8
      John Ferlan 提交于
      As it turns out virDomainDeviceFindControllerModel was only ever
      called for SCSI controllers using VIR_DOMAIN_CONTROLLER_TYPE_SCSI
      as a parameter.
      
      So rename to virDomainDeviceFindSCSIController and rather than
      return a model, let's return a virDomainControllerDefPtr to let
      the caller reference whatever it wants.
      932862b8
  8. 22 10月, 2017 1 次提交
    • M
      qemu_alias: Be more tolerant if alias don't follow our format · ad30f069
      Michal Privoznik 提交于
      When assigning alias to a device we usually iterate over other
      devices of its kind trying to find next index. We do this by
      stripping down the prefix and then parsing number at the end,
      Usually, if the prefix doesn't match the one we are expecting, we
      just continue with next iteration. Except for couple of
      functions: qemuGetNextChrDevIndex(),
      qemuAssignDeviceRedirdevAlias() and qemuAssignDeviceShmemAlias().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      ad30f069
  9. 19 10月, 2017 4 次提交
  10. 05 10月, 2017 1 次提交
  11. 18 4月, 2017 1 次提交
    • P
      qemu: refactor qemuDomainMachine* functions · ac97658d
      Pavel Hrdina 提交于
      Introduce new wrapper functions without *Machine* in the function
      name that take the whole virDomainDef structure as argument and
      call the existing functions with *Machine* in the function name.
      
      Change the arguments of existing functions to *machine* and *arch*
      because they don't need the whole virDomainDef structure and they
      could be used in places where we don't have virDomainDef.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      ac97658d
  12. 15 3月, 2017 1 次提交
    • M
      qemu: Implement NVDIMM · 1bc17319
      Michal Privoznik 提交于
      So, majority of the code is just ready as-is. Well, with one
      slight change: differentiate between dimm and nvdimm in places
      like device alias generation, generating the command line and so
      on.
      
      Speaking of the command line, we also need to append 'nvdimm=on'
      to the '-machine' argument so that the nvdimm feature is
      advertised in the ACPI tables properly.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1bc17319
  13. 22 2月, 2017 1 次提交
  14. 11 11月, 2016 1 次提交
  15. 18 10月, 2016 1 次提交
  16. 20 9月, 2016 1 次提交
  17. 09 9月, 2016 1 次提交
    • J
      qemu: Add support for TLS X.509 path to TCP chardev backend · ce61c164
      John Ferlan 提交于
      When building a chardev device string for tcp, add the necessary pieces to
      access provide the TLS X.509 path to qemu.  This includes generating the
      'tls-creds-x509' object and then adding the 'tls-creds' parameter to the
      VIR_DOMAIN_CHR_TYPE_TCP command line.
      
      Finally add the tests for the qemu command line. This test will make use
      of the "new(ish)" /etc/pki/qemu setting for a TLS certificate environment
      by *not* "resetting" the chardevTLSx509certdir prior to running the test.
      Also use the default "verify" option (which is "no").
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      ce61c164
  18. 02 8月, 2016 3 次提交
    • J
      qemu: Introduce qemuAliasFromHostdev · 647bc753
      John Ferlan 提交于
      Introduce a common API to generate the alias for a host device
      647bc753
    • J
      qemu: Make QEMU_DRIVE_HOST_PREFIX more private · dd0dbe1d
      John Ferlan 提交于
      Move QEMU_DRIVE_HOST_PREFIX into the qemu_alias.c to dissuade future
      callers from using it. Create qemuAliasDiskDriveSkipPrefix in order
      to handle the current consumers that desire to check if an alias has
      the drive- prefix and "get beyond it" in order to get the disk alias.
      dd0dbe1d
    • J
      qemu: Use qemuAliasFromDisk instead of qemuDeviceDriveHostAlias · 13effcaf
      John Ferlan 提交于
      Since we already have a function that will generate the drivestr from
      the alias, let's use it and remove the qemuDeviceDriveHostAlias.
      
      Move the QEMU_DRIVE_HOST_PREFIX definition into qemu_alias.h
      
      Also alter qemuAliasFromDisk to use the QEMU_DRIVE_HOST_PREFIX instead
      of "drive-%s".
      13effcaf
  19. 19 7月, 2016 1 次提交
  20. 20 5月, 2016 1 次提交
    • J
      qemu: Utilize qemu secret objects for RBD auth/secret · a1344f70
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1182074
      
      If they're available and we need to pass secrets to qemu, then use the
      qemu domain secret object in order to pass the secrets for RBD volumes
      instead of passing the base64 encoded secret on the command line.
      
      The goal is to make AES secrets the default and have no user interaction
      required in order to allow using the AES mechanism. If the mechanism
      is not available, then fall back to the current plain mechanism using
      a base64 encoded secret.
      
      New APIs:
      
      qemu_domain.c:
        qemuDomainGetSecretAESAlias:
          Generate/return the secret object alias for an AES Secret Info type.
          This will be called from qemuDomainSecretAESSetup.
      
        qemuDomainSecretAESSetup: (private)
          This API handles the details of the generation of the AES secret
          and saves the pieces that need to be passed to qemu in order for
          the secret to be decrypted. The encrypted secret based upon the
          domain master key, an initialization vector (16 byte random value),
          and the stored secret. Finally, the requirement from qemu is the IV
          and encrypted secret are to be base64 encoded.
      
      qemu_command.c:
        qemuBuildSecretInfoProps: (private)
          Generate/return a JSON properties object for the AES secret to
          be used by both the command building and eventually the hotplug
          code in order to add the secret object. Code was designed so that
          in the future perhaps hotplug could use it if it made sense.
      
        qemuBuildObjectSecretCommandLine (private)
          Generate and add to the command line the -object secret for the
          secret. This will be required for the subsequent RBD reference
          to the object.
      
        qemuBuildDiskSecinfoCommandLine (private)
          Handle adding the AES secret object.
      
      Adjustments:
      
      qemu_domain.c:
        The qemuDomainSecretSetup was altered to call either the AES or Plain
        Setup functions based upon whether AES secrets are possible (we have
        the encryption API) or not, we have secrets, and of course if the
        protocol source is RBD.
      
      qemu_command.c:
        Adjust the qemuBuildRBDSecinfoURI API's in order to generate the
        specific command options for an AES secret, such as:
      
          -object secret,id=$alias,keyid=$masterKey,data=$base64encodedencrypted,
                  format=base64
          -drive file=rbd:pool/image:id=myname:auth_supported=cephx\;none:\
                 mon_host=mon1.example.org\:6321,password-secret=$alias,...
      
        where the 'id=' value is the secret object alias generated by
        concatenating the disk alias and "-aesKey0". The 'keyid= $masterKey'
        is the master key shared with qemu, and the -drive syntax will
        reference that alias as the 'password-secret'. For the -drive
        syntax, the 'id=myname' is kept to define the username, while the
        'key=$base64 encoded secret' is removed.
      
        While according to the syntax described for qemu commit '60390a21'
        or as seen in the email archive:
      
          https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg04083.html
      
        it is possible to pass a plaintext password via a file, the qemu
        commit 'ac1d8878' describes the more feature rich 'keyid=' option
        based upon the shared masterKey.
      
      Add tests for checking/comparing output.
      
      NB: For hotplug, since the hotplug code doesn't add command line
          arguments, passing the encoded secret directly to the monitor
          will suffice.
      a1344f70
  21. 16 5月, 2016 1 次提交
  22. 07 4月, 2016 3 次提交
    • 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
      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
  23. 04 4月, 2016 2 次提交
    • 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
  24. 29 3月, 2016 1 次提交
  25. 17 2月, 2016 1 次提交