• E
    maint: avoid nested use of virConnect{Ref,Close} · 25221a1b
    Eric Blake 提交于
    The public virConnectRef and virConnectClose API are just thin
    wrappers around virObjectRef/virObjectRef, with added object
    validation and an error reset.  Within our backend drivers, use
    of the object validation is just an inefficiency since we always
    pass valid objects.  More important to think about is what
    happens with the error reset; our uses of virConnectRef happened
    to be safe (since we hadn't encountered any earlier errors), but
    in several cases the use of virConnectClose could lose a real
    error.
    
    Ideally, we should also avoid calling virConnectOpen() from
    within backend drivers - but that is a known situation that
    needs much more design work.
    
    * src/qemu/qemu_process.c (qemuProcessReconnectHelper)
    (qemuProcessReconnect): Avoid nested public API call.
    * src/qemu/qemu_driver.c (qemuAutostartDomains)
    (qemuStateInitialize, qemuStateStop): Likewise.
    * src/qemu/qemu_migration.c (doPeer2PeerMigrate): Likewise.
    * src/storage/storage_driver.c (storageDriverAutostart):
    Likewise.
    * src/uml/uml_driver.c (umlAutostartConfigs): Likewise.
    * src/lxc/lxc_process.c (virLXCProcessAutostartAll): Likewise.
    (virLXCProcessReboot): Likewise, and avoid leaking conn on error.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    25221a1b
uml_driver.c 80.3 KB