1. 20 12月, 2019 6 次提交
  2. 19 12月, 2019 23 次提交
  3. 18 12月, 2019 11 次提交
    • D
      conf: fix populating of fake NUMA in multi-node hosts · e67ccd3c
      Daniel P. Berrangé 提交于
      If the host OS doesn't have NUMA present, we fallback to
      populating fake NUMA info and the code thus assumes only a
      single NUMA node.
      
      Unfortunately we also fallback to fake NUMA if numactl-devel
      was not present, and in this case we can still have multiple
      NUMA nodes. In this case we create all CPUs, but only the
      CPUs in the first node have any data filled in, resulting in
      capabilities like:
      
          <topology>
            <cells num='1'>
              <cell id='0'>
                <memory unit='KiB'>15977572</memory>
                <cpus num='48'>
                  <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
                  <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
                  <cpu id='2' socket_id='0' core_id='1' siblings='2'/>
                  <cpu id='3' socket_id='0' core_id='1' siblings='3'/>
                  <cpu id='4' socket_id='0' core_id='2' siblings='4'/>
                  <cpu id='5' socket_id='0' core_id='2' siblings='5'/>
                  <cpu id='6' socket_id='0' core_id='3' siblings='6'/>
                  <cpu id='7' socket_id='0' core_id='3' siblings='7'/>
                  <cpu id='8' socket_id='0' core_id='4' siblings='8'/>
                  <cpu id='9' socket_id='0' core_id='4' siblings='9'/>
                  <cpu id='10' socket_id='0' core_id='5' siblings='10'/>
                  <cpu id='11' socket_id='0' core_id='5' siblings='11'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                  <cpu id='0'/>
                </cpus>
              </cell>
            </cells>
          </topology>
      
      With this new code we get something slightly less broken
      
          <topology>
            <cells num='4'>
              <cell id='0'>
                <memory unit='KiB'>15977572</memory>
                <cpus num='12'>
                  <cpu id='0' socket_id='0' core_id='0' siblings='0-1'/>
                  <cpu id='1' socket_id='0' core_id='0' siblings='0-1'/>
                  <cpu id='2' socket_id='0' core_id='1' siblings='2-3'/>
                  <cpu id='3' socket_id='0' core_id='1' siblings='2-3'/>
                  <cpu id='4' socket_id='0' core_id='2' siblings='4-5'/>
                  <cpu id='5' socket_id='0' core_id='2' siblings='4-5'/>
                  <cpu id='6' socket_id='0' core_id='3' siblings='6-7'/>
                  <cpu id='7' socket_id='0' core_id='3' siblings='6-7'/>
                  <cpu id='8' socket_id='0' core_id='4' siblings='8-9'/>
                  <cpu id='9' socket_id='0' core_id='4' siblings='8-9'/>
                  <cpu id='10' socket_id='0' core_id='5' siblings='10-11'/>
                  <cpu id='11' socket_id='0' core_id='5' siblings='10-11'/>
                </cpus>
              </cell>
              <cell id='0'>
                <memory unit='KiB'>15977572</memory>
                <cpus num='12'>
                  <cpu id='12' socket_id='0' core_id='0' siblings='12-13'/>
                  <cpu id='13' socket_id='0' core_id='0' siblings='12-13'/>
                  <cpu id='14' socket_id='0' core_id='1' siblings='14-15'/>
                  <cpu id='15' socket_id='0' core_id='1' siblings='14-15'/>
                  <cpu id='16' socket_id='0' core_id='2' siblings='16-17'/>
                  <cpu id='17' socket_id='0' core_id='2' siblings='16-17'/>
                  <cpu id='18' socket_id='0' core_id='3' siblings='18-19'/>
                  <cpu id='19' socket_id='0' core_id='3' siblings='18-19'/>
                  <cpu id='20' socket_id='0' core_id='4' siblings='20-21'/>
                  <cpu id='21' socket_id='0' core_id='4' siblings='20-21'/>
                  <cpu id='22' socket_id='0' core_id='5' siblings='22-23'/>
                  <cpu id='23' socket_id='0' core_id='5' siblings='22-23'/>
                </cpus>
              </cell>
            </cells>
          </topology>
      
      The topology at least now reflects what 'virsh nodeinfo' reports.
      The main bug is that the CPU "id" values won't match what the Linux
      host actually uses.
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      e67ccd3c
    • D
      conf: avoid mem leak re-allocating fake NUMA capabilities · fb5aaf3d
      Daniel P. Berrangé 提交于
      The 'caps' object is already allocated when the fake NUMA
      initialization takes place.
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      fb5aaf3d
    • D
      qemu_command: tidy up qemuBuildHostdevCommandLine loop · aed9bcd1
      Daniel Henrique Barboza 提交于
      The current 'for' loop with 5 consecutive 'ifs' inside
      qemuBuildHostdevCommandLine can be a bit smarter:
      
      - all 5 'ifs' fails if hostdev->mode is not equal to
      VIR_DOMAIN_HOSTDEV_MODE_SUBSYS. This check can be moved to the
      start of the loop, failing to the next element immediately
      in case it fails;
      
      - all 5 'ifs' checks for a specific subsys->type to build the proper
      command line argument (virHostdevIsSCSIDevice and virHostdevIsMdevDevice
      do that but within a helper). Problem is that the code will keep
      checking for matches even if one was already found, and there is
      no way a hostdev will fit more than one 'if' (i.e. a hostdev can't
      have 2+ different types). This means that a SUBSYS_TYPE_USB will
      create its command line argument in the first 'if', then all other
      conditionals will surely fail but will end up being checked anyway.
      
      All of this can be avoided by moving the hostdev->mode comparing
      to the start of the loop and using a switch statement with
      subsys->type to execute the proper code for a given hostdev
      type.
      Suggested-by: NJán Tomko <jtomko@redhat.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      aed9bcd1
    • D
    • D
      access: report an error if no access manager is present · cccc3fc1
      Daniel P. Berrangé 提交于
      The code calling this method expects it to have reported an error on
      failure.
      Reviewed-by: NCole Robinson <crobinso@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      cccc3fc1
    • M
      qemu: Don't leak hostcpu or hostnuma on driver cleanup · 39a7dff7
      Michal Privoznik 提交于
      When freeing qemu driver struct members, we forgot to free
      @hostcpu and @hostnuma members.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      39a7dff7
    • M
      qemu: Reorder cleanup in qemuStateCleanup() · 7cf76d4e
      Michal Privoznik 提交于
      This function is supposed to clean up virQEMUDriver structure and
      free individual members. However, it's doing that in random order
      which makes it hard to track which members are being freed and
      which are not. Do the free in reverse order than the structure
      definition - assuming that the most important members (like
      mutex) are declared first and freed last.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      7cf76d4e
    • M
      virCapabilitiesHostNUMAUnref: Accept NULL · 599f9c73
      Michal Privoznik 提交于
      Fortunately, this is not causing any problems now because glib
      does this check for us when calling this function via attribute
      cleanup. But in a future commit we will explicitly call this
      function over a struct member that might be NULL.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      599f9c73
    • M
      testutilsxen: Avoid double free of driver caps · 98f1f4a4
      Michal Privoznik 提交于
      In testXLInitDriver() a dummy driver structure is filled and it
      is freed later in testXLFreeDriver(). However, it is sufficient
      to unref just driver->config because that results in
      libxlDriverConfigDispose() being called which unrefs
      driver->config->caps. There is no need to unref it again in
      testXLFreeDriver() - in fact it's undesired.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      98f1f4a4
    • M
      domaincapstest: Don't leak cpu definitions · 08a7e88b
      Michal Privoznik 提交于
      When generating domain capabilities, we need to fake host CPU to
      get reproducible result. We do this by copying a pre-existent CPU
      config and setting VIR_TEST_MOCK_FAKE_HOST_CPU env variable which
      is then consumed by qemucpumock. However, we forget to free the
      CPU copy afterwards.
      
       2,196 (2,016 direct, 180 indirect) bytes in 18 blocks are definitely lost in loss record 291 of 297
          at 0x4838B86: calloc (vg_replace_malloc.c:762)
          by 0x57CB6A0: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.6000.7)
          by 0x4A0F72D: virCPUDefNew (cpu_conf.c:87)
          by 0x4A0FAC7: virCPUDefCopyWithoutModel (cpu_conf.c:235)
          by 0x4A0FBBE: virCPUDefCopy (cpu_conf.c:273)
          by 0x10E3C0: testUtilsHostCpusGetDefForArch (testutilshostcpus.h:157)
          by 0x10E3C0: fakeHostCPU (domaincapstest.c:61)
          by 0x10E3C0: fillQemuCaps (domaincapstest.c:86)
          by 0x10E3C0: test_virDomainCapsFormat (domaincapstest.c:234)
          by 0x10F4BC: virTestRun (testutils.c:146)
          by 0x10DE93: doTestQemuInternal (domaincapstest.c:301)
          by 0x10E13D: doTestQemu (domaincapstest.c:332)
          by 0x1124CF: testQemuCapsIterate (testutilsqemu.c:635)
          by 0x10DCE3: mymain (domaincapstest.c:435)
          by 0x10FD8B: virTestMain (testutils.c:916)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      08a7e88b
    • D