You need to sign in or sign up before continuing.
  1. 10 8月, 2018 1 次提交
    • D
      conf: rewrite filtering for capabilities lookup · 68dc579f
      Daniel P. Berrangé 提交于
      The virCapabilitiesDomainDataLookupInternal() is given a list of
      parameters representing the desired domain characteristics. It then has
      to look throught the capabilities to identify an acceptable match.
      
      The virCapsDomainDataCompare() method is used for filtering out
      candidates which don't match the desired criteria. It is called
      primarily from the innermost loops and as such is doing many repeated
      checks. For example if architcture and os type were checked at the top
      level loop the two inner loops could be avoided entirely. If emulator
      and domain type were checked in the 2nd level loop the 3rd level loop
      can be avoided too.
      
      This change thus removes the virCapsDomainDataCompare() method and puts
      suitable checks at the start of each loop to ensure it executes the
      minimal number of loop iterations possible. The code becomes clearer to
      understand as a nice side-effect.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      68dc579f
  2. 23 7月, 2018 1 次提交
    • A
      src: Make virStr*cpy*() functions return an int · 6c0d0210
      Andrea Bolognani 提交于
      Currently, the functions return a pointer to the
      destination buffer on success or NULL on failure.
      
      Not only does this kind of error handling look quite
      alien in the context of libvirt, where most functions
      return zero on success and a negative int on failure,
      but it's also somewhat pointless because unless there's
      been a failure the returned pointer will be the same
      one passed in by the user, thus offering no additional
      value.
      
      Change the functions so that they return an int
      instead.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      6c0d0210
  3. 08 6月, 2018 2 次提交
  4. 05 6月, 2018 1 次提交
  5. 24 4月, 2018 1 次提交
    • M
      virNumaGetHugePageInfo: Return page_avail and page_free as ULL · 31daccf5
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1569678
      
      On some large systems (with ~400GB of RAM) it is possible for
      unsigned int to overflow in which case we report invalid number
      of 4K pages pool size. Switch to unsigned long long.
      
      We hit overflow in virNumaGetPages when doing:
      
          huge_page_sum += 1024 * page_size * page_avail;
      
      because although 'huge_page_sum' is an unsigned long long, the
      page_size and page_avail are both unsigned int, so the promotion
      to unsigned long long doesn't happen until the sum has been
      calculated, by which time we've already overflowed.
      
      Turning page_avail into a unsigned long long is not strictly
      needed until we need ability to represent more than 2^32
      4k pages, which equates to 16 TB of RAM. That's not
      outside the realm of possibility, so makes sense that we
      change it to unsigned long long to avoid future problems.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      31daccf5
  6. 18 4月, 2018 1 次提交
    • M
      virobject: Introduce VIR_CLASS_NEW() macro · 10f94828
      Michal Privoznik 提交于
      So far we are repeating the following lines over and over:
      
        if (!(virSomeObjectClass = virClassNew(virClassForObject(),
                                   "virSomeObject",
                                   sizeof(virSomeObject),
                                   virSomeObjectDispose)))
            return -1;
      
      While this works, it is impossible to do some checking. Firstly,
      the class name (the 2nd argument) doesn't match the name in the
      code in all cases (the 3rd argument). Secondly, the current style
      is needlessly verbose. This commit turns example into following:
      
        if (!(VIR_CLASS_NEW(virSomeObject,
                            virClassForObject)))
            return -1;
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      10f94828
  7. 17 4月, 2018 1 次提交
  8. 26 1月, 2018 2 次提交
  9. 18 11月, 2017 2 次提交
  10. 21 9月, 2017 1 次提交
    • J
      cpu_conf: Drop updateCPU from virCPUDefFormat · 4fd179f5
      Jiri Denemark 提交于
      In the past we updated host-model CPUs with host CPU data by adding a
      model and features, but keeping the host-model mode. And since the CPU
      model is not normally formatted for host-model CPU defs, we had to pass
      the updateCPU flag to the formatting code to be able to properly output
      updated host-model CPUs. Libvirt doesn't do this anymore, host-model
      CPUs are turned into custom mode CPUs once updated with host CPU data
      and thus there's no reason for keeping the hacks inside CPU XML
      formatters.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      4fd179f5
  11. 28 8月, 2017 1 次提交
  12. 14 8月, 2017 2 次提交
  13. 02 8月, 2017 2 次提交
  14. 16 6月, 2017 1 次提交
    • M
      Report more correct information for cache control · cc9f0521
      Martin Kletzander 提交于
      On some platforms the number of bits in the cbm_mask might not be
      divisible by 4 (and not even by 2), so we need to properly count the
      bits.  Similar file, min_cbm_bits, is properly parsed and used, but if
      the number is greater than one, we lose the information about
      granularity when reporting the data in capabilities.  For that matter
      always report granularity, but if it is not the same as the minimum,
      add that information in there as well.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      cc9f0521
  15. 05 6月, 2017 1 次提交
    • E
      Expose resource control capabilities for caches · 0ab409cc
      Eli Qiao 提交于
      Add cache resource control into capabilities for CAT without CDP:
      
        <cache>
          <bank id='0' level='3' type='unified' size='15360' unit='KiB' cpus='0-5'>
            <control min='768' unit='KiB' scope='both' max_allocation='4'/>
          </bank>
        </cache>
      
      and with CDP:
      
        <cache>
          <bank id='0' level='3' type='unified' size='15360' unit='KiB' cpus='0-5'>
            <control min='768' unit='KiB' scope='code' max_allocation='4'/>
            <control min='768' unit='KiB' scope='data' max_allocation='4'/>
          </bank>
        </cache>
      
      Also add new test cases for vircaps2xmltest.
      Signed-off-by: NEli Qiao <liyong.qiao@intel.com>
      0ab409cc
  16. 29 5月, 2017 1 次提交
    • M
      virCapabilitiesInitCaches: Don't leak @cpus · 6e9e1423
      Michal Privoznik 提交于
      The @cpus is allocated by virFileReadValueBitmap() but never
      freed:
      
      ==21274== 40 (32 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 808 of 1,004
      ==21274==    at 0x4C2E080: calloc (vg_replace_malloc.c:711)
      ==21274==    by 0x54BA561: virAlloc (viralloc.c:144)
      ==21274==    by 0x54BC604: virBitmapNewEmpty (virbitmap.c:126)
      ==21274==    by 0x54BD059: virBitmapParseUnlimited (virbitmap.c:570)
      ==21274==    by 0x54EECE9: virFileReadValueBitmap (virfile.c:4113)
      ==21274==    by 0x5563132: virCapabilitiesInitCaches (capabilities.c:1548)
      ==21274==    by 0x2BB86E59: virQEMUCapsInit (qemu_capabilities.c:1132)
      ==21274==    by 0x2BBEC067: virQEMUDriverCreateCapabilities (qemu_conf.c:928)
      ==21274==    by 0x2BC3DEAA: qemuStateInitialize (qemu_driver.c:845)
      ==21274==    by 0x5625AAC: virStateInitialize (libvirt.c:770)
      ==21274==    by 0x124519: daemonRunStateInit (libvirtd.c:881)
      ==21274==    by 0x554C927: virThreadHelper (virthread.c:206)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      6e9e1423
  17. 22 5月, 2017 1 次提交
  18. 12 5月, 2017 1 次提交
    • J
      conf: Fix resource leak in virCapabilitiesInitCaches · d6128618
      John Ferlan 提交于
      The @type from virFileReadValueString needs to be VIR_FREE each time
      through the loop since it's not saved and since cleanup can be reached
      prior to decoding it for @kernel_type amd bank->type, the cleanup code
      needs to also have a VIR_FREE
      
      Found by Coverity
      d6128618
  19. 09 5月, 2017 2 次提交
  20. 07 4月, 2017 1 次提交
  21. 27 3月, 2017 3 次提交
  22. 04 2月, 2016 1 次提交
    • J
      conf: add net device prefix to capabilities · 819d1d94
      Joao Martins 提交于
      In the reverted commit d2e5538b, the libxl driver was changed to copy
      interface names autogenerated by libxl to the corresponding network def
      in the domain's virDomainDef object. The copied name is freed when the
      domain transitions to the shutoff state. But when migrating a domain,
      the autogenerated name is included in the XML sent to the destination
      host.  It is possible an interface with the same name already exists on
      the destination host, causing migration to fail.
      
      This patch defines a new capability for setting the network device
      prefix that will be used in the driver. Valid prefixes are
      VIR_NET_GENERATED_PREFIX or the one announced by the driver.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      819d1d94
  23. 26 9月, 2015 1 次提交
    • S
      conf: Add new VIR_DOMAIN_VIRT_NONE enum · 62569e45
      Shivangi Dhir 提交于
      Introduce VIR_DOMAIN_VIRT_NONE to give domaintype the default value of zero.
      This is specially helpful in constructing better error messages
      when we don't want to look up the default emulator by virtType.
      
      The test data in vircapstest.c is also modified to reflect this change.
      62569e45
  24. 15 6月, 2015 1 次提交
    • M
      virCapabilitiesDomainDataLookup: Produce saner error message · f8867012
      Michal Privoznik 提交于
      During a review, I've noticed this error message that was eventually
      produced when I was trying to define a domain:
      
      error: invalid argument: could not find capabilities for arch=mips64el
      domaintype=(null)
      
      Look at the (null). Why is it there? Well, during XML parsing, we try
      to look up the default emulator for given OS type and possibly virt
      type too. And this is the problem, because if we don't want to look up
      by virt type, a -1 is passed to note this fact. Later, the code
      handles -1 just right. Except for error message. When it is
      constructed (in a very fabulous way I must say), the value is compared
      to zero, not -1. And since we don't have any translation from -1 to a
      virt type string, we just print (null).
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f8867012
  25. 12 5月, 2015 2 次提交
  26. 08 5月, 2015 1 次提交
    • C
      caps: Fix regression defaulting to host arch · 8910e063
      Cole Robinson 提交于
      My commit 747761a7 (v1.2.15 only) dropped this bit of logic when filling
      in a default arch in the XML:
      
      -    /* First try to find one matching host arch */
      -    for (i = 0; i < caps->nguests; i++) {
      -        if (caps->guests[i]->ostype == ostype) {
      -            for (j = 0; j < caps->guests[i]->arch.ndomains; j++) {
      -                if (caps->guests[i]->arch.domains[j]->type == domain &&
      -                    caps->guests[i]->arch.id == caps->host.arch)
      -                    return caps->guests[i]->arch.id;
      -            }
      -        }
      -    }
      
      That attempt to match host.arch is important, otherwise we end up
      defaulting to i686 on x86_64 host for KVM, which is not intended.
      Duplicate it in the centralized CapsLookup function.
      
      Additionally add some testcases that would have caught this.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1219191
      8910e063
  27. 27 4月, 2015 1 次提交
  28. 21 4月, 2015 4 次提交