1. 09 6月, 2016 2 次提交
  2. 08 6月, 2016 2 次提交
  3. 07 6月, 2016 2 次提交
  4. 23 5月, 2016 1 次提交
  5. 20 5月, 2016 4 次提交
    • 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
    • J
      qemu: Introduce qemuDomainSecretSetup · 97868a2b
      John Ferlan 提交于
      Currently just a shim to call qemuDomainSecretPlainSetup, but soon to be more
      97868a2b
    • J
      util: Introduce virCryptoGenerateRandom · 23803250
      John Ferlan 提交于
      Move the logic from qemuDomainGenerateRandomKey into this new
      function, altering the comments, variable names, and error messages
      to keep things more generic.
      
      NB: Although perhaps more reasonable to add soemthing to virrandom.c.
          The virrandom.c was included in the setuid_rpc_client, so I chose
          placement in vircrypto.
      23803250
    • P
  6. 19 5月, 2016 1 次提交
    • C
      qemu: Assign device addresses in PostParse · 5d7314bb
      Cole Robinson 提交于
      This wires up qemuDomainAssignAddresses into the new
      virDomainDefAssignAddressesCallback, so it's always triggered
      via virDomainDefPostParse. We are essentially doing this already
      with open coded calls sprinkled about.
      
      qemu argv parse output changes slightly since previously it wasn't
      hitting qemuDomainAssignAddresses.
      5d7314bb
  7. 18 5月, 2016 1 次提交
    • A
      qemu: Automatically choose usable GIC version · 1a012c9a
      Andrea Bolognani 提交于
      When the <gic/> element in not present in the domain XML, use the
      domain capabilities to figure out what GIC version is usable and
      choose that one automatically.
      
      This allows guests to be created on hardware that only supports
      GIC v3 without having to update virt-manager and similar tools.
      
      Keep using the default GIC version if the <gic/> element has been
      added to the domain XML but no version has been specified, as not
      to break existing guests.
      1a012c9a
  8. 16 5月, 2016 3 次提交
    • J
      secret: Alter virSecretGetSecretString · abd2272c
      John Ferlan 提交于
      Rather than returning a "char *" indicating perhaps some sized set of
      characters that is NUL terminated, alter the function to return 0 or -1
      for success/failure and add two parameters to handle returning the
      buffer and it's size.
      
      The function no longer encodes the returned secret, rather it returns
      the unencoded secret forcing callers to make the necessary adjustments.
      
      Alter the callers to handle the adjusted model.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      abd2272c
    • P
      qemu: domain: Fix names for functions that clear security info · fb1dddfb
      Peter Krempa 提交于
      They don't free the structure itself so they should be called *Clear
      rather than *Free.
      fb1dddfb
    • P
      secret: util: Refactor virSecretGetSecretString · 1d632c39
      Peter Krempa 提交于
      Call the internal driver callbacks rather than the public APIs to avoid
      calling unnecessarily the error dispatching code and don't overwrite
      the error messages provided by the APIs. They are good enough to
      describe which secret is missing either by UUID or the usage (basically
      name).
      1d632c39
  9. 13 5月, 2016 1 次提交
  10. 12 5月, 2016 1 次提交
  11. 11 5月, 2016 2 次提交
    • L
      conf: log error when incorrect PCI root controller is added to domain · e5aecc2f
      Laine Stump 提交于
      libvirt may automatically add a pci-root or pcie-root controller to a
      domain, depending on the arch/machinetype, and it hopefully always
      makes the right decision about which to add (since in all cases these
      controllers are an implicit part of the virtual machine).
      
      But it's always possible that someone will create a config that
      explicitly supplies the wrong type of PCI controller for the selected
      machinetype. In the past that would lead to an error later when
      libvirt was trying to assign addresses to other devices, for example:
      
        XML error: PCI bus is not compatible with the device at
        0000:00:02.0. Device requires a PCI Express slot, which is not
        provided by bus 0000:00
      
      (that's the error message that appears if you replace the pcie-root
      controller in a Q35 domain with a pci-root controller).
      
      This patch adds a check at the same place that the implicit
      controllers are added (to ensure that the same logic is used to check
      which type of pci root is correct). If a pci controller with index='0'
      is already present, we verify that it is of the model that we would
      have otherwise added automatically; if not, an error is logged:
      
        The PCI controller with index='0' must be " model='pcie-root' for
        this machine type, " but model='pci-root' was found instead.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1004602
      e5aecc2f
    • J
      qemu: Add extra checks for secret destroy API's · fc5c1e7f
      John Ferlan 提交于
      Remove the possibility that a NULL hostdev->privateData or a
      disk->privateData could crash libvirtd by checking for NULL
      before dereferencing for the secinfo structure in the
      qemuDomainSecret{Disk|Hostdev}Destroy functions. The hostdevPriv
      could be NULL if qemuProcessNetworkPrepareDevices adds a new
      hostdev during virDomainNetGetActualHostdev that then gets
      inserted via virDomainHostdevInsert. The hostdevPriv was added
      by commit id '27726d8c' and is currently only used by scsi hostdev.
      fc5c1e7f
  12. 09 5月, 2016 2 次提交
  13. 06 5月, 2016 3 次提交
    • J
      qemu: Introduce qemuDomainSecretIV · bead05ea
      John Ferlan 提交于
      Add the data structure and infrastructure to support an initialization
      vector (IV) secrets. The IV secret generation will need to have access
      to the domain private master key, so let's make sure the prepare disk
      and hostdev functions can accept that now.
      
      Anywhere that needs to make a decision over which secret type to use
      in order to fill in or use the IV secret has a switch added.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      bead05ea
    • J
      qemu: Split out the master key create and write · 608dfc6a
      John Ferlan 提交于
      A recent review of related changes noted that we should split the creation
      (or generation) of the master key into the qemuProcessPrepareDomain and leave
      the writing of the master key for qemuProcessPrepareHost.
      
      Made the adjustment and modified some comments to functions that have
      changed calling parameters, but didn't change the intro doc.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      608dfc6a
    • J
      qemu: Adjust names of qemuDomainSecretInfoType enums · 70ae856e
      John Ferlan 提交于
      From a review after push, add the "_TYPE" into the name.
      
      Also use qemuDomainSecretInfoType in the struct rather than int
      with the comment field containing the struct name
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      70ae856e
  14. 03 5月, 2016 4 次提交
  15. 02 5月, 2016 11 次提交
    • B
      qemu: add default panic device to S390 guests · 73e4e10e
      Boris Fiuczynski 提交于
      This patch adds by default a panic device with model s390 to S390 guests.
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      73e4e10e
    • B
      qemu: add panic device support for S390 · d8554654
      Boris Fiuczynski 提交于
      If a panic device is being defined without a model in a domain
      the default value is always overwritten with model ISA. An ISA
      bus does not exist on S390 and therefore specifying a panic device
      results in an unsupported configuration.
      Since the S390 architecture inherently provides a crash detection
      capability the panic device should be defined in the domain xml.
      
      This patch adds an s390 panic device model and prevents setting a
      device address on it.
      Signed-off-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      d8554654
    • B
    • S
      send default USB controller in xml to destination during migration · 192a53e0
      Shivaprasad G Bhat 提交于
      The default USB controller is not sent to destination as the older versions
      of libvirt(0.9.4 or earlier as I see in commit log of 409b5f54) didn't
      support them. For some archs where the support started much later can
      safely send the USB controllers without this worry. So, send the controller
      to destination for all archs except x86. Moreover this is not very applicable
      to x86 as the USB controller has model ich9_ehci1 on q35 and for pc-i440fx,
      there cant be any slots before USB as it is fixed on slot 1.
      
      The patch fixes a bug that, if the USB controller happens to occupy
      a slot after disks/interfaces and one of them is hot-unplugged, then
      the default USB controller added on destination takes the smallest slot
      number and that would lead to savestate mismatch and migration
      failure. Seen and verified on PPC64.
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      192a53e0
    • J
      qemu: Introduce qemuDomainSecretHostdevPrepare and Destroy · d0816650
      John Ferlan 提交于
      Similar to the qemuDomainSecretDiskPrepare, generate the secret
      for the Hostdev's prior to call qemuProcessLaunch which calls
      qemuBuildCommandLine. Additionally, since the secret is not longer
      added as part of building the command, the hotplug code will need
      to make the call to add the secret in the hostdevPriv.
      
      Since this then is the last requirement to pass a virConnectPtr
      to qemuBuildCommandLine, we now can remove that as part of these
      changes. That removal has cascading effects through various callers.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      d0816650
    • J
      qemu: Introduce qemuDomainHostdevPrivatePtr · 27726d8c
      John Ferlan 提交于
      Modeled after the qemuDomainDiskPrivatePtr logic, create a privateData
      pointer in the _virDomainHostdevDef to allow storage of private data
      for a hypervisor in order to at least temporarily store auth/secrets
      data for usage during qemuBuildCommandLine.
      
      NB: Since the qemu_parse_command (qemuParseCommandLine) code is not
      expecting to restore the auth/secret data, there's no need to add
      code to handle this new structure there.
      
      Updated copyrights for modules touched. Some didn't have updates in a
      couple years even though changes have been made.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      27726d8c
    • J
      qemu: Introduce qemuDomainSecretPrepare and Destroy · 40d8e2ba
      John Ferlan 提交于
      Rather than needing to pass the conn parameter to various command
      line building API's, add qemuDomainSecretPrepare just prior to the
      qemuProcessLaunch which calls qemuBuilCommandLine. The function
      must be called after qemuProcessPrepareHost since it's expected
      to eventually need the domain masterKey generated during the prepare
      host call. Additionally, future patches may require device aliases
      (assigned during the prepare domain call) in order to associate
      the secret objects.
      
      The qemuDomainSecretDestroy is called after the qemuProcessLaunch
      finishes in order to clear and free memory used by the secrets
      that were recently prepared, so they are not kept around in memory
      too long.
      
      Placing the setup here is beneficial for future patches which will
      need the domain masterKey in order to generate an encrypted secret
      along with an initialization vector to be saved and passed (since
      the masterKey shouldn't be passed around).
      
      Finally, since the secret is not added during command line build,
      the hotplug code will need to get the secret into the private disk data.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      40d8e2ba
    • J
      qemu: Introduce qemuDomainSecretInfo · 48f56a9c
      John Ferlan 提交于
      Introduce a new private structure to hold qemu domain auth/secret data.
      This will be stored in the qemuDomainDiskPrivate as a means to store the
      auth and fetched secret data rather than generating during building of
      the command line.
      
      The initial changes will handle the current username and secret values
      for rbd and iscsi disks (in their various forms). The rbd secret is
      stored as a base64 encoded value, while the iscsi secret is stored as
      a plain text value. Future changes will store encoded/encrypted secret
      data as well as an initialization vector needed to be given to qemu
      in order to decrypt the encoded password along with the domain masterKey.
      The inital assumption will be that VIR_DOMAIN_SECRET_INFO_PLAIN is
      being used.
      
      Although it's expected that the cleanup of the secret data will be
      done immediately after command line generation, reintroduce the object
      dispose function qemuDomainDiskPrivateDispose to handle removing
      memory associated with the structure for "normal" cleanup paths.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      48f56a9c
    • P
      qemu: hotplug: Allow update of disk default snapshot location · 662862ec
      Peter Krempa 提交于
      Since the field is internal to libvirt we can allow the users to modify
      it.
      662862ec
    • P
      qemu: domain: Check few more fields for when changing disk source · 3b3debfb
      Peter Krempa 提交于
      Both disk->src->shared and disk->src->readonly can't be modified when
      changing disk source for floppy and cdrom drives since both arguments
      are passed as arguments of the disk rather than the image in qemu.
      
      Historically these fields have only two possible values since they are
      represented as XML thus we need to ignore if user did not provide them
      and thus we are treating them as false.
      3b3debfb
    • P
      qemu: domain: Fix error message in qemuDomainDiskChangeSupported · a84d604d
      Peter Krempa 提交于
      disk->dst represents the <target> element in the XML.
      a84d604d