1. 11 7月, 2016 3 次提交
  2. 07 7月, 2016 4 次提交
    • M
      virDomainHostdevDefFree: Don't leak privateData · 6fcffcb1
      Michal Privoznik 提交于
      After 27726d8c a privateData is allocated in
      virDomainHostdevDefAlloc(). However, the counter part - freeing
      them in Free() is missing which leads to the following memory
      leak:
      
      ==6489== 24 bytes in 1 blocks are definitely lost in loss record 684 of 1,003
      ==6489==    at 0x4C2C070: calloc (vg_replace_malloc.c:623)
      ==6489==    by 0x54B7C94: virAllocVar (viralloc.c:560)
      ==6489==    by 0x5517BE6: virObjectNew (virobject.c:193)
      ==6489==    by 0x1B400121: qemuDomainHostdevPrivateNew (qemu_domain.c:798)
      ==6489==    by 0x5557B24: virDomainHostdevDefAlloc (domain_conf.c:2152)
      ==6489==    by 0x5575578: virDomainHostdevDefParseXML (domain_conf.c:12709)
      ==6489==    by 0x5582292: virDomainDefParseXML (domain_conf.c:16995)
      ==6489==    by 0x5583C98: virDomainDefParseNode (domain_conf.c:17470)
      ==6489==    by 0x5583B07: virDomainDefParse (domain_conf.c:17417)
      ==6489==    by 0x5583B95: virDomainDefParseFile (domain_conf.c:17441)
      ==6489==    by 0x55A3F24: virDomainObjListLoadConfig (virdomainobjlist.c:465)
      ==6489==    by 0x55A43E6: virDomainObjListLoadAllConfigs (virdomainobjlist.c:596)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      6fcffcb1
    • P
      conf: Isolate virDomainLiveConfigHelperMethod to libxl only · f3d3be3d
      Peter Krempa 提交于
      Libxl is the last user and I don't have the toolchain prepared to
      compile the libxl driver. Move it to the libxl driver to avoid having to
      refactor the code.
      f3d3be3d
    • P
      conf: Don't use virDomainLiveConfigHelperMethod in virDomainObjGetMetadata · ef881407
      Peter Krempa 提交于
      Few arguments of the function are not necessary any more which leads to
      some cleanups. The 'uri' argument had a stray ATTRIBUTE_UNUSED.
      ef881407
    • P
  3. 02 7月, 2016 4 次提交
    • L
      conf: support host-side IP/route information in <interface> · 98fa8f3e
      Laine Stump 提交于
      This is place as a sub-element of <source>, where other aspects of the
      host-side connection to the network device are located (network or
      bridge name, udp listen port, etc). It's a bit odd that the interface
      we're configuring with this info is itself named in <target dev='x'/>,
      but that ship sailed long ago:
      
          <interface type='ethernet'>
            <mac address='00:16:3e:0f:ef:8a'/>
            <source>
              <ip address='192.168.122.12' family='ipv4'
                  prefix='24' peer='192.168.122.1'/>
              <ip address='192.168.122.13' family='ipv4' prefix='24'/>
              <route family='ipv4' address='0.0.0.0'
                     gateway='192.168.122.1'/>
              <route family='ipv4' address='192.168.124.0' prefix='24'
                     gateway='192.168.124.1'/>
            </source>
          </interface>
      
      In practice, this will likely only be useful for type='ethernet', so
      its presence in any other type of interface is currently forbidden in
      the generic device Validate function (but it's been put into the
      general population of virDomainNetDef rather than the
      ethernet-specific union member so that 1) we can more easily add the
      capability to other types if needed, and 2) we can retain the info
      when set to an invalid interface type all the way through to
      validation and report a proper error, rather than just ignoring it
      (which is currently what happens for many other type-specific
      settings).
      
      (NB: The already-existing configuration of IP info for the guest-side
      of interfaces is in subelements directly under <interface>, and the
      name of the guest-side interface (when configurable) is in <guest
      dev='x'/>).
      
      (This patch had been pushed earlier in
      commit fe6a7789, but was reverted in
      commit d6584565 because it had been
      accidentally pushed during the freeze for release 2.0.0)
      98fa8f3e
    • V
      conf: allow setting peer address in <ip> element of <interface> · b81cf13e
      Vasiliy Tolstov 提交于
      The peer attribute is used to set the property of the same name in the
      interface IP info:
      
        <interface type='ethernet'>
          ...
          <ip family='ipv4' address='192.168.122.5'
              prefix='32' peer='192.168.122.6'/>
          ...
        </interface>
      
      Note that this element is used to set the IP information on the
      *guest* side interface, not the host side interface - that will be
      supported in an upcoming patch.
      
      (This patch now has quite a history: it was originally pushed in
      commit 690969af, which was subsequently reverted in commit 1d14b13f,
      then reworked and pushed (along with a lot of other related/supporting
      patches) in commit 93135abf; however *that* commit had been
      accidentally pushed during dev. freeze for release 2.0.0, so it was
      again reverted in commit f6acf039).
      Signed-off-by: NVasiliy Tolstov <v.tolstov@selfip.ru>
      Signed-off-by: NLaine Stump <laine@laine.org>
      b81cf13e
    • J
      encryption: Add <cipher> and <ivgen> to encryption · 2552fec2
      John Ferlan 提交于
      For a luks device, allow the configuration of a specific cipher to be
      used for encrypting the volume.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      2552fec2
    • L
      util: new function virXMLNodeSanitizeNamespaces() · b874f26b
      Laine Stump 提交于
      This is a generic version of virDomainDefMetadataSanitize() - the same
      functionality is now needed for network metadata.
      b874f26b
  4. 01 7月, 2016 1 次提交
    • J
      Introduce virDomainUSBDeviceDefForeach · 492b3bfd
      Ján Tomko 提交于
      A helper that will execute a callback on every USB device
      in the domain definition.
      
      With an ability to skip USB hubs, since we will want to treat
      them differently in some cases.
      492b3bfd
  5. 30 6月, 2016 2 次提交
  6. 27 6月, 2016 14 次提交
    • J
      Revert "conf: allow setting peer address in <ip> element of <interface>" · f6acf039
      Ján Tomko 提交于
      This reverts commit 93135abf.
      
      This feature was accidentally pushed in the feature freeze.
      f6acf039
    • J
      Revert "conf: support host-side IP/route information in <interface>" · d6584565
      Ján Tomko 提交于
      This reverts commit fe6a7789.
      
      This feature was accidentally pushed in the feature freeze.
      d6584565
    • L
      conf: support host-side IP/route information in <interface> · fe6a7789
      Laine Stump 提交于
      This is place as a sub-element of <source>, where other aspects of the
      host-side connection to the network device are located (network or
      bridge name, udp listen port, etc). It's a bit odd that the interface
      we're configuring with this info is itself named in <target dev='x'/>,
      but that ship sailed long ago:
      
          <interface type='ethernet'>
            <mac address='00:16:3e:0f:ef:8a'/>
            <source>
              <ip address='192.168.122.12' family='ipv4'
                  prefix='24' peer='192.168.122.1'/>
              <ip address='192.168.122.13' family='ipv4' prefix='24'/>
              <route family='ipv4' address='0.0.0.0'
                     gateway='192.168.122.1'/>
              <route family='ipv4' address='192.168.124.0' prefix='24'
                     gateway='192.168.124.1'/>
            </source>
          </interface>
      
      In practice, this will likely only be useful for type='ethernet', so
      its presence in any other type of interface is currently forbidden in
      the generic device Validate function (but it's been put into the
      general population of virDomainNetDef rather than the
      ethernet-specific union member so that 1) we can more easily add the
      capability to other types, and 2) we can retain the info when set to
      an invalid interface type all the way through to validation and report
      a proper error, rather than just ignoring it (which is currently what
      happens for many other type-specific settings).
      
      (NB: The already-existing configuration of IP info for the guest-side
      of interfaces is in subelements directly under <interface>, and the
      name of the guest-side interface (when configurable) is in <guest
      dev='x'/>).
      fe6a7789
    • V
      conf: allow setting peer address in <ip> element of <interface> · 93135abf
      Vasiliy Tolstov 提交于
      The peer attribute is used to set the property of the same name in the
      interface IP info:
      
        <interface type='ethernet'>
          ...
          <ip family='ipv4' address='192.168.122.5'
              prefix='32' peer='192.168.122.6'/>
          ...
        </interface>
      
      Note that this element is used to set the IP information on the
      *guest* side interface, not the host side interface - that will be
      supported in an upcoming patch.
      
      (This is an updated *re*-commit of commit 690969af, which was
      subsequently reverted in commit 1d14b13f).
      Signed-off-by: NVasiliy Tolstov <v.tolstov@selfip.ru>
      Signed-off-by: NLaine Stump <laine@laine.org>
      93135abf
    • L
      conf: clean up after adding calls to virNetDevIPInfo helpers · 25599582
      Laine Stump 提交于
      virDomainNetIPInfoParseXML() and virDomainNetIPInfoFormat() are no
      longer "unused", so we can now remove the "ATTRIBUTE_UNUSED" from
      their definitions, since virDomainNetIPInfoFormat() is now the only
      caller of virDomainNetIPsFormat() and virDomainNetRoutesFormat(),
      those two functions can simply be subsumed into
      virDomainNetIPInfoFormat().
      25599582
    • L
      conf: use virNetDevIPInfo for guest-side <interface> config · fbc1843d
      Laine Stump 提交于
      All the same information was already there, just in slightly different
      places in the virDomainNetDef.
      fbc1843d
    • L
      conf: use virNetDevIPInfo in virDomainHostdevCaps · 69e04044
      Laine Stump 提交于
      a.k.a. <hostdev mode='capabilities' type='net'>.
      
      This replaces the existing nips, ips, nroutes, and routes with a
      single virNetDevIPInfo, and simplifies the code by calling that
      object's parse/format/clear functions instead of open coding.
      69e04044
    • L
      conf: single object containing list of IP addresses, list of routes · 9911562a
      Laine Stump 提交于
      There are currently two places in the domain where this combination is
      used, and there is about to be another. This patch puts them together
      for brevity and uniformity.
      
      As with the newly-renamed virNetDevIPAddr and virNetDevIPRoute
      objects, the new virNetDevIPInfo object will need to be accessed by a
      utility function that calls low level Netlink functions (so we don't
      want it to be in the conf directory) and will be called from multiple
      hypervisor drivers (so it can't be in any hypervisor directory); the
      most appropriate place is thus once again the util directory.
      
      The parse and format functions are in conf/domain_conf.c because only
      the domain XML (i.e. *not* the network XML) has this exact combination
      of IP addresses plus routes. Note that virDomainNetIPInfoFormat() will
      end up being the only caller to virDomainNetRoutesFormat() and
      virDomainNetIPsFormat(), so it will just subsume those functions in a
      later patch, but we can't do that until they are no longer called.
      
      (It would have been nice to include the interface name within the
      virNetDevIPInfo object (with a slight name change), but that can't
      be done cleanly, because in each case the interface name is provided
      in a different place in the XML relative to the routes and IP
      addresses, so putting it in this object would actually make the code
      more confused rather than simpler).
      9911562a
    • L
      util: move IP route & address object-related functions to virnetdevip.c · fa18e814
      Laine Stump 提交于
      These functions all need to be called from a utility function that
      must be located in the util directory, so we move them all into
      util/virnetdevip.[ch] now that it exists.
      
      Function and struct names were appropriately changed for the new
      location, but all code is unchanged aside from motion and renaming.
      fa18e814
    • L
      conf/openvz: eliminate incorrect/undocumented use of <source dev='blah'/> · 9658e70f
      Laine Stump 提交于
      When support for <interface type='ethernet'> was added in commit
      9a4b705f back in 2010, it erroneously looked at <source dev='blah'/>
      for a user-specified guest-side interface name. This was never
      documented though. (that attribute already existed at the time in the
      data.ethernet union member of virDomainNetDef, but apparently had no
      practical use - it was only used as a storage place for a NetDef's
      bridge name during qemuDomainXMLToNative(), but even then that was
      never used for anything).
      
      When support for similar guest-side device naming was added to the lxc
      driver several years later, it was put in a new subelement <guest
      dev='blah'/>.
      
      In the intervening years, since there was no validation that
      ethernet.dev was NULL in the other drivers that didn't actually use
      it, innocent souls who were adding other features assuming they needed
      to account for non-NULL ethernet.dev when really they didn't, so
      little bits of the usual pointless cargo-cult code showed up.
      
      This patch not only switches the openvz driver to use the documented
      <guest dev='blah'/> notation for naming the guest-side device (just in
      case anyone is still using the openvz driver), and logs an error if
      anyone tries to set <source dev='blah'/> for a type='ethernet'
      interface, it also removes the cargo-cult uses of ethernet.dev and
      <source dev='blah'/>, and eliminates if from the RNG and from
      virDomainNetDef.
      
      NB: I decided on this course of action after mentioning the
      inconsistency here:
      
        https://www.redhat.com/archives/libvir-list/2016-May/msg02038.html
      
      and getting encouragement do eliminate it in a later IRC discussion
      with danpb.
      9658e70f
    • L
      conf: new function virDomainNetDefClear · 7cfbaad1
      Laine Stump 提交于
      We need to clear these out without freeing the object completely.
      7cfbaad1
    • L
      conf: clean up virDomainNetIPParseXML() · bfd2de6e
      Laine Stump 提交于
      Rearrange this function to be better organized and more correct:
      
      * the error codes were changed from the incorrect INVALID_ARG to
        XML_ERROR
      
      * prefix still isn't required, but if present it must be valid or an
        error will be logged.
      
      * don't emit a debug log just because prefix is missing - this
        is valid.
      
      * group everything related to setting prefix in one place rather than
        scattered through the function.
      bfd2de6e
    • L
      global: consistently use IP rather than Ip in identifiers · 22a6873a
      Laine Stump 提交于
      I'm tired of mistyping this all the time, so let's do it the same all
      the time (similar to how we changed all "Pci" to "PCI" awhile back).
      
      (NB: I've left alone some things in the esx and vbox drivers because
      I'm unable to compile them and they weren't obviously *not* a part of
      some API. I also didn't change a couple of variables named,
      e.g. "somethingIptables", because they were derived from the name of
      the "iptables" command)
      22a6873a
    • L
      util: move virInterface(State|Link)/virNetDevFeature from conf to util · 638c6e5b
      Laine Stump 提交于
      These had been declared in conf/device_conf.h, but then used in
      util/virnetdev.c, meaning that we had to #include conf/device_conf.h
      in virnetdev.c (which we have for a long time said shouldn't be done.
      
      This caused a bigger problem when I tried to #include util/virnetdev.h
      in a file in src/conf (which is allowed) - for some reason the
      "device_conf.h: File not found" error.
      
      The solution is to move the data types and functions used in util
      sources from conf to util. Some names were adjusted during the move
      ("virInterface" --> "virNetDevIf", and "VIR_INTERFACE" -->
      "VIR_NETDEV_IF")
      638c6e5b
  7. 24 6月, 2016 1 次提交
  8. 23 6月, 2016 3 次提交
  9. 21 6月, 2016 1 次提交
    • L
      conf: limit chassisNr, and busNr to a minimum value of 1, not 0 · df2fb9bf
      Laine Stump 提交于
      In the case of chassisNr (used to set chassis_nr of a pci-bridge
      controller), 0 is reserved for / used by the pci[e]-root bus. In the
      base of busNr, a value of 0 would mean that the root bus had no places
      available to plug in new buses, including the pxb itself (the
      documentation I wrote for pxb even noted the limit of busNr as 1.254).
      
      NB: oddly, the "chassis" attribute, which is used for pcie-root-port
      and pcie-switch-downstream-port *can* be set to 0, since it's the
      combination of {chassis, slot} that needs to be unique, not chassis by
      itself (and slot 0 of pcie-root is reserved, while pcie-*-port can use
      *only* slot 0).
      
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1342962
      df2fb9bf
  10. 20 6月, 2016 3 次提交
    • P
      conf: Fix label name in virDomainGraphicsListensParseXML · 0a07bf3d
      Peter Krempa 提交于
      Use 'cleanup' since it's also used on success.
      0a07bf3d
    • P
      conf: Fix memory leak in graphics XML parser · 9982758c
      Peter Krempa 提交于
      When loading status XMLs with following graphics definition:
      
        <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
          <listen type='address' address='127.0.0.1' fromConfig='1'/>
          <image compression='off'/>
        </graphics>
      
      libvirtd would leak a few bytes:
      
      10 bytes in 1 blocks are definitely lost in loss record 71 of 1,127
         at 0x4C2C000: malloc (vg_replace_malloc.c:299)
         by 0x6789298: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
         by 0x552AB0A: virXMLPropString (virxml.c:479)
         by 0x5539536: virDomainGraphicsListensParseXML (domain_conf.c:11171)
         by 0x553DD5E: virDomainGraphicsDefParseXMLSpice (domain_conf.c:11414)
         by 0x553DD5E: virDomainGraphicsDefParseXML (domain_conf.c:11749)
         by 0x5566061: virDomainDefParseXML (domain_conf.c:16939)
         by 0x556953F: virDomainObjParseXML (domain_conf.c:17348)
         by 0x556953F: virDomainObjParseNode (domain_conf.c:17513)
         by 0x5569902: virDomainObjParseFile (domain_conf.c:17532)
         by 0x5571E02: virDomainObjListLoadStatus (virdomainobjlist.c:514)
         by 0x5571E02: virDomainObjListLoadAllConfigs (virdomainobjlist.c:596)
         by 0x26E0BDC8: qemuStateInitialize (qemu_driver.c:911)
         by 0x55B1FDB: virStateInitialize (libvirt.c:770)
         by 0x122039: daemonRunStateInit (libvirtd.c:960)
      9982758c
    • J
      Remove separator argument from virBitmapParse · ff52e9d4
      Ján Tomko 提交于
      Most the callers pass 0 in one form or another, including
      vircapstest which used VIR_ARCH_NONE.
      ff52e9d4
  11. 18 6月, 2016 3 次提交
  12. 17 6月, 2016 1 次提交