1. 28 4月, 2012 2 次提交
  2. 27 4月, 2012 6 次提交
    • J
      qemu: Use common helper when probing qemu capabilities · 2d76fea1
      Jiri Denemark 提交于
      QEMU binary is called several times when we probe different kinds of
      capabilities the binary supports. This patch introduces new common
      helper so that all probes use a consistent way of invoking qemu.
      2d76fea1
    • E
      qemu: improve errors related to offline domains · 8e532d34
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=816662 pointed out
      that attempting 'virsh blockpull' on an offline domain gave a
      misleading error message about qemu lacking support for the
      operation, even when qemu was specifically updated to support it.
      The real problem is that we have several capabilities that are
      only determined when starting a domain, and therefore are still
      clear when first working with an inactive domain (namely, any
      capability set by qemuMonitorJSONCheckCommands).
      
      While this patch was able to hoist an existing check in one of the
      three culprits, it had to add redundant checks in the other two
      places (because you always have to check for an active domain after
      obtaining a VM job lock, but the capability bits were being checked
      prior to obtaining the job lock).
      
      Someday it would be nice to patch libvirt to cache the set of
      capabilities per qemu binary (as determined by inode and timestamp),
      rather than re-probing the binary every time a domain is started,
      and to teach the cache how to query the monitor during the one
      time the probe is made rather than having to wait until a guest
      is started; then, a capability probe would succeed even for offline
      guests because it just refers to the cache, and the single check for
      an active domain after grabbing the job lock would be sufficient.
      But since that will involve a lot more coding, I'm happy to go
      with this simpler solution for an immediate solution.
      
      * src/qemu/qemu_driver.c (qemuDomainPMSuspendForDuration)
      (qemuDomainSnapshotCreateXML, qemuDomainBlockJobImpl): Check for
      offline state before checking an online-only cap.
      8e532d34
    • S
      macvtap: fix a typo · 4bf9061e
      Stefan Berger 提交于
      Below patch fixes the following coverity findings
      
      Error: OVERRUN_STATIC:
      /libvirt/src/qemu/qemu_command.c:152:
      overrun-buffer-val: Overrunning static array "net->mac" of size 6 bytes by passing it as an argument to a function which indexes it at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:948:
      access_dbuff_const: Calling "virNetDevMacVLanVPortProfileRegisterCallback" indexes array "macaddress" at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:773:
      access_dbuff_const: Calling "memcpy" indexes array "macaddress" with index "16UL" at byte position 15.
      
      Error: OVERRUN_STATIC:
      /libvirt/src/qemu/qemu_migration.c:2744:
      overrun-buffer-val: Overrunning static array "net->mac" of size 6 bytes by passing it as an argument to a function which indexes it at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:773:
      access_dbuff_const: Calling "memcpy" indexes array "macaddress" with index "16UL" at byte position 15.
      
      Error: OVERRUN_STATIC:
      /libvirt/src/qemu/qemu_driver.c:435:
      overrun-buffer-val: Overrunning static array "net->mac" of size 6 bytes by passing it as an argument to a function which indexes it at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:1036:
      access_dbuff_const: Calling "virNetDevMacVLanVPortProfileRegisterCallback" indexes array "macaddress" at byte position 15.
      /libvirt/src/util/virnetdevmacvlan.c:773:
      access_dbuff_const: Calling "memcpy" indexes array "macaddress" with index "16UL" at byte position 15.
      
      4bf9061e
    • S
      nwfilter: address more coverity findings · 42548fbf
      Stefan Berger 提交于
      This patch addresses the following coverity findings:
      
      /libvirt/src/conf/nwfilter_params.c:390:
      var_assigned: Assigning: "varValue" = null return value from "virHashLookup".
      
      /libvirt/src/conf/nwfilter_params.c:392:
      dereference: Dereferencing a pointer that might be null "varValue" when calling "virNWFilterVarValueGetNthValue".
      
      /libvirt/src/conf/nwfilter_params.c:399:
      dereference: Dereferencing a pointer that might be null "tmp" when calling "virNWFilterVarValueGetNthValue".
      42548fbf
    • S
      nwfilter: address coverity findings · 9c1ce3dc
      Stefan Berger 提交于
      This patch addresses the following coverity findings:
      
      /libvirt/src/conf/nwfilter_params.c:157:
      deref_parm: Directly dereferencing parameter "val".
      
      /libvirt/src/conf/nwfilter_params.c:473:
      negative_returns: Using variable "iterIndex" as an index to array "res->iter".
      
      /libvirt/src/nwfilter/nwfilter_ebiptables_driver.c:2891:
      unchecked_value: No check of the return value of "virAsprintf(&protostr, "-d 01:80:c2:00:00:00 ")".
      
      /libvirt/src/nwfilter/nwfilter_ebiptables_driver.c:2894:
      unchecked_value: No check of the return value of "virAsprintf(&protostr, "-p 0x%04x ", l3_protocols[protoidx].attr)".
      
      /libvirt/src/nwfilter/nwfilter_ebiptables_driver.c:3590:
      var_deref_op: Dereferencing null variable "inst".
      9c1ce3dc
    • L
      util: fix error messages in virNetlinkEventServiceStart · 9586925b
      Laine Stump 提交于
      Some of the error messages in this function should have been
      virReportSystemError (since they have an errno they want to log), but
      were mistakenly written as netlinkError, which expects a libvirt error
      code instead. The result was that when one of the errors was
      encountered, "No error message provided" would be printed instead of
      something meaningful (see
      https://bugzilla.redhat.com/show_bug.cgi?id=816465 for an example).
      9586925b
  3. 26 4月, 2012 7 次提交
    • J
      qemu: Avoid bogus error at the end of tunnelled migration · 8ef5f263
      Jiri Denemark 提交于
      Once qemu monitor reports migration has completed, we just closed our
      end of the pipe and let migration tunnel die. This generated bogus error
      in case we did so before the thread saw EOF on the pipe and migration
      was aborted even though it was in fact successful.
      
      With this patch we first wake up the tunnel thread and once it has read
      all data from the pipe and finished the stream we close the
      filedescriptor.
      
      A small additional bonus of this patch is that real errors reported
      inside qemuMigrationIOFunc are not overwritten by virStreamAbort any
      more.
      8ef5f263
    • J
      qemu: Fix detection of failed migration · 25a63451
      Jiri Denemark 提交于
      When QEMU reported failed or canceled migration, we correctly detected
      it but didn't really consider it as an error condition and migration
      protocol just went on. Luckily, some of the subsequent steps eventually
      failed end we reported an (unrelated and mostly random) error back to
      the caller.
      25a63451
    • J
      rpc: Discard non-blocking calls only when necessary · b1e374a7
      Jiri Denemark 提交于
      Currently, non-blocking calls are either sent immediately or discarded
      in case sending would block. This was implemented based on the
      assumption that the non-blocking keepalive call is not needed as there
      are other calls in the queue which would keep the connection alive.
      However, if those calls are no-reply calls (such as those carrying
      stream data), the remote party knows the connection is alive but since
      we don't get any reply from it, we think the connection is dead.
      
      This is most visible in tunnelled migration. If it happens to be longer
      than keepalive timeout (30s by default), it may be unexpectedly aborted
      because the connection is considered to be dead.
      
      With this patch, we only discard non-blocking calls when the last call
      with a thread is completed and thus there is no thread left to keep
      sending the remaining non-blocking calls.
      b1e374a7
    • J
      qemu: Preserve original error during migration · 6d646947
      Jiri Denemark 提交于
      In some cases (spotted with broken connection during tunneled migration)
      we were overwriting the original error with worse or even misleading
      errors generated when we were cleaning up after failed migration.
      6d646947
    • P
      keepalive: Add ability to disable keepalive messages · 6446a9e2
      Peter Krempa 提交于
      The docs for virConnectSetKeepAlive() advertise that this function
      should be able to disable keepalives on negative or zero interval time.
      
      This patch removes the check that prohibited this and adds code to
      disable keepalives on negative/zero interval.
      
      * src/libvirt.c: virConnectSetKeepAlive(): - remove check for negative
                                                   values
      * src/rpc/virnetclient.c
      * src/rpc/virnetclient.h: - add virNetClientKeepAliveStop() to disable
                                  keepalive messages
      * src/remote/remote_driver.c: remoteSetKeepAlive(): -add ability to
                                                           disable keepalives
      6446a9e2
    • L
      util: fix crash when starting macvtap interfaces · f78024b9
      Laine Stump 提交于
      This patch resolves https://bugzilla.redhat.com/show_bug.cgi?id=815270
      
      The function virNetDevMacVLanVPortProfileRegisterCallback() takes an
      arg "virtPortProfile", and was checking it for non-NULL before using
      it. However, the prototype for
      virNetDevMacVLanPortProfileRegisterCallback had marked that arg with
      ATTRIBUTE_NONNULL(). Contrary to what one may think,
      ATTRIBUTE_NONNULL() does not provide any guarantee that an arg marked
      as such really is always non-null; the only effect to the code
      generated by gcc, is that gcc *assumes* it is non-NULL; this results
      in, for example, the check for a non-NULL value being optimized out.
      
      (Unfortunately, this code removal only occurs when optimization is
      enabled, and I am in the habit of doing local builds with optimization
      off to ease debugging, so the bug didn't show up in my earlier local
      testing).
      
      In general, virPortProfile might always be NULL, so it shouldn't be
      marked as ATTRIBUTE_NONNULL. One other function prototype made this
      same error, so this patch fixes it as well.
      f78024b9
    • E
      build: fix bootstrap on RHEL · bae13129
      Eric Blake 提交于
      Commit 8fe455fd tried to work around
      a regression introduced in upstream gnulib that requires gettext 0.18
      or newer on all projects using bootstrap, by making libvirt require
      gettext 0.18.  But this fails on RHEL 6.2, which still ships gettext
      0.17.  Revert that change, and instead, import the latest round of
      gnulib updates that fix that problem properly.
      
      If you have already built in the window where libvirt required 0.18,
      be aware that incremental updates may run into problems: this is
      because 'autopoint --force' will not downgrade m4/po.m4 back to an
      older version, but it must be downgraded back to 0.17 levels to work
      with this patch.  You may either manually remove that file then rerun
      bootstrap, or it may prove easier to just clean up all non-git files
      to start from a clean slate.
      
      * bootstrap.conf: Revert minimum gettext back to 0.17.
      * configure.ac: Likewise.
      * .gnulib: Update to latest, for bootstrap fixes.
      * bootstrap: Resync from gnulib.
      bae13129
  4. 25 4月, 2012 2 次提交
  5. 24 4月, 2012 5 次提交
    • S
      Improve on virAtomic implementation · a4a5c00b
      Stefan Berger 提交于
      This patch improves the previously added virAtomicInt implementation
      by using gcc-builtins if possible. The needed builtins are available
      since GCC >= 4.1. At least the 4.0 docs don't mention them.
      a4a5c00b
    • H
      fix memleak in linuxParseCPUmap · 3ac30361
      Hu Tao 提交于
      3ac30361
    • P
      build: Fix version of gettext macros · 8fe455fd
      Peter Krempa 提交于
      Commit c9cd419c added copying of the
      makefile for translation files from gnulib. The makefile from gnulib is
      of version 0.18 but the build configuration cretes macros from version
      0.17 which breaks the build with message:
      
      *** error: gettext infrastructure mismatch: using a Makefile.in.in from
      gettext version 0.18 but the autoconf macros are from gettext version
      0.17
      8fe455fd
    • M
      vbox: Fix passing an empty IMedium* array to IMachine::Delete · a9bc123e
      Matthias Bolte 提交于
      vboxArray is not castable to a COM item type. vboxArray is a
      wrapper around the XPCOM and MSCOM specific array handling.
      
      In this case we can avoid passing NULL as an empty array to
      IMachine::Delete by passing a dummy IMedium* array with a single
      NULL item.
      a9bc123e
    • G
      openvz: add network interface stats · 52ee7c2b
      Guido Günther 提交于
      This will only work for veth devices since venet devices don't have
      a target element.
      52ee7c2b
  6. 23 4月, 2012 4 次提交
    • E
      blockjob: enhance xml to track mirrors across libvirtd restart · ae6aa8c3
      Eric Blake 提交于
      In order to track a block copy job across libvirtd restarts, we
      need to save internal XML that tracks the name of the file
      holding the mirror.  Displaying this name in dumpxml might also
      be useful to the user, even if we don't yet have a way to (re-)
      start a domain with mirroring enabled up front.  This is done
      with a new <mirror> sub-element to <disk>, as in:
      
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/original.img'/>
            <mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/>
            ...
          </disk>
      
      For now, the element is output-only, in live domains; it is ignored
      when defining a domain or hot-plugging a disk (since those contexts
      use VIR_DOMAIN_XML_INACTIVE in parsing).  The 'ready' attribute appears
      when libvirt knows that the job has changed from the initial pulling
      phase over to the mirroring phase, although absence of the attribute
      is not a sure indicator of the current phase.  If we come up with a way
      to make qemu start with mirroring enabled, we can relax the xml
      restriction, and allow <mirror> (but not attribute 'ready') on input.
      Testing active-only XML meant tweaking the testsuite slightly, but it
      was worth it.
      
      * docs/schemas/domaincommon.rng (diskspec): Add diskMirror.
      * docs/formatdomain.html.in (elementsDisks): Document it.
      * src/conf/domain_conf.h (_virDomainDiskDef): New members.
      * src/conf/domain_conf.c (virDomainDiskDefFree): Clean them.
      (virDomainDiskDefParseXML): Parse them, but only internally.
      (virDomainDiskDefFormat): Output them.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise.
      * tests/qemuxml2xmltest.c (testInfo): Alter members.
      (testCompareXMLToXMLHelper): Allow more test control.
      (mymain): Run new test.
      ae6aa8c3
    • E
      blockjob: add 'blockcopy' to virsh · 1f06c007
      Eric Blake 提交于
      Rather than further overloading 'blockpull', I decided to create a
      new virsh command to expose the new flags of virDomainBlockRebase.
      
      Blocking until the command completes naturally is pointless, since
      the block copy job is intended to run indefinitely.  Instead, I
      made the command support three --wait modes: by default, it runs until
      mirroring is started; with --pivot, it pivots as soon as mirroring
      is started; and with --finish, it aborts (for a clean copy) as
      soon as mirroring is started.
      
      * tools/virsh.c (VSH_CMD_BLOCK_JOB_COPY): New mode.
      (blockJobImpl): Support new flags.
      (cmdBlockCopy): New command.
      (cmdBlockJob): Support new job info, new abort flag.
      * tools/virsh.pod (blockcopy, blockjob): Document the new command
      and flags.
      1f06c007
    • E
      blockjob: add new API flags · 36484692
      Eric Blake 提交于
      This patch introduces a new block job, useful for live storage
      migration using pre-copy streaming.  Justification for including
      this under virDomainBlockRebase rather than adding a new command
      includes: 1) there are now two possible block jobs in qemu, with
      virDomainBlockRebase starting either type of command, and
      virDomainBlockJobInfo and virDomainBlockJobAbort working to end
      either type; 2) reusing this command allows distros to backport
      this feature to the libvirt 0.9.10 API without a .so bump.
      
      Note that a future patch may add a more powerful interface named
      virDomainBlockJobCopy, dedicated to just the block copy job, in
      order to expose even more options (such as setting an arbitrary
      format type for the destination without having to probe it from a
      pre-existing destination file); adding a new command for targetting
      just block copy would be similar to how we already have
      virDomainBlockPull for targetting just the block pull job.
      
      Using a live VM with the backing chain:
        base <- snap1 <- snap2
      as the starting point, we have:
      
      - virDomainBlockRebase(dom, disk, "/path/to/copy", 0,
          VIR_DOMAIN_BLOCK_REBASE_COPY)
      creates /path/to/copy with the same format as snap2, with no backing
      file, so entire chain is copied and flattened
      
      - virDomainBlockRebase(dom, disk, "/path/to/copy", 0,
          VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)
      creates /path/to/copy as a raw file, so entire chain is copied and
      flattened
      
      - virDomainBlockRebase(dom, disk, "/path/to/copy", 0,
          VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_SHALLOW)
      creates /path/to/copy with the same format as snap2, but with snap1 as
      a backing file, so only snap2 is copied.
      
      - virDomainBlockRebase(dom, disk, "/path/to/copy", 0,
          VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)
      reuse existing /path/to/copy (must have empty contents, and format is
      probed[*] from the metadata), and copy the full chain
      
      - virDomainBlockRebase(dom, disk, "/path/to/copy", 0,
          VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT|
          VIR_DOMAIN_BLOCK_REBASE_SHALLOW)
      reuse existing /path/to/copy (contents must be identical to snap1,
      and format is probed[*] from the metadata), and copy only the contents
      of snap2
      
      - virDomainBlockRebase(dom, disk, "/path/to/copy", 0,
          VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT|
          VIR_DOMAIN_BLOCK_REBASE_SHALLOW|VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)
      reuse existing /path/to/copy (must be raw volume with contents
      identical to snap1), and copy only the contents of snap2
      
      Less useful combinations:
      
      - virDomainBlockRebase(dom, disk, "/path/to/copy", 0,
          VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_SHALLOW|
          VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)
      fail if source is not raw, otherwise create /path/to/copy as raw and
      the single file is copied (no chain involved)
      
      - virDomainBlockRebase(dom, disk, "/path/to/copy", 0,
          VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT|
          VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)
      makes little sense: the destination must be raw but have no contents,
      meaning that it is an empty file, so there is nothing to reuse
      
      The other three flags are rejected without VIR_DOMAIN_BLOCK_COPY.
      
      [*] Note that probing an existing file for its format can be a security
      risk _if_ there is a possibility that the existing file is 'raw', in
      which case the guest can manipulate the file to appear like some other
      format.  But, by virtue of the VIR_DOMAIN_BLOCK_REBASE_COPY_RAW flag,
      it is possible to avoid probing of raw files, at which point, probing
      of any remaining file type is no longer a security risk.
      
      It would be nice if we could issue an event when pivoting from phase 1
      to phase 2, but qemu hasn't implemented that, and we would have to poll
      in order to synthesize it ourselves.  Meanwhile, qemu will give us a
      distinct job info and completion event when we either cancel or pivot
      to end the job.  Pivoting is accomplished via the new:
      
      virDomainBlockJobAbort(dom, disk, VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT)
      
      Management applications can pre-create the copy with a relative
      backing file name, and use the VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT
      flag to have qemu reuse the metadata; if the management application
      also copies the backing files to a new location, this can be used
      to perform live storage migration of an entire backing chain.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_JOB_TYPE_COPY):
      New block job type.
      (virDomainBlockJobAbortFlags, virDomainBlockRebaseFlags): New enums.
      * src/libvirt.c (virDomainBlockRebase): Document the new flags,
      and implement general restrictions on flag combinations.
      (virDomainBlockJobAbort): Document the new flag.
      (virDomainSaveFlags, virDomainSnapshotCreateXML)
      (virDomainRevertToSnapshot, virDomainDetachDeviceFlags): Document
      restrictions.
      * include/libvirt/virterror.h (VIR_ERR_BLOCK_COPY_ACTIVE): New
      error.
      * src/util/virterror.c (virErrorMsg): Define it.
      36484692
    • P
      cpu: Improve error reporting on incompatible CPUs · a2ba53cf
      Peter Krempa 提交于
      This patch modifies the CPU comparrison function to report the
      incompatibilities in more detail to ease identification of problems.
      
      * src/cpu/cpu.h:
          cpuGuestData(): Add argument to return detailed error message.
      * src/cpu/cpu.c:
          cpuGuestData(): Add passthrough for error argument.
      * src/cpu/cpu_x86.c
          x86FeatureNames(): Add function to convert a CPU definition to flag
                             names.
          x86Compute(): - Add error message parameter
                        - Add macro for reporting detailed error messages.
                        - Improve error reporting.
                        - Simplify calculation of forbidden flags.
          x86DataIteratorInit():
          x86cpuidMatchAny(): Remove functions that are no longer needed.
      * src/qemu/qemu_command.c:
          qemuBuildCpuArgStr(): - Modify for new function prototype
                                - Add detailed error reports
                                - Change error code on incompatible processors
                                  to VIR_ERR_CONFIG_UNSUPPORTED instead of
                                  internal error
      * tests/cputest.c:
          cpuTestGuestData(): Modify for new function prototype
      a2ba53cf
  7. 22 4月, 2012 2 次提交
    • W
      building: remove libvirt_dbus.syms from EXTRA_DIST · 28ae4f0c
      Wen Congyang 提交于
      commit 2223ea98 removes src/libvirt_dbus.syms, but it forgets
      to remove it from EXTRA_DIST. It will cause 'make dist' failed.
      28ae4f0c
    • M
      win32: Properly handle TlsGetValue returning NULL · e0aba54b
      Matthias Bolte 提交于
      virThreadSelf tries to access the virThreadPtr stored in TLS for the
      current thread via TlsGetValue. When virThreadSelf is called on a thread
      that was not created via virThreadCreate (e.g. the main thread) then
      TlsGetValue returns NULL as TlsAlloc initializes TLS slots to NULL.
      
      virThreadSelf can be called on the main thread via this call chain from
      virsh
      
      vshDeinit
      virEventAddTimeout
      virEventPollAddTimeout
      virEventPollInterruptLocked
      virThreadIsSelf
      
      triggering a segfault as virThreadSelf unconditionally dereferences the
      return value of TlsGetValue.
      
      Fix this by making virThreadSelf check the TLS slot value for NULL and
      setting the given virThreadPtr accordingly.
      
      Reported by Marcel Müller.
      e0aba54b
  8. 21 4月, 2012 1 次提交
  9. 20 4月, 2012 10 次提交
    • G
      openvz: wire up getHostname · 995b5b3d
      Guido Günther 提交于
      995b5b3d
    • E
      virnetserver: handle sigaction correctly · f4346173
      Eric Blake 提交于
      POSIX says that sa_sigaction is only safe to use if sa_flags
      includes SA_SIGINFO; conversely, sa_handler is only safe to
      use when flags excludes that bit.  Gnulib doesn't guarantee
      an implementation of SA_SIGINFO, but does guarantee that
      if SA_SIGINFO is undefined, we can safely define it to 0 as
      long as we don't dereference the 2nd or 3rd argument of
      any handler otherwise registered via sa_sigaction.
      
      Based on a report by Wen Congyang.
      
      * src/rpc/virnetserver.c (SA_SIGINFO): Stub for mingw.
      (virNetServerSignalHandler): Avoid bogus dereference.
      (virNetServerFatalSignal, virNetServerNew): Set flags properly.
      (virNetServerAddSignalHandler): Drop unneeded #ifdef.
      f4346173
    • E
      conf: remove redundant () · 6877a34d
      Eric Blake 提交于
      I almost copied-and-pasted some redundant () into my new code,
      and figured a general cleanup prereq patch would be better instead.
      
      No semantic change.
      
      * src/conf/domain_conf.c (virDomainLeaseDefParseXML)
      (virDomainDiskDefParseXML, virDomainFSDefParseXML)
      (virDomainActualNetDefParseXML, virDomainNetDefParseXML)
      (virDomainGraphicsDefParseXML, virDomainVideoAccelDefParseXML)
      (virDomainVideoDefParseXML, virDomainHostdevFind)
      (virDomainControllerInsertPreAlloced, virDomainDefParseXML)
      (virDomainObjParseXML, virDomainCpuSetFormat)
      (virDomainCpuSetParse, virDomainDiskDefFormat)
      (virDomainActualNetDefFormat, virDomainNetDefFormat)
      (virDomainTimerDefFormat, virDomainGraphicsListenDefFormat)
      (virDomainDefFormatInternal, virDomainNetGetActualHostdev)
      (virDomainNetGetActualBandwidth, virDomainGraphicsGetListen):
      Reduce extra ().
      6877a34d
    • E
      build: avoid strtol and strtod · ae27f341
      Eric Blake 提交于
      Ensure we don't introduce any more lousy integer parsing in new
      code, while avoiding a scrub-down of existing legacy code.
      
      Note that we also need to enable sc_prohibit_atoi_atof (see cfg.mk
      local-checks-to-skip) before we are bulletproof, but that also
      entails scrubbing I'm not ready to do at the moment.
      
      * src/util/util.c (virStrToLong_i, virStrToLong_ui)
      (virStrToLong_l, virStrToLong_ul, virStrToLong_ll)
      (virStrToLong_ull, virStrToDouble): Mark exemptions.
      * src/util/virmacaddr.c (virMacAddrParse): Likewise.
      * cfg.mk (sc_prohibit_strtol): New syntax check.
      (exclude_file_name_regexp--sc_prohibit_strtol): Ignore files that
      I'm not willing to fix yet.
      (local-checks-to-skip): Re-enable sc_prohibit_atoi_atof.
      ae27f341
    • E
      conf: tighten up XML integer parsing · c09acad3
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=617711 reported that
      even with my recent patched to allow <memory unit='G'>1</memory>,
      people can still get away with trying <memory>1G</memory> and
      silently get <memory unit='KiB'>1</memory> instead.  While
      virt-xml-validate catches the error, our C parser did not.
      
      Not to mention that it's always fun to fix bugs while reducing
      lines of code.  :)
      
      * src/conf/domain_conf.c (virDomainParseMemory): Check for parse error.
      (virDomainDefParseXML): Avoid strtoll.
      * src/conf/storage_conf.c (virStorageDefParsePerms): Likewise.
      * src/util/xml.c (virXPathLongBase, virXPathULongBase)
      (virXPathULongLong, virXPathLongLong): Likewise.
      c09acad3
    • E
      virsh: avoid strtol · bb65c8af
      Eric Blake 提交于
      We were forgetting to check errno for overflow.
      
      * tools/virsh.c (get_integer_keycode, vshCommandOptInt)
      (vshCommandOptUInt, vshCommandOptUL, vshCommandOptLongLong)
      (vshCommandOptULongLong): Rewrite to be safer.
      bb65c8af
    • E
      build: avoid type-punning in vbox · 1aeacfd5
      Eric Blake 提交于
      Commit 78345c68 makes at least gcc 4.1.2 on RHEL 5 complain:
      
      cc1: warnings being treated as errors
      In file included from vbox/vbox_V4_0.c:13:
      vbox/vbox_tmpl.c: In function 'vboxDomainUndefineFlags':
      vbox/vbox_tmpl.c:5298: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      
      * src/vbox/vbox_tmpl.c (vboxDomainUndefineFlags): Use union to
      avoid compiler warning.
      1aeacfd5
    • E
      build: fix fresh checkout on RHEL5 · c9cd419c
      Eric Blake 提交于
      Building a fresh checkout on RHEL 5 has been broken since commit
      29db7a00, due to a gnulib regression in the bootstrap script
      (incremental builds from a checkout earlier than that point were
      okay, though).
      
      * .gnulib: Update to latest, for bootstrap fixes.
      * bootstrap: Resync from gnulib.
      * gnulib/local/top/maint.mk.diff: Drop patch that was added
      upstream in the meantime.
      c9cd419c
    • E
      virsh: avoid uninitialized memory usage · 2aed9a97
      Eric Blake 提交于
      Detected by valgrind, via Alex Jia.  Caused by imcomplete
      copy-and-paste from vshWatchJob in commit 3b96a892.
      
      * tools/virsh.c (cmdBlockPull): fix uninitialized memory usage.
      
      * How to reproduce?
      $ qemu-img create /var/lib/libvirt/images/test 1M
      $ cat > /tmp/test.xml <<EOF
      <domain type='qemu'>
        <name>test</name>
        <memory>219200</memory>
        <vcpu>1</vcpu>
        <os>
          <type arch='x86_64'>hvm</type>
          <boot dev='hd'/>
        </os>
        <devices>
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/test'/>
            <target dev='vda' bus='virtio'/>
          </disk>
          <input type='mouse' bus='ps2'/>
          <graphics type='spice' autoport='yes' listen='0.0.0.0'/>
        </devices>
      </domain>
      EOF
      $ virsh define /tmp/test.xml
      $ valgrind -v virsh blockpull test /var/lib/libvirt/images/test --wait
      
      actual result:
      
      ==10906== 1 errors in context 1 of 1:
      ==10906== Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s)
      ==10906==    at 0x39CF80F5BE: __libc_sigaction (sigaction.c:67)
      ==10906==    by 0x43016C: cmdBlockPull (virsh.c:7638)
      ==10906==    by 0x4150D4: vshCommandRun (virsh.c:18574)
      ==10906==    by 0x425E73: main (virsh.c:20178)
      ==10906==  Address 0x7fefffae8 is on thread 1's stack
      2aed9a97
    • D
      The policy kit and HAL node device drivers both require a · 2223ea98
      Daniel P. Berrange 提交于
      DBus connection. The HAL device code further requires that
      the DBus connection is integrated with the event loop and
      provides such glue logic itself.
      
      The forthcoming FirewallD integration also requires a
      dbus connection with event loop integration. Thus we need
      to pull the current event loop glue out of the HAL driver.
      
      Thus we create src/util/virdbus.{c,h} files. This contains
      just one method virDBusGetSystemBus() which obtains a handle
      to the single shared system bus instance, with event glue
      automagically setup.
      2223ea98
  10. 19 4月, 2012 1 次提交
    • S
      nwfilter: Fix support for trusted DHCP servers · 7c26343b
      Stefan Berger 提交于
      Fix the support for trusted DHCP server in the ebtables code's
      hard-coded function applying DHCP only filtering rules:
      Rather than using a char * use the more flexible
      virNWFilterVarValuePtr that contains the trusted DHCP server(s)
      IP address. Process all entries.
      
      Since all callers so far provided NULL as parameter, no changes
      are necessary in any other code.
      7c26343b