1. 24 11月, 2016 1 次提交
  2. 18 4月, 2016 1 次提交
    • J
      Libvirt: virTypedParamsValidate: Fix detection of multiple parameters · 0e570a6a
      Jason J. Herne 提交于
      virTypedParamsValidate currently uses an index based check to find
      duplicate parameters. This check does not work. Consider the following
      simple example:
      
      We have only 2 keys
      A  (multiples allowed)
      B  (multiples NOT allowed)
      
      We are given the following list of parameters to check:
      A
      A
      B
      
      If you work through the validation loop you will see that our last iteration
      through the loop has i=2 and j=1. In this case, i > j and keys[j].value.i will
      indicate that multiples are not allowed. Both conditionals are satisfied so
      an incorrect error will be given: "parameter '%s' occurs multiple times"
      
      This patch replaces the index based check with code that remembers
      the name of the last parameter seen and only triggers the error case if
      the current parameter name equals the last one. This works because the
      list is sorted and duplicate parameters will be grouped together.
      
      In reality, we hit this bug while using selective block migration to migrate
      a guest with 5 disks. 5 was apparently just the right number to push i > j
      and hit this bug.
      
      virsh migrate --live guestname --copy-storage-all
                    --migrate-disks vdb,vdc,vdd,vde,vdf
                    qemu+ssh://dsthost/systemSigned-off-by: NJason J. Herne <jjherne@linux.vnet.ibm.com>
      Reviewed-by: NEric Farman <farman@linux.vnet.ibm.com>
      0e570a6a
  3. 03 2月, 2016 3 次提交
    • E
      util: Export remoteSerializeTypedParameters internally via util · 8cd1d546
      Erik Skultety 提交于
      Same as for deserializer, this method might get handy for admin one day.
      The major reason for this patch is to stay consistent with idea, i.e.
      when deserializer can be shared, why not serializer as well. The only
      problem to be solved was that the daemon side serializer uses a code
      snippet which handles sparse arrays returned by some APIs as well as
      removes any string parameters that can't be returned to older clients.
      This patch makes of the new virTypedParameterRemote datatype introduced
      by one of the pvious patches.
      8cd1d546
    • E
      util: Export remoteFreeTypedParameters internally via util · 9afc115f
      Erik Skultety 提交于
      Since the method is static to remote_driver, it can't even be used by our
      daemon. Other than that, it would be useful to be able to use it with admin as
      well. This patch uses the new virTypedParameterRemote datatype introduced in
      one of previous patches.
      9afc115f
    • E
      util: Export remoteDeserializeTypedParameters internally via util · 0472cef6
      Erik Skultety 提交于
      Currently, the deserializer is hardcoded into remote_driver which makes
      it impossible for admin to use it. One way to achieve a shared implementation
      (besides moving the code to another module) would be pass @ret_params_val as a
      void pointer as opposed to the remote_typed_param pointer and add a new extra
      argument specifying which of those two protocols is being used and typecast
      the pointer at the function entry. An example from remote_protocol:
      
      struct remote_typed_param_value {
              int type;
              union {
                      int i;
                      u_int ui;
                      int64_t l;
                      uint64_t ul;
                      double d;
                      int b;
                      remote_nonnull_string s;
              } remote_typed_param_value_u;
      };
      typedef struct remote_typed_param_value remote_typed_param_value;
      
      struct remote_typed_param {
              remote_nonnull_string field;
              remote_typed_param_value value;
      };
      
      That would leave us with a bunch of if-then-elses that needed to be used across
      the method. This patch takes the other approach using the new datatype
      introduced in one of earlier commits.
      0472cef6
  4. 02 7月, 2015 1 次提交
    • J
      util: Avoid Coverity FORWARD_NULL · 2c058412
      John Ferlan 提交于
      Avoid a false positive since Coverity find a path in virResizeN which
      could return 0 prior to the allocation of memory and thus flags a
      possible NULL dereference. Instead allocate the output buffer based
      on 'nparams' and only fill it partially if need be - shouldn't be too
      much a waste of space. Quicker than multiple VIR_RESIZE_N calls or
      two loops of STREQ's sandwiched around a single VIR_ALLOC_N using
      'n' matches from a first loop to generate the 'n' addresses to return
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      2c058412
  5. 18 6月, 2015 4 次提交
  6. 05 9月, 2014 1 次提交
    • E
      maint: use hanging curly braces · 625e04a8
      Eric Blake 提交于
      Our style overwhelmingly uses hanging braces (the open brace
      hangs at the end of the compound condition, rather than on
      its own line), with the primary exception of the top level function
      body.  Fix the few remaining outliers, before adding a syntax
      check in a later patch.
      
      * src/interface/interface_backend_netcf.c (netcfStateReload)
      (netcfInterfaceClose, netcf_to_vir_err): Correct use of { in
      compound statement.
      * src/conf/domain_conf.c (virDomainHostdevDefFormatSubsys)
      (virDomainHostdevDefFormatCaps): Likewise.
      * src/network/bridge_driver.c (networkAllocateActualDevice):
      Likewise.
      * src/util/virfile.c (virBuildPathInternal): Likewise.
      * src/util/virnetdev.c (virNetDevGetVirtualFunctions): Likewise.
      * src/util/virnetdevmacvlan.c
      (virNetDevMacVLanVPortProfileCallback): Likewise.
      * src/util/virtypedparam.c (virTypedParameterAssign): Likewise.
      * src/util/virutil.c (virGetWin32DirectoryRoot)
      (virFileWaitForDevices): Likewise.
      * src/vbox/vbox_common.c (vboxDumpNetwork): Likewise.
      * tests/seclabeltest.c (main): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      625e04a8
  7. 25 3月, 2014 1 次提交
  8. 04 1月, 2014 1 次提交
    • E
      maint: avoid nested public calls · 8f6c845f
      Eric Blake 提交于
      Having one API call into another is generally not good; among
      other issues, it gives confusing logs, and is not quite as
      efficient.
      
      This fixes several instances, but not all: we still have instances
      in both libvirt.c and in backend hypervisors (lxc and qemu) calling
      the public virTypedParamsGetString and friends, which dispatch
      errors immediately.  I'm not sure if it is worth trying to clean
      that up in a separate patch (such a cleanup may be easiest by
      separating the public function into a wrapper around the internal,
      then tweaking internal.h so that internal users directly use the
      internal function).
      
      * src/libvirt.c (virDomainGetUUIDString, virNetworkGetUUIDString)
      (virStoragePoolGetUUIDString, virSecretGetUUIDString)
      (virNWFilterGetUUIDString): Avoid nested public API call.
      * src/util/virtypedparam.c (virTypedParamsReplaceString): Don't
      dispatch errors here.
      (virTypedParamsGet): No need to reset errors.
      (virTypedParamsGetBoolean): Use consistent ordering.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8f6c845f
  9. 11 7月, 2013 1 次提交
  10. 10 7月, 2013 1 次提交
  11. 25 6月, 2013 6 次提交
  12. 24 5月, 2013 1 次提交
  13. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  14. 19 2月, 2013 1 次提交
    • J
      Avoid resetting errors in virTypedParamsFree · ee1d6d91
      Jiri Denemark 提交于
      The function does not report any errors so there should be no need too
      reset an existing error first. Moreover, virTypedParamsFree is mostly
      called in cleanup phase where it has the potential to reset any useful
      reported earlier.
      ee1d6d91
  15. 18 1月, 2013 2 次提交
    • J
      Introduce virTypedParamsClear public API · de78bf60
      Jiri Denemark 提交于
      The function is just a renamed public version of former
      virTypedParameterArrayClear.
      de78bf60
    • 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
  16. 21 12月, 2012 3 次提交
  17. 03 12月, 2012 1 次提交
  18. 21 9月, 2012 1 次提交
  19. 07 9月, 2012 1 次提交
  20. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  21. 18 7月, 2012 1 次提交
  22. 21 1月, 2012 1 次提交
    • E
      maint: enforce use of _LAST marker · bb69630b
      Eric Blake 提交于
      When converting a linear enum to a string, we have checks in
      place in the VIR_ENUM_IMPL macro to ensure that there is one
      string for every value, which lets us quickly flag if a user
      added a value but forgot to add a counterpart string.  However,
      this only works if we use the _LAST marker.
      
      * cfg.mk (sc_require_enum_last_marker): New syntax check.
      * src/conf/domain_conf.h (virDomainSnapshotState): Add new marker.
      * src/conf/domain_conf.c (virDomainSnapshotState): Fix offender.
      * src/qemu/qemu_monitor_json.c (qemuMonitorWatchdogAction)
      (qemuMonitorIOErrorAction, qemuMonitorGraphicsAddressFamily):
      Likewise.
      * src/util/virtypedparam.c (virTypedParameter): Likewise.
      bb69630b
  23. 20 1月, 2012 1 次提交
    • E
      util: add new file for virTypedParameter utils · 61ca98b0
      Eric Blake 提交于
      Preparation for another patch that refactors common patterns
      into the new file for fewer lines of code overall.
      
      * src/util/util.h (virTypedParameterArrayClear): Move...
      * src/util/virtypedparam.h: ...to new file.
      (virTypedParameterArrayValidate, virTypedParameterAssign): New
      prototypes.
      * src/util/util.c (virTypedParameterArrayClear): Likewise.
      * src/util/virtypedparam.c: New file.
      * po/POTFILES.in: Mark file for translation.
      * src/Makefile.am (UTIL_SOURCES): Build it.
      * src/libvirt_private.syms (util.h): Split...
      (virtypedparam.h): to new section.
      (virkeycode.h): Sort.
      * daemon/remote.c: Adjust callers.
      * tools/virsh.c: Likewise.
      61ca98b0