1. 22 1月, 2013 4 次提交
    • M
      safe{read,write}: Document usage with nonblocking FD · 074b6d45
      Michal Privoznik 提交于
      Currently, whenever somebody calls saferead() on nonblocking FD
      (safewrite() is totally interchangeable for purpose of this message)
      he might get wrong return value. For instance, in the first iteration
      some data is read. The number of bytes read is stored into local
      variable 'nread'. However, in next iterations we can get -1 from
      read() with errno == EAGAIN, in which case the -1 is returned despite
      fact some data has already been read. So the caller gets confused.
      Bare read() should be used for nonblocking FD.
      074b6d45
    • J
      1640fafc
    • J
      docs: event.c source file was renamed as virevent.c · c72e3274
      Jiri Denemark 提交于
      c72e3274
    • E
      spec: indent %if to make it easier to see conditions · c8f79c9b
      Eric Blake 提交于
      Nested conditionals are hard to read if they are not indented.
      We can't add arbitrary whitespace to everything in spec files,
      but we CAN add spaces before %if and %define.  Use this trick,
      plus a fancy sed script that rewrites a spec file into a C
      file, so we can use cppi to keep our spec file nice.
      
      For reference, the sed script converts code like:
      
      |# RHEL-5 builds are client-only for s390, ppc
      |%if 0%{?rhel} == 5
      |    %ifnarch %{ix86} x86_64 ia64
      |        %define client_only        1
      |    %endif
      |%endif
      
      into the following for cppi:
      
      |// # RHEL-5 builds are client-only for s390, ppc
      |#if a // 0%{?rhel} == 5
      |# if a // %{ix86} x86_64 ia64
      |#  define client_only        1
      |# endif
      |#endif
      
      and errors from 'make syntax-check' look like:
      spec_indentation
      cppi: mingw-libvirt.spec.in: line 130: not properly indented
      maint.mk: incorrect preprocessor indentation
      
      * libvirt.spec.in: Add some indentation to make it easier to follow
      various conditionals.
      * mingw-libvirt-spec.in: Likewise.
      * cfg.mk (sc_spec_indentation): New syntax check to enforce it.
      c8f79c9b
  2. 21 1月, 2013 2 次提交
  3. 19 1月, 2013 2 次提交
  4. 18 1月, 2013 29 次提交
    • D
      Fix race condition when destroying guests · 81621f3e
      Daniel P. Berrange 提交于
      When running virDomainDestroy, we need to make sure that no other
      background thread cleans up the domain while we're doing our work.
      This can happen if we release the domain object while in the
      middle of work, because the monitor might detect EOF in this window.
      For this reason we have a 'beingDestroyed' flag to stop the monitor
      from doing its normal cleanup. Unfortunately this flag was only
      being used to protect qemuDomainBeginJob, and not qemuProcessKill
      
      This left open a race condition where either libvirtd could crash,
      or alternatively report bogus error messages about the domain already
      having been destroyed to the caller
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      81621f3e
    • C
      25feed14
    • C
      docs: don't use <i> and <tt> HTML tags · cb022b6b
      Claudio Bley 提交于
      Use of <tt> is discouraged in HTML 4.x and has finally been obsoleted
      in HTML 5. Likewise for the <i> tag.
      
      Using tables for layout is (widely) considered bad style, too.
      
      Use defintion lists, definition term and defintion description
      elements instead.
      Signed-off-by: NClaudio Bley <cbley@av-test.de>
      cb022b6b
    • C
      docs: Assign classes to documentation elements · 458dd20d
      Claudio Bley 提交于
      In CSS the following class names are available:
      
      * keyword     (keywords like "typedef", "struct")
      * type        (types like "int", "void*")
      * comment     (comments after members of enums or structs)
      * directive   (preprocessor directives, #define)
      * undisclosed (text saying that the API is not public)
      
      Additionally, kill all of the left-over "programlisting" class
      assignments. There are no CSS rules for them.
      Signed-off-by: NClaudio Bley <cbley@av-test.de>
      458dd20d
    • J
      Introduce virTypedParamsClear public API · de78bf60
      Jiri Denemark 提交于
      The function is just a renamed public version of former
      virTypedParameterArrayClear.
      de78bf60
    • J
      virsh: Use virTypedParams* APIs in cpu-stats · f52e9f1f
      Jiri Denemark 提交于
      f52e9f1f
    • J
      virsh: Use virTypedParams* APIs in node-memory-tune · c7805f40
      Jiri Denemark 提交于
      c7805f40
    • J
      virsh: Use virTypedParams* APIs in numatune · ec3e5064
      Jiri Denemark 提交于
      ec3e5064
    • J
      virsh: Use virTypedParams* APIs in memtune · 77862330
      Jiri Denemark 提交于
      77862330
    • J
      virsh: Use virTypedParams* APIs in domblkstat · 2e467de4
      Jiri Denemark 提交于
      2e467de4
    • J
      virsh: Use virTypedParams* APIs in schedinfo · e982dacb
      Jiri Denemark 提交于
      e982dacb
    • J
      virsh: Use virTypedParams* APIs in domiftune · 9b2d2446
      Jiri Denemark 提交于
      9b2d2446
    • J
      virsh: Use virTypedParams* APIs in blkiotune · 39e5173a
      Jiri Denemark 提交于
      39e5173a
    • J
      virsh: Use virTypedParams* APIs in blkdeviotune · a8fca0da
      Jiri Denemark 提交于
      a8fca0da
    • J
      Add virTypedParams* APIs · 54dd75fd
      Jiri Denemark 提交于
      Working with virTypedParameters in clients written in C is ugly and
      requires all clients to duplicate the same code. This set of APIs makes
      this code for manipulating with virTypedParameters integral part of
      libvirt so that all clients may benefit from it.
      54dd75fd
    • P
      qemu: Simplify condition with already extracted flag · 5c13ed4f
      Peter Krempa 提交于
      5c13ed4f
    • A
      storage: Fix lvcreate parameter for backingStore. · ffee627a
      Atsushi Kumagai 提交于
      When virStorageBackendLogicalCreateVol() creates a snapshot for a
      logical volume with backingStore element, it fails with the message
      below:
      
        2013-01-17 03:10:18.869+0000: 1967: error : virCommandWait:2345 :
        internal error Child process (/sbin/lvcreate --name lvm-snapshot -L 51200K
        -s=/dev/lvm-pool/lvm-volume) unexpected exit status 3: /sbin/lvcreate:
        invalid option -- '='  Error during parsing of command line.
      
      This is because virCommandAddArgPair() uses '=' to connect the two
      parameters, it's unsuitable for -s option of the lvcreate.
      Signed-off-by: NAtsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
      ffee627a
    • E
      build: fix build on BSD · f403bdc1
      Eric Blake 提交于
      A build on FreeBSD failed with:
      util/virportallocator.c:108: error: storage size of 'addr' isn't known
      util/virportallocator.c:123: error: 'INADDR_ANY' undeclared (first use in this function)
      
      It turns out that while POSIX allows sockaddr_in to leak in through
      <arpa/inet.h> (the way Linux does it), it is not mandatory, and
      conforming applications are required to get it through <netinet/in.h>.
      
      * src/util/virportallocator.c: Include header for struct
      sockaddr_in.
      * tests/virportallocatortest.c: Likewise.
      f403bdc1
    • J
      network: Remove dead code getting, but not using ipdef · 7d31dd64
      John Ferlan 提交于
      The fetch of 'ipdef' in networkRefreshDhcpDaemon() when the loop to fill
      in ipv4def fails to find an ipv4 address with dhcp defined. The filled in
      ipdef value was not used.  Code was made unnecessary with commit it 2d5cd1.
      7d31dd64
    • J
      0cff3554
    • J
      esx: No need to check for objectSpec · ea79a49f
      John Ferlan 提交于
      Coverity complains that the objectSpec != NULL check was unnecessary because
      there was no way to get to the label with objectSpec = NULL.
      ea79a49f
    • J
      e44d2400
    • D
      Followup fix for integer wraparound in port allocator · 55599102
      Daniel P. Berrange 提交于
      Change iterator variable datatype to int
      55599102
    • V
      qemu: Double mutex unlock in qemuDomainModifyDeviceFlags · 56fd5134
      Viktor Mihajlovski 提交于
      The driver mutex was unlocked in qemuDomainModifyDeviceFlags before
      entering qemuDomainObjBeginJobWithDriver where it will be unlocked once
      more leaving it in an undefined state. The result was that two
      threads were simultaneously looking up the domain hash table during
      multiple parallel device attach/detach operations.
      Luckily this triggered a virHashIterationError.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      56fd5134
    • R
      fixed xt_physdev warning when defining ip(6)tables rules · 65fb9d49
      Reinier Schoof 提交于
      When starting a VM, /var/log/messages was spammed with the following message:
       xt_physdev: using --physdev-out in the OUTPUT, FORWARD and POSTROUTING chains for non-bridged traffic is not supported anymore.
      
      With each extra VM I start, the messages get amplified
      exponentially. This results in longer starting times every new VM,
      relative the the previously started VM. When I ran a test with
      starting 100 equal VM's, the first VM started in about 2 seconds, the
      100th VM took 48 seconds to start. I'm running a vanilla 3.7.1 kernel,
      but I have the same issue on VM hosts with kernel 3.2.28 or 3.2.0,
      running libvirt 0.9.12 and 0.9.8 respectively.
      
      Looking into the warning, it seemed that iptables need an extra argument,
      --physdev-is-bridged, in commands like:
       iptables -A libvirt-out -m physdev --physdev-is-bridged --physdev-out vnet99 -g FP-vnet99
      
      With that, the warnings in /var/log/messages are gone and running the
      test again proved the 100th VM started in 3.8 seconds.
      65fb9d49
    • L
      conf: don't fail to parse <boot> when parsing a single device · 877dab6c
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=895294
      
      The symptom was that attempts to modify a network device using
      virDomainUpdateDeviceFlags() would fail if the original device had a
      <boot> element (e.g. "<boot order='1'/>"), even if the updated device
      had the same <boot> element. Instead, the following error would be logged:
      
        cannot modify network device boot index setting
      
      It's true that it's not possible to change boot order (internally
      known as bootIndex) of a live device; qemuDomainChangeNet checks for
      that, but the problem was that the information it was checking was
      incorrect.
      
      Explanation:
      
      When a complete domain is parsed, a global (to the domain) "bootMap"
      is passed down to the parse for each device; the bootMap is used to
      make sure that devices don't have conflicting settings for their boot
      orders.
      
      When a single device is parsed by itself (as in the case of
      virDomainUpdateDeviceFlags), there is no global bootMap that would be
      appropriate to send, so NULL is sent instead. However, although the
      lowest level function that parses just the boot order *does* simply
      skip the sanity check in that case, the next higher level
      "virDomainDeviceInfoParseXML" function refuses to call down to the
      lower "virDomainDeviceBootParseXML" if bootMap is NULL. So, the boot
      order is never set in the "new" device object, and when it is compared
      to the original (which does have a boot order), they don't match.
      
      The fix is to patch virDomainDeviceInfoParseXML to not care about
      bootMap, and just always call virDomainDeviceInfoBootParseXML whenever
      there is a <boot> element. When we are only parsing a single device,
      we don't care whether or not any specified boot order is consistent
      with the rest of the domain; we will always do this check later (in
      the current case, we do it by verifying that the net bootIndex exactly
      matches the old bootIndex).
      877dab6c
    • L
      network: use bandwidth from portgroup when appropriate · 7d480a46
      Laine Stump 提交于
      The bandwidth plug and unplug functions were assuming that an
      interface's bandwidth setting was always specified directly in the
      domain's <interface> definition, but that's not necessarily true - it
      could have been obtained from a <portgroup> definition in the network
      definition. This patch fixes those functions to use
      virDomainNetGetActualBandwidth(), which gets the bandwidth pointer
      from iface->data.network.actual if it exists, otherwise returns
      iface->bandwidth.
      7d480a46
    • J
      network: Resolve some issues around vlan copying · 35ed25bd
      John Ferlan 提交于
      Remove extraneous check for 'netdef' when dereferencing for vlan.nTags.
      Prior code would already check if netdef was NULL.
      
      Coverity complained about a path where the 'vlan' was potentially valid,
      but a prior checks may not have allocated 'iface->data.network.actual',
      so like other paths it needs to be allocated on the fly.
      
      Move the copying of vlan up earlier in networkAllocateActualDevice, so
      that actual.type gets properly set.
      
      Since the first assignment to vlan is redundant except in the case of
      jumping immediately to validate from the start of the function,
      eliminate its initial setting at the top of the function in favor of
      calling the helper function virDomainNetGetActualVlan() (which doesn't
      depend on the local vlan pointer being initialized) down at validate:
      Signed-off-by: NLaine Stump <laine@redhat.com>
      35ed25bd
    • D
      Fix inheritance of virNetClient · 757e3d3a
      Daniel P. Berrange 提交于
      When creating the virClass object for virNetClient, we specified
      virObject as the parent instead of virObjectLockable
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      757e3d3a
  5. 17 1月, 2013 3 次提交