cinder.ssh_utils module

cinder.ssh_utils module

Utilities related to SSH connection management.

class SSHPool(ip, port, conn_timeout, login, password=None, privatekey=None, *args, **kwargs)

Bases: Pool

A simple eventlet pool to hold ssh connections.

create()

Generate a new pool item. In order for the pool to function, either this method must be overriden in a subclass or the pool must be constructed with the create argument. It accepts no arguments and returns a single instance of whatever thing the pool is supposed to contain.

In general, create() is called whenever the pool exceeds its previous high-water mark of concurrently-checked-out-items. In other words, in a new pool with min_size of 0, the very first call to get() will result in a call to create(). If the first caller calls put() before some other caller calls get(), then the first item will be returned, and create() will not be called a second time.

get()

Return an item from the pool, when one is available.

This may cause the calling greenthread to block. Check if a connection is active before returning it.

For dead connections create and return a new connection.

put(conn)

Put an item back into the pool, when done. This may cause the putting greenthread to block.

remove(ssh)

Close an ssh client and remove it from free_items.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.