1. 22 7月, 2017 3 次提交
  2. 17 7月, 2017 5 次提交
    • J
      nodedev: Convert virNodeDeviceObj to use virObjectLockable · dae23ec3
      John Ferlan 提交于
      Now that we have a bit more control, let's convert our object into
      a lockable object and let that magic handle the create and lock/unlock.
      
      This also involves creating a virNodeDeviceEndAPI in order to handle
      the object cleanup for API's that use the Add or Find API's in order
      to get a locked/reffed object. The EndAPI will unlock and unref the
      object returning NULL to indicate to the caller to not use the obj.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      dae23ec3
    • J
      nodedev: Alter node device obj list function names · 881a486a
      John Ferlan 提交于
      Ensure that any function that walks the node device object list is prefixed
      by virNodeDeviceObjList.
      
      Also, modify the @filter param name for virNodeDeviceObjListExport to
      be @aclfilter.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      881a486a
    • J
      nodedev: Introduce virNodeDeviceObjListNew · 9c5d98fd
      John Ferlan 提交于
      In preparation to make things private, make the ->devs be pointers to a
      virNodeDeviceObjList and then manage everything inside virnodedeviceobj
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      9c5d98fd
    • J
      test: Adjust cleanup/error paths for nodedev test APIs · c4ff1a18
      John Ferlan 提交于
       - In testDestroyVport rather than use a cleanup label, just return -1
         immediately since nothing else is needed.
      
       - In testStoragePoolDestroy, if !privpool, then just return -1 since
         nothing else will happen anyway.
      
       - Rather than "goto cleanup;" on failure to virNodeDeviceObjFindByName
         an @obj, just return directly.  This then allows the cleanup: label code
         to not have to check "if (obj)" before calling virNodeDeviceObjUnlock.
         This also simplifies some exit logic...
      
       - In testNodeDeviceObjFindByName use an error: label to handle the failure
         and don't do the ncaps++ within the VIR_STRDUP() source target index.
         Only increment ncaps after success. Easier on eyes at error label too.
      
       - In testNodeDeviceDestroy use "cleanup" rather than "out" for the goto
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      c4ff1a18
    • J
      nodedev: Alter virNodeDeviceObjRemove · 87e50c9c
      John Ferlan 提交于
      Rather than passing the object to be removed by reference, pass by value
      and then let the caller decide whether or not the object should be free'd
      and how to handle the logic afterwards. This includes free'ing the object
      and/or setting the local variable to NULL to prevent subsequent unexpected
      usage (via something like virNodeDeviceObjRemove in testNodeDeviceDestroy).
      
      For now this function will just handle the remove of the object from the
      list for which it was placed during virNodeDeviceObjAssignDef.
      
      This essentially reverts logic from commit id '61148074' that free'd the
      device entry on list, set *dev = NULL and returned. Thus fixing a bug in
      node_device_hal.c/dev_refresh() which would never call dev_create(udi)
      since @dev would have been set to NULL.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      87e50c9c
  3. 15 7月, 2017 1 次提交
  4. 25 6月, 2017 1 次提交
    • J
      events: Avoid double free possibility on remote call failure · 2065499b
      John Ferlan 提交于
      If a remote call fails during event registration (more than likely from
      a network failure or remote libvirtd restart timed just right), then when
      calling the virObjectEventStateDeregisterID we don't want to call the
      registered @freecb function because that breaks our contract that we
      would only call it after succesfully returning.  If the @freecb routine
      were called, it could result in a double free from properly coded
      applications that free their opaque data on failure to register, as seen
      in the following details:
      
          Program terminated with signal 6, Aborted.
          #0  0x00007fc45cba15d7 in raise
          #1  0x00007fc45cba2cc8 in abort
          #2  0x00007fc45cbe12f7 in __libc_message
          #3  0x00007fc45cbe86d3 in _int_free
          #4  0x00007fc45d8d292c in PyDict_Fini
          #5  0x00007fc45d94f46a in Py_Finalize
          #6  0x00007fc45d960735 in Py_Main
          #7  0x00007fc45cb8daf5 in __libc_start_main
          #8  0x0000000000400721 in _start
      
      The double dereference of 'pyobj_cbData' is triggered in the following way:
      
          (1) libvirt_virConnectDomainEventRegisterAny is invoked.
          (2) the event is successfully added to the event callback list
              (virDomainEventStateRegisterClient in
              remoteConnectDomainEventRegisterAny returns 1 which means ok).
          (3) when function remoteConnectDomainEventRegisterAny is hit,
              network connection disconnected coincidently (or libvirtd is
              restarted) in the context of function 'call' then the connection
              is lost and the function 'call' failed, the branch
              virObjectEventStateDeregisterID is therefore taken.
          (4) 'pyobj_conn' is dereferenced the 1st time in
              libvirt_virConnectDomainEventFreeFunc.
          (5) 'pyobj_cbData' (refered to pyobj_conn) is dereferenced the
               2nd time in libvirt_virConnectDomainEventRegisterAny.
          (6) the double free error is triggered.
      
      Resolve this by adding a @doFreeCb boolean in order to avoid calling the
      freeCb in virObjectEventStateDeregisterID for any remote call failure in
      a remoteConnect*EventRegister* API. For remoteConnect*EventDeregister* calls,
      the passed value would be true indicating they should run the freecb if it
      exists; whereas, it's false for the remote call failure path.
      
      Patch based on the investigation and initial patch posted by
      fangying <fangying1@huawei.com>.
      2065499b
  5. 07 6月, 2017 3 次提交
  6. 05 6月, 2017 1 次提交
  7. 03 6月, 2017 8 次提交
  8. 26 5月, 2017 1 次提交
  9. 25 4月, 2017 1 次提交
  10. 19 4月, 2017 2 次提交
  11. 13 4月, 2017 1 次提交
  12. 11 4月, 2017 6 次提交
  13. 10 4月, 2017 5 次提交
  14. 03 4月, 2017 1 次提交
    • M
      virGetDomain: Set domain ID too · 5683b213
      Michal Privoznik 提交于
      So far our code is full of the following pattern:
      
        dom = virGetDomain(conn, name, uuid)
        if (dom)
            dom->id = 42;
      
      There is no reasong why it couldn't be just:
      
        dom = virGetDomain(conn, name, uuid, id);
      
      After all, client domain representation consists of tuple (name,
      uuid, id).
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5683b213
  15. 27 3月, 2017 1 次提交