1. 02 11月, 2012 20 次提交
    • D
      Document bracket whitespace rules & add syntax-check rule · a3e95abe
      Daniel P. Berrange 提交于
      This documents the following whitespace rules
      
            if(foo)   // Bad
            if (foo)  // Good
      
            int foo (int wizz)  // Bad
            int foo(int wizz)   // Good
      
            bar = foo (wizz);  // Bad
            bar = foo(wizz);   // Good
      
            typedef int (*foo) (int wizz);  // Bad
            typedef int (*foo)(int wizz);   // Good
      
            int foo( int wizz );  // Bad
            int foo(int wizz);    // Good
      
      There is a syntax-check rule extension to validate all these rules.
      Checking for 'function (...args...)' is quite difficult since it
      needs to ignore valid usage with keywords like 'if (...test...)'
      and while/for/switch. It must also ignore source comments and
      quoted strings.
      
      It is not possible todo this with a simple regex in the normal
      syntax-check style. So a short Perl script is created instead
      to analyse the source. In practice this works well enough. The
      only thing it can't cope with is multi-line quoted strings of
      the form
      
       "start of string\
      more lines\
      more line\
      the end"
      
      but this can and should be written as
      
       "start of string"
       "more lines"
       "more line"
       "the end"
      
      with this simple change, the bracket checking script does not
      have any false positives across libvirt source, provided it
      is only run against .c files. It is not practical to run it
      against .h files, since those use whitespace extensively to
      get alignment (though this is somewhat inconsistent and could
      arguably be fixed).
      
      The only limitation is that it cannot detect a violation where
      the first arg starts with a '*', eg
      
         foo(*wizz);
      
      since this generates too many false positives on function
      typedefs which can't be supressed efficiently.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a3e95abe
    • D
      Remove spurious whitespace between function name & open brackets · 1c04f999
      Daniel P. Berrange 提交于
      The libvirt coding standard is to use 'function(...args...)'
      instead of 'function (...args...)'. A non-trivial number of
      places did not follow this rule and are fixed in this patch.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1c04f999
    • P
      net: Mark network persistent when assigning persistent definition · 0211fd6e
      Peter Krempa 提交于
      When assigning the new persistent definition for a transient network
      (thus making it persistent) the network needs to be marked persistent
      before actually atempting to assign the definition.
      0211fd6e
    • P
      net: Add support for changing persistent networks to transient · fa16957c
      Peter Krempa 提交于
      Until now, the network undefine API was able to undefine only inactive
      networks. The restriction doesn't make sense any more so this patch
      implements changing networks to transient.
      fa16957c
    • P
      net: Re-use checks when creating transient networks · b6dbbae1
      Peter Krempa 提交于
      When a transient network was created some of the checks weren't run on
      the definition allowing to start invalid networks.
      
      This patch splits out code to the network validation function and
      re-uses that code when creating transient networks.
      b6dbbae1
    • P
      net: Remove dnsmasq and radvd files also when destroying transient nets · e87af617
      Peter Krempa 提交于
      The network driver didn't care about config files when a network was
      destroyed, just when it was undefined leaving behind files for transient
      networks.
      
      This patch splits out the cleanup code to a helper function that handles
      the cleanup if the inactive network object is being removed and re-uses
      this code when getting rid of inactive networks.
      e87af617
    • P
      net: Move creation of dnsmasq hosts file to function starting dnsmasq · 23ae3fe4
      Peter Krempa 提交于
      The hosts file was created in the network definition function. This
      patch moves the place the file is being created to the point where
      dnsmasq is being started.
      23ae3fe4
    • P
      net: Change argument type of virNetworkObjIsDuplicate() · a3258c0e
      Peter Krempa 提交于
      The argument check_active is used only as a boolean so this patch
      changes the type and updates callers.
      a3258c0e
    • P
      conf: net: Fix deadlock if assignment of network def fails · f8230891
      Peter Krempa 提交于
      When the assignment fails, the network object is not unlocked and next
      call that would use it deadlocks.
      f8230891
    • P
      conf: net: Fix helper for applying new network definition · 947230fb
      Peter Krempa 提交于
      When there's no new definition the helper overwrote the old one with
      NULL.
      947230fb
    • J
      build: Do not ignore logging.c in sc_prohibit_mkstemp · d055498d
      Jiri Denemark 提交于
      Now that the offending code was removed, we may remove this as well.
      d055498d
    • D
      Remove a chunk which should not have been pushed as part of 1.0.0 · bd0cb27c
      Daniel Veillard 提交于
      I didn't noticed that that small old patch was still applied locally
      bd0cb27c
    • M
      logging.c: Properly indent and ignore one syntax-check rule · 30b398d5
      Michal Privoznik 提交于
      With our fix of mkostemp (pushed as 2b435c15) we define a macro
      to compile with uclibc. However, this definition is conditional
      and thus needs to be properly indented. Moreover, with this definition
      sc_prohibit_mkstemp syntax-check rule keeps yelling:
      
        src/util/logging.c:63:# define mkostemp(x,y) mkstemp(x)
        maint.mk: use mkostemp with O_CLOEXEC instead of mkstemp
      
      Therefore we should ignore this file for this rule.
      30b398d5
    • G
      qemu: use default machine type if missing it in qemu command line · 1851a0c8
      Guannan Ren 提交于
      BZ:https://bugzilla.redhat.com/show_bug.cgi?id=871273
      when using virsh qemu-attach to attach an existing qemu process,
      if it misses the -M option in qemu command line, libvirtd crashed
      because the NULL value of def->os.machine in later use.
      
      Example:
      /usr/libexec/qemu-kvm -name foo \
                            -cdrom /var/lib/libvirt/images/boot.img \
                            -monitor unix:/tmp/demo,server,nowait \
      
      error: End of file while reading data: Input/output error
      error: Failed to reconnect to the hypervisor
      
      This patch tries to set default machine type if the value of
      def->os.machine is still NULL after qemu command line parsing.
      1851a0c8
    • D
      Release of libvirt-1.0.0 · 2b435c15
      Daniel Veillard 提交于
      * configure.ac docs/news.html.in libvirt.spec.in: update for the new release
      * po/*.po*: update from transifex, a lot of added support e.g. Indian
        languages, and regenerate
      2b435c15
    • E
      cpumap: optimize for clients that don't need online count · 3d0130cb
      Eric Blake 提交于
      It turns out that calling virNodeGetCPUMap(conn, NULL, NULL, 0)
      is both useful, and with Viktor's patches, common enough to
      optimize.  Since this interface hasn't been released yet, we
      can change the RPC call.
      
      A bit more background on the optimization - learning the cpu count
      is a single file read (/sys/devices/system/cpu/possible), but
      learning the number of online cpus can possibly trigger a file
      read per cpu, depending on the age of the kernel, and all wasted
      if the caller passed NULL for both arguments.
      
      * src/nodeinfo.c (nodeGetCPUMap): Avoid bitmap when not needed.
      * src/remote/remote_protocol.x (remote_node_get_cpu_map_args):
      Supply two separate flags for needed arguments.
      * src/remote/remote_driver.c (remoteNodeGetCPUMap): Update
      caller.
      * daemon/remote.c (remoteDispatchNodeGetCPUMap): Likewise.
      * src/remote_protocol-structs: Regenerate.
      3d0130cb
    • D
      qemu: QMP capabilities support starts with 1.2 · ba804d9f
      Doug Goldstein 提交于
      Per the code comment in qemuCapsInitQMPBasic() and commit 43e23c73, we
      should only use QMP for capabilities probing starting with 1.2 and
      newer.  The old code had dead logic that probed on 1.0 and newer.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ba804d9f
    • D
      Linux Containers are not allowed to create device nodes. · 2e03b08e
      Dan Walsh 提交于
      This needs to be done before the container starts. Turning
      off the mknod capability is noticed by systemd, which will
      no longer attempt to create device nodes.
      
      This eliminates SELinux AVC messages and ugly failure messages in the journal.
      2e03b08e
    • S
      qemu: Fix name comparison in qemuMonitorJSONBlockIoThrottleInfo() · 23d47b33
      Stefan Hajnoczi 提交于
      The string comparison logic was inverted and matched the first drive
      that does *not* have the name we search for.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      23d47b33
    • S
      qemu: Keep QEMU host drive prefix in BlkIoTune · 04ee70bf
      Stefan Hajnoczi 提交于
      The QEMU -drive id= begins with libvirt's QEMU host drive prefix
      ("drive-"), which is stripped off in several places two convert between
      host ("-drive") and guest ("-device") device names.
      
      In the case of BlkIoTune it is unnecessary to strip the QEMU host drive
      prefix because we operate on "info block"/"query-block" output that uses
      host drive names.
      
      Stripping the prefix incorrectly caused string comparisons to fail since
      we were comparing the guest device name against the host device name.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      04ee70bf
  2. 01 11月, 2012 9 次提交
  3. 31 10月, 2012 8 次提交
    • M
      gitignore: Ignore 'tags' · ffa62d06
      Michal Privoznik 提交于
      ffa62d06
    • M
      qemu: Fix EmulatorPinInfo without emulatorpin · 10c5212b
      Martin Kletzander 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=871312
      
      Recent fixes made almost all the right steps to make emulator pinned
      to the cpuset of the whole domain in case <emulatorpin> isn't
      specified, but qemudDomainGetEmulatorPinInfo still reports all the
      CPUs even when cpuset is specified.  This patch fixes that.
      10c5212b
    • P
      util: Improve error reporting from absolutePathFromBaseFile helper · ca043b8c
      Peter Krempa 提交于
      There are multiple reasons canonicalize_file_name() used in
      absolutePathFromBaseFile helper can fail. This patch enhances error
      reporting from that helper.
      ca043b8c
    • M
      Make non-KVM machines work with QMP probing · 037a49dc
      Martin Kletzander 提交于
      When there is no 'qemu-kvm' binary and the emulator used for a machine
      is, for example, 'qemu-system-x86_64' that, by default, runs without
      kvm enabled, libvirt still supplies '-no-kvm' option to this process,
      even though it does not recognize such option (making the start of a
      domain fail in that case).
      
      This patch fixes building a command-line for QEMU machines without KVM
      acceleration and is based on following assumptions:
      
       - QEMU_CAPS_KVM flag means that QEMU is running KVM accelerated
         machines by default (without explicitly requesting that using a
         command-line option).  It is the closest to the truth according to
         the code with the only exception being the comment next to the
         flag, so it's fixed in this patch as well.
      
       - QEMU_CAPS_ENABLE_KVM flag means that QEMU is, by default, running
         without KVM acceleration and in case we need KVM acceleration it
         needs to be explicitly instructed to do so.  This is partially
         true for the past (this option essentially means that QEMU
         recognizes the '-enable-kvm' option, even though it's almost the
         same).
      037a49dc
    • G
      bugfix: ip6tables rule removal · adaa7ab6
      Gene Czarcinski 提交于
      Three FORWARD chain rules are added and two INPUT chain rules
      are added when a network is started but only the FORWARD chain
      rules are removed when the network is destroyed.
      adaa7ab6
    • E
      maint: log xml during volume creation · 270a9fef
      Eric Blake 提交于
      I noticed this while answering a list question about Java bindings
      of volume creation.  All other functions that take xml logged xmlDesc.
      
      * src/libvirt.c (virStorageVolCreateXML)
      (virStorageVolCreateXMLFrom): Use consistent spelling of xmlDesc,
      and log the argument.
      270a9fef
    • G
    • L
      util: do a better job of matching up pids with their binaries · 7bafe009
      Laine Stump 提交于
      This patch resolves: https://bugzilla.redhat.com/show_bug.cgi?id=871201
      
      If libvirt is restarted after updating the dnsmasq or radvd packages,
      a subsequent "virsh net-destroy" will fail to kill the dnsmasq/radvd
      process.
      
      The problem is that when libvirtd restarts, it re-reads the dnsmasq
      and radvd pidfiles, then does a sanity check on each pid it finds,
      including checking that the symbolic link in /proc/$pid/exe actually
      points to the same file as the path used by libvirt to execute the
      binary in the first place. If this fails, libvirt assumes that the
      process is no longer alive.
      
      But if the original binary has been replaced, the link in /proc is set
      to "$binarypath (deleted)" (it literally has the string " (deleted)"
      appended to the link text stored in the filesystem), so even if a new
      binary exists in the same location, attempts to resolve the link will
      fail.
      
      In the end, not only is the old dnsmasq/radvd not terminated when the
      network is stopped, but a new dnsmasq can't be started when the
      network is later restarted (because the original process is still
      listening on the ports that the new process wants).
      
      The solution is, when the initial "use stat to check for identical
      inodes" check for identity between /proc/$pid/exe and $binpath fails,
      to check /proc/$pid/exe for a link ending with " (deleted)" and if so,
      truncate that part of the link and compare what's left with the
      original binarypath.
      
      A twist to this problem is that on systems with "merged" /sbin and
      /usr/sbin (i.e. /sbin is really just a symlink to /usr/sbin; Fedora
      17+ is an example of this), libvirt may have started the process using
      one path, but /proc/$pid/exe lists a different path (indeed, on F17
      this is the case - libvirtd uses /sbin/dnsmasq, but /proc/$pid/exe
      shows "/usr/sbin/dnsmasq"). The further bit of code to resolve this is
      to call virFileResolveAllLinks() on both the original binarypath and
      on the truncated link we read from /proc/$pid/exe, and compare the
      results.
      
      The resulting code still succeeds in all the same cases it did before,
      but also succeeds if the binary was deleted or replaced after it was
      started.
      7bafe009
  4. 30 10月, 2012 3 次提交