1. 21 2月, 2015 1 次提交
  2. 30 1月, 2015 1 次提交
    • M
      xend: Don't crash in virDomainXMLDevID · cd7702d4
      Michal Privoznik 提交于
      The function is called from all {Attach,Update,Detach}Device APIs to
      create config strings that are later passed to the xend to perform the
      desired action. The function is intended to handle all supported
      devices. However, as of 5b05358a we
      are trying to get disk driver of the device without checking if the
      device really is a disk. This leads to an segmentation fault:
      
        #0 0x00007ffff7571815 in virDomainDiskGetDriver () from /usr/lib/libvirt.so.0
        #1 0x00007fffeb9ad471 in ?? () from /usr/lib/libvirt/connection-driver/libvirt_driver_xen.so
        #2 0x00007fffeb9b1062 in xenDaemonAttachDeviceFlags () from /usr/lib/libvirt/connection-driver/libvirt_driver_xen.so
        #3 0x00007fffeb9a8a86 in ?? () from /usr/lib/libvirt/connection-driver/libvirt_driver_xen.so
        #4 0x00007ffff7609266 in virDomainAttachDevice () from /usr/lib/libvirt.so.0
        #5 0x0000555555593c9d in ?? ()
        #6 0x00007ffff76743c9 in virNetServerProgramDispatch () from /usr/lib/libvirt.so.0
        #7 0x00005555555a678d in ?? ()
        #8 0x00007ffff755460e in ?? () from /usr/lib/libvirt.so.0
        #9 0x00007ffff7553b06 in ?? () from /usr/lib/libvirt.so.0
        #10 0x00007ffff4998b50 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
        #11 0x00007ffff46e30ed in clone () from /lib/x86_64-linux-gnu/libc.so.6
        #12 0x0000000000000000 in ?? ()
      Reported-by: NXiaolin Su <linxxnil@126.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      cd7702d4
  3. 14 1月, 2015 1 次提交
    • D
      Give virDomainDef parser & formatter their own flags · 0ecd6851
      Daniel P. Berrange 提交于
      The virDomainDefParse* and virDomainDefFormat* methods both
      accept the VIR_DOMAIN_XML_* flags defined in the public API,
      along with a set of other VIR_DOMAIN_XML_INTERNAL_* flags
      defined in domain_conf.c.
      
      This is seriously confusing & error prone for a number of
      reasons:
      
       - VIR_DOMAIN_XML_SECURE, VIR_DOMAIN_XML_MIGRATABLE and
         VIR_DOMAIN_XML_UPDATE_CPU are only relevant for the
         formatting operation
       - Some of the VIR_DOMAIN_XML_INTERNAL_* flags only apply
         to parse or to format, but not both.
      
      This patch cleanly separates out the flags. There are two
      distint VIR_DOMAIN_DEF_PARSE_* and VIR_DOMAIN_DEF_FORMAT_*
      flags that are used by the corresponding methods. The
      VIR_DOMAIN_XML_* flags received via public API calls must
      be converted to the VIR_DOMAIN_DEF_FORMAT_* flags where
      needed.
      
      The various calls to virDomainDefParse which hardcoded the
      use of the VIR_DOMAIN_XML_INACTIVE flag change to use the
      VIR_DOMAIN_DEF_PARSE_INACTIVE flag.
      0ecd6851
  4. 15 11月, 2014 1 次提交
  5. 11 9月, 2014 1 次提交
  6. 04 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in xen and friends · fb6d6507
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on code related to xen.
      
      * src/libxl/libxl_conf.c (libxlCapsInitGuests)
      (libxlMakeDomBuildInfo): Correct use of {}.
      * src/xen/xen_hypervisor.c (virXen_getvcpusinfo)
      (xenHypervisorMakeCapabilitiesInternal): Likewise.
      * src/xen/xend_internal.c (xenDaemonOpen)
      (xenDaemonDomainMigratePerform, xend_detect_config_version)
      (xenDaemonDetachDeviceFlags, xenDaemonDomainMigratePerform)
      (xenDaemonDomainBlockPeek): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiConnectListDomains)
      (xenapiDomainLookupByUUID, xenapiDomainGetOSType): Likewise.
      * src/xenconfig/xen_common.c (xenParseCPUFeatures, xenFormatNet):
      Likewise.
      * src/xenconfig/xen_sxpr.c (xenParseSxpr, xenFormatSxprNet)
      (xenFormatSxpr): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fb6d6507
  7. 20 8月, 2014 1 次提交
  8. 18 7月, 2014 1 次提交
  9. 03 7月, 2014 1 次提交
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
  10. 19 6月, 2014 1 次提交
    • M
      virCaps: expose pages info · 02129b7c
      Michal Privoznik 提交于
      There are two places where you'll find info on page sizes. The first
      one is under <cpu/> element, where all supported pages sizes are
      listed. Then the second one is under each <cell/> element which refers
      to concrete NUMA node. At this place, the size of page's pool is
      reported. So the capabilities XML looks something like this:
      
      <capabilities>
      
        <host>
          <uuid>01281cda-f352-cb11-a9db-e905fe22010c</uuid>
          <cpu>
            <arch>x86_64</arch>
            <model>Westmere</model>
            <vendor>Intel</vendor>
            <topology sockets='1' cores='1' threads='1'/>
            ...
            <pages unit='KiB' size='4'/>
            <pages unit='KiB' size='2048'/>
            <pages unit='KiB' size='1048576'/>
          </cpu>
          ...
          <topology>
            <cells num='4'>
              <cell id='0'>
                <memory unit='KiB'>4054408</memory>
                <pages unit='KiB' size='4'>1013602</pages>
                <pages unit='KiB' size='2048'>3</pages>
                <pages unit='KiB' size='1048576'>1</pages>
                <distances/>
                <cpus num='1'>
                  <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
                </cpus>
              </cell>
              <cell id='1'>
                <memory unit='KiB'>4071072</memory>
                <pages unit='KiB' size='4'>1017768</pages>
                <pages unit='KiB' size='2048'>3</pages>
                <pages unit='KiB' size='1048576'>1</pages>
                <distances/>
                <cpus num='1'>
                  <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
                </cpus>
              </cell>
              ...
            </cells>
          </topology>
          ...
        </host>
      
        <guest/>
      
      </capabilities>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      02129b7c
  11. 04 6月, 2014 1 次提交
    • M
      virCaps: Expose distance between host NUMA nodes · 8ba0a58f
      Michal Privoznik 提交于
      If user or management application wants to create a guest,
      it may be useful to know the cost of internode latencies
      before the guest resources are pinned. For example:
      
      <capabilities>
      
        <host>
          ...
          <topology>
            <cells num='2'>
              <cell id='0'>
                <memory unit='KiB'>4004132</memory>
                <distances>
                  <sibling id='0' value='10'/>
                  <sibling id='1' value='20'/>
                </distances>
                <cpus num='2'>
                  <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
                  <cpu id='2' socket_id='0' core_id='2' siblings='2'/>
                </cpus>
              </cell>
              <cell id='1'>
                <memory unit='KiB'>4030064</memory>
                <distances>
                  <sibling id='0' value='20'/>
                  <sibling id='1' value='10'/>
                </distances>
                <cpus num='2'>
                  <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
                  <cpu id='3' socket_id='0' core_id='2' siblings='3'/>
                </cpus>
              </cell>
            </cells>
          </topology>
          ...
        </host>
        ...
      </capabilities>
      
      We can see the distance from node1 to node0 is 20 and within nodes 10.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      8ba0a58f
  12. 22 4月, 2014 1 次提交
  13. 25 3月, 2014 2 次提交
  14. 18 3月, 2014 1 次提交
  15. 29 1月, 2014 1 次提交
    • J
      xen: fix parsing xend http response · 37564b47
      Jim Fehlig 提交于
      Commit df36af58 broke parsing of http response from xend.  The prior
      use of atoi() would happily parse e.g. a string containing "200 OK\r\n",
      whereas virStrToLong_i() will fail when called with a NULL end_ptr.
      Change the calls to virStrToLong_i() to provide a non-NULL end_ptr.
      37564b47
  16. 05 12月, 2013 1 次提交
    • P
      maint: Kill usage of atoi() · df36af58
      Peter Krempa 提交于
      Kill the use of atoi() and introduce syntax check to forbid it and it's
      friends (atol, atoll, atof, atoq).
      
      Also fix a typo in variable name holding the cylinders count of a disk
      pool (apparently unused).
      
      examples/domsuspend/suspend.c will need a larger scale refactor as the
      whole example file is broken thus it will be exempted from the syntax
      check for now.
      df36af58
  17. 21 11月, 2013 1 次提交
    • E
      maint: fix comma style issues: xen · 86f6748b
      Eric Blake 提交于
      Most of our code base uses space after comma but not before;
      fix the remaining uses before adding a syntax check.
      
      * src/libxl/libxl_driver.c: Consistently use commas.
      * src/xen/xend_internal.c: Likewise.
      * src/xen/xs_internal.c: Likewise.
      * src/xenapi/xenapi_driver.c: Likewise.
      * src/xenapi/xenapi_utils.c: Likewise.
      * src/xenxs/xen_sxpr.c: Likewise.
      * src/xenxs/xen_xm.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      86f6748b
  18. 26 9月, 2013 1 次提交
  19. 06 8月, 2013 1 次提交
    • J
      xen: fix memory corruption in legacy driver · 0e671a16
      Jim Fehlig 提交于
      Commit 632180d1 introduced memory corruption in xenDaemonListDefinedDomains
      by starting to populate the names array at index -1, causing all sorts
      of havoc in libvirtd such as aborts like the following
      
      *** Error in `/usr/sbin/libvirtd': double free or corruption (out): 0x00007fffe00ccf20 ***
      ======= Backtrace: =========
      /lib64/libc.so.6(+0x7abf6)[0x7ffff3fa0bf6]
      /lib64/libc.so.6(+0x7b973)[0x7ffff3fa1973]
      /lib64/libc.so.6(xdr_array+0xde)[0x7ffff403cbae]
      /usr/sbin/libvirtd(+0x50251)[0x5555555a4251]
      /lib64/libc.so.6(xdr_free+0x15)[0x7ffff403ccd5]
      /usr/lib64/libvirt.so.0(+0x1fad34)[0x7ffff76b1d34]
      /usr/lib64/libvirt.so.0(virNetServerProgramDispatch+0x1fc)[0x7ffff76b16f1]
      /usr/lib64/libvirt.so.0(+0x1f214a)[0x7ffff76a914a]
      /usr/lib64/libvirt.so.0(+0x1f222d)[0x7ffff76a922d]
      /usr/lib64/libvirt.so.0(+0xbcc4f)[0x7ffff7573c4f]
      /usr/lib64/libvirt.so.0(+0xbc5e5)[0x7ffff75735e5]
      /lib64/libpthread.so.0(+0x7e0f)[0x7ffff48f7e0f]
      /lib64/libc.so.6(clone+0x6d)[0x7ffff400e7dd]
      
      Fix by initializing ret to 0 and only setting to error on failure path.
      0e671a16
  20. 01 8月, 2013 1 次提交
  21. 11 7月, 2013 1 次提交
  22. 10 7月, 2013 1 次提交
  23. 23 5月, 2013 1 次提交
  24. 21 5月, 2013 12 次提交
    • D
      Convert Xen domain core dump driver methods to use virDomainDefPtr · fa9b8b04
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain coredump
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      fa9b8b04
    • D
      Convert Xen domain stats/peek driver methods to use virDomainDefPtr · 89d819f2
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain stats &
      peek APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      89d819f2
    • D
      Convert Xen domain scheduler driver methods to use virDomainDefPtr · f6e95ac0
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain scheduler
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f6e95ac0
    • D
      Convert Xen domain autostart driver methods to use virDomainDefPtr · d305e869
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain autostart
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d305e869
    • D
      Convert Xen domain device hotplug driver methods to use virDomainDefPtr · 21213a4b
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain hotplug
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      21213a4b
    • D
      Convert Xen domain VCPU driver methods to use virDomainDefPtr · 95e18efd
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain VCPU
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      95e18efd
    • D
      Convert Xen domain create/define/getxml/migration APIs to use virDomainDefPtr · 18b14012
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain create, migrate,
      getxml, & define APIs to simplify introduction of ACL security
      checks. The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      18b14012
    • D
      Convert Xen domain managed save driver methods to use virDomainDefPtr · 0a6fc8ab
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain save
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0a6fc8ab
    • D
      Convert Xen domain property driver methods to use virDomainDefPtr · 249fbea0
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain property
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      249fbea0
    • D
      Convert Xen domain lifecycle driver methods to use virDomainDefPtr · f547c520
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain lifecycle
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f547c520
    • D
      Convert Xen domain lookup driver methods to use virDomainDefPtr · 5ed5783b
      Daniel P. Berrange 提交于
      Introduce use of a virDomainDefPtr in the domain lookup
      APIs to simplify introduction of ACL security checks.
      The virDomainPtr cannot be safely used, since the app
      may have supplied mis-matching name/uuid/id fields. eg
      the name points to domain X, while the uuid points to
      domain Y. Resolving the virDomainPtr to a virDomainDefPtr
      ensures a consistent name/uuid/id set.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5ed5783b
    • E
      maint: use LGPL correctly · d7f53c7b
      Eric Blake 提交于
      Several files called out COPYING or COPYING.LIB instead of using
      the normal boilerplate.  It's especially important that we don't
      call out COPYING from an LGPL file, since COPYING is traditionally
      used for the GPL.  A few files were lacking copyright altogether.
      
      * src/rpc/gendispatch.pl: Add missing copyright.
      * Makefile.nonreentrant: Likewise.
      * src/check-symfile.pl: Likewise.
      * src/check-symsorting.pl: Likewise.
      * src/driver.h: Likewise.
      * src/internal.h: Likewise.
      * tools/libvirt-guests.sh.in: Likewise.
      * tools/virt-pki-validate.in: Mention copyright in comment, not just code.
      * tools/virt-sanlock-cleanup.in: Likewise.
      * src/rpc/genprotocol.pl: Spell out license terms.
      * src/xen/xend_internal.h: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * Makefile.am: Likewise.
      * daemon/Makefile.am: Likewise.
      * docs/Makefile.am: Likewise.
      * docs/schemas/Makefile.am: Likewise.
      * examples/apparmor/Makefile.am: Likewise.
      * examples/domain-events/events-c/Makefile.am: Likewise.
      * examples/dominfo/Makefile.am: Likewise.
      * examples/domsuspend/Makefile.am: Likewise.
      * examples/hellolibvirt/Makefile.am: Likewise.
      * examples/openauth/Makefile.am: Likewise.
      * examples/python/Makefile.am: Likewise.
      * examples/systemtap/Makefile.am: Likewise.
      * examples/xml/nwfilter/Makefile.am: Likewise.
      * gnulib/lib/Makefile.am: Likewise.
      * gnulib/tests/Makefile.am: Likewise.
      * include/Makefile.am: Likewise.
      * include/libvirt/Makefile.am: Likewise.
      * python/Makefile.am: Likewise.
      * python/tests/Makefile.am: Likewise.
      * src/Makefile.am: Likewise.
      * tests/Makefile.am: Likewise.
      * tools/Makefile.am: Likewise.
      * configure.ac: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d7f53c7b
  25. 09 5月, 2013 4 次提交