1. 28 10月, 2011 1 次提交
    • J
      Introduce virXMLSaveFile as a wrapper for virFileRewrite · fef8127c
      Jiri Denemark 提交于
      Every time we write XML into a file we call virEmitXMLWarning to write a
      warning that the file is automatically generated. virXMLSaveFile
      simplifies this into a single step and makes rewriting existing XML file
      safe by using virFileRewrite internally.
      fef8127c
  2. 06 9月, 2011 1 次提交
    • P
      XML: Improve XML parsing error messages · 9fd3bb7a
      Peter Krempa 提交于
      This patch modifies error handling function for the XML parser provided
      by libxml2.
      
      Originaly only a line number and error message were logged. With this
      new error handler function, the user is provided with a more complex
      description of the parsing error.
      
      Context of the error is printed in libXML2 style and filename of the
      file, that caused the error is printed. Example of an parse error:
      
      13:41:36.262: 16032: error : catchXMLError:706 :
      /etc/libvirt/qemu/rh_bad.xml:58: Opening and ending tag mismatch: name
      line 2 and domain
      </domain>
      ---------^
      
      Context of the error gives the user hints that may help to quickly
      locate a corrupt xml file.
      
      fixes BZs:
      ----------
      Bug 708735 - [RFE] Show column and line on XML parsing error
      https://bugzilla.redhat.com/show_bug.cgi?id=708735
      
      Bug 726771 - libvirt does not specify problem file if persistent xml is
      invalid
      https://bugzilla.redhat.com/show_bug.cgi?id=726771
      9fd3bb7a
  3. 19 8月, 2011 1 次提交
    • E
      xml: add another convenience function · 751304e3
      Eric Blake 提交于
      Often, we want to use XPath functions on the just-parsed document;
      fold this into the parser function for convenience.
      
      * src/util/xml.h (virXMLParseHelper): Add argument.
      (virXMLParseStrHelper, virXMLParseFileHelper): Delete.
      (virXMLParseCtxt, virXMLParseStringCtxt, virXMLParseFileCtxt): New
      macros.
      * src/libvirt_private.syms (xml.h): Remove deleted functions.
      * src/util/xml.c (virXMLParseHelper): Add argument.
      (virXMLParseStrHelper, virXMLParseFileHelper): Delete.
      751304e3
  4. 13 5月, 2011 1 次提交
  5. 17 4月, 2011 1 次提交
  6. 05 3月, 2011 1 次提交
  7. 15 2月, 2011 1 次提交
  8. 14 1月, 2011 1 次提交
    • E
      util: add missing string->integer conversion functions · 1ff03b28
      Eric Blake 提交于
      It was awkward having only int conversion in the virStrToLong family,
      but only long conversion in the virXPath family.  Make both families
      support both types.
      
      * src/util/util.h (virStrToLong_l, virStrToLong_ul): New
      prototypes.
      * src/util/xml.h (virXPathInt, virXPathUInt): Likewise.
      * src/util/util.c (virStrToLong_l, virStrToLong_ul): New
      functions.
      * src/util/xml.c (virXPathInt, virXPathUInt): Likewise.
      * src/libvirt_private.syms (util.h, xml.h): Export them.
      1ff03b28
  9. 23 3月, 2010 1 次提交
  10. 08 3月, 2010 1 次提交
    • E
      build: consistently use C99 varargs macros · 2e56fb2b
      Eric Blake 提交于
      Prior to this patch, there was an inconsistent mix between GNU and C99.
      
      For consistency, and potential portability to other compilers, stick
      with the C99 vararg macro syntax.
      
      * src/conf/cpu_conf.c (virCPUReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/conf/domain_conf.c (virDomainReportError): Likewise.
      * src/conf/domain_event.c (eventReportError): Likewise.
      * src/conf/interface_conf.c (virInterfaceReportError): Likewise.
      * src/conf/network_conf.c (virNetworkReportError): Likewise.
      * src/conf/node_device_conf.h (virNodeDeviceReportError): Likewise.
      * src/conf/secret_conf.h (virSecretReportError): Likewise.
      * src/conf/storage_conf.h (virStorageReportError): Likewise.
      * src/esx/esx_device_monitor.c (ESX_ERROR): Use C99 rather than
        GNU vararg macro syntax.
      * src/esx/esx_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_interface_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_network_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_secret_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_storage_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_util.c (ESX_ERROR): Likewise.
      * src/esx/esx_vi.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vi_methods.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vi_types.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vmx.c (ESX_ERROR): Likewise.
      * src/util/hostusb.c (usbReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/util/json.c (virJSONError): Likewise.
      * src/util/macvtap.c (ReportError): Likewise.
      * src/util/pci.c (pciReportError): Likewise.
      * src/util/stats_linux.c (virStatsError): Likewise.
      * src/util/util.c (virUtilError): Likewise.
      * src/util/xml.c (virXMLError): Likewise.
      * src/xen/proxy_internal.c (virProxyError): Use C99 rather than
        GNU vararg macro syntax.
      * src/xen/sexpr.c (virSexprError): Likewise.
      * src/xen/xen_driver.c (xenUnifiedError): Likewise.
      * src/xen/xen_hypervisor.c (virXenError): Likewise.
      * src/xen/xen_inotify.c (virXenInotifyError): Likewise.
      * src/xen/xend_internal.c (virXendError): Likewise.
      * src/xen/xm_internal.c (xenXMError): Likewise.
      * src/xen/xs_internal.c (virXenStoreError): Likewise.
      * src/cpu/cpu.h (virCPUReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/datatypes.c (virLibConnError): Likewise.
      * src/interface/netcf_driver.c (interfaceReportError): Likewise.
      * src/libvirt.c (virLibStreamError): Likewise.
      * src/lxc/lxc_conf.h (lxcError): Likewise.
      * src/network/bridge_driver.c (networkReportError): Likewise.
      * src/nodeinfo.c (nodeReportError): Likewise.
      * src/opennebula/one_conf.h (oneError): Likewise.
      * src/openvz/openvz_conf.h (openvzError): Likewise.
      * src/phyp/phyp_driver.c (PHYP_ERROR): Likewise.
      * src/qemu/qemu_conf.h (qemuReportError): Likewise.
      * src/remote/remote_driver.c (errorf): Likewise.
      * src/security/security_driver.h (virSecurityReportError): Likewise.
      * src/test/test_driver.c (testError): Likewise.
      * src/uml/uml_conf.h (umlReportError): Likewise.
      * src/vbox/vbox_driver.c (vboxError): Likewise.
      * src/vbox/vbox_tmpl.c (vboxError): Likewise.
      2e56fb2b
  11. 02 3月, 2010 1 次提交
    • D
      Add new clock mode allowing variable adjustments · b9e2967a
      Daniel P. Berrange 提交于
      This introduces a third option for clock offset synchronization,
      that allows an arbitrary / variable adjustment to be set. In
      essence the XML contains the time delta in seconds, relative to
      UTC.
      
        <clock offset='variable' adjustment='123465'/>
      
      The difference from 'utc' mode, is that management apps should
      track adjustments and preserve them at next reboot.
      
      * docs/schemas/domain.rng: Schema for new clock mode
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Parse
        new clock time delta
      * src/libvirt_private.syms, src/util/xml.c, src/util/xml.h: Add
        virXPathLongLong() method
      b9e2967a
  12. 09 2月, 2010 2 次提交
  13. 22 10月, 2009 1 次提交
    • D
      Consolidate virXPathNodeSet() · 2f4682a9
      Daniel Veillard 提交于
      virXPathNodeSet() could return -1 when doing an evaluation failure
      due to xmlXPathEval() from libxml2 behaviour.
      * src/util/xml.c: make sure we always return 0 unless the returned
        XPath type is of the wrong type (meaning the query passed didn't
        evaluate to a node set and code must be fixed)
      2f4682a9
  14. 29 9月, 2009 1 次提交
    • D
      Fix some XPath relative node resets · 237f3bf8
      Daniel Veillard 提交于
      * src/util/xml.c: The virXPath... function take extra care to preserve
        the XPath context node (ctxt->node) but in the case of virXPathString
        and virXPathBoolean they forgot to do this on the error path. This
        patch fixes this and move all ctxt->node = relnode instuctions just
        after the xmlXPathEval() to make sure this doesn't happen if this code
        is modified.
      237f3bf8
  15. 21 9月, 2009 1 次提交
    • D
      Move all shared utility files to src/util/ · 1355e055
      Daniel P. Berrange 提交于
      * src/bridge.c, src/bridge.h, src/buf.c, src/buf.h, src/cgroup.c,
        src/cgroup.h, src/conf.c, src/conf.h, src/event.c, src/event.h,
        src/hash.c, src/hash.h, src/hostusb.c, src/hostusb.h,
        src/iptables.c, src/iptables.h, src/logging.c, src/logging.h,
        src/memory.c, src/memory.h, src/pci.c, src/pci.h, src/qparams.c,
        src/qparams.h, src/stats_linux.c, src/stats_linux.h,
        src/threads-pthread.c, src/threads-pthread.h, src/threads-win32.c,
        src/threads-win32.h, src/threads.c, src/threads.h, src/util.c,
        src/util.h, src/uuid.c, src/uuid.h, src/virterror.c,
        src/virterror_internal.h, src/xml.c, src/xml.h: Move all files
        into src/util/
      * daemon/Makefile.am: Add -Isrc/util/ to build flags
      * src/Makefile.am: Add -Isrc/util/ to build flags and update for
        moved files
      * src/libvirt_private.syms: Export cgroup APIs since they're now
        in util rather than linking directly to drivers
      * src/xen/xs_internal.c: Disable bogus virEventRemoveHandle call
        when built under PROXY
      * proxy/Makefile.am: Update for changed file locations. Remove
        bogus build of event.c
      * tools/Makefile.am, tests/Makefile.am: Add -Isrc/util/ to build flags
      1355e055
  16. 03 3月, 2009 1 次提交
  17. 24 2月, 2009 2 次提交
  18. 14 2月, 2009 1 次提交
  19. 29 1月, 2009 1 次提交
    • J
      error-reporting calls using VIR_ERR_NO_MEMORY: use virReportOOMError instead · bc18a91f
      Jim Meyering 提交于
      * src/uml_conf.c (VIR_FROM_THIS): Define to VIR_FROM_UML.
      * src/xs_internal.c (VIR_FROM_THIS): Define to VIR_FROM_XEN.
      * src/xml.c (VIR_FROM_THIS): Define to VIR_FROM_XML.
      * src/stats_linux.c (VIR_FROM_THIS): Define to VIR_FROM_STATS_LINUX.
      * src/datatypes.c (VIR_FROM_THIS): Define to VIR_FROM_NONE.
      * src/lxc_conf.c (VIR_FROM_THIS): Define to VIR_FROM_LXC.
      * src/libvirt.c (VIR_FROM_THIS): Define to VIR_FROM_NONE.
      * src/node_device_conf.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV.
      * src/openvz_conf.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ.
      * src/openvz_driver.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ.
      * src/conf.c (VIR_FROM_THIS): Define to VIR_FROM_CONF.
      Note: this loses config_filename:config_lineno diagnostics,
      but that's ok.
      * src/node_device.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV.
      * src/sexpr.c (VIR_FROM_THIS): Define to VIR_FROM_SEXPR.
      * po/POTFILES.in: remove src/sexpr.c and src/lxc_conf.c
      bc18a91f
  20. 05 11月, 2008 1 次提交
  21. 14 10月, 2008 1 次提交
    • J
      avoid many format string warnings · fd52c6ff
      Jim Meyering 提交于
      Building with --disable-nls exposed many new warnings like these:
      virsh.c:4952: warning: format not a string literal and no format ...
      util.c:163: warning: format not a string literal and no format arguments
      All but one of the following changes add a "%s" argument before
      the offending _(...) argument.
      
      This was the only manual change:
      * src/lxc_driver.c (lxcVersion): Use %s and strerror(errno)
      rather than %m, to avoid a warning from gcc -Wformat-security.
      
      Add "%s" before each warned about format-string-with-no-%-directive:
      * src/domain_conf.c (virDomainHostdevSubsysUsbDefParseXML)
      (virDomainDefParseString, virDomainDefParseFile):
      * src/hash.c (virGetConnect, __virGetDomain, virReleaseDomain)
      (__virGetNetwork, virReleaseNetwork, __virGetStoragePool)
      (virReleaseStoragePool, __virGetStorageVol, virReleaseStorageVol):
      * src/lxc_container.c (lxcContainerChild):
      * src/lxc_driver.c (lxcDomainDefine, lxcDomainUndefine)
      (lxcDomainGetInfo, lxcGetOSType, lxcDomainDumpXML)
      (lxcSetupInterfaces, lxcDomainStart, lxcDomainCreateAndStart)
      (lxcVersion, lxcGetSchedulerParameters):
      * src/network_conf.c (virNetworkDefParseString)
      (virNetworkDefParseFile):
      * src/openvz_conf.c (openvzReadNetworkConf, openvzLoadDomains):
      * src/openvz_driver.c (openvzDomainDefineCmd)
      (openvzDomainGetInfo, openvzDomainDumpXML, openvzDomainShutdown)
      (openvzDomainReboot, ADD_ARG_LIT, openvzDomainDefineXML)
      (openvzDomainCreateXML, openvzDomainCreate, openvzDomainUndefine)
      (openvzDomainSetAutostart, openvzDomainGetAutostart)
      (openvzDomainSetVcpus):
      * src/qemu_driver.c (qemudDomainBlockPeek, qemudDomainMemoryPeek):
      * src/remote_internal.c (remoteDomainBlockPeek)
      (remoteDomainMemoryPeek, remoteAuthPolkit):
      * src/sexpr.c (sexpr_new, _string2sexpr):
      * src/storage_backend_disk.c (virStorageBackendDiskMakeDataVol)
      (virStorageBackendDiskCreateVol):
      * src/storage_backend_fs.c
      (virStorageBackendFileSystemNetFindPoolSources):
      * src/storage_backend_logical.c (virStorageBackendLogicalFindLVs)
      (virStorageBackendLogicalFindPoolSources):
      * src/test.c (testOpenDefault, testOpenFromFile, testOpen)
      (testGetDomainInfo, testDomainRestore)
      (testNodeGetCellsFreeMemory):
      * src/util.c (virExec):
      * src/virsh.c (cmdAttachDevice, cmdDetachDevice)
      (cmdAttachInterface, cmdDetachInterface, cmdAttachDisk)
      (cmdDetachDisk, cmdEdit):
      * src/xend_internal.c (do_connect, wr_sync, xend_op_ext)
      (urlencode, xenDaemonDomainCreateXML)
      (xenDaemonDomainLookupByName_ids, xenDaemonDomainLookupByID)
      (xenDaemonParseSxprOS, xend_parse_sexp_desc_char)
      (xenDaemonParseSxprChar, xenDaemonParseSxprDisks)
      (xenDaemonParseSxpr, sexpr_to_xend_topology, sexpr_to_domain)
      (xenDaemonDomainFetch, xenDaemonDomainGetAutostart)
      (xenDaemonDomainSetAutostart, xenDaemonDomainMigratePerform)
      (xenDaemonDomainDefineXML, xenDaemonGetSchedulerType)
      (xenDaemonGetSchedulerParameters)
      (xenDaemonSetSchedulerParameters, xenDaemonDomainBlockPeek)
      (xenDaemonFormatSxprChr, virDomainXMLDevID):
      * src/xm_internal.c (xenXMConfigCacheRefresh, xenXMDomainPinVcpu)
      (xenXMDomainCreate, xenXMDomainDefineXML)
      (xenXMDomainAttachDevice, xenXMDomainDetachDevice):
      * src/xml.c (virXPathString, virXPathNumber, virXPathLong)
      (virXPathULong, virXPathBoolean, virXPathNode, virXPathNodeSet):
      * src/xs_internal.c (xenStoreOpen):
      fd52c6ff
  22. 10 10月, 2008 1 次提交
  23. 09 10月, 2008 1 次提交
  24. 26 7月, 2008 1 次提交
  25. 25 7月, 2008 3 次提交
  26. 12 7月, 2008 1 次提交
  27. 11 7月, 2008 1 次提交
  28. 09 7月, 2008 1 次提交
  29. 30 5月, 2008 1 次提交
  30. 23 5月, 2008 2 次提交
    • R
      Standardize use of header files, making internal.h primary. · 1d8d4f86
      Richard W.M. Jones 提交于
      	* qemud/internal.h, qemud/qemud.h: Rename this file so it
      	doesn't conflict with src/internal.h.
      	* HACKING: Document how header files should be used.
      	* qemud/Makefile.am: Add src/ directory to includes.
      	* qemud/event.c, qemud/mdns.c, qemud/qemud.c, qemud/remote.c,
      	qemud/remote_protocol.c, qemud/remote_protocol.h,
      	qemud/remote_protocol.x, src/buf.c, src/libvirt.c,
      	src/nodeinfo.c, src/qemu_conf.c, src/qemu_driver.c,
      	src/stats_linux.c, src/storage_backend.c, src/storage_backend_fs.c,
      	src/storage_backend_iscsi.c, src/storage_backend_logical.c,
      	src/storage_conf.c, src/storage_driver.c, src/util.c,
      	src/util.h, src/virsh.c, src/virterror.c, src/xend_internal.c,
      	src/xml.c, tests/reconnect.c, tests/xmlrpctest.c,
      	tests/qparamtest.c: Standardize	use of header files.
      	* docs/*, po/*: Rebuild docs.
      1d8d4f86
    • D
      Apply CPU pinning at startup for QEMU guests · e193b5dd
      Daniel P. Berrange 提交于
      e193b5dd
  31. 16 5月, 2008 2 次提交
    • J
      * src/xml.c: Include "c-ctype.h". · a770c2ab
      Jim Meyering 提交于
      a770c2ab
    • J
      start using c-ctype functions · c1ee35af
      Jim Meyering 提交于
      Up to now, we've been avoiding ctype functions like isspace, isdigit,
      etc.  because they are locale-dependent.  Now that we have the c-ctype
      functions, we can start using *them*, to make the code more readable
      with changes like these:
      
      -        /* This may not work on EBCDIC. */
      -        if ((*p >= 'a' && *p <= 'z') ||
      -            (*p >= 'A' && *p <= 'Z') ||
      -            (*p >= '0' && *p <= '9'))
      +        if (c_isalnum(*p))
      
      -    while ((*cur >= '0') && (*cur <= '9')) {
      +    while (c_isdigit(*cur)) {
      
      Also, some macros in conf.c used names that conflicted with
      standard meaning of "BLANK" and "SPACE", so I've adjusted them
      to be in line with the definition of e.g., isblank.
      In addition, I've wrapped those statement macros with do {...} while (0),
      so that we can't forget the ";" after a use.  There was one like that
      already (fixed below).  The missing semicolon would mess up automatic
      indenting.
      * src/buf.c (virBufferURIEncodeString):
      * src/conf.c (IS_EOL, SKIP_BLANKS_AND_EOL, SKIP_BLANKS)
      (virConfParseLong, virConfParseValue, virConfParseName)
      (virConfParseSeparator, virConfParseStatement, IS_BLANK, IS_CHAR)
      (IS_DIGIT, IS_SPACE, SKIP_SPACES):
      * src/nodeinfo.c:
      * src/qemu_conf.c (qemudParseInterfaceXML):
      * src/qemu_driver.c (qemudDomainBlockStats):
      * src/sexpr.c:
      * src/stats_linux.c:
      * src/util.c (virParseNumber, virDiskNameToIndex):
      * src/uuid.c (hextobin, virUUIDParse):
      * src/virsh.c:
      * src/xml.c (parseCpuNumber, virParseCpuSet):
      c1ee35af
  32. 15 5月, 2008 1 次提交
  33. 08 5月, 2008 1 次提交
  34. 07 5月, 2008 1 次提交
    • D
      Sound support for QEmu and Xen · 70f44663
      Daniel Veillard 提交于
      * src/qemu_conf.c src/qemu_conf.h src/xend_internal.c
        src/xend_internal.h src/xm_internal.c src/xml.c src/xml.h:
        Patch from Cole Robinson adding sound support for QEmu and Xen
      * tests/qemuxml2argvtest.c tests/sexpr2xmltest.c
        tests/xmconfigtest.c tests/xml2sexprtest.c:
        Associated regression tests
      Daniel
      70f44663