1. 15 10月, 2013 2 次提交
    • E
      maint: avoid 'const fooPtr' in several util files · 1b0bc416
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/util outside of the virnet namespace.
      
      Also, make a few virSocketAddr functions const-correct, for easier
      conversions in future patches.
      
      * src/util/virbuffer.h (virBufferError, virBufferUse)
      (virBufferGetIndent): Use intended type.
      * src/util/virmacaddr.h (virMacAddrCmp, virMacAddrCmpRaw)
      (virMacAddrSet, virMcAddrFormat, virMacAddrIsUnicast)
      (virMacAddrIsMulticast): Likewise.
      * src/util/virebtables.h (ebtablesAddForwardAllowIn)
      (ebtablesRemoveForwardAllowIn): Likewise.
      * src/util/virsocketaddr.h (virSocketAddrSetIPv4Addr): Drop
      incorrect const.
      (virMacAddrGetRaw, virSocketAddrFormat, virSocketAddrFormatFull):
      Make const-correct.
      (virSocketAddrMask, virSocketAddrMaskByPrefix)
      (virSocketAddrBroadcast, virSocketAddrBroadcastByPrefix)
      (virSocketAddrGetNumNetmaskBits, virSocketAddrGetIpPrefix)
      (virSocketAddrEqual, virSocketAddrIsPrivate)
      (virSocketAddrIsWildcard): Use intended type.
      * src/util/virbuffer.c (virBufferError, virBufferUse)
      (virBufferGetIndent): Fix fallout.
      * src/util/virmacaddr.c (virMacAddrCmp, virMacAddrCmpRaw)
      (virMacAddrSet, virMcAddrFormat, virMacAddrIsUnicast)
      (virMacAddrIsMulticast): Likewise.
      * src/util/virebtables.c (ebtablesAddForwardAllowIn)
      (ebtablesRemoveForwardAllowIn): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrMask, virMacAddrGetRaw)
      (virSocketAddrMaskByPrefix, virSocketAddrBroadcast)
      (virSocketAddrBroadcastByPrefix, virSocketAddrGetNumNetmaskBits)
      (virSocketAddrGetIpPrefix, virSocketAddrEqual)
      (virSocketAddrIsPrivate, virSocketAddrIsWildcard)
      (virSocketAddrGetIPv4Addr, virSocketAddrGetIPv6Addr)
      (virSocketAddrFormat, virSocketAddrFormatFull): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1b0bc416
    • E
      maint: avoid 'const fooPtr' in hashes · b43efdaa
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up virhash to provide a const-correct interface: all actions
      that don't modify the table take a const table.  Note that in
      one case (virHashSearch), we actually strip const away - we aren't
      modifying the contents of the table, so much as associated data
      for ensuring that the code uses the table correctly (if this were
      C++, it would be a case for the 'mutable' keyword).
      
      * src/util/virhash.h (virHashKeyComparator, virHashEqual): Use
      intended type.
      (virHashSize, virHashTableSize, virHashLookup, virHashSearch):
      Make const-correct.
      * src/util/virhash.c (virHashEqualData, virHashEqual)
      (virHashLookup, virHashSize, virHashTableSize, virHashSearch)
      (virHashComputeKey): Fix fallout.
      * src/conf/nwfilter_params.c
      (virNWFilterFormatParameterNameSorter): Likewise.
      * src/nwfilter/nwfilter_ebiptables_driver.c
      (ebiptablesFilterOrderSort): Likewise.
      * tests/virhashtest.c (testHashGetItemsCompKey)
      (testHashGetItemsCompValue): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b43efdaa
  2. 14 10月, 2013 5 次提交
    • D
      Initialize threading & error layer in LXC controller · 97973ebb
      Daniel P. Berrange 提交于
      In Fedora 20, libvirt_lxc crashes immediately at startup with a
      trace
      
       #0  0x00007f0cddb653ec in free () from /lib64/libc.so.6
       #1  0x00007f0ce0e16f4a in virFree (ptrptr=ptrptr@entry=0x7f0ce1830058) at util/viralloc.c:580
       #2  0x00007f0ce0e2764b in virResetError (err=0x7f0ce1830030) at util/virerror.c:354
       #3  0x00007f0ce0e27a5a in virResetLastError () at util/virerror.c:387
       #4  0x00007f0ce0e28858 in virEventRegisterDefaultImpl () at util/virevent.c:233
       #5  0x00007f0ce0db47c6 in main (argc=11, argv=0x7fff4596c328) at lxc/lxc_controller.c:2352
      
      Normally virInitialize calls virErrorInitialize and
      virThreadInitialize, but we don't link to libvirt.so
      in libvirt_lxc, and nor did we ever call the error
      or thread initializers.
      
      I have absolutely no idea how this has ever worked, let alone
      what caused it to stop working in Fedora 20.
      
      In addition not all code paths from virLogSetFromEnv will
      ensure virLogInitialize is called correctly, which is another
      possible crash scenario.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      97973ebb
    • D
      Don't ignore all dbus connection errors · 6bd88600
      Daniel P. Berrange 提交于
      Previous commit
      
        commit 7ada155c
        Author: Gao feng <gaofeng@cn.fujitsu.com>
        Date:   Wed Sep 11 11:15:02 2013 +0800
      
          DBus: introduce virDBusIsServiceEnabled
      
      Made the cgroups code fallback to non-systemd based setup
      when dbus is not running. It was too big a hammer though,
      as it did not check what error code was received when the
      dbus connection failed. Thus it silently ignored serious
      errors from dbus such as "too many client connections",
      which should always be treated as fatal.
      
      We only want to ignore errors if the dbus unix socket does
      not exist, or if nothing is listening on it.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6bd88600
    • D
      Fix flaw in detecting log format · 5787f0b9
      Daniel P. Berrange 提交于
      The log message regex has been
      
      [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\+[0-9]{4}: [0-9]+: debug|info|warning|error :
      
      The precedence of '|' is high though, so this is equivalent to matching
      
         [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\+[0-9]{4}: [0-9]+: debug
      
      Or
      
         info
      
      Or
      
         warning
      
      Or
      
         error :
      
      Which is clearly not what it should have done. This caused the code to
      skip over things which are not log messages. The solution is to simply
      add brackets.
      
      A test case is also added to validate correctness.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5787f0b9
    • D
      Add a method for closing the dbus system bus connection · 489beb0a
      Daniel P. Berrange 提交于
      If the dbus system bus connection is marked as private, then
      allow it to be closed.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      489beb0a
    • D
      Allow use of a private dbus bus connection · 0cb774f0
      Daniel P. Berrange 提交于
      The dbus_bus_get() function returns a shared bus connection that
      all libraries in a process can use. You are forbidden from calling
      close on this connection though, since you can never know if any
      other code might be using it.
      
      Add an option to use private dbus bus connections, if the app
      wants to be able to close the connection.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0cb774f0
  3. 11 10月, 2013 3 次提交
  4. 09 10月, 2013 1 次提交
  5. 08 10月, 2013 2 次提交
    • M
      virerror: s/VIR_ERR_STORAGE_VOL_EXISTS/VIR_ERR_STORAGE_VOL_EXISTS/ · 4b744d7d
      Michal Privoznik 提交于
      We currently have other error codes in singular form, e.g.
      VIR_ERR_NETWORK_EXIST. Cleanup the previous patch to match the form.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      4b744d7d
    • H
      fix a ambiguous output of the command:'virsh vol-create-as' · 91875896
      Hongwei Bi 提交于
      I created a storage volume(eg: test) from a storage pool(eg:vg10) using
      the following command:"virsh vol-create-as --pool vg10 --name test --capacity 300M."
      When I re-executed the above command, the output was as the following:
      "error: Failed to create vol test
       error: Storage volume not found: storage vol 'test' already exists"
      
      I think the output "Storage volume not found" is not appropriate. Because in fact storage
      vol test has been found at this time. And then I think virErrorNumber should includes
      VIR_ERR_STORAGE_EXIST which can also be used elsewhere. So I make this patch. The result
      is as following:
      "error: Failed to create vol test
       error: storage volume 'test' exists already"
      91875896
  6. 04 10月, 2013 4 次提交
  7. 03 10月, 2013 3 次提交
  8. 02 10月, 2013 1 次提交
  9. 01 10月, 2013 1 次提交
    • L
      util: recognize SMB/CIFS filesystems as shared · e4e73337
      Laine Stump 提交于
      This should resolve:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1012085
      
      libvirt previously recognized NFS, GFS2, OCFS2, and AFS filesystems as
      "shared", and thus eligible for exceptions to certain rules/actions
      about chowning image files before handing them off to a guest. This
      patch widens the definition of "shared filesystem" to include SMB and
      CIFS filesystems (aka "Windows file sharing"); both of these use the
      same protocol, but different drivers so there are different magic
      numbers for each.
      e4e73337
  10. 30 9月, 2013 3 次提交
  11. 28 9月, 2013 1 次提交
    • D
      event: Make debug message match function comments · b41bed70
      Doug Goldstein 提交于
      The debug message said there was a timeout of 0 pending for -1 ms which
      made me think this is where a hang was coming from but according to the
      function comments this case means that there is no timeout pending so
      make the debug message say that instead of saying there's a -1 ms
      timeout.
      b41bed70
  12. 26 9月, 2013 5 次提交
  13. 25 9月, 2013 1 次提交
    • L
      util/viriptables: add/remove rules that short-circuit masquerading · ccca5dc3
      Laszlo Ersek 提交于
      The functions
      - iptablesAddForwardDontMasquerade(),
      - iptablesRemoveForwardDontMasquerade
      handle exceptions in the masquerading implemented in the POSTROUTING chain
      of the "nat" table. Such exceptions should be added as chronologically
      latest, logically top-most rules.
      
      The bridge driver will call these functions beginning with the next patch:
      some special destination IP addresses always refer to the local
      subnetwork, even though they don't match any practical subnetwork's
      netmask. Packets from virbrN targeting such IP addresses are never routed
      outwards, but the current rules treat them as non-virbrN-destined packets
      and masquerade them. This causes problems for some receivers on virbrN.
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      ccca5dc3
  14. 24 9月, 2013 2 次提交
  15. 19 9月, 2013 1 次提交
    • J
      docs: fix virEventAddHandle return details · b8e4644d
      Jonathan Lebon 提交于
      In commit 6d41cb87, the interface for virEventAddHandleFunc was changed.
      This patch updates the documentation for virEventAddHandle to reflect
      the new significance of the return value. Also, both functions now
      mention -1 for failure.
      b8e4644d
  16. 18 9月, 2013 2 次提交
  17. 17 9月, 2013 3 次提交