1. 04 12月, 2013 9 次提交
    • D
      Don't overwrite errors from virConfReadFile · d75d8b46
      Daniel P. Berrange 提交于
      The SELinux security driver would overwrite errors from the
      virConfReadFile function.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d75d8b46
    • M
      virThreadPoolFree: Join worker threads · 78839da0
      Michal Privoznik 提交于
      Even though currently we are freeing the pool of worker threads at the
      daemon very end, nothing holds us back in joining the worker threads.
      Moreover, we avoid leaks like this:
      
      ==26697== 1,680 bytes in 5 blocks are possibly lost in loss record 913 of 942
      ==26697==    at 0x4C2BDE4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==26697==    by 0x4011131: allocate_dtv (in /lib64/ld-2.16.so)
      ==26697==    by 0x401176D: _dl_allocate_tls (in /lib64/ld-2.16.so)
      ==26697==    by 0x8499602: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.16.so)
      ==26697==    by 0x52F53E9: virThreadCreate (virthreadpthread.c:188)
      ==26697==    by 0x52F5D4F: virThreadPoolNew (virthreadpool.c:221)
      ==26697==    by 0x53F30DB: virNetServerNew (virnetserver.c:377)
      ==26697==    by 0x11C6ED: main (libvirtd.c:1366)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      78839da0
    • S
      qemu: fix live pinning to memory node on NUMA system · 81fae6b9
      Shivaprasad G Bhat 提交于
      Ever since the subcpusets(vcpu,emulator) were introduced, the parent
      cpuset cannot be modified to remove the nodes that are in use by the
      subcpusets.
      The fix is to break the memory node modification into three steps:
       1. assign new nodes into the parent,
       2. change the nodes in the child nodes,
       3. remove the old nodes on the parent node.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1009880Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      81fae6b9
    • J
      storage_driver: Resolve Coverity CHECKED_RETURN warning · 37a02bab
      John Ferlan 提交于
      The storageRegister() didn't check the return from the
      virRegisterStorageDriver() like other callers did, so Coverity
      flagged it.  Just check the return and handle.
      37a02bab
    • J
      bridge_driver: Resolve Coverity CHECKED_RETURN warning · b17168cb
      John Ferlan 提交于
      The networkRegister() didn't check the return status of the
      virRegisterNetworkDriver() call like other callers, so just
      check and handle here as well.
      b17168cb
    • J
      950a493b
    • J
      virnetserverclient: Remove Coverity DEADCODE warning · 643b5f84
      John Ferlan 提交于
      The x509dname is only set inside a WITH_GNUTLS conditional, so
      when used/check later on for NULL, Coverity detects this is not
      possible.  Added WITH_GNUTLS around uses to remove message
      643b5f84
    • J
      nwfilter: Remove Coverity DEADCODE warning · 5a298ec0
      John Ferlan 提交于
      The nwfilterStateInitialize() would only assign sysbus inside
      a WITH_DBUS conditional, thus leaving a subsequent check for sysbus
      and nwfilterDriverInstallDBusMatches() as a no-op
      
      Rather than try to add WITH_DBUS conditions which ended up conflicting
      with the usage of HAVE_FIREWALLD conditionals, just remove the WITH_DBUS
      since virdbus.c has entry points for with and without conditions.
      5a298ec0
    • M
      src: Align make output · 2e1ced57
      Michal Privoznik 提交于
      The make inserts six spaces instead of four:
      
        GEN      access/viraccessapichecklxc.h
        GEN    hyperv/hyperv_wmi.generated.h
        GEN      access/viraccessapichecklxc.c
        GEN    hyperv/hyperv_wmi.generated.c
        GEN    hyperv/hyperv_wmi_classes.generated.typedef
        GEN    hyperv/hyperv_wmi_classes.generated.h
        GEN    hyperv/hyperv_wmi_classes.generated.c
        GEN      libvirt_access_qemu.xml
        GEN      libvirt_access.syms
        GEN      libvirt_access_lxc.xml
        GEN      libvirt_access_qemu.syms
        GEN      libvirt_access_lxc.syms
        GEN      libvirt_qemu.def
        GEN    esx/esx_vi_types.generated.typedef
        GEN    esx/esx_vi_types.generated.typeenum
        GEN    esx/esx_vi_types.generated.typetostring
        GEN    esx/esx_vi_types.generated.typefromstring
        GEN    esx/esx_vi_types.generated.h
        GEN    esx/esx_vi_types.generated.c
        GEN    esx/esx_vi_methods.generated.h
        GEN    esx/esx_vi_methods.generated.c
        GEN    esx/esx_vi_methods.generated.macro
        GEN    esx/esx_vi.generated.h
        GEN    esx/esx_vi.generated.c
        GEN      libvirt_lxc.def
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2e1ced57
  2. 03 12月, 2013 15 次提交
    • L
      qemu: report error on attempt to live change virtio-net queues · 5e12641e
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1029732
      
      The BZ asked for the capability to change the number of queues used by
      a virtio-net device while the device is in use. Because the number of
      queues can only be set at the time the device is created, that isn't
      possible. However, libvirt also shouldn't be silently reporting
      success when someone tries to change the number of queues. So this
      patch flags that as an error (just as attempts to change any of the
      other virtio-specific parameters already do).
      5e12641e
    • L
      qemu: add "-boot strict" to commandline whenever possible · 96fddee3
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=888635
      
      (which was already closed as CANTFIX because the qemu "-boot strict"
      commandline option wasn't available at the time).
      
      Problem: you couldn't have a domain that used PXE to boot, but also
      had an un-bootable disk device *even if that disk wasn't listed in the
      boot order*, because if PXE timed out (e.g. due to the bridge
      forwarding delay), the BIOS would move on to the next target, which
      would be the unbootable disk device (again - even though it wasn't
      given a boot order), and get stuck at a "BOOT DISK FAILURE, PRESS ANY
      KEY" message until a user intervened.
      
      The solution available since sometime around QEMU 1.5, is to add
      "-boot strict=on" to *every* qemu command. When this is done, if any
      devices have a boot order specified, then QEMU will *only* attempt to
      boot from those devices that have an explicit boot order, ignoring the
      rest.
      96fddee3
    • L
      qemu: default to vfio for nodedev-detach · 47b9aae0
      Laine Stump 提交于
      This patch resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1035188
      
      Commit f094aaac changed the PCI device assignment in qemu domains
      to default to using VFIO rather than legacy KVM device assignment
      (when VFIO is available). It didn't change which driver was used by
      default for virNodeDeviceDetachFlags(), though, so that API (and the
      virsh nodedev-detach command) was still binding to the pci-stub
      driver, used by legacy KVM assignment, by default.
      
      This patch publicizes (only within the qemu module, though, so no
      additions to the symbol exports are needed) the functions that check
      for presence of KVM and VFIO device assignment, then uses those
      functions to decide what to do when no driver is specified for
      virNodeDeviceDetachFlags(); if the vfio driver is loaded, the device
      will be bound to vfio-pci, or if legacy KVM assignment is supported on
      this system, the device will be bound to pci-stub; if neither method
      is available, the detach will fail.
      47b9aae0
    • P
      qemu: snapshots: Declare supported and unsupported snapshot configs · 26fb96d8
      Peter Krempa 提交于
      Currently the snapshot code did not check if it actually supports
      snapshots on various disk backends for domains. To avoid future problems
      add checkers that whitelist the supported configurations.
      26fb96d8
    • P
      qemu: Clear old translated pool source · bdeb0f01
      Peter Krempa 提交于
      Clear the old data to avoid leaking it when attempting to re-translate a
      pool on the same domain object.
      bdeb0f01
    • P
      qemu: Refactor disk source string formatting · 0df53f04
      Peter Krempa 提交于
      This patch adds function qemuGetDriveSourceString to produce
      qemu-compatible disk source strings that will enable to reuse the code
      and refactors building of the qemu commandline of disks to use this new
      helper.
      0df53f04
    • P
      qemu: Unify formatting of RBD sources · b384e2b4
      Peter Krempa 提交于
      b384e2b4
    • P
      qemu: Split out NBD command generation · d94fd0c9
      Peter Krempa 提交于
      d94fd0c9
    • P
      eaa1539b
    • P
      qemu: Use qemuBuildNetworkDriveURI to handle http/ftp and friends · 078a1025
      Peter Krempa 提交于
      Prepare the function to integrate other protocols and start folding
      other network protocols into a common place.
      078a1025
    • P
      qemu: Simplify call pattern of qemuBuildDriveURIString · 927ddae1
      Peter Krempa 提交于
      Automatically assign secret type from the disk source definition and
      pull in adding of the comma. Then update callers to keep generated
      output the same.
      927ddae1
    • P
      qemu: Split out formatting of network disk source URI · a29d33ff
      Peter Krempa 提交于
      The snapshot code will need to use qemu-style formatted URIs of network
      disks. Split out the code to avoid duplication.
      a29d33ff
    • P
      qemu: Refactor qemuTranslateDiskSourcePool · e1a4d08b
      Peter Krempa 提交于
      Before this patch, the translation function still needs a second ugly
      helper function to actually format the command line for qemu. But if we
      do the right stuff in the translation function, we don't have to bother
      with the second function any more.
      
      This patch removes the messy qemuBuildVolumeString function and changes
      qemuTranslateDiskSourcePool to set stuff up correctly so that the
      regular code paths meant for volumes can be used to format the command
      line correctly.
      
      For this purpose a new helper "qemuDiskGetActualType()" is introduced to
      return the type of the volume in a pool.
      
      As a part of the refactor the qemuTranslateDiskSourcePool function is
      fixed to do decisions based on the pool type instead of the volume type.
      This allows to separate pool-type-specific stuff more clearly and will
      ease addition of other pool types that will require certain other
      operations to get the correct pool source.
      
      The previously fixed tests should make sure that we don't break stuff
      that was working before.
      e1a4d08b
    • O
      Doc: Explicitly declaring that nodedev-destroy only works for vHBA · ec2fb767
      Osier Yang 提交于
      Though trying to destroy a physical HBA doesn't make sense at all,
      it's still a bit misleading with saying "only works for HBA".
      Signed-off-by: NOsier Yang <jyang@redhat.com>
      ec2fb767
    • D
      Ensure to zero out the virDomainBlockJobInfo arg · 4cac241a
      Daniel P. Berrange 提交于
      The virDomainGetBlockJobInfo method did not zero out the
      virDomainBlockJobInfo pointer arg, so when block jobs were
      not active it would return garbage for the bandwidth/cur/end
      fields.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4cac241a
  3. 02 12月, 2013 15 次提交
    • P
      qemu: snapshot: Add functions similar to disk source pool translation · 7e6242e9
      Peter Krempa 提交于
      To avoid future pain, add placeholder functions to get the actual
      snapshot disk type.
      7e6242e9
    • P
      qemu: snapshot: Touch up error message · cdf02d64
      Peter Krempa 提交于
      cdf02d64
    • P
      conf: Add helper do clear disk source authentication struct · 0018477f
      Peter Krempa 提交于
      Add virDomainDiskAuthClear to help cleaning out the struct in other
      places too.
      0018477f
    • P
      qemu: snapshot: Detect internal snapshots also for sheepdog and RBD · d8cf91ae
      Peter Krempa 提交于
      When doing an internal snapshot on a VM with sheepdog or RBD disks we
      would not set a flag to mark the domain is using internal snapshots and
      might end up creating a mixed snapshot. Move the setting of the variable
      to avoid this problem.
      d8cf91ae
    • P
      conf: Add functions to copy and free network disk source definitions · ae361674
      Peter Krempa 提交于
      To simplify operations on virDomainDiskHostDef arrays we will need deep
      copy and freeing functions. Add and properly export them.
      ae361674
    • P
      snapshot: conf: Fix NULL dereference when <driver> element is empty · 5a66c667
      Peter Krempa 提交于
      Consider the following valid snapshot XML as the <driver> element is
      allowed to be empty in the domainsnapshot.rng schema:
      
      $ cat snap.xml
      <domainsnapshot>
        <disks>
          <disk name='vda' snapshot='external'>
            <source file='/tmp/foo'/>
            <driver/>
          </disk>
        </disks>
      </domainsnapshot>
      
      produces the following error:
      
      $ virsh snapshot-create domain snap.xml
      error: internal error: unknown disk snapshot driver '(null)'
      
      The driver type is parsed as NULL from the XML as the attribute is not
      present and then directly used to produce the error message.
      
      With this patch the attempt to parse the driver type is skipped if not
      present to avoid changing the schema to forbid the empty driver element.
      5a66c667
    • P
      snapshot: conf: Use common parsing and formatting functions for source · 43f2ccdc
      Peter Krempa 提交于
      Disk source elements for snapshots were using separate code from our
      config parser. As snapshots can be stored on more than just regular
      files, we will need the universal parser to allow us to expose a variety
      of snapshot disk targets. This patch reuses the config parsers and
      formatters to do the job.
      
      This initial support only changes the code without any visible XML
      change.
      43f2ccdc
    • P
      conf: Export disk source formatter and parser · 5f86d11e
      Peter Krempa 提交于
      This code will be reused in the snapshot disk definition parser.
      5f86d11e
    • P
      conf: Split out seclabel formating code for disk source · 30f7ca67
      Peter Krempa 提交于
      The code is common for all the various disk types. Split it out to a
      common function.
      30f7ca67
    • P
      conf: Clean up virDomainDiskSourceDefFormatInternal · 03ad83cb
      Peter Krempa 提交于
      Avoid if statements when used with virBufferEscapeString which
      automaticaly omits the whole string. Also add some line breaks to
      visualy separate the code.
      03ad83cb
    • P
      conf: Support disk source formatting without needing a virDomainDiskDefPtr · d6b4c2cc
      Peter Krempa 提交于
      The <source> element formatting function was expecting a
      virDomainDiskDefPtr to store the data. As snapshots are not using this
      data structure to hold the data, we need to add an internal function
      which splits out individual fields separately.
      d6b4c2cc
    • R
      vbox: handle errors of virDomainHostdevDefAlloc correctly · 1ed7e014
      Ryota Ozaki 提交于
      The original code ignored errors of virDomainHostdevDefAlloc,
      however, we should properly do error return from the function
      if it occurs.
      
      The fix pulls out virDomainHostdevDefAlloc from the loop and
      executes it all together before the loop. So we can easily
      return on errors without the notion of other memory allocations
      in the loop.
      
      The deallocation code is separated from the allocation code
      because it will be used by a further patch for fixing other error
      handlings.
      Reported-by: NLaine Stump <laine@laine.org>
      Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
      1ed7e014
    • R
      vbox: fix incorrect loop condition in vboxHostDeviceGetXMLDesc · 82b5dd23
      Ryota Ozaki 提交于
      The fixed loop used logical OR to combine two conditions, however,
      it is apparently incorrect and logical AND is correct.
      
      We can fix it by replacing OR with AND, but this patch instead
      fixes the problem by getting rid of the first conditional
      statement: USBFilterCount < def->nhostdevs. It isn't needed
      because USBFilterCount will never be greater than or equal to
      def->nhostdevs.
      
      def->nhostdevs is calculated in the following code
      above the loop in question like this:
      
          for (i = 0; i < deviceFilters.count; i++) {
              PRBool active = PR_FALSE;
              IUSBDeviceFilter *deviceFilter = deviceFilters.items[i];
      
              deviceFilter->vtbl->GetActive(deviceFilter, &active);
              if (active) {
                  def->nhostdevs++;
              }
          }
      
      And the loop is constructed as like this:
      
          for (i = 0; (USBFilterCount < def->nhostdevs) || (i < deviceFilters.count); i++) {
              PRBool active                  = PR_FALSE;
      (snip)
              deviceFilter->vtbl->GetActive(deviceFilter, &active);
              if (!active)
                  continue;
      (snip)
              USBFilterCount++;
          }
      
      So def->nhostdevs is the number of active device filters and
      USBFilterCount is counted up only when a device filter is active.
      Thus, we can remove USBFilterCount < def->nhostdevs safely.
      Reported-by: NLaine Stump <laine@laine.org>
      Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
      82b5dd23
    • N
      Fix memory leak in virNWFilterDefParseXML() · 6c874c01
      Nehal J Wani 提交于
      While running nwfilterxml2xmltest, it was found that valgrind pointed out the
      following error...
      
      ==7466== 16 bytes in 1 blocks are definitely lost in loss record 26 of 90
      ==7466==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
          ==7466==    by 0x4C651AD: virAlloc (viralloc.c:142)
          ==7466==    by 0x4D0450D: virNWFilterDefParseNode (nwfilter_conf.c:2575)
          ==7466==    by 0x4D05D84: virNWFilterDefParse (nwfilter_conf.c:2647)
          ==7466==    by 0x401FDE: testCompareXMLToXMLHelper (nwfilterxml2xmltest.c:39)
          ==7466==    by 0x402DE1: virtTestRun (testutils.c:138)
          ==7466==    by 0x4018E9: mymain (nwfilterxml2xmltest.c:111)
          ==7466==    by 0x403482: virtTestMain (testutils.c:593)
          ==7466==    by 0x341F421A04: (below main) (libc-start.c:225)
      
      ...21 times, which are related to 21 tests in nwfilterxml2xmltest.c which sent
      EXPECT_WARN = false. There were two scenarios in virNWFilterDefParseXML(),
      when the variable 'entry' was malloc'ed, but not freed.
      6c874c01
    • N
      Fix memory leak in virDomainDefParseXML() · 2cfcd2cc
      Nehal J Wani 提交于
      This patch fixes the memory leaks found while running qemuxml2argvtest
      
      ==8260== 3 bytes in 1 blocks are definitely lost in loss record 1 of
      129
      ==8260==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
      ==8260==    by 0x341F485E21: strdup (strdup.c:42)
      ==8260==    by 0x4CADCFF: virStrdup (virstring.c:554)
      ==8260==    by 0x4CBB839: virXPathString (virxml.c:90)
      ==8260==    by 0x4CE753A: virDomainDefParseXML (domain_conf.c:11478)
      ==8260==    by 0x4CEB4FE: virDomainDefParseNode (domain_conf.c:12742)
      ==8260==    by 0x4CEB675: virDomainDefParse (domain_conf.c:12684)
      ==8260==    by 0x425958: testCompareXMLToArgvHelper (qemuxml2argvtest.c:107)
      ==8260==    by 0x427111: virtTestRun (testutils.c:138)
      ==8260==    by 0x41D3FE: mymain (qemuxml2argvtest.c:452)
      ==8260==    by 0x4277B2: virtTestMain (testutils.c:593)
      ==8260==    by 0x341F421A04: (below main) (libc-start.c:225)
      ==8260==
      ==8260== 4 bytes in 1 blocks are definitely lost in loss record 5 of
      129
      ==8260==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
      ==8260==    by 0x341F485E21: strdup (strdup.c:42)
      ==8260==    by 0x4CADCFF: virStrdup (virstring.c:554)
      ==8260==    by 0x4CBB839: virXPathString (virxml.c:90)
      ==8260==    by 0x4CE753A: virDomainDefParseXML (domain_conf.c:11478)
      ==8260==    by 0x4CEB4FE: virDomainDefParseNode (domain_conf.c:12742)
      ==8260==    by 0x4CEB675: virDomainDefParse (domain_conf.c:12684)
      ==8260==    by 0x425958: testCompareXMLToArgvHelper (qemuxml2argvtest.c:107)
      ==8260==    by 0x427111: virtTestRun (testutils.c:138)
      ==8260==    by 0x41D39A: mymain (qemuxml2argvtest.c:451)
      ==8260==    by 0x4277B2: virtTestMain (testutils.c:593)
      ==8260==    by 0x341F421A04: (below main) (libc-start.c:225)
      ==8260==
      2cfcd2cc
  4. 29 11月, 2013 1 次提交