1. 27 9月, 2019 2 次提交
    • L
      conf: take advantage of VIR_AUTOPTR for virNetworkPortDefPtr · b6a8d303
      Laine Stump 提交于
      define a VIR_DEFINE_AUTOPTR_FUNC() to autofree virNetworkPortDefs, and
      convert all uses of virNetworkPortDefPtr that are appropriate to use
      it.
      
      This coincidentally fixes multiple potential memory leaks (in failure
      cases) in networkPortCreateXML()
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      b6a8d303
    • L
      conf: utility function to update entry in def->nets array · 7e490cda
      Laine Stump 提交于
      A virDomainNetDef object in a domain's nets array might contain a
      virDomainHostdevDef, and when this is the case, the domain's hostdevs
      array will also have a pointer to this embedded hostdev (this is done
      so that internal functions that need to perform some operation on all
      hostdevs won't leave out the type='hostdev' network interfaces).
      
      When a network device was updated with virDomainUpdateDeviceFlags(),
      we were replacing the entry in the nets array (and free'ing the
      original) but forgetting about the pointer in the hostdevs array
      (which would then point to the now-free'd hostdev contained in the old
      net object.) This often resulted in a libvirtd crash.
      
      The solution is to add a function, virDomainNetUpdate(), called by
      qemuDomainUpdateDeviceConfig(), that updates the hostdevs array
      appropriately along with the nets array.
      
      Resolves: https://bugzilla.redhat.com/1558934Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      7e490cda
  2. 26 9月, 2019 1 次提交
    • M
      domain_conf: Unref video private data in virDomainVideoDefClear() · 4e9d72be
      Michal Privoznik 提交于
      The private data for video definition is created in
      virDomainVideoDefNew() and we attempt to free it in
      virDomainVideoDefFree(). This seems to work, except
      the free function calls clear function which zeroes
      out the whole structure and thus virObjectUnref()
      which is called on private data does nothing.
      
      2,568 bytes in 107 blocks are definitely lost in loss record 207 of 213
         at 0x4A35476: calloc (vg_replace_malloc.c:752)
         by 0x50A6048: virAllocVar (viralloc.c:346)
         by 0x513CC5A: virObjectNew (virobject.c:243)
         by 0x4DC1DEE: qemuDomainVideoPrivateNew (qemu_domain.c:1337)
         by 0x51A6BD6: virDomainVideoDefNew (domain_conf.c:2831)
         by 0x51B9F06: virDomainVideoDefParseXML (domain_conf.c:15541)
         by 0x51CB761: virDomainDefParseXML (domain_conf.c:21158)
         by 0x51C5973: virDomainDefParseNode (domain_conf.c:21708)
         by 0x51C583A: virDomainDefParse (domain_conf.c:21663)
         by 0x51C58AE: virDomainDefParseFile (domain_conf.c:21688)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      4e9d72be
  3. 25 9月, 2019 5 次提交
  4. 20 9月, 2019 1 次提交
  5. 19 9月, 2019 5 次提交
  6. 16 9月, 2019 1 次提交
  7. 12 9月, 2019 2 次提交
  8. 11 9月, 2019 1 次提交
  9. 10 9月, 2019 4 次提交
    • J
      conf: Avoid checking root element name in virDomainDefParseNode · 29307fa8
      Jiri Denemark 提交于
      The only caller for which this check makes sense is virDomainDefParse.
      Thus the check should be moved there.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      29307fa8
    • J
      9bcbc52e
    • L
      conf: new "managed" attribute for target dev of <interface type='ethernet'> · 77f72a86
      Laine Stump 提交于
      Although <interface type='ethernet'> has always been able to use an
      existing tap device, this is just a coincidence due to the fact that
      the same ioctl is used to create a new tap device or get a handle to
      an existing device.
      
      Even then, once we have the handle to the device, we still insist on
      doing extra setup to it (setting the MAC address and IFF_UP).  That
      *might* be okay if libvirtd is running as a privileged process, but if
      libvirtd is running as an unprivileged user, those attempted
      modifications to the tap device will fail (yes, even if the tap is set
      to be owned by the user running libvirtd). We could avoid this if we
      knew that the device already existed, but as stated above, an existing
      device and new device are both accessed in the same manner, and
      anyway, we need to preserve existing behavior for those who are
      already using pre-existing devices with privileged libvirtd (and
      allowing/expecting libvirt to configure the pre-existing device).
      
      In order to cleanly support the idea of using a pre-existing and
      pre-configured tap device, this patch introduces a new optional
      attribute "managed" for the interface <target> element. This
      attribute is only valid for <interface type='ethernet'> (since all
      other interface types have mandatory config that doesn't apply in the
      case where we expect the tap device to be setup before we
      get it). The syntax would look something like this:
      
         <interface type='ethernet'>
            <target dev='mytap0' managed='no'/>
            ...
         </interface>
      
      This patch just adds managed to the grammar and parser for <target>,
      but has no functionality behind it.
      
      (NB: when managed='no' (the default when not specified is 'yes'), the
      target dev is always a name explicitly provided, so we don't
      auto-remove it from the config just because it starts with "vnet"
      (VIR_NET_GENERATED_TAP_PREFIX); this makes it possible to use the
      same pattern of names that libvirt itself uses when it automatically
      creates the tap devices.)
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      77f72a86
    • L
      conf: use virXMLFormatElement for interface <target> · 33d02dfc
      Laine Stump 提交于
      This will simplify addition of another attribute to the <target> element
      Signed-off-by: NLaine Stump <laine@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      33d02dfc
  10. 06 9月, 2019 2 次提交
  11. 05 9月, 2019 1 次提交
  12. 21 8月, 2019 6 次提交
  13. 20 8月, 2019 1 次提交
  14. 19 8月, 2019 1 次提交
  15. 16 8月, 2019 1 次提交
  16. 12 8月, 2019 1 次提交
  17. 09 8月, 2019 4 次提交
  18. 06 8月, 2019 1 次提交