1. 18 7月, 2016 1 次提交
  2. 11 7月, 2016 6 次提交
    • M
      qemuDomainObjPrivateFree: Free @masterKey too · 6b6e2cf9
      Michal Privoznik 提交于
      This one's a bit more complicated. In qemuProcessPrepareDomain()
      a master key for encrypting secret for ciphered disks is created.
      This object lives within qemuDomainObjPrivate object. It is freed
      in qemuProcessStop(), but if nobody calls it (for instance like
      our qemuxml2argvtest does), the key object leaks.
      
      ==17078== 32 bytes in 1 blocks are definitely lost in loss record 633 of 707
      ==17078==    at 0x4C2C070: calloc (vg_replace_malloc.c:623)
      ==17078==    by 0xAD924DF: virAllocN (viralloc.c:191)
      ==17078==    by 0x5050BA6: virCryptoGenerateRandom (qemuxml2argvmock.c:166)
      ==17078==    by 0x453DC8: qemuDomainMasterKeyCreate (qemu_domain.c:678)
      ==17078==    by 0x47A36B: qemuProcessPrepareDomain (qemu_process.c:4913)
      ==17078==    by 0x47C728: qemuProcessCreatePretendCmd (qemu_process.c:5542)
      ==17078==    by 0x433698: testCompareXMLToArgvFiles (qemuxml2argvtest.c:332)
      ==17078==    by 0x4339AC: testCompareXMLToArgvHelper (qemuxml2argvtest.c:413)
      ==17078==    by 0x446E7A: virTestRun (testutils.c:179)
      ==17078==    by 0x445BD9: mymain (qemuxml2argvtest.c:2022)
      ==17078==    by 0x44886F: virTestMain (testutils.c:969)
      ==17078==    by 0x445D9B: main (qemuxml2argvtest.c:2036)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      6b6e2cf9
    • D
      Fix logic in qemuDomainObjPrivateXMLParseVcpu · ed1fbd7c
      Daniel P. Berrange 提交于
      The code in qemuDomainObjPrivateXMLParseVcpu for parsing
      the 'idstr' string was comparing the overall boolean
      result against 0 which was always true
      
      qemu/qemu_domain.c: In function 'qemuDomainObjPrivateXMLParseVcpu':
      qemu/qemu_domain.c:1482:59: error: comparison of constant '0' with boolean expression is always false [-Werror=bool-compare]
           if ((idstr && virStrToLong_uip(idstr, NULL, 10, &idx)) < 0 ||
                                                                 ^
      
      It was further performing two distinct error checks in
      the same conditional and reporting a single error message,
      which was misleading in one of the two cases.
      
      This splits the conditional check into two parts with
      distinct error messages and fixes the logic error.
      
      Fixes the bug in
      
        commit 5184f398
        Author: Peter Krempa <pkrempa@redhat.com>
        Date:   Fri Jul 1 14:56:14 2016 +0200
      
          qemu: Store vCPU thread ids in vcpu private data objects
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ed1fbd7c
    • P
      qemu: Store vCPU thread ids in vcpu private data objects · 5184f398
      Peter Krempa 提交于
      Rather than storing them in an external array store them directly.
      5184f398
    • P
      qemu: Add cpu ID to the vCPU pid list in the status XML · 3f57ce4a
      Peter Krempa 提交于
      Note the vcpu ID so that once we allow non-contiguous vCPU topologies it
      will be possible to pair thread id's with the vcpus.
      3f57ce4a
    • P
      qemu: domain: Extract formating and parsing of vCPU thread ids · b91335af
      Peter Krempa 提交于
      Further patches will be adding index and modifying the source variables
      so this will make it more clear.
      b91335af
    • P
      qemu: domain: Add vcpu private data structure · 2540c932
      Peter Krempa 提交于
      Members will be added in follow-up patches.
      2540c932
  3. 08 7月, 2016 1 次提交
  4. 04 7月, 2016 1 次提交
  5. 02 7月, 2016 1 次提交
  6. 28 6月, 2016 1 次提交
  7. 27 6月, 2016 1 次提交
    • L
      qemu: forbid setting guest-side IP address/route info of <interface> · d987f63a
      Laine Stump 提交于
      libvirt's qemu driver doesn't have direct access to the config on the
      guest side of a network interface, and currently doesn't have any
      method in place to even inform the guest of the desired config. In the
      future, an unenforceable attempt to set the guest-side IP info could
      be made by adding a static host entry to the appropriate dnsmasq
      configuration (or changing the default dhcp client address on the qemu
      commandline for type='user' interfaces), or enhancing the guest agent
      to allow setting an IP address, but for now it can't have any effect,
      and we don't want to give the illusion that it does.
      
      To prevent the "disappearance" of any existing configs with ip
      address/route info (due to parser failure), this check is added in the
      newly implemented qemuDomainDeviceDefValidate(), which is only called
      when a domain is defined or started, *not* when it is reread from disk
      at libvirtd startup.
      d987f63a
  8. 25 6月, 2016 2 次提交
  9. 24 6月, 2016 4 次提交
  10. 23 6月, 2016 1 次提交
  11. 22 6月, 2016 2 次提交
  12. 20 6月, 2016 1 次提交
  13. 18 6月, 2016 1 次提交
    • A
      qemu: Permit PCI-free aarch64 mach-virt guests · 86a68bdb
      Andrea Bolognani 提交于
      There has been some progress lately in enabling virtio-pci on
      aarch64 guests; however, guest OS support is still spotty at best,
      so most guests are going to be using virtio-mmio instead.
      
      Currently, mach-virt guests are closely modeled after q35 guests,
      and that includes always adding a dmi-to-pci-bridge that's just
      impossible to get rid of. While that's acceptable (if suboptimal)
      for q35, where you will always need some kind of PCI device anyway,
      mach-virt guests should be allowed to avoid it.
      86a68bdb
  14. 17 6月, 2016 5 次提交
    • A
      b31b3eee
    • P
    • P
      conf: Remove pre-calculation of initial memory size · a877a163
      Peter Krempa 提交于
      While we need to know the difference between the total memory stored in
      <memory> and the actual size not included in the possible memory modules
      we can't pre-calculate it reliably. This is due to the fact that
      libvirt's XML is copied via formatting and parsing the XML and the
      initial memory size can be reliably calculated only when certain
      conditions are met due to backwards compatibility.
      
      This patch removes the storage of 'initial_memory' and fixes the helpers
      to recalculate the initial memory size all the time from the total
      memory size. This conversion is possible when we also make sure that
      memory hotplug accounts properly for the update of the total memory size
      and thus the helpers for inserting and removing memory devices need to
      be tweaked too.
      
      This fixes a bug where a cold-plug and cold-remove of a memory device
      would increase the size reported in <memory> in the XML by the size of
      the memory device. This would happen as the persistent definition is
      copied before attaching the device and this would lead to the loss of
      data in 'initial_memory'.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1344892
      a877a163
    • L
      qemu: don't add pci-bridge to Q35/arm domains unless it's needed · d5fb8f45
      Laine Stump 提交于
      Until now, a Q35 domain (or arm/virt, or any other domain that has a
      pcie-root bus) would always have a pci-bridge added, so that there
      would be a hotpluggable standard PCI slot available to plug in any PCI
      devices that might be added. This patch removes the explicit add,
      instead relying on the pci-bridge being auto-added during PCI address
      assignment (it will add a pci-bridge if there are no free slots).
      
      This doesn't eliminate the dmi-to-pci-bridge controller that is
      explicitly added whether or not a standard PCI slot is required (and
      that is almost never used as anything other than a converter between
      pcie.0's PCIe slots and standard PCI). That will be done separately.
      d5fb8f45
    • L
      qemu: don't be as insistent about adding dmi-to-pci-bridge or pci-bridge · 97b215a4
      Laine Stump 提交于
      Previously there was no way to have a Q35 domain that didn't have
      these two controllers. This patch skips their creation as long as
      there are some other kinds of pci controllers at index 1 and 2
      (e.g. some pcie-root-port controllers).
      
      I'm hoping that soon we won't add them at all, plugging all devices
      into auto-added pcie-*-port ports instead, but in the meantime this
      makes it easier to experiment with alternative bus hierarchies.
      97b215a4
  15. 09 6月, 2016 3 次提交
    • P
      vnc: add support for listen type 'socket' · acc83afe
      Pavel Hrdina 提交于
      VNC graphics already supports sockets but only via 'socket' attribute.
      This patch coverts that attribute into listen type 'socket'.
      
      For backward compatibility we need to handle listen type 'socket' and 'socket'
      attribute properly to support old XMLs and new XMLs.  If both are provided they
      have to match, if only one of them is provided we need to be able to parse that
      configuration too.
      
      To not break migration back to old libvirt if the socket is provided by user we
      need to generate migratable XML without the listen element and use only 'socket'
      attribute.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      acc83afe
    • P
      vnc: rename socketAutogenerated to socketFromConfig · 17271d04
      Pavel Hrdina 提交于
      Even though it's auto-generated it's based on qemu.conf option and listen type
      address already uses "fromConfig" to carry this information.  Following commits
      will convert the socket to listen element so this rename is required because
      there will be also an option to get socket auto-generated independently on the
      qemu.conf option.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      17271d04
    • M
      qemu: Move channel path generation out of command creation · f670008b
      Martin Kletzander 提交于
      Put it into separate function called qemuDomainPrepareChannel() and call
      it from the new qemuProcessPrepareDomain().
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      f670008b
  16. 08 6月, 2016 2 次提交
  17. 07 6月, 2016 2 次提交
  18. 23 5月, 2016 1 次提交
  19. 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