1. 23 11月, 2010 18 次提交
    • D
      Fix parsing of port attribute in storage XML configuration · b6e5a0a2
      Daniel P. Berrange 提交于
      The XML docs describe a 'port' attribute for the
      storage source <host> element, but the parser never
      handled it.
      
      * docs/schemas/storagepool.rng: Define port attribute
      * src/conf/storage_conf.c: Add missing parsing/formatting
        of host port number
      * src/conf/storage_conf.h: Remove bogus/unused 'protocol' field
      b6e5a0a2
    • D
      Ensure logfile isn't truncated by shutdown message. · 7f9cebc0
      Daniel P. Berrange 提交于
      When running non-root, the QEMU log file is usually opened with
      truncation, since there is no logrotate for non-root usage.
      This means that when libvirt logs the shutdown timestamp, the
      log is accidentally truncated
      
      * src/qemu/qemu_driver.c: Never truncate log file with shutdown
        message
      7f9cebc0
    • D
      Remove trailing ':' from timestamp · dbf405bf
      Daniel P. Berrange 提交于
      The QEMU logger appends a ':' to the timestamp when it deems
      it neccessary, so the virTimestamp API should not duplicate
      this
      
      * src/util/util.c: Remove trailing ':' from timestamp
      dbf405bf
    • D
      Log all errors at level INFO to stop polluting syslog · 04bd0360
      Daniel P. Berrange 提交于
      Everytime a public API returns an error, libvirtd pollutes
      syslog with that error message. Reduce the error logging
      level to INFO so these don't appear by default.
      
      * src/util/virterror.c: Log all errors at INFO
      04bd0360
    • D
      Ensure virExec preserves logging environment · 882f78c3
      Daniel P. Berrange 提交于
      The virFork call resets all logging handlers that may have been
      set. Re-enable them after fork in virExec, so that env variables
      fir LIBVIRT_LOG_OUTPUTS and LIBVIRT_LOG_FILTERS take effect
      until the execve()
      
      * src/util/util.c: Preserve logging in child in virExec
      882f78c3
    • D
      Include a thread identifier in log messages · 9288c31b
      Daniel P. Berrange 提交于
      To allow messages from different threads to be untangled,
      include an integer thread identifier in log messages.
      
      * src/util/logging.c: Include thread ID
      * src/util/threads.h, src/util/threads.h, src/util/threads-pthread.c:
        Add new virThreadSelfID() function
      * configure.ac: Check for sys/syscall.h
      9288c31b
    • C
      qemu: setvcpus: Save config changes to disk · 388fa625
      Cole Robinson 提交于
      Currently changes to the persistent config aren't flushed to disk, meaning
      they are lost if the domain is redefined or libvirtd is restarted.
      388fa625
    • C
      qemu: setvcpus: Simplify altering the persistent config · 39b62654
      Cole Robinson 提交于
      Do this by adding a helper function to get the persistent domain config. This
      should be useful for other functions that may eventually want to alter
      the persistent domain config (attach/detach device). Also make similar changes
      to the test drivers setvcpus command.
      
      A caveat is that the function will return the running config for a transient
      domain, rather than error. This simplifies callers, as long as they use
      other methods to ensure the guest is persistent.
      39b62654
    • C
      qemu: setvcpus: Fix maxvcpus check · d7520291
      Cole Robinson 提交于
      Doing 'virsh setvcpus $vm --config 10' doesn't check the value against the
      domains maxvcpus value. A larger value for example will prevent the guest
      from starting.
      
      Also make a similar change to the test driver.
      d7520291
    • C
      conf: domain: Improve vcpus validation reporting · 81e6f68d
      Cole Robinson 提交于
      81e6f68d
    • C
      Make state driver device hotplug/update actually transient · 45ec297d
      Cole Robinson 提交于
      The current semantics of non-persistent hotplug/update are confusing: the
      changes will persist as long as the in memory domain definition isn't
      overwritten. This means hotplug changes stay around until the domain is
      redefined or libvirtd is restarted.
      
      Call virDomainObjSetDefTransient at VM startup, so that we properly discard
      hotplug changes when the VM is shutdown.
      45ec297d
    • C
      domain_conf: Add virDomainObjSetDefTransient · 08a72a7d
      Cole Robinson 提交于
      This function sets the running domain definition as transient, by reparsing
      the persistent config and assigning it to newDef. This ensures that any
      changes made to the running definition and not the persistent config are
      discarded when the VM is shutdown.
      08a72a7d
    • C
      xend: Escape reserved sexpr characters · 3afe5d40
      Cole Robinson 提交于
      If we don't escape ' or \ xend can't parse the generated sexpr. This
      might over apply the EscapeSexpr routine, but it shouldn't hurt.
      3afe5d40
    • C
      buf: Simplify virBufferEscapeString · 0af02cb2
      Cole Robinson 提交于
      We are about to copy this function, so clean it up before we do.
      0af02cb2
    • C
      xend: urlencode: Properly escape '&' · c8b2a23c
      Cole Robinson 提交于
      Since we send the sexpr to xend via HTTP, we need to properly escape
      '&'
      c8b2a23c
    • C
      conf: Fix parsing python style triple quotes · 21108d37
      Cole Robinson 提交于
      An incorrect check broke matching the closing set of quotes. Update
      tests to cover this case for XM config files.
      21108d37
    • C
      conf: Convert ParseString to use STRPREFIX · f57c0b23
      Cole Robinson 提交于
      f57c0b23
    • A
      qed: Minor updates to QED support patches · a76234f3
      Adam Litke 提交于
      This patch makes two corrections to the newly-added QED support patch series:
      
       - Correct the QED header field offsets
       - Remove XML parsing for VIR_STORAGE_FILE_AUTO_SAFE
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      a76234f3
  2. 20 11月, 2010 5 次提交
  3. 19 11月, 2010 5 次提交
    • D
    • E
      capabilities, cpu: use new array API · aca20efb
      Eric Blake 提交于
      * src/conf/capabilities.h (_virCaps, _virCapsHost, _virCapsGuest)
      (_virCapsGuestArch): Add additional fields.
      * src/conf/cpu_conf.h (_virCPUDef): Likewise.
      * src/conf/capabilities.c (virCapabilitiesFormatXML): Reflect
      updated type.
      (virCapabilitiesAddGuest, virCapabilitiesAddHostFeature)
      (virCapabilitiesAddHostMigrateTransport)
      (virCapabilitiesAddHostNUMACell, virCapabilitiesAddGuestFeature)
      (virCapabilitiesAddGuestDomain): Use new array APIs.
      * src/conf/cpu_conf.c (virCPUDefAddFeature, virCPUDefCopy)
      (virCPUDefParseXML): Likewise.
      * tests/testutilsqemu.c (testQemuCapsInit): Adjust test.
      aca20efb
    • E
      memory: make it easier to avoid quadratic scaling of arrays · 269d3b72
      Eric Blake 提交于
      * src/util/memory.h (VIR_RESIZE_N): New macro.
      * src/util/memory.c (virResizeN): New function.
      * src/libvirt_private.syms: Export new helper.
      * docs/hacking.html.in: Document it.
      * HACKING: Regenerate.
      269d3b72
    • E
      memory: make it safer to expand arrays · 5a0beacc
      Eric Blake 提交于
      * src/util/memory.h (VIR_REALLOC_N): Update docs.
      (VIR_EXPAND_N, VIR_SHRINK_N): New macros.
      (virAlloc, virAllocN, virReallocN, virAllocVar, virFree): Add some
      gcc attributes.
      * src/util/memory.c (virExpandN, virShrinkN): New functions.
      (virReallocN): Update docs.
      * src/libvirt_private.syms: Export new helpers.
      * docs/hacking.html.in: Prefer newer interfaces over
      VIR_REALLOC_N, since uninitialized memory can bite us.
      * HACKING: Regenerate.
      5a0beacc
    • D
      Fix a failure to restore SELinux label for character devices · 83fa1184
      Daniel Veillard 提交于
      The code in SELinuxRestoreSecurityChardevLabel() was trying to
      use SELinuxSetFilecon directly for devices or file types while
      it should really use SELinuxRestoreSecurityFileLabel encapsulating
      routine, which avoid various problems like resolving symlinks,
      making sure he file exists and work around NFS problems
      83fa1184
  4. 18 11月, 2010 4 次提交
    • M
      virt-aa-helper: Fix several compile errors · c505eafe
      Matthias Bolte 提交于
      Include locale.h for setlocale().
      
      Revert the usage string back to it's original form.
      
      Use puts() instead of fputs(), as fputs() expects a FILE*.
      
      Add closing parenthesis to some vah_error() calls.
      
      Use argv[0] instead of an undefined argv0.
      c505eafe
    • E
      maint: avoid remaining sprintf uses · e8aba782
      Eric Blake 提交于
      * cfg.mk (sc_prohibit_sprintf): New rule.
      (sc_prohibit_asprintf): Avoid false positives.
      * docs/hacking.html.in (Printf-style functions): Document the
      policy.
      * HACKING: Regenerate.
      * .x-sc_prohibit_sprintf: New exemptions.
      * Makefile.am (syntax_check_exceptions): Ship new file.
      * src/vbox/vbox_tmpl.c (vboxStartMachine, vboxAttachUSB): Use
      virAsprintf instead.
      * src/uml/uml_driver.c (umlOpenMonitor): Use snprintf instead.
      * tools/virsh.c (cmdDetachInterface): Likewise.
      * src/security/security_selinux.c (SELinuxGenSecurityLabel):
      Likewise.
      * src/openvz/openvz_driver.c (openvzDomainDefineCmd): Likewise,
      and ensure large enough buffer.
      e8aba782
    • E
      virt-aa-helper: translate error messages · c811d46f
      Eric Blake 提交于
      These messages are visible to the user, so they should be
      consistently translated.
      
      * cfg.mk (msg_gen_function): Add vah_error, vah_warning.
      * src/security/virt-aa-helper.c: Translate messages.
      (catchXMLError): Fix capitalization.
      c811d46f
    • E
      maint: improve i18n on non-Linux · 981d2cda
      Eric Blake 提交于
      Per the gettext developer:
      http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00019.html
      http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00021.html
      
      gettext() doesn't work correctly on all platforms unless you have
      called setlocale().  Furthermore, gnulib's gettext.h has provisions
      for setting up a default locale, which is the preferred method for
      libraries to use gettext without having to call textdomain() and
      override the main program's default domain (virInitialize already
      calls bindtextdomain(), but this is insufficient without the
      setlocale() added in this patch; and a redundant bindtextdomain()
      in this patch doesn't hurt, but serves as a good example for other
      packages that need to bind a second translation domain).
      
      This patch is needed to silence a new gnulib 'make syntax-check'
      rule in the next patch.
      
      * daemon/libvirtd.c (main): Setup locale and gettext.
      * src/lxc/lxc_controller.c (main): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/storage/parthelper.c (main): Likewise.
      * tools/virsh.c (main): Fix exit status.
      * src/internal.h (DEFAULT_TEXT_DOMAIN): Define, for gettext.h.
      (_): Simplify definition accordingly.
      * po/POTFILES.in: Add src/storage/parthelper.c.
      981d2cda
  5. 17 11月, 2010 6 次提交
    • E
      maint: use gnulib configmake rather than open-coding things · 0d5f54bb
      Eric Blake 提交于
      * bootstrap.conf (gnulib_modules): Add configmake.
      * daemon/Makefile.am (libvirtd_CFLAGS): Drop defines provided by
      gnulib.
      * src/Makefile.am (INCLUDES): Likewise.
      * tests/Makefile.am (INCLUDES): Likewise.
      * tools/Makefile.am (virsh_CFLAGS): Likewise.
      * daemon/libvirtd.c (qemudInitPaths, usage, main): Update
      clients.
      * src/cpu/cpu_map.c (CPUMAPFILE): Likewise.
      * src/driver.c (DEFAULT_DRIVER_DIR): Likewise.
      * src/internal.h (_): Likewise.
      * src/libvirt.c (virInitialize): Likewise.
      * src/lxc/lxc_conf.h (LXC_CONFIG_DIR, LXC_STATE_DIR, LXC_LOG_DIR):
      Likewise.
      * src/lxc/lxc_conf.c (lxcCapsInit, lxcLoadDriverConfig):
      Likewise.
      * src/network/bridge_driver.c (NETWORK_PID_DIR)
      (NETWORK_STATE_DIR, DNSMASQ_STATE_DIR, networkStartup): Likewise.
      * src/nwfilter/nwfilter_driver.c (nwfilterDriverStartup):
      Likewise.
      * src/qemu/qemu_conf.c (qemudLoadDriverConfig): Likewise.
      * src/qemu/qemu_driver.c (qemudStartup): Likewise.
      * src/remote/remote_driver.h (LIBVIRTD_PRIV_UNIX_SOCKET)
      (LIBVIRTD_PRIV_UNIX_SOCKET_RO, LIBVIRTD_CONFIGURATION_FILE)
      (LIBVIRT_PKI_DIR): Likewise.
      * src/secret/secret_driver.c (secretDriverStartup): Likewise.
      * src/security/security_apparmor.c (VIRT_AA_HELPER): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/storage/storage_backend_disk.c (PARTHELPER): Likewise.
      * src/storage/storage_driver.c (storageDriverStartup): Likewise.
      * src/uml/uml_driver.c (TEMPDIR, umlStartup): Likewise.
      * src/util/hooks.c (LIBVIRT_HOOK_DIR): Likewise.
      * tools/virsh.c (main): Likewise.
      * docs/hooks.html.in: Likewise.
      0d5f54bb
    • S
      replace last instances of close() · 8e3051af
      Stefan Berger 提交于
      I am replacing the last instances of close() I found with VIR_CLOSE() / VIR_FORCE_CLOSE respectively.
      
      The first part patches virsh, which I missed out on previously.
      
      The 2nd patch I had left out intentionally to look at it more carefully:
      The 'closed' variable could be easily removed since it wasn't used anywhere else. The possible race condition that could result from the filedescriptor being closed and not set to -1 (and possibly let us write into 'something' totally different if the fd was allocated by another thread) seems to be prevented by the qemuMonitorLock() already placed around the code that reads from or writes to the fd. So the change of this code as shown in the patch should not have any side-effects.
      8e3051af
    • S
      nwfilter: also purge ip(6)tables rules before detecting IP address · d4897acf
      Stefan Berger 提交于
      Rather than only cleaning any remaining ebtables rules, also clean those applied to iptables and ip6tables when detecting the IP address of an interface. Previous applied iptables rules may hinder DHCP packets.
      d4897acf
    • S
      deprecate fclose() and introduce VIR_{FORCE_}FCLOSE() · 7b7cb1ec
      Stefan Berger 提交于
      Similarly to deprecating close(), I am now deprecating fclose() and
      introduce VIR_FORCE_FCLOSE() and VIR_FCLOSE(). Also, fdopen() is replaced with
      VIR_FDOPEN().
      
      Most of the files are opened in read-only mode, so usage of
      VIR_FORCE_CLOSE() seemed appropriate. Others that are opened in write
      mode already had the fclose()<  0 check and I converted those to
      VIR_FCLOSE()<  0.
      
      I did not find occurrences of possible double-closed files on the way.
      7b7cb1ec
    • O
      qemu: fix typos in qemu_monitor_text.c · 54837455
      Osier Yang 提交于
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextChangeMedia)
      54837455
    • O
      qemu: record timestamp in qemu domain log · 93bc093a
      Osier Yang 提交于
      Currently only support domain start and shutdown, for domain start,
      record timestamp before the qemu command line, and for domain shutdown,
      just say it's shutting down with timestamp.
      
      * src/qemu/qemu_driver.c (qemudStartVMDaemon, qemudShutdownVMDaemon
        introduced two macros - START_POSTFIX, SHUTDOWN_POSTFIX)
      93bc093a
  6. 16 11月, 2010 2 次提交
    • E
      nwfilter: use /bin/sh rather than requiring bash · 61af79c1
      Eric Blake 提交于
      * src/nwfilter/nwfilter_ebiptables_driver.c (CMD_EXEC): Fix syntax
      error in previous patch.
      Reported by Stefan Berger.
      61af79c1
    • E
      nwfilter: use /bin/sh rather than requiring bash · 61cdff65
      Eric Blake 提交于
      * src/nwfilter/nwfilter_ebiptables_driver.c
      (ebiptablesWriteToTempFile): Use /bin/sh.
      (bash_cmd_path): Delete.
      (ebiptablesDriverInit, ebiptablesDriverShutdown): No need to
      search for bash.
      (CMD_EXEC): Prefer $() over ``, since we can assume POSIX.
      (iptablesSetupVirtInPost): Use portable 'test' syntax.
      (iptablesLinkIPTablesBaseChain): Use POSIX $(()) syntax.
      61cdff65