1. 04 5月, 2018 1 次提交
    • J
      conf: Clean up object referencing for Add and Remove · b04629b6
      John Ferlan 提交于
      When adding a new object to the domain object list, there should
      have been 2 virObjectRef calls made one for each list into which
      the object was placed to match the 2 virObjectUnref calls that
      would occur during Remove as part of virHashRemoveEntry when
      virObjectFreeHashData is called when the element is removed from
      the hash table as set up in virDomainObjListNew.
      
      Some drivers (libxl, lxc, qemu, and vz) handled this inconsistency
      by calling virObjectRef upon successful return from virDomainObjListAdd
      in order to use virDomainObjEndAPI when done with the returned @vm.
      While others (bhyve, openvz, test, and vmware) handled this via only
      calling virObjectUnlock upon successful return from virDomainObjListAdd.
      
      This patch will "unify" the approach to use virDomainObjEndAPI
      for any @vm successfully returned from virDomainObjListAdd.
      
      Because list removal is so tightly coupled with list addition,
      this patch fixes the list removal algorithm to return the object
      as entered - "locked and reffed".  This way, the callers can then
      decide how to uniformly handle add/remove success and failure.
      This removes the onus on the caller to "specially handle" the
      @vm during removal processing.
      
      The Add/Remove logic allows for some logic simplification such
      as in libxl where we can Remove the @vm directly rather than
      needing to set a @remove_dom boolean and removing after the
      libxlDomainObjEndJob completes as the @vm is locked/reffed.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      b04629b6
  2. 23 4月, 2018 2 次提交
  3. 18 4月, 2018 1 次提交
    • M
      virobject: Introduce VIR_CLASS_NEW() macro · 10f94828
      Michal Privoznik 提交于
      So far we are repeating the following lines over and over:
      
        if (!(virSomeObjectClass = virClassNew(virClassForObject(),
                                   "virSomeObject",
                                   sizeof(virSomeObject),
                                   virSomeObjectDispose)))
            return -1;
      
      While this works, it is impossible to do some checking. Firstly,
      the class name (the 2nd argument) doesn't match the name in the
      code in all cases (the 3rd argument). Secondly, the current style
      is needlessly verbose. This commit turns example into following:
      
        if (!(VIR_CLASS_NEW(virSomeObject,
                            virClassForObject)))
            return -1;
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      10f94828
  4. 13 4月, 2018 1 次提交
  5. 12 4月, 2018 5 次提交
  6. 11 4月, 2018 1 次提交
    • J
      bhyve: Use virDomainObjListFindBy{UUID|ID}Ref · f52d0d42
      John Ferlan 提交于
      For bhyveDomObjFromDomain, bhyveDomainLookupByUUID, and
      bhyveDomainLookupByID let's return a locked and referenced
      @vm object so that callers can then use the common and more
      consistent virDomainObjEndAPI in order to handle cleanup rather
      than needing to know that the returned object is locked and
      calling virObjectUnlock.
      
      The LookupByName already returns the ref counted and locked object,
      so this will make things more consistent.
      
      For bhyveDomainUndefine and bhyveDomainDestroy since the
      virDomainObjListRemove will return an unlocked object, we need to
      relock before making the EndAPI call.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      f52d0d42
  7. 10 4月, 2018 1 次提交
  8. 13 3月, 2018 1 次提交
  9. 23 2月, 2018 1 次提交
  10. 22 2月, 2018 6 次提交
  11. 19 2月, 2018 1 次提交
  12. 09 2月, 2018 1 次提交
  13. 09 11月, 2017 1 次提交
  14. 19 10月, 2017 1 次提交
  15. 18 10月, 2017 1 次提交
    • E
      maint: Replace tabs with spaces in all source files in repo · b08017ca
      Erik Skultety 提交于
      So we have a syntax-check rule to catch all tab indents but it naturally
      can't catch tab spacing, i.e. as a delimiter. This patch is a result of
      running 'vim -en +retab +wq'
      (using tabstop=8 softtabstop=4 shiftwidth=4 expandtab) on each file from
      a list generated by the following:
      find . -regextype gnu-awk \
               -regex ".*\.(rng|syms|html|s?[ch]|py|pl|php(\.code)?)(\.in)?" \
               | xargs git grep -lP "\t"
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      b08017ca
  16. 21 9月, 2017 1 次提交
    • J
      cpu_conf: Drop updateCPU from virCPUDefFormat · 4fd179f5
      Jiri Denemark 提交于
      In the past we updated host-model CPUs with host CPU data by adding a
      model and features, but keeping the host-model mode. And since the CPU
      model is not normally formatted for host-model CPU defs, we had to pass
      the updateCPU flag to the formatting code to be able to properly output
      updated host-model CPUs. Libvirt doesn't do this anymore, host-model
      CPUs are turned into custom mode CPUs once updated with host CPU data
      and thus there's no reason for keeping the hacks inside CPU XML
      formatters.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      4fd179f5
  17. 18 9月, 2017 1 次提交
  18. 06 8月, 2017 1 次提交
  19. 25 7月, 2017 1 次提交
  20. 18 7月, 2017 1 次提交
    • A
      conf: Introduce isolation groups · b8b6abbc
      Andrea Bolognani 提交于
      Isolation groups will eventually allow us to make sure certain
      devices, eg. PCI hostdevs, are assigned to guest PCI buses in
      a way that guarantees improved isolation, error detection and
      recovery for machine types and hypervisors that support it,
      eg. pSeries guest on QEMU.
      
      This patch merely defines storage for the new information
      we're going to need later on and makes sure it is passed from
      the hypervisor driver (QEMU / bhyve) down to the generic PCI
      address allocation code.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      Reviewed-by: NLaine Stump <laine@laine.org>
      b8b6abbc
  21. 15 7月, 2017 1 次提交
    • A
      conf: Move index number checking to drivers · 620c390c
      Andrea Bolognani 提交于
      pSeries guests will soon be allowed to have multiple
      PHBs (pci-root controllers), which of course means that
      all but one of them will have a non-zero index; hence,
      we'll need to relax the current check.
      
      However, right now the check is performed in the conf
      module, which is generic rather than tied to the QEMU
      driver, and where we don't have information such as the
      guest machine type available.
      
      To make this change of behavior possible down the line,
      we need to move the check from the XML parser to the
      drivers. Luckily, only QEMU and bhyve are using PCI
      controllers, so this doesn't result in much duplication.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      Reviewed-by: NLaine Stump <laine@laine.org>
      620c390c
  22. 27 6月, 2017 1 次提交
  23. 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
  24. 07 6月, 2017 1 次提交
  25. 05 6月, 2017 1 次提交
  26. 28 4月, 2017 1 次提交
  27. 21 4月, 2017 1 次提交
  28. 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
  29. 27 3月, 2017 2 次提交
    • M
      Remove src/nodeinfo · 26ae4e48
      Martin Kletzander 提交于
      There is no "node driver" as there was before, drivers have to do
      their own ACL checking anyway, so they all specify their functions and
      nodeinfo is basically just extending conf/capablities.  Hence moving
      the code to src/conf/ is the right way to go.
      
      Also that way we can de-duplicate some code that is in virsysfs and/or
      virhostcpu that got duplicated during the virhostcpu.c split.  And
      Some cleanup is done throughout the changes, like adding the vir*
      prefix etc.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      26ae4e48
    • M
      Move src/fdstream to src/util/virfdstream · bdcb1995
      Martin Kletzander 提交于
      There is no reason for it not to be in the utils, all global symbols
      under that file already have prefix vir* and there is no reason for it
      to be part of DRIVER_SOURCES because that is just a leftover from
      older days (pre-driver modules era, I believe).
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      bdcb1995