1. 27 6月, 2016 3 次提交
    • 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
  2. 24 6月, 2016 1 次提交
  3. 23 6月, 2016 3 次提交
  4. 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
  5. 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
  6. 18 6月, 2016 3 次提交
  7. 17 6月, 2016 3 次提交
    • 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
    • P
      conf: Fix perf event parser · 23690e1d
      Peter Krempa 提交于
      The parser was totaly broken. Fix it by rewriting it. Add tests so that
      it doesn't happen.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1346723
      23690e1d
  8. 14 6月, 2016 1 次提交
  9. 11 6月, 2016 1 次提交
  10. 09 6月, 2016 6 次提交
  11. 08 6月, 2016 1 次提交
  12. 07 6月, 2016 6 次提交
  13. 06 6月, 2016 2 次提交
    • J
      Do not check for domain liveness in virDomainObjSetDefTransient · 8c40ede4
      Ján Tomko 提交于
      Remove the live attribute and mark the definition as transient
      whether the domain is runing or not.
      
      There were only two callers left calling with live=false:
      * testDomainStartState, where the domain already is active
        because we assigned vm->def->id just a few lines above the call
      * virDomainObjGetPersistentDef, which now only calls
        virDomainObjSetDefTransient for an active domain
      8c40ede4
    • J
      Check if the domain is active in virDomainObjGetPersistentDef · 1dcb1dc0
      Ján Tomko 提交于
      Calling virDomainObjSetDefTransient with live=false is a no-op
      on an inactive domain.
      
      Only call it on an active domain, since this is the only place using
      the live bool.
      1dcb1dc0
  14. 03 6月, 2016 1 次提交
    • M
      virDomainChrGetDomainPtrsInternal: Return an integer · 43395f19
      Michal Privoznik 提交于
      There's this problem on the recent gcc-6.1:
      
      In file included from conf/domain_conf.c:37:0:
      conf/domain_conf.c: In function 'virDomainChrPreAlloc':
      conf/domain_conf.c:14109:35: error: potential null pointer dereference [-Werror=null-dereference]
           return VIR_REALLOC_N(*arrPtr, *cntPtr + 1);
                                         ^~
      ./util/viralloc.h:158:73: note: in definition of macro 'VIR_REALLOC_N'
       # define VIR_REALLOC_N(ptr, count) virReallocN(&(ptr), sizeof(*(ptr)), (count), \
                                                                               ^~~~~
      conf/domain_conf.c: In function 'virDomainChrRemove':
      conf/domain_conf.c:14133:21: error: potential null pointer dereference [-Werror=null-dereference]
           for (i = 0; i < *cntPtr; i++) {
                           ^~~~~~~
      
      GCC basically fails to see, that the
      virDomainChrGetDomainPtrsInternal will never actually return NULL
      because it's never called over a domain char device with _LAST
      type. But to make it shut up, lets turn this function into
      returning an integer and check in the callers if a zero value
      value was returned.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      43395f19
  15. 02 6月, 2016 1 次提交
    • M
      virDomainFormatSchedDef: Avoid false positive NULL dereference · f916194c
      Michal Privoznik 提交于
      Okay, I admit that our code here is complex. It's not easy to
      spot that NULL deref can't really happen here. So it's no wonder
      that a dumb compiler fails to see all the connections and
      produces the following errors:
      
        CC       conf/libvirt_conf_la-domain_conf.lo
      conf/domain_conf.c: In function 'virDomainDefFormatInternal':
      conf/domain_conf.c:22162:22: error: potential null pointer dereference [-Werror=null-dereference]
                   if (sched->policy == i)
                       ~~~~~^~~~~~~~
      <snip/>
      cc1: all warnings being treated as errors
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f916194c
  16. 26 5月, 2016 2 次提交
    • L
      conf: permit auto-assignment of controller indexes · 4d100c7a
      Laine Stump 提交于
      Hand-entering indexes for 20 PCI controllers is not as tedious as
      manually determining and entering their PCI addresses, but it's still
      annoying, and the algorithm for determining the proper index is
      incredibly simple (in all cases except one) - just pick the lowest
      unused index.
      
      The one exception is USB2 controllers because multiple controllers in
      the same group have the same index. For these we look to see if 1) the
      most recently added USB controller is also a USB2 controller, and 2)
      the group *that* controller belongs to doesn't yet have a controller
      of the exact model we're just now adding - if both are true, the new
      controller gets the same index, but in all other cases we just assign
      the lowest unused index.
      
      With this patch in place and combined with the automatic PCI address
      assignment, we can define a PCIe switch with several ports like this:
      
        <controller type='pci' model='pcie-root-port'/>
        <controller type='pci' model='pcie-switch-upstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        <controller type='pci' model='pcie-switch-downstream-port'/>
        ...
      
      These will each get a unique index, and PCI addresses that connect
      them together appropriately with no pesky numbers required.
      4d100c7a
    • L
      conf: make virDomainControllerFindUnusedIndex() more generally usable · 808e16ff
      Laine Stump 提交于
      Make virDomainControllerFindUnusedIndex() a global function so that it
      can be used outside domain_conf.c (as well as higher up in
      domain_conf.c itself)/ Also make its DomainDef arg a const* so that
      functions which only have a const* to the domain can use it.
      808e16ff
  17. 25 5月, 2016 2 次提交