1. 22 2月, 2018 22 次提交
  2. 21 2月, 2018 2 次提交
  3. 20 2月, 2018 8 次提交
    • D
      Fix build with GCC 8 new switch fallthrough warnings · 75f4813c
      Daniel P. Berrangé 提交于
      GCC 8 became more fussy about detecting switch
      fallthroughs. First it doesn't like it if you have
      a fallthrough attribute that is not before a case
      statement. e.g.
      
         FOO:
         BAR:
         WIZZ:
            ATTRIBUTE_FALLTHROUGH;
      
      Is unacceptable as there's no final case statement,
      so while FOO & BAR are falling through, WIZZ is
      not falling through. IOW, GCC wants us to write
      
        FOO:
        BAR:
          ATTRIBUTE_FALLTHROUGH;
        WIZZ:
      
      Second, it will report risk of fallthrough even if you
      have a case statement for every single enum value, but
      only if the switch is nested inside another switch and
      the outer case statement has no final break. This is
      is arguably valid because despite the fact that we have
      cast from "int" to the enum typedef, nothing guarantees
      that the variable we're switching on only contains values
      that have corresponding switch labels. e.g.
      
         int domstate = 87539319;
         switch ((virDomainState)domstate) {
            ...
         }
      
      will not match enum value, but also not raise any kind
      of compiler warning. So it is right to complain about
      risk of fallthrough if no default: is present.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      75f4813c
    • D
      conf: add enum constants for default controller models · a302480d
      Daniel P. Berrangé 提交于
      The controller model is slightly unusual in that the default value is
      -1, not 0. As a result the default value is not covered by any of the
      existing enum cases. This in turn means that any switch() statements
      that think they have covered all cases, will in fact not match the
      default value at all. In the qemuDomainDeviceCalculatePCIConnectFlags()
      method this has caused a serious mistake where we fallthrough from the
      SCSI controller case, to the VirtioSerial controller case, and from
      the USB controller case to the IDE controller case.
      
      By adding explicit enum constant starting at -1, we can ensure switches
      remember to handle the default case.
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      a302480d
    • A
      qemu: Simplify modelName stringification · cbd1eba8
      Andrea Bolognani 提交于
      There's no need to perform checks before conversion, we can just
      call virDomainControllerPCIModelNameTypeToString() and check the
      results later on.
      
      Since the variables involved are only used for PCI controllers,
      we can declare them in the 'case' scope rather than in the
      function scope to make everything a bit nicer while at it.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      cbd1eba8
    • A
      qemu: Move skip for implicit PHB of pSeries guests · 35e9c02c
      Andrea Bolognani 提交于
      Performing the skip earlier will help us making the function
      nicer later on. We also make the condition for the skip a bit
      more precise, though that'a more for self-documenting purposes
      and doesn't change anything in practice.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      35e9c02c
    • A
      qemu: Move 'done' label in qemuBuildControllerDevStr() · 3424de62
      Andrea Bolognani 提交于
      Even when we skip part of the processing, we still want error
      checking on the buffer.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      3424de62
    • M
      storage_conf: Make virStorageAuthDefFormat return void · 82e43ae1
      Michal Privoznik 提交于
      This function returns nothing but zero. Therefore it makes no
      sense to have it returning an integer.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      82e43ae1
    • M
      virDomainDiskSourceFormatInternal: Avoid leaking @childBuf · 4e657f2a
      Michal Privoznik 提交于
      If formatting of storage encryption or private data fails we must
      jump to the error label instead of returning immediately
      otherwise @attrBuf and @childBuf might be leaked.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      4e657f2a
    • L
      conf: move 'generated' member from virMacAddr to virDomainNetDef · e62cb4a9
      Laine Stump 提交于
      Commit 7e62c4cd (first appearing in libvirt-3.9.0 as a resolution
      to rhbz #1343919) added a "generated" attribute to virMacAddr that was
      set whenever a mac address was auto-generated by libvirt. This
      knowledge was used in a single place - when trying to match a NetDef
      from the Domain to Delete with user-provided XML. Since the XML parser
      always auto-generates a MAC address for NetDefs when none is provided,
      it was previously impossible to make a search where the MAC address
      isn't significant, but the addition of the "generated" attribute made
      it possible for the search function to ignore auto-generated MACs.
      
      This implementation had a problem though - it was adding a field to a
      "low level" struct - virMacAddr - which is used in other places with
      the assumption that it contains exactly a 6 byte MAC address and
      nothing else. In particular, virNWFilterSnoopEthHdr uses virMacAddr as
      part of the definition of an ethernet packet header, whose layout must
      of course match an actual ethernet packet. Adding the extra bools into
      virNWFilterSnoopEthHdr caused the nwfilter driver's "IP discovery via
      DHCP packet snooping" functionality to mysteriously stop working.
      
      In order to fix that behavior, and prevent potential future similar
      odd behavior, this patch moves the "generated" member out of
      virMacAddr (so that it is again really is just a MAC address) into
      virDomainNetDef, and sets it only when virDomainNetGenerateMAC() is
      called from virDomainNetDefParseXML() (which is the only time we care
      about it).
      
      Resolves: https://bugzilla.redhat.com/1529338
      
      (It should also be applied to any maintenance branch that applies
      commit 7e62c4cd and friends to resolve
      https://bugzilla.redhat.com/1343919)
      Signed-off-by: NLaine Stump <laine@laine.org>
      e62cb4a9
  4. 19 2月, 2018 8 次提交