1. 09 5月, 2013 2 次提交
  2. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  3. 24 4月, 2013 1 次提交
  4. 05 4月, 2013 3 次提交
    • P
      conf callback: Rearrange function parameters · ad0d10b2
      Peter Krempa 提交于
      Move the xmlopt and caps arguments to the end of the argument list.
      ad0d10b2
    • P
      conf: Add post XML parse callbacks and prepare for cleaning of virCaps · 43b99fc4
      Peter Krempa 提交于
      This patch adds instrumentation that will allow hypervisor drivers to
      fill and validate domain and device definitions after parsed by the XML
      parser.
      
      With this patch, after the XML is parsed, a callback to the driver is
      issued requesting to fill and validate driver specific details of the
      configuration. This allows to use sensible defaults and checks on a per
      driver basis at the time the XML is parsed.
      
      Two callback pointers are stored in the new virDomainXMLConf object:
      * virDomainDeviceDefPostParseCallback (devicesPostParseCallback)
        - called for a single device parsed and for every single device in a
          domain config. A virDomainDeviceDefPtr is passed along with the
          domain definition and virCaps.
      
      * virDomainDefPostParseCallback, (domainPostParseCallback)
        - A callback that is meant to process the domain config after it's
        parsed.  A virDomainDefPtr is passed along with virCaps.
      
      Both types of callbacks support arbitrary opaque data passed for the
      callback functions.
      
      Errors may be reported in those callbacks resulting in a XML parsing
      failure.
      43b99fc4
    • P
      maint: Rename xmlconf to xmlopt and virDomainXMLConfig to virDomainXMLOption · e84b1931
      Peter Krempa 提交于
      This patch is the result of running:
      
      for i in $(git ls-files | grep -v html | grep -v \.po$ ); do
        sed -i -e "s/virDomainXMLConf/virDomainXMLOption/g" -e "s/xmlconf/xmlopt/g" $i
      done
      
      and a few manual tweaks.
      e84b1931
  5. 13 3月, 2013 1 次提交
    • P
      virCaps: conf: start splitting out irrelevat data · 27cf98e2
      Peter Krempa 提交于
      The virCaps structure gathered a ton of irrelevant data over time that.
      The original reason is that it was propagated to the XML parser
      functions.
      
      This patch aims to create a new data structure virDomainXMLConf that
      will contain immutable data that are used by the XML parser. This will
      allow two things we need:
      
      1) Get rid of the stuff from virCaps
      
      2) Allow us to add callbacks to check and add driver specific stuff
      after domain XML is parsed.
      
      This first attempt removes pointers to private data allocation functions
      to this new structure and update all callers and function that require
      them.
      27cf98e2
  6. 11 2月, 2013 1 次提交
  7. 21 12月, 2012 6 次提交
  8. 02 11月, 2012 1 次提交
  9. 12 10月, 2012 1 次提交
  10. 21 9月, 2012 1 次提交
  11. 20 9月, 2012 1 次提交
  12. 18 9月, 2012 1 次提交
  13. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  14. 20 7月, 2012 1 次提交
  15. 17 7月, 2012 1 次提交
    • S
      Convert 'raw MAC address' usages to use virMacAddr · 387117ad
      Stefan Berger 提交于
      Introduce new members in the virMacAddr 'class'
      - virMacAddrSet: set virMacAddr from a virMacAddr
      - virMacAddrSetRaw: setting virMacAddr from raw 6 byte MAC address buffer
      - virMacAddrGetRaw: writing virMacAddr into raw 6 byte MAC address buffer
      - virMacAddrCmp: comparing two virMacAddr
      - virMacAddrCmpRaw: comparing a virMacAddr with a raw 6 byte MAC address buffer
      
      then replace raw MAC addresses by replacing
      
      - 'unsigned char *' with virMacAddrPtr
      - 'unsigned char ... [VIR_MAC_BUFLEN]' with virMacAddr
      
      and introduce usage of above functions where necessary.
      387117ad
  16. 27 3月, 2012 1 次提交
    • M
      Cleanup for a return statement in source files · 9943276f
      Martin Kletzander 提交于
      Return statements with parameter enclosed in parentheses were modified
      and parentheses were removed. The whole change was scripted, here is how:
      
      List of files was obtained using this command:
      git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
      grep -e '\.[ch]$' -e '\.py$'
      
      Found files were modified with this command:
      sed -i -e                                                                 \
      's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
      -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
      
      Then checked for nonsense.
      
      The whole command looks like this:
      git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
      grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e                            \
      's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
      -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
      9943276f
  17. 08 3月, 2012 1 次提交
    • E
      xml: use long long internally, to centralize overflow checks · 73b99771
      Eric Blake 提交于
      On 64-bit platforms, unsigned long and unsigned long long are
      identical, so we don't have to worry about overflow checks.
      On 32-bit platforms, anywhere we narrow unsigned long long back
      to unsigned long, we have to worry about overflow; it's easier
      to do this in one place by having most of the code use the same
      or wider types, and only doing the narrowing at the last minute.
      Therefore, the memory set commands remain unsigned long, and
      the memory get command now centralizes the overflow check into
      libvirt.c, so that drivers don't have to repeat the work.
      
      This also fixes a bug where xen returned the wrong value on
      failure (most APIs return -1 on failure, but getMaxMemory
      must return 0 on failure).
      
      * src/driver.h (virDrvDomainGetMaxMemory): Use long long.
      * src/libvirt.c (virDomainGetMaxMemory): Raise overflow.
      * src/test/test_driver.c (testGetMaxMemory): Fix driver.
      * src/rpc/gendispatch.pl (name_to_ProcName): Likewise.
      * src/xen/xen_hypervisor.c (xenHypervisorGetMaxMemory): Likewise.
      * src/xen/xen_driver.c (xenUnifiedDomainGetMaxMemory): Likewise.
      * src/xen/xend_internal.c (xenDaemonDomainGetMaxMemory):
      Likewise.
      * src/xen/xend_internal.h (xenDaemonDomainGetMaxMemory):
      Likewise.
      * src/xen/xm_internal.c (xenXMDomainGetMaxMemory): Likewise.
      * src/xen/xm_internal.h (xenXMDomainGetMaxMemory): Likewise.
      * src/xen/xs_internal.c (xenStoreDomainGetMaxMemory): Likewise.
      * src/xen/xs_internal.h (xenStoreDomainGetMaxMemory): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiDomainGetMaxMemory):
      Likewise.
      * src/esx/esx_driver.c (esxDomainGetMaxMemory): Likewise.
      * src/libxl/libxl_driver.c (libxlDomainGetMaxMemory): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainGetMaxMemory): Likewise.
      * src/lxc/lxc_driver.c (lxcDomainGetMaxMemory): Likewise.
      * src/uml/uml_driver.c (umlDomainGetMaxMemory): Likewise.
      73b99771
  18. 07 2月, 2012 2 次提交
    • P
      xen-xm: SIGSEGV in xenXMDomainDefineXML: filename · 360afebf
      Philipp Hahn 提交于
      filename is not initialized to NULL while it's unconditionally freed in
      the error path.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      360afebf
    • P
      xen-xm: fix data loss in domain edit · 700102c9
      Philipp Hahn 提交于
      On CentOS5:
      If "virsh edit $DOM" is used and an error happens (for example changing
      any live cycle action to a non-existing value), libvirt forgets that
      $DOM exists, since it is already removed from the internal hash tables,
      which are used for domain lookup.
      In once case (unreproducible) even the persistent configuration
      /etc/xen/$DOM was deleted.
      
      Instead of using the compound function xenXMConfigSaveFile() explicitly
      use xenFomatXM() and virConfWriteFile() to distinguish between a failure
      in converting the libvirt definition to the xen-xm format and a problem
      when writing the file.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      700102c9
  19. 06 2月, 2012 1 次提交
    • P
      xen_xm: Fix SIGSEGV in xenXMDomainDefineXML · 046b0a69
      Philipp Hahn 提交于
      On CentOS5 with xen-3.0.3:
      
       Program received signal SIGSEGV, Segmentation fault.
       virFree (ptrptr=0x8) at util/memory.c:310
       310         free(*(void**)ptrptr);
       (gdb) bt
       #0  virFree (ptrptr=0x8) at util/memory.c:310
       #1  0x00002aaaaae167c8 in xenXMDomainDefineXML (conn=0x694e80, xml=0x6b2ce0 "P\fk") at xen/xm_internal.c:1199
       #2  0x00002aaaaae070d7 in xenUnifiedDomainDefineXML (conn=0x8,
           xml=0x6ac040 "<domain type='xen'>\n  <name>pv</name>\n  <uuid>20291bc0-453a-4d6c-c6ac-4e5af63b932c</uuid>\n  <memory>1048576</memory>\n  <currentMemory>1048576</currentMemory>\n  <vcpu>1</vcpu>\n  <os>\n    <type arch='x8"...) at xen/xen_driver.c:1524
       #3  0x00002aaaaada7803 in virDomainDefineXML (conn=0x694e80,
           xml=0x6ac040 "<domain type='xen'>\n  <name>pv</name>\n  <uuid>20291bc0-453a-4d6c-c6ac-4e5af63b932c</uuid>\n  <memory>1048576</memory>\n  <currentMemory>1048576</currentMemory>\n  <vcpu>1</vcpu>\n  <os>\n    <type arch='x8"...) at libvirt.c:7823
       #4  0x0000000000426173 in cmdEdit (ctl=0x7fffffffb8e0, cmd=<value optimized out>) at virsh.c:14882
       #5  0x000000000041c9ce in vshCommandRun (ctl=0x7fffffffb8e0, cmd=0x658c50) at virsh.c:17712
       #6  0x000000000042c3b9 in main (argc=1, argv=<value optimized out>) at virsh.c:19317
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      046b0a69
  20. 26 1月, 2012 1 次提交
  21. 02 12月, 2011 1 次提交
    • E
      maint: typo fixes · a6997934
      Eric Blake 提交于
      Many of these were mentioned by Yuri Chornoivan in:
      https://bugzilla.redhat.com/show_bug.cgi?id=669506
      
      * src/esx/esx_vi.c (esxVI_WaitForTaskCompletion): Fix spelling.
      * src/conf/netdev_vport_profile_conf.c
      (virNetDevVPortProfileParse): Likewise.
      * src/xen/xend_internal.c (xenDaemonDomainSetVcpusFlags):
      Likewise.
      * src/xen/xm_internal.c (xenXMDomainSetVcpusFlags): Likewise.
      * src/esx/esx_util.c (esxUtil_ResolveHostname): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemBuild): Likewise.
      * daemon/libvirtd.conf: Likewise.
      * src/util/logging.c (virLogMessage): Likewise.
      * src/uml/uml_conf.c (umlBuildCommandLineNet): Likewise.
      * src/vmx/vmx.c (virVMXFormatEthernet): Likewise.
      a6997934
  22. 22 11月, 2011 1 次提交
    • E
      conf: don't modify cpu set string during parsing · 693d22d4
      Eric Blake 提交于
      None of the callers cared if str was updated to point to the next
      byte after the parsed cpuset; simplifying this results in quite
      a few code simplifications.  Additionally, virCPUDefParseXML was
      strdup()'ing a malloc()'d string; avoiding a memory copy resulted
      in less code.
      
      * src/conf/domain_conf.h (virDomainCpuSetParse): Alter signature.
      * src/conf/domain_conf.c (virDomainCpuSetParse): Don't modify str.
      (virDomainVcpuPinDefParseXML, virDomainDefParseXML): Adjust
      callers.
      * src/conf/cpu_conf.c (virCPUDefParseXML): Likewise.
      * src/xen/xend_internal.c (sexpr_to_xend_topology): Likewise.
      * src/xen/xm_internal.c (xenXMDomainPinVcpu): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxpr): Likewise.
      * src/xenxs/xen_xm.c (xenParseXM): Likewise.
      693d22d4
  23. 23 8月, 2011 1 次提交
  24. 19 8月, 2011 2 次提交
  25. 29 7月, 2011 2 次提交
    • E
      xen: drop unused callbacks · 1b3765fd
      Eric Blake 提交于
      Found by:
      
      for f in $(sed -n 's/.*Drv[^ ]* \([^;]*\);.*/\1/p' src/xen/xen_driver.h)
      do
        git grep "\(\.\|->\)$f\b" src/xen
      done | cat
      
      and looking through the resulting list to see which callback struct
      members are still necessary.
      
      * src/xen/xen_driver.h (xenUnifiedDriver): Drop all callbacks that
      are only used directly.
      * src/xen/xen_hypervisor.c (xenHypervisorDriver): Shrink list.
      * src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
      * src/xen/xend_internal.c (xenDaemonDriver): Likewise.
      * src/xen/xm_internal.c (xenXMDriver): Likewise.
      * src/xen/xs_internal.c (xenStoreDriver): Likewise.
      1b3765fd
    • E
      xen: cleanup callback struct · f859919f
      Eric Blake 提交于
      Using C99 initializers and xen-specific prefixes will make it
      so that future patches are less likely to add callback members
      to the xenUnifiedDriver struct, since the goal is to get rid
      of the callback struct in the first place.
      
      * src/xen/xen_driver.h (xenUnifiedDriver): Rename all struct
      members, to make it obvious which ones are still in use.
      * src/xen/xen_driver.c: Update all callers.
      * src/xen/xen_hypervisor.c (xenHypervisorDriver): Rewrite with C99
      initializers.
      * src/xen/xend_internal.c (xenDaemonDriver): Likewise.
      * src/xen/xs_internal.c (xenStoreDriver): Likewise.
      * src/xen/xm_internal.c (xenXMDriver): Likewise.
      * src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
      f859919f
  26. 22 7月, 2011 2 次提交
    • E
      build: fix bugs with destroyFlags patches · 934fdcb3
      Eric Blake 提交于
      Build failure on xenapi_driver from compiler warnings (flags was unused).
      
      Build failure on xen (incorrect number of arguments).  And in fixing
      that, I obeyed the comments of struct xenUnifiedDriver that state
      that we want to minimize the number of callback functions in that
      struct, not add to it.
      
      * src/xen/xen_driver.c (xenUnifiedDomainDestroyFlags): Use correct
      arguments.
      (xenUnifiedDomainDestroy): Simplify.
      * src/xen/xen_driver.h (xenUnifiedDriver): Remove unused callback.
      * src/xen/xen_hypervisor.c (xenHypervisorDestroyDomain): Likewise.
      * src/xen/xend_internal.c (xenDaemonDomainDestroy): Likewise.
      * src/xen/xend_internal.h (xenDaemonDomainDestroyFlags): Likewise.
      * src/xen/xm_internal.c (xenXMDriver): Likewise.
      * src/xen/xs_internal.c (xenStoreDriver): Likewise.
      * src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiDomainDestroyFlags): Reject
      unknown flags.
      934fdcb3
    • M
      destroy: Implement internal API for xen driver · 1edf5cc5
      Michal Privoznik 提交于
      1edf5cc5
  27. 16 7月, 2011 1 次提交
    • E
      xen: reject unknown flags · 6a713b31
      Eric Blake 提交于
      Also fix a logic bug in xenXMDomain{Attach,Detach}DeviceFlags,
      where (flags & VIR_DOMAIN_DEVICE_MODIFY_CURRENT) is always false.
      
      * src/xen/xen_driver.c (xenUnifiedDomainXMLFromNative)
      (xenUnifiedDomainXMLToNative, xenUnifiedDomainBlockPeek): Reject
      unknown flags.
      * src/xen/xen_hypervisor.c (xenHypervisorOpen)
      (xenHypervisorGetDomainState): Likewise.
      * src/xen/xen_inotify.c (xenInotifyOpen): Likewise.
      * src/xen/xs_internal.c (xenStoreOpen, xenStoreDomainGetState)
      (xenStoreDomainReboot): Likewise.
      * src/xen/xend_internal.c (xenDaemonOpen, xenDaemonDomainReboot)
      (xenDaemonDomainCoreDump, xenDaemonDomainGetState)
      (xenDaemonDomainMigratePrepare, xenDaemonDomainSetVcpusFlags,
      xenDaemonDomainGetVcpusFlags, xenDaemonAttachDeviceFlags,
      xenDaemonDetachDeviceFlags): Likewise.
      (xenDaemonDomainGetXMLDesc): Prefer unsigned flags.
      * src/xen/xend_internal.h (xenDaemonDomainGetXMLDesc): Likewise.
      * src/xen/xm_internal.h (xenXMDomainGetXMLDesc): Likewise.
      * src/xen/xm_internal.c (xenXMDomainGetXMLDesc): Likewise.
      (xenXMOpen, xenXMDomainGetState, xenXMDomainSetVcpusFlags)
      (xenXMDomainGetVcpusFlags): Reject unknown flags.
      (xenXMDomainAttachDeviceFlags, xenXMDomainDetachDeviceFlags):
      Likewise, and avoid always-false conditional.
      * src/xen/xen_driver.h (XEN_MIGRATION_FLAGS): New define.
      6a713b31
  28. 12 7月, 2011 1 次提交
    • M
      Add domain type checking · aa14709a
      Matthias Bolte 提交于
      The drivers were accepting domain configs without checking if those
      were actually meant for them. For example the LXC driver happily
      accepts configs with type QEMU.
      
      Add a check for the expected domain types to the virDomainDefParse*
      functions.
      aa14709a