1. 26 11月, 2012 1 次提交
  2. 25 11月, 2012 1 次提交
  3. 23 11月, 2012 3 次提交
  4. 22 11月, 2012 2 次提交
  5. 15 11月, 2012 4 次提交
    • M
      Use helper functions to format the journal iov array · 39c814ff
      Miloslav Trmač 提交于
      This simplifies the top-level code, at the cost of using a little more
      stack space.  The primary benefit is being able to send more fields
      without knowing in advance how many of them, and of which types, these
      fields will be, and without having to individually add buffer variables.
      
      The code imposes an upper limit on the total number of iovs/buffers
      used, and fields that wouldn't fit are silently dropped.  This is not
      significant in this patch, but will affect the following one.
      Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
      39c814ff
    • M
      Add metadata to virLogOutputFunc · 37f7a1fa
      Miloslav Trmač 提交于
      ... and update all users.  No change in functionality, the parameter
      will be used in the next patch.
      Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
      37f7a1fa
    • M
      Add a metadata parameter to virLog{, V}Message · c780e9b8
      Miloslav Trmač 提交于
      ... and update all users.  No change in functionality, the parameter
      will be used later.
      
      The metadata representation is as minimal as possible, but requires
      the caller to allocate an array on stack explicitly.
      
      The alternative of using varargs in the virLogMessage() callers:
      * Would not allow the caller to optionally omit some metadata elements,
        except by having two calls to virLogMessage.
      * Would not be as type-safe (e.g. using int vs. size_t), and the compiler
        wouldn't be able to do type checking
      * Depending on parameter order:
        a) virLogMessage(..., message format, message params...,
                         metadata..., NULL)
           can not be portably implemented (parse_printf_format() is a glibc
           function)
        b) virLogMessage(..., metadata..., NULL,
                         message format, message params...)
           would prevent usage of ATTRIBUTE_FMT_PRINTF and the associated
           compiler checking.
      Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
      c780e9b8
    • L
      util: fix index when building lock owners array · bc4b4330
      Laine Stump 提交于
      The "restart" function for locks allocates a new array according to
      and pre-sets its length, then reads the owner pids from a JSON
      document in a loop. Rather than adding each owner at a different
      index, though, it repeatedly overwrites the last element of the array
      with all the owners.
      bc4b4330
  6. 09 11月, 2012 1 次提交
    • P
      storage: fix broken backing chain · e0c469e5
      Philipp Hahn 提交于
      82507838 refactored the code to keep both the raw and canonicalized form
      of the backingStore, which breaks badly when the storage pool contains a
      storage volume, which is missing its backing store file:
       # ./daemon/libvirtd -l
       2012-11-07 12:43:33.279+0000: 22175: info : libvirt version: 1.0.0
       2012-11-07 12:43:33.279+0000: 22175: error : absolutePathFromBaseFile:542 : Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
       2012-11-07 12:43:33.280+0000: 22175: error : storageDriverAutostart:115 : Failed to autostart storage pool 'default': Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
      
      This is because virStorageFileGetMetadataFromBuf() aborts with -1 if the
      filename of the backingStore can not be canonicalized:
       #0  absolutePathFromBaseFile () at util/storage_file.c:541
       #1  virStorageFileGetMetadataFromBuf () at util/storage_file.c:728
       #2  virStorageFileGetMetadataFromFD () at util/storage_file.c:932
       #3  virStorageBackendProbeTarget () at storage/storage_backend_fs.c:94
       #4  virStorageBackendFileSystemRefresh () at storage/storage_backend_fs.c:849
       #5  storagePoolStart () at storage/storage_driver.c:700
       #6  virStoragePoolCreate () at libvirt.c:12471
       ...
      
      Treat files which miss their backing file as standalone files.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      e0c469e5
  7. 05 11月, 2012 1 次提交
  8. 02 11月, 2012 4 次提交
  9. 01 11月, 2012 2 次提交
    • M
      iohelper: fdatasync() at the end · f32e3a2d
      Michal Privoznik 提交于
      Currently, when we are doing (managed) save, we insert the
      iohelper between the qemu and OS. The pipe is created, the
      writing end is passed to qemu and the reading end to the
      iohelper. It reads data and write them into given file. However,
      with write() being asynchronous data may still be in OS
      caches and hence in some (corner) cases, all migration data
      may have been read and written (not physically though). So
      qemu will report success, as well as iohelper. However, with
      some non local filesystems, where ENOSPACE is polled every X
      time units, we may get into situation where all operations
      succeeded but data hasn't reached the disk. And in fact will
      never do. Therefore we ought sync caches to make sure data
      has reached the block device on remote host.
      f32e3a2d
    • D
      Don't assume pid_t is the same size as an int · 6bf55a97
      Daniel P. Berrange 提交于
      virPidFileReadPathIfAlive passed in an 'int *' where a 'pid_t *'
      was expected, which breaks on Mingw64 targets. Also a few places
      were using '%d' for formatting pid_t, change them to '%lld' and
      force a cast to the longer type as done elsewhere in the same
      file.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6bf55a97
  10. 31 10月, 2012 2 次提交
    • 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
    • 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
  11. 30 10月, 2012 1 次提交
    • M
      qemu: Report errors from iohelper · 34e8f63a
      Michal Privoznik 提交于
      Currently, we use iohelper when saving/restoring a domain.
      However, if there's some kind of error (like I/O) it is not
      propagated to libvirt. Since it is not qemu who is doing
      the actual write() it will not get error. The iohelper does.
      Therefore we should check for iohelper errors as it makes
      libvirt more user friendly.
      34e8f63a
  12. 29 10月, 2012 2 次提交
    • P
      util: Re-format literal strings in virXMLEmitWarning · cbd10126
      Peter Krempa 提交于
      And drop a stray space at the end of the first line of the warning.
      cbd10126
    • J
      xml: print uuids in the warning · 0b121614
      Ján Tomko 提交于
      In the XML warning, we print a virsh command line that can be used to
      edit that XML. This patch prints UUIDs if the entity name contains
      special characters (like shell metacharacters, or "--" that would break
      parsing of the XML comment). If the entity doesn't have a UUID, just
      print the virsh command that can be used to edit it.
      0b121614
  13. 26 10月, 2012 2 次提交
    • C
      daemon: Fix LIBVIRT_DEBUG=1 default output · eba36a38
      Cole Robinson 提交于
      This commit changes the behavior of LIBVIRT_DEBUG=1 libvirtd:
      
      $ git show 7022b091
      commit 7022b091
      Author: Daniel P. Berrange <berrange@redhat.com>
      Date:   Thu Sep 27 13:13:09 2012 +0100
      
          Automatically enable systemd journal logging
      
          Probe to see if the systemd journal is accessible, and if
          so enable logging to the journal by default, rather than
          stderr (current default under systemd).
      
      Previously  'LIBVIRT_DEBUG=1 /usr/sbin/libvirtd' would show all debug
      output to stderr, now it send debug output to the journal.
      
      Only use the journal by default if running in daemon mode, or
      if stdin is _not_ a tty. This should make libvirtd launched from
      systemd use the journal, but preserve the old behavior in most
      situations.
      eba36a38
    • E
      bitmap: add virBitmapCountBits · 0711c4b7
      Eric Blake 提交于
      Sometimes it's handy to know how many bits are set.
      
      * src/util/bitmap.h (virBitmapCountBits): New prototype.
      (virBitmapNextSetBit): Use correct type.
      * src/util/bitmap.c (virBitmapNextSetBit): Likewise.
      (virBitmapSetAll): Maintain invariant of clear tail bits.
      (virBitmapCountBits): New function.
      * src/libvirt_private.syms (bitmap.h): Export it.
      * tests/virbitmaptest.c (test2): Test it.
      0711c4b7
  14. 24 10月, 2012 1 次提交
  15. 23 10月, 2012 1 次提交
  16. 22 10月, 2012 3 次提交
  17. 21 10月, 2012 1 次提交
    • L
      network: always create dnsmasq hosts and addnhosts files, even if empty · 1cb1f9da
      Laine Stump 提交于
      This fixes the problem reported in:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=868389
      
      Previously, the dnsmasq hosts file (used for static dhcp entries, and
      addnhosts file (used for additional dns host entries) were only
      created/referenced on the dnsmasq commandline if there was something
      to put in them at the time the network was started. Once we can update
      a network definition while it's active (which is now possible with
      virNetworkUpdate), this is no longer a valid strategy - if there were
      0 dhcp static hosts (resulting in no reference to the hosts file on the
      commandline), then one was later added, the commandline wouldn't have
      linked dnsmasq up to the file, so even though we create it, dnsmasq
      doesn't pay any attention.
      
      The solution is to just always create these files and reference them
      on the dnsmasq commandline (almost always, anyway). That way dnsmasq
      can notice when a new entry is added at runtime (a SIGHUP is sent to
      dnsmasq by virNetworkUdpate whenever a host entry is added or removed)
      
      The exception to this is that the dhcp static hosts file isn't created
      if there are no lease ranges *and* no static hosts. This is because in
      this case dnsmasq won't be setup to listen for dhcp requests anyway -
      in that case, if the count of dhcp hosts goes from 0 to 1, dnsmasq
      will need to be restarted anyway (to get it listening on the dhcp
      port). Likewise, if the dhcp hosts count goes from 1 to 0 (and there
      are no dhcp ranges) we need to restart dnsmasq so that it will stop
      listening on port 67. These special situations are handled in the
      bridge driver's networkUpdate() by checking for ((bool)
      nranges||nhosts) both before and after the update, and triggering a
      dnsmasq restart if the before and after don't match.
      1cb1f9da
  18. 20 10月, 2012 5 次提交
    • E
      storage: make it easier to find file within chain · 5eaf6054
      Eric Blake 提交于
      In order to temporarily label files read/write during a commit
      operation, we need to crawl the backing chain and find the absolute
      file name that needs labeling in the first place, as well as the
      name of the file that owns the backing file.
      
      * src/util/storage_file.c (virStorageFileChainLookup): New
      function.
      * src/util/storage_file.h: Declare it.
      * src/libvirt_private.syms (storage_file.h): Export it.
      5eaf6054
    • E
      storage: remember relative names in backing chain · 82507838
      Eric Blake 提交于
      In order to search for a backing file name as literally present
      in a chain, we need to remember if the chain had relative names.
      Also, searching for absolute names is easier if we only have
      to canonicalize once, rather than on every iteration.
      
      * src/util/storage_file.h (_virStorageFileMetadata): Add field.
      * src/util/storage_file.c (virStorageFileGetMetadataFromBuf):
      (virStorageFileFreeMetadata): Manage it
      (absolutePathFromBaseFile): Store absolute names in canonical form.
      82507838
    • E
      storage: don't require caller to pre-allocate metadata struct · 1fc95932
      Eric Blake 提交于
      Requiring pre-allocation was an unusual idiom.  It allowed iteration
      over the backing chain to use fewer mallocs, but made one-shot
      clients harder to read.  Also, this makes it easier for a future
      patch to move away from opening fds on every iteration over the chain.
      
      * src/util/storage_file.h (virStorageFileGetMetadataFromFD): Alter
      signature.
      * src/util/storage_file.c (virStorageFileGetMetadataFromFD): Allocate
      return value.
       (virStorageFileGetMetadata): Update clients.
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Likewise.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      1fc95932
    • E
      storage: get entire metadata chain in one call · 35c74c17
      Eric Blake 提交于
      Previously, no one was using virStorageFileGetMetadata, and for good
      reason - it couldn't support root-squash NFS.  Change the signature
      and make it useful to future patches, including enhancing the metadata
      to recursively track the entire chain.
      
      * src/util/storage_file.h (_virStorageFileMetadata): Add field.
      (virStorageFileGetMetadata): Alter signature.
      * src/util/storage_file.c (virStorageFileGetMetadata): Rewrite.
      (virStorageFileGetMetadataRecurse): New function.
      (virStorageFileFreeMetadata): Handle recursion.
      35c74c17
    • E
      storage: list more file types · f772b3d9
      Eric Blake 提交于
      When an image has no backing file, using VIR_STORAGE_FILE_AUTO
      for its type is a bit confusing.  Additionally, a future patch
      would like to reserve a default value for the case of no file
      type specified in the XML, but different from the current use
      of -1 to imply probing, since probing is not always safe.
      
      Also, a couple of file types were missing compared to supported
      code: libxl supports 'vhd', and qemu supports 'fat' for directories
      passed through as a file system.
      
      * src/util/storage_file.h (virStorageFileFormat): Add
      VIR_STORAGE_FILE_NONE, VIR_STORAGE_FILE_FAT, VIR_STORAGE_FILE_VHD.
      * src/util/storage_file.c (virStorageFileMatchesVersion): Match
      documentation when version probing not supported.
      (cowGetBackingStore, qcowXGetBackingStore, qcow1GetBackingStore)
      (qcow2GetBackingStoreFormat, qedGetBackingStore)
      (virStorageFileGetMetadataFromBuf)
      (virStorageFileGetMetadataFromFD): Take NONE into account.
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Likewise.
      * src/conf/storage_conf.c (virStorageVolumeFormatFromString): New
      function.
      (poolTypeInfo): Use it.
      f772b3d9
  19. 16 10月, 2012 3 次提交