1. 02 8月, 2016 1 次提交
    • J
      Introduce node device lifecycle event APIs · fcabc1ca
      Jovanka Gulicoska 提交于
      Node device lifecycle event API entry points for registering and
      deregistering node deivce events, as well as types of events
      associated with node device.
      These entry points will be used for implementing asynchronous
      lifecycle events.
      
      Node device API:
      virConnectNodeDeviceEventRegisterAny
      virConnectNodeDeviceEventDeregisterAny
      virNodeDeviceEventLifecycleType which has events CREATED and DELETED
      fcabc1ca
  2. 17 6月, 2016 1 次提交
    • J
      Introduce storage lifecycle event APIs · 1328f982
      Jovanka Gulicoska 提交于
      Storage pool lifecycle event API entry points for registering and deregistering
      storage pool events, as well as types of events associated with storage pools.
      These entry points will be used for implementing asynchronous lifecycle events.
      
      Storage pool API:
      virConnectStoragePoolEventRegisterAny
      virConnectStoragePoolEventDeregisterAny
      virStoragePoolEventLifecycleType which has events STARTED, STOPPED, DEFINED,
      UNDEFINED, and REFRESHED
      1328f982
  3. 03 5月, 2016 1 次提交
    • E
      admin: Introduce virAdmClient client-side object · 324945d9
      Erik Skultety 提交于
      Besides ID, the object also stores static data like connection transport and
      connection timestamp, since once obtained a list of all clients connected to a
      server, from user's perspective, it would be nice to know whether a given
      client is remote or local only and when did it connect to the daemon.
      Along with the object introduction, all necessary client-side methods necessary
      to work with the object are added as well.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      324945d9
  4. 01 3月, 2016 2 次提交
  5. 17 2月, 2016 1 次提交
    • E
      admin: Introduce virAdmServer structure · c50a834b
      Erik Skultety 提交于
      This is the key structure of all management operations performed on the
      daemon/clients. An admin client needs to be able to identify
      another client (either admin or non-privileged client) to perform an
      action on it. This identification includes a server the client is
      connected to, thus a client-side representation of a server is needed.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      c50a834b
  6. 21 12月, 2015 1 次提交
    • E
      Revert "admin: Rename virAdmConnect to virAdmDaemon" · 3245e178
      Erik Skultety 提交于
      Commmit df8192aa introduced admin related rename and some minor
      (caused by automated approach, aka sed) and some more severe isues along with
      it. First reason to revert is the inconsistency with libvirt library.
      Although we deal with the daemon directly rather than with a specific
      hypervisor, we still do have a connection. That being said, contributors might
      get under the impression that AdmDaemonNew would spawn/start a new daemon
      (since it's admin API, why not...), or AdmDaemonClose would do the exact
      opposite or they might expect DaemonIsAlive report overall status of the daemon
      which definitely isn't the case.
      The second reason to revert this patch is renaming virt-admin client. The
      client tool does not necessarily have to reflect the names of the API's it's
      using in his internals. An example would be 's/vshAdmConnect/vshAdmDaemon'
      where noone can be certain of what the latter function really does. The former
      is quite expressive about some connection magic it performs, but the latter does
      not say anything, especially when vshAdmReconnect and vshAdmDisconnect were
      left untouched.
      3245e178
  7. 01 12月, 2015 1 次提交
    • M
      admin: Rename virAdmConnect to virAdmDaemon · df8192aa
      Martin Kletzander 提交于
      virAdmConnect was named after virConnect, but after some discussions,
      most of the APIs called will be working with remote daemon and starting
      them virAdmDaemon will make more sense.  Only possibly controversal name
      is CloseCallback (de)registration, and connecting to the daemon (which
      will still be Open/Close), but even this makes sense if one thinks about
      the daemon being opened and closed, e.g. as file, etc.
      
      This way all the APIs working with the daemon will start with
      virAdmDaemon prefix, they will accept virAdmDaemonPtr as first parameter
      and that will better suit with other namings as well (virDomain*,
      virAdmServer*, etc.).
      
      Because in virt-admin, the connection name does not refer to a struct
      that would have a connect in its name, also adjust 'connname' in
      clients.  And because it is not used anywhere in the vsh code, move it
      from there into each client.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      df8192aa
  8. 30 11月, 2015 2 次提交
    • E
      admin: Add support for connection close callbacks · 6dd7e42d
      Erik Skultety 提交于
      As we need a client disconnect handler, we also need a mechanism to register
      such handlers for a client. This patch introduced both the close callbacks and
      also the client vshAdmCatchDisconnect handler to be registered with it. By
      registering the handler we still need to make sure the client can react to
      daemon's events like disconnect or keepalive, so asynchronous I/O event polling
      is necessary to be enabled too.
      6dd7e42d
    • E
      admin: Add URI support and introduce virAdmGetDefaultURI · dbecb87f
      Erik Skultety 提交于
      Since virt-admin should be able to connect to various admin servers
      on hosted different daemons, we need to provide URI support to
      libvirt-admin.
      dbecb87f
  9. 10 8月, 2015 1 次提交
  10. 16 6月, 2015 1 次提交
    • M
      Add libvirt-admin library · 55e0c840
      Martin Kletzander 提交于
      Initial scratch of the admin library.  It has its own virAdmConnectPtr
      that inherits from virAbstractConnectPtr and thus trivially supports
      error reporting.
      
      There's pkg-config file added and spec-file adjusted as well.
      
      Since the library should be "minimalistic" and not depend on any other
      library, the list of files is especially crafted for it.  Most of them
      could've been put to it's own sub-libraries that would be LIBADD'd to
      libvirt_util, libvirt_net_rpc and libvirt_setuid_rpc_client to minimize
      the number of object files being built, but that's a refactoring that
      isn't the orginal aim of this commit.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      55e0c840
  11. 15 4月, 2015 1 次提交
  12. 27 1月, 2015 1 次提交
  13. 24 10月, 2014 1 次提交
  14. 23 10月, 2014 1 次提交
  15. 05 5月, 2014 1 次提交
  16. 10 1月, 2014 5 次提交
    • E
      maint: improve VIR_ERR_INVALID_DOMAIN_SNAPSHOT usage · dd0e04d9
      Eric Blake 提交于
      The existing check of domain snapshots validated that they
      point to a domain, but did not validate that the domain
      points to a connection, even though any errors blindly assume
      the connection is valid.  On the other hand, as mentioned in
      commit 6e130ddc, any valid domain is already tied to a valid
      connection, and VIR_IS_SNAPSHOT vs. VIR_IS_DOMAIN_SNAPSHOT
      makes no real difference; it's best to just validate the chain
      of all three.  For consistency with previous patches, continue
      the trend of using a common macro.  For now, we don't need
      virCheckDomainSnapshotGoto().
      
      * src/datatypes.h (virCheckDomainSnapshotReturn): New macro.
      (VIR_IS_SNAPSHOT, VIR_IS_DOMAIN_SNAPSHOT):
      Drop unused macros.
      * src/libvirt.c: Use macro throughout.
      (virLibDomainSnapshotError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      dd0e04d9
    • E
      maint: improve VIR_ERR_INVALID_NWFILTER usage · 7d0a0ab7
      Eric Blake 提交于
      While all errors related to invalid nwfilters appeared to be
      consistent, we might as well continue the trend of using a
      common macro.  As in commit 6e130ddc, the difference between
      VIR_IS_NWFILTER and VIR_IS_CONNECTED_NWFILTER is moot, since
      reference counting means any valid nwfilter is also tied to
      a valid connection.  For now, we don't need virCheckNWFilterGoto().
      
      * src/datatypes.h (virCheckNWFilterReturn): New macro.
      (VIR_IS_NWFILTER, VIR_IS_CONNECTED_NWFILTER): Drop unused macros.
      * src/libvirt.c: Use macro throughout.
      (virLibNWFilterError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7d0a0ab7
    • E
      maint: improve VIR_ERR_INVALID_STREAM usage · 101f176a
      Eric Blake 提交于
      For streams validation, we weren't consistent on whether to
      use VIR_FROM_NONE or VIR_FROM_STREAMS.  Furthermore, in many
      API, we want to ensure that a stream is tied to the same
      connection as the other object we are operating on; while
      other API failed to validate the stream at all.  And the
      difference between VIR_IS_STREAM and VIR_IS_CONNECTED_STREAM
      is moot; as in commit 6e130ddc, we know that reference
      counting means a valid stream will always be tied to a valid
      connection.  Similar to previous patches, use a common macro
      to make it nicer.
      
      * src/datatypes.h (virCheckStreamReturn, virCheckStreamGoto):
      New macros.
      (VIR_IS_STREAM, VIR_IS_CONNECTED_STREAM): Drop unused macros.
      * src/libvirt.c: Use macro throughout.
      (virLibStreamError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      101f176a
    • E
      maint: improve VIR_ERR_INVALID_SECRET usage · 916273eb
      Eric Blake 提交于
      While all errors related to invalid secrets appeared to be
      consistent, we might as well continue the trend of using a
      common macro.  Just as in commit 6e130ddc, the difference
      between VIR_IS_SECRET and VIR_IS_CONNECTED_SECRET is moot
      (due to reference counting, any valid secret must be tied to
      a valid domain).  For now, we don't need virCheckSecretGoto().
      
      * src/datatypes.h (virCheckSecretReturn): New macro.
      (VIR_IS_SECRET, VIR_IS_CONNECTED_SECRET): Drop unused macros.
      * src/libvirt.c: Use macro throughout.
      (virLibSecretError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      916273eb
    • E
      maint: improve VIR_ERR_INVALID_NODE_DEVICE usage · 9ec935d5
      Eric Blake 提交于
      While all errors related to invalid node device appeared to be
      consistent, we might as well continue the trend of using a
      common macro.  For now, we don't need virCheckNodeDeviceGoto().
      
      * src/datatypes.h (virCheckNodeDeviceReturn): New macro.
      (VIR_IS_NODE_DEVICE, VIR_IS_CONNECTED_NODE_DEVICE): Drop
      unused macros.
      * src/libvirt.c: Use macro throughout.
      (virLibNodeDeviceError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9ec935d5
  17. 09 1月, 2014 4 次提交
    • E
      maint: improve VIR_ERR_INVALID_STORAGE_VOL usage · 097c9b52
      Eric Blake 提交于
      For storage volume validation, we weren't consistent on
      whether to use VIR_FROM_NONE or VIR_FROM_STORAGE.  Similar
      to previous patches, use a common macro to make it nicer.
      Furthermore, just as in commit 6e130ddc, the difference
      between VIR_IS_STORAGE_VOL and VIR_IS_CONNECTED_STORAGE_VOL
      is moot (due to reference counting, any valid volume must
      be tied to a valid connection).
      
      virStorageVolCreateXMLFrom allows cross-connection cloning,
      where the error is reported against the connection of the
      destination pool.
      
      * src/datatypes.h (virCheckStorageVolReturn)
      (virCheckStorageVolGoto): New macros.
      (VIR_IS_STORAGE_VOL, VIR_IS_CONNECTED_STORAGE_VOL): Drop
      unused macros.
      * src/libvirt.c: Use macro throughout.
      (virLibStorageVolError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      097c9b52
    • E
      maint: improve VIR_ERR_INVALID_STORAGE_POOL usage · 8add79a9
      Eric Blake 提交于
      virStoragePoolBuild reported an invalid pool as if it were an
      invalid network.  Likewise, we weren't consistent on whether to
      use VIR_FROM_NONE or VIR_FROM_STORAGE.  Similar to previous
      patches, use a common macro to make it nicer.  Furthermore, just
      as in commit 6e130ddc, the difference between VIR_IS_STORAGE_POOL
      and VIR_IS_CONNECTED_STORAGE_POOL is moot (due to reference
      counting, any valid pool must be tied to a valid connection).
      For now, we don't need virCheckStoragePoolGoto().
      
      * src/datatypes.h (virCheckStoragePoolReturn): New macro.
      (VIR_IS_STORAGE_POOL, VIR_IS_CONNECTED_STORAGE_POOL): Drop
      unused macros.
      * src/libvirt.c: Use macro throughout.
      (virLibStoragePoolError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8add79a9
    • E
      maint: improve VIR_ERR_INVALID_INTERFACE usage · 459532b4
      Eric Blake 提交于
      When checking for a valid interface, we weren't consistent on
      whether we reported as VIR_FROM_NONE or VIR_FROM_INTERFACE.
      Similar to previous patches, use a common macro to make it nicer.
      Furthermore, just as in commit 6e130ddc, the difference between
      VIR_IS_INTERFACE and VIR_IS_CONNECTED_INTERFACE is moot (due to
      reference counting, any valid interface must be tied to a valid
      connection).  For now, we don't need virCheckInterfaceGoto().
      
      * src/datatypes.h (virCheckInterfaceReturn): New macro.
      (VIR_IS_INTERFACE, VIR_IS_CONNECTED_INTERFACE): Drop unused
      macros.
      * src/libvirt.c: Use macro throughout.
      (virLibInterfaceError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      459532b4
    • E
      maint: improve VIR_ERR_INVALID_NETWORK usage · e1761593
      Eric Blake 提交于
      When checking for a valid network, we weren't consistent on
      whether we reported an invalid network or a connection.  Similar
      to previous patches such as commit 6e130ddc, the difference
      between VIR_IS_NETWORK and VIR_IS_CONNECTED_NETWORK is moot (due
      to reference counting, any valid network must be tied to a valid
      connection).  Use a common macro to make the error reporting
      for invalid networks nicer.
      
      * src/datatypes.h (virCheckNetworkReturn, virCheckNetworkGoto): New
      macros.
      (VIR_IS_NETWORK, VIR_IS_CONNECTED_NETWORK): Drop unused macros.
      * src/libvirt.c: Use macro throughout.
      (virLibNetworkError): Drop unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e1761593
  18. 08 1月, 2014 2 次提交
    • E
      maint: inline VIR_IS*_DOMAIN macro · c2aa14b4
      Eric Blake 提交于
      Cleanup after a previous patch, commit 6e130ddc.  In particular,
      note that xenDomainUsedCpus can only be reached from
      xenUnifiedDomainGetXMLDesc, which in turn is only reached from
      public API that already validated the domain.
      
      * src/xen/xen_driver.c (xenDomainUsedCpus): Drop redundant check.
      * src/datatypes.h (VIR_IS_DOMAIN, VIR_IS_CONNECTED_DOMAIN):
      Delete, and inline into all callers, since no other file uses it
      any more.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c2aa14b4
    • E
      maint: improve VIR_ERR_INVALID_DOMAIN usage · 6e130ddc
      Eric Blake 提交于
      In datatype.c, virGetDomainSnapshot could result in the message:
      
      error: invalid domain pointer in bad domain
      
      Furthermore, while there are a few functions in libvirt.c that
      only care about a virDomainPtr without regards to the connection
      (such as virDomainGetName), most functions also require a valid
      connection.  Yet several functions were blindly dereferencing
      the conn member without checking it for validity first (such as
      virDomainOpenConsole).  Rather than try and correct all usage
      of VIR_IS_DOMAIN vs. VIR_IS_CONNECTED_DOMAIN, it is easier to
      just blindly require that a valid domain object always has a
      valid connection object (which should be true anyways, since
      every domain object holds a reference to its connection, so the
      connection will not be closed until all domain objects have
      also been closed to release their reference).
      
      After this patch, all places that validate a domain consistently
      report:
      
      error: invalid domain pointer in someFunc
      
      * src/datatypes.h (virCheckDomainReturn, virCheckDomainGoto): New
      macros.
      * src/datatypes.c (virGetDomainSnapshot): Use new macro.
      (virLibConnError): Delete unused macro.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6e130ddc
  19. 07 1月, 2014 2 次提交
    • E
      maint: inline VIR_IS_CONNECT macro · 968fe2c8
      Eric Blake 提交于
      Cleanup after commit db3dd082 removed all clients outside of
      the .h file.
      
      * src/datatypes.h (VIR_IS_CONNECT): Delete, and inline into all
      callers, since no other file uses it any more.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      968fe2c8
    • E
      maint: improve VIR_ERR_INVALID_CONN usage · db3dd082
      Eric Blake 提交于
      The datatype.c object checks could result in a message like:
      
      error: invalid connection pointer in no connection
      
      This consolidates all clients of this message to have uniform contents:
      
      error: invalid connection pointer in someFunc
      
      Note that virCheckConnectReturn raises an error immediately; in
      datatypes.c, where we don't need to raise the error (but instead
      just leave it in the thread-local setting), we use
      virCheckConnectGoto and the cleanup label instead.  Then, for
      consistency in that file, all subsequent error messages are
      touched to also use the cleanup error label.
      
      * src/datatypes.h (virCheckConnectReturn)
      (virCheckConnectGoto): New macros.
      * src/datatypes.c: Use new macro.
      * src/libvirt-qemu.c (virDomainQemuAttach): Likewise.
      (virLibConnError): Delete unused macro.
      * src/libvirt-lxc.c (virLibConnError): Likewise.
      * src/libvirt.c: Use new macro throughout.
      * docs/api_extension.html.in: Modernize documentation.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      db3dd082
  20. 03 1月, 2014 1 次提交
    • E
      maint: improve debug of libvirt-{qemu,lxc} apis · 13f83720
      Eric Blake 提交于
      I noticed that the virDomainQemuMonitorCommand debug output wasn't
      telling me the name of the domain it was working on.  While it was
      easy enough to determine which pointer matches the domain based on
      other log messages, it is nicer to be consistent.
      
      * src/util/viruuid.h (VIR_UUID_DEBUG): Moved here from...
      * src/libvirt.c (VIR_UUID_DEBUG): ...here.
      (VIR_ARG15, VIR_HAS_COMMA, VIR_DOMAIN_DEBUG_EXPAND)
      (VIR_DOMAIN_DEBUG_PASTE, VIR_DOMAIN_DEBUG_0, VIR_DOMAIN_DEBUG_1)
      (VIR_DOMAIN_DEBUG_2, VIR_DOMAIN_DEBUG): Move...
      * src/datatypes.h: ...here.
      * src/libvirt-qemu.c (virDomainQemuMonitorCommand)
      (virDomainQemuAgentCommand): Better debug messages.
      * src/libvirt-lxc.c (virDomainLxcOpenNamespace): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      13f83720
  21. 24 4月, 2013 1 次提交
  22. 05 4月, 2013 1 次提交
    • P
      rpc: Fix connection close callback race condition and memory corruption/crash · 8ad126e6
      Peter Krempa 提交于
      The last Viktor's effort to fix the race and memory corruption unfortunately
      wasn't complete in the case the close callback was not registered in an
      connection. At that time, the trail of event's that I'll describe later could
      still happen and corrupt the memory or cause a crash of the client (including
      the daemon in case of a p2p migration).
      
      Consider the following prerequisities and trail of events:
      Let's have a remote connection to a hypervisor that doesn't have a close
      callback registered and the client is using the event loop. The crash happens in
      cooperation of 2 threads. Thread E is the event loop and thread W is the worker
      that does some stuff. R denotes the remote client.
      
      1.) W - The client finishes everything and sheds the last reference on the client
      2.) W - The virObject stuff invokes virConnectDispose that invokes doRemoteClose
      3.) W - the remote close method invokes the REMOTE_PROC_CLOSE RPC method.
      4.) W - The thread is preempted at this point.
      5.) R - The remote side receives the close and closes the socket.
      6.) E - poll() wakes up due to the closed socket and invokes the close callback
      7.) E - The event loop is preempted right before remoteClientCloseFunc is called
      8.) W - The worker now finishes, and frees the conn object.
      9.) E - The remoteClientCloseFunc accesses the now-freed conn object in the
              attempt to retrieve pointer for the real close callback.
      10.) Kaboom, corrupted memory/segfault.
      
      This patch tries to fix this by introducing a new object that survives the
      freeing of the connection object. We can't increase the reference count on the
      connection object itself or the connection would never be closed, as the
      connection is closed only when the reference count reaches zero.
      
      The new object - virConnectCloseCallbackData - is a lockable object that keeps
      the pointers to the real user registered callback and ensures that the
      connection callback is either not called if the connection was already freed or
      that the connection isn't freed while this is being called.
      8ad126e6
  23. 21 12月, 2012 1 次提交
  24. 26 11月, 2012 1 次提交
    • A
      Add private data pointer to virStoragePool and virStorageVol · 2b121dbc
      Ata E Husain Bohra 提交于
      This will simplify the refactoring of the ESX storage driver to support
      a VMFS and an iSCSI backend.
      
      One of the tasks the storage driver needs to do is to decide which backend
      driver needs to be invoked for a given request. This approach extends
      virStoragePool and virStorageVol to store extra parameters:
      
      1. privateData: stores pointer to respective backend storage driver.
      2. privateDataFreeFunc: stores cleanup function pointer.
      
      virGetStoragePool and virGetStorageVol are modfied to accept these extra
      parameters as user params. virStoragePoolDispose and virStorageVolDispose
      checks for cleanup operation if available.
      
      The private data pointer allows the ESX storage driver to store a pointer
      to the used backend with each storage pool and volume. This avoids the need
      to detect the correct backend in each storage driver function call.
      2b121dbc
  25. 21 9月, 2012 1 次提交
  26. 07 8月, 2012 1 次提交
    • D
      Convert public datatypes to inherit from virObject · 46ec5f85
      Daniel P. Berrange 提交于
      This converts the following public API datatypes to use the
      virObject infrastructure:
      
        virConnectPtr
        virDomainPtr
        virDomainSnapshotPtr
        virInterfacePtr
        virNetworkPtr
        virNodeDevicePtr
        virNWFilterPtr
        virSecretPtr
        virStreamPtr
        virStorageVolPtr
        virStoragePoolPtr
      
      The code is significantly simplified, since the mutex in the
      virConnectPtr object now only needs to be held when accessing
      the per-connection virError object instance. All other operations
      are completely lock free.
      
      * src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
        public datatypes to use virObject
      * src/conf/domain_event.c, src/phyp/phyp_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
        src/qemu/qemu_process.c, src/storage/storage_driver.c,
        src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
        tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
        tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
        to use virObjectUnref/virObjectRef
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      46ec5f85
  27. 02 8月, 2012 1 次提交
    • O
      Fix indentions · 7ee395a8
      Osier Yang 提交于
      Some of the macros use tab, while the left use spaces, this patch
      change it to always use the spaces. And a few aligning fixes.
      7ee395a8
  28. 30 7月, 2012 2 次提交