1. 07 4月, 2018 1 次提交
    • J
      conf: Fix error path logic in virDomainObjListAddLocked · 2689a922
      John Ferlan 提交于
      If the virHashAddEntry fails, then we need to "careful" about
      how we free the @vm. When virDomainObjNew returns there is one
      reference and the object is locked, so use virDomainObjEndAPI
      when done.
      
      Add a virObjectRef in the error path for the second virHashAddEntry
      call since it doesn't call virObjectRef, but virHashRemoveEntry
      will call virObjectUnref because virObjectFreeHashData is called
      when the element is removed from the hash table as set up in
      virDomainObjListNew.
      
      Eventually these paths should goto error and error should be changed
      to use EndAPI as well, but that requires more adjustments to other
      paths in the code to have a locked and ref counted @vm.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      2689a922
  2. 09 11月, 2017 1 次提交
  3. 18 8月, 2017 2 次提交
    • P
      conf: add infrastructure for tolerating certain post parse callback failures · 7c5cf498
      Peter Krempa 提交于
      Some failures of the post parse callback can be tolerated. This is
      specifically desired when loading the configs of existing VMs. In such
      case the post parse callback should not really be modifying anything
      in the definition.
      
      This patch adds a parse flag VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL
      which will allow the callbacks to report non-fatal failures by returning
      a positive return value. In such case the field 'postParseFailed' in the
      domain definition is set to true, to notify the drivers that the
      callback failed and possibly needs to be re-run.
      7c5cf498
    • P
      conf: domainlist: Explicitly report failure to load domain config · 7a5f68a1
      Peter Krempa 提交于
      When dropping a domain report which one was dropped so that it's not
      necessary to rummage through the logs.
      7a5f68a1
  4. 15 8月, 2017 3 次提交
    • J
      util: Introduce and use virObjectRWUnlock · 045d712c
      John Ferlan 提交于
      Rather than overload virObjectUnlock as commit id '77f4593b' has
      done, create a separate virObjectRWUnlock API that will force the
      consumers to make the proper decision regarding unlocking the
      RWLock's. Similar to the RWLockRead and RWLockWrite, use the
      virObjectGetRWLockableObj helper. This restores the virObjectUnlock
      code to using the virObjectGetLockableObj.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      045d712c
    • J
      util: Introduce and use virObjectRWLockWrite · 908b3364
      John Ferlan 提交于
      Instead of making virObjectLock be the entry point for two
      different types of locks, let's create a virObjectRWLockWrite API
      which will only handle the virObjectRWLockableClass objects.
      
      Use the new virObjectRWLockWrite for the virdomainobjlist code
      in order to handle the Add, Remove, Rename, and Load operations
      that need to be very synchronous.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      908b3364
    • J
      util: Rename virObjectLockRead to virObjectRWLockRead · 99a72b3e
      John Ferlan 提交于
      Since the class it represents is based on virObjectRWLockableClass
      and in order to make sure we differentiate just in case anyone somehow
      believes they could use virObjectLockRead for a virObjectLockableClass,
      let's rename the API to use the RW in the name. Besides the RW locks
      refer to pthread_rwlock_{init|rdlock|wrlock|unlock|destroy} while the
      other locks refer to pthread_mutex_{init|lock|unlock|destroy}.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      99a72b3e
  5. 24 7月, 2017 1 次提交
  6. 20 7月, 2017 1 次提交
  7. 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
  8. 26 9月, 2016 1 次提交
  9. 24 6月, 2016 3 次提交
  10. 13 6月, 2016 1 次提交
    • W
      libxl: fix vm lock overwritten bug · 9ac94507
      Wang Yufei 提交于
      In libxl driver we do virObjectRef in libxlDomainObjBeginJob,
      If virCondWaitUntil failed, it goes to error, do virObjectUnref,
      There's a chance that someone undefine the vm at the same time,
      and refs unref to zero, vm is freed in libxlDomainObjBeginJob.
      But the vm outside function is not Null, we do virObjectUnlock(vm).
      That's how we overwrite the vm memory after it's freed. I fix it.
      Signed-off-by: NWang Yufei <james.wangyufei@huawei.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9ac94507
  11. 07 6月, 2016 1 次提交
    • P
      conf: Add infrastructure for adding configuration validation · b394af16
      Peter Krempa 提交于
      Until now we weren't able to add checks that would reject configuration
      once accepted by the parser. This patch adds a new callback and
      infrastructure to add such checks. In this patch all the places where
      rejecting a now-invalid configuration wouldn't be a good idea are marked
      with a new parser flag.
      b394af16
  12. 17 2月, 2016 1 次提交
    • E
      util: Add a return value to void hash iterators · cc48d3a1
      Erik Skultety 提交于
      Our existing virHashForEach method iterates through all items disregarding the
      fact, that some of the iterators might have actually failed. Errors are usually
      dispatched through an error element in opaque data which then causes the
      original caller of virHashForEach to return -1. In that case, virHashForEach
      could return as soon as one of the iterators fail. This patch changes the
      iterator return type and adjusts all of its instances accordingly, so the
      actual refactor of virHashForEach method can be dealt with later.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      cc48d3a1
  13. 03 2月, 2016 1 次提交
    • N
      qemu: qemuDomainRename and virDomainObjListNumOfDomains ABBA deadlock fix · 1e93470d
      Nikolay Shirokovskiy 提交于
      A pretty nasty deadlock occurs while trying to rename a VM in parallel
      with virDomainObjListNumOfDomains.
      The short description of the problem is as follows:
      
      Thread #1:
      
      qemuDomainRename:
          ------> aquires domain lock by qemuDomObjFromDomain
             ---------> waits for domain list lock in any of the listed functions:
                - virDomainObjListFindByName
                - virDomainObjListRenameAddNew
                - virDomainObjListRenameRemove
      
      Thread #2:
      
      virDomainObjListNumOfDomains:
          ------> aquires domain list lock
             ---------> waits for domain lock in virDomainObjListCount
      
      Introduce generic virDomainObjListRename function for renaming domains.
      It aquires list lock in right order to avoid deadlock. Callback is used
      to make driver specific domain updates.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1e93470d
  14. 30 11月, 2015 1 次提交
    • M
      conf: Split virDomainObjList into a separate file · 90f3c0d7
      Michal Privoznik 提交于
      Our domain_conf.* files are big enough. Not only they contain XML
      parsing code, but they served as a storage of all functions whose
      name is virDomain prefixed. This is just wrong as it gathers not
      related functions (and modules) into one big file which is then
      harder to maintain. Split virDomainObjList module into a separate
      file called virdomainobjlist.[ch].
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      90f3c0d7