Configure the cluster handle using a Ceph config file.
:param path: path to the config file
- :type path: str
"""
self.require_state("configuring", "connected")
path_raw = cstr(path, 'path', opt=True)
Get the value of a configuration option
:param option: which option to read
- :type option: str
:returns: str - value of the option or None
:raises: :class:`TypeError`
Set the value of a configuration option
:param option: which option to set
- :type option: str
:param option: value of the option
- :type option: str
:raises: :class:`TypeError`, :class:`ObjectNotFound`
"""
absence of quorum.
:param mon_id: the ID portion of the monitor's name (i.e., mon.<ID>)
- :type mon_id: str
:returns: the string reply from the monitor
"""
Checks if a given pool exists.
:param pool_name: name of the pool to check
- :type pool_name: str
:raises: :class:`TypeError`, :class:`Error`
:returns: bool - whether the pool exists, false otherwise.
Returns a pool's ID based on its name.
:param pool_name: name of the pool to look up
- :type pool_name: str
:raises: :class:`TypeError`, :class:`Error`
:returns: int - pool ID, or None if it doesn't exist
Returns a pool's name based on its ID.
:param pool_id: ID of the pool to look up
- :type pool_id: int
:raises: :class:`TypeError`, :class:`Error`
:returns: string - pool name, or None if it doesn't exist
- with a specific CRUSH rule and auid: crush_rule and auid given
:param pool_name: name of the pool to create
- :type pool_name: str
:param crush_rule: rule to use for placement in the new pool
- :type crush_rule: int
:param auid: id of the owner of the new pool
- :type auid: int
:raises: :class:`TypeError`, :class:`Error`
"""
but the actual data is deleted in the background.
:param pool_name: name of the pool to delete
- :type pool_name: str
:raises: :class:`TypeError`, :class:`Error`
"""
List inconsistent placement groups in the given pool
:param pool_id: ID of the pool in which PGs are listed
- :type pool_id: int
:returns: list - inconsistent placement groups
"""
self.require_state("connected")
pool.
:param ioctx_name: name of the pool
- :type ioctx_name: str
:raises: :class:`TypeError`, :class:`Error`
:returns: Ioctx - Rados Ioctx object
pool.
:param pool_id: ID of the pool
- :type pool_id: int
:raises: :class:`TypeError`, :class:`Error`
:returns: Ioctx - Rados Ioctx object
Blocklist a client from the OSDs
:param client_address: client address
- :type client_address: str
:param expire_seconds: number of seconds to blocklist
- :type expire_seconds: int
:raises: :class:`Error`
"""
"""
Set flags for the last operation added to this write_op.
:para flags: flags to apply to the last operation
- :type flags: int
"""
cdef:
"""
Set an extended attribute on an object.
:param xattr_name: name of the xattr
- :type xattr_name: str
:param xattr_value: buffer to set xattr to
- :type xattr_value: bytes
"""
xattr_name_raw = cstr(xattr_name, 'xattr_name')
cdef:
"""
Removes an extended attribute on from an object.
:param xattr_name: name of the xattr to remove
- :type xattr_name: str
"""
xattr_name_raw = cstr(xattr_name, 'xattr_name')
cdef:
"""
Append data to an object synchronously
:param to_write: data to write
- :type to_write: bytes
"""
cdef:
"""
Write whole object, atomically replacing it.
:param to_write: data to write
- :type to_write: bytes
"""
cdef:
"""
Write to offset.
:param to_write: data to write
- :type to_write: bytes
:param offset: byte offset in the object to begin writing at
- :type offset: int
"""
cdef:
"""
Zero part of an object.
:param offset: byte offset in the object to begin writing at
- :type offset: int
:param offset: number of zero to write
- :type offset: int
"""
cdef:
"""
Truncate an object.
:param offset: byte offset in the object to begin truncating at
- :type offset: int
"""
cdef:
Execute an OSD class method on an object
:param cls: name of the object class
- :type cls: str
:param method: name of the method
- :type method: str
:param data: input data
- :type data: bytes
"""
cls_raw = cstr(cls, 'cls')
"""
Write the same buffer multiple times
:param to_write: data to write
- :type to_write: bytes
:param write_len: total number of bytes to write
- :type len: int
:param offset: byte offset in the object to begin writing at
- :type offset: int
"""
cdef:
char *_to_write = to_write
"""
Set flags for the last operation added to this read_op.
:para flags: flags to apply to the last operation
- :type flags: int
"""
cdef:
:param oncomplete: what to do when the write is safe and complete in memory
on all replicas
- :type oncomplete: completion
:param onsafe: what to do when the write is safe and complete on storage
on all replicas
- :type onsafe: completion
:raises: :class:`Error`
:returns: completion object
oncomplete(completion, size, mtime)
:param object_name: the name of the object to get stats from
- :type object_name: str
:param oncomplete: what to do when the stat is complete
- :type oncomplete: completion
:raises: :class:`Error`
:returns: completion object
Queues the write and returns.
:param object_name: name of the object
- :type object_name: str
:param to_write: data to write
- :type to_write: bytes
:param offset: byte offset in the object to begin writing at
- :type offset: int
:param oncomplete: what to do when the write is safe and complete in memory
on all replicas
- :type oncomplete: completion
:param onsafe: what to do when the write is safe and complete on storage
on all replicas
- :type onsafe: completion
:raises: :class:`Error`
:returns: completion object
Queues the write and returns.
:param object_name: name of the object
- :type object_name: str
:param to_write: data to write
- :type to_write: str
:param oncomplete: what to do when the write is safe and complete in memory
on all replicas
- :type oncomplete: completion
:param onsafe: what to do when the write is safe and complete on storage
on all replicas
- :type onsafe: completion
:raises: :class:`Error`
:returns: completion object
Asynchronously write the same buffer multiple times
:param object_name: name of the object
- :type object_name: str
:param to_write: data to write
- :type to_write: bytes
:param write_len: total number of bytes to write
- :type write_len: int
:param offset: byte offset in the object to begin writing at
- :type offset: int
:param oncomplete: what to do when the writesame is safe and
complete in memory on all replicas
- :type oncomplete: completion
:raises: :class:`Error`
:returns: completion object
"""
Queues the write and returns.
:param object_name: name of the object
- :type object_name: str
:param to_append: data to append
- :type to_append: str
:param offset: byte offset in the object to begin writing at
- :type offset: int
:param oncomplete: what to do when the write is safe and complete in memory
on all replicas
- :type oncomplete: completion
:param onsafe: what to do when the write is safe and complete on storage
on all replicas
- :type onsafe: completion
:raises: :class:`Error`
:returns: completion object
"""
Asynchronously compare an on-disk object range with a buffer
:param object_name: the name of the object
- :type object_name: str
:param cmp_buf: buffer containing bytes to be compared with object contents
- :type cmp_buf: bytes
:param offset: object byte offset at which to start the comparison
- :type offset: int
:param oncomplete: what to do when the write is safe and complete in memory
on all replicas
- :type oncomplete: completion
:raises: :class:`TypeError`
returns: 0 - on success, negative error code on failure,
oncomplete(completion, data_read)
:param object_name: name of the object to read from
- :type object_name: str
:param length: the number of bytes to read
- :type length: int
:param offset: byte offset in the object to begin reading from
- :type offset: int
:param oncomplete: what to do when the read is complete
- :type oncomplete: completion
:raises: :class:`Error`
:returns: completion object
onsafe(completion, data)
:param object_name: name of the object
- :type object_name: str
:param cls: name of the object class
- :type cls: str
:param method: name of the method
- :type method: str
:param data: input data
- :type data: bytes
:param length: size of output buffer in bytes (default=8192)
- :type length: int
:param oncomplete: what to do when the execution is complete
- :type oncomplete: completion
:param onsafe: what to do when the execution is safe and complete
- :type onsafe: completion
:raises: :class:`Error`
:returns: completion object
Asynchronously remove an object
:param object_name: name of the object to remove
- :type object_name: str
:param oncomplete: what to do when the remove is safe and complete in memory
on all replicas
- :type oncomplete: completion
:param onsafe: what to do when the remove is safe and complete on storage
on all replicas
- :type onsafe: completion
:raises: :class:`Error`
:returns: completion object
:param loc_key: the key to use as the object locator, or NULL to discard
any previously set key
- :type loc_key: str
:raises: :class:`TypeError`
"""
To stop to read from snapshot, use set_read(LIBRADOS_SNAP_HEAD)
:param snap_id: the snapshot Id
- :type snap_id: int
:raises: :class:`TypeError`
"""
will be placed in the same namespace.
:param nspace: the namespace to use, or None/"" for the default namespace
- :type nspace: str
:raises: :class:`TypeError`
"""
Write data to an object synchronously
:param key: name of the object
- :type key: str
:param data: data to write
- :type data: bytes
:param offset: byte offset in the object to begin writing at
- :type offset: int
:raises: :class:`TypeError`
:raises: :class:`LogicError`
it is atomically truncated and then written.
:param key: name of the object
- :type key: str
:param data: data to write
- :type data: bytes
:raises: :class:`TypeError`
:raises: :class:`Error`
"""
Write the same buffer multiple times
:param key: name of the object
- :type key: str
:param data: data to write
- :type data: bytes
:param write_len: total number of bytes to write
- :type write_len: int
:param offset: byte offset in the object to begin writing at
- :type offset: int
:raises: :class:`TypeError`
:raises: :class:`LogicError`
Append data to an object synchronously
:param key: name of the object
- :type key: str
:param data: data to write
- :type data: bytes
:raises: :class:`TypeError`
:raises: :class:`LogicError`
Read data from an object synchronously
:param key: name of the object
- :type key: str
:param length: the number of bytes to read (default=8192)
- :type length: int
:param offset: byte offset in the object to begin reading at
- :type offset: int
:raises: :class:`TypeError`
:raises: :class:`Error`
Execute an OSD class method on an object.
:param key: name of the object
- :type key: str
:param cls: name of the object class
- :type cls: str
:param method: name of the method
- :type method: str
:param data: input data
- :type data: bytes
:param length: size of output buffer in bytes (default=8192)
- :type length: int
:raises: :class:`TypeError`
:raises: :class:`Error`
This does not delete any snapshots of the object.
:param key: the name of the object to delete
- :type key: str
:raises: :class:`TypeError`
:raises: :class:`Error`
zeroes. If this shrinks the object, the excess data is removed.
:param key: the name of the object to resize
- :type key: str
:param size: the new size of the object in bytes
- :type size: int
:raises: :class:`TypeError`
:raises: :class:`Error`
'''
Compare an on-disk object range with a buffer
:param key: the name of the object
- :type key: str
:param cmp_buf: buffer containing bytes to be compared with object contents
- :type cmp_buf: bytes
:param offset: object byte offset at which to start the comparison
- :type offset: int
:raises: :class:`TypeError`
:raises: :class:`Error`
Get object stats (size/mtime)
:param key: the name of the object to get stats from
- :type key: str
:raises: :class:`TypeError`
:raises: :class:`Error`
Get the value of an extended attribute on an object.
:param key: the name of the object to get xattr from
- :type key: str
:param xattr_name: which extended attribute to read
- :type xattr_name: str
:raises: :class:`TypeError`
:raises: :class:`Error`
Start iterating over xattrs on an object.
:param oid: the name of the object to get xattrs from
- :type oid: str
:raises: :class:`TypeError`
:raises: :class:`Error`
Set an extended attribute on an object.
:param key: the name of the object to set xattr to
- :type key: str
:param xattr_name: which extended attribute to set
- :type xattr_name: str
:param xattr_value: the value of the extended attribute
- :type xattr_value: bytes
:raises: :class:`TypeError`
:raises: :class:`Error`
Removes an extended attribute on from an object.
:param key: the name of the object to remove xattr from
- :type key: str
:param xattr_name: which extended attribute to remove
- :type xattr_name: str
:raises: :class:`TypeError`
:raises: :class:`Error`
Send a rados notification to an object.
:param obj: the name of the object to notify
- :type obj: str
:param msg: optional message to send in the notification
- :type msg: str
:param timeout_ms: notify timeout (in ms)
- :type timeout_ms: int
:raises: :class:`TypeError`
:raises: :class:`Error`
Register an interest in an object.
:param obj: the name of the object to notify
- :type obj: str
:param callback: what to do when a notify is received on this object
- :type callback: callable
:param error_callback: what to do when the watch session encounters an error
- :type error_callback: callable
:param timeout: how many seconds the connection will keep after disconnection
- :type timeout: int
:raises: :class:`TypeError`
:raises: :class:`Error`
Create a pool-wide snapshot
:param snap_name: the name of the snapshot
- :type snap_name: str
:raises: :class:`TypeError`
:raises: :class:`Error`
Removes a pool-wide snapshot
:param snap_name: the name of the snapshot
- :type snap_name: str
:raises: :class:`TypeError`
:raises: :class:`Error`
Get the id of a pool snapshot
:param snap_name: the name of the snapshot to lookop
- :type snap_name: str
:raises: :class:`TypeError`
:raises: :class:`Error`
Rollback an object to a snapshot
:param oid: the name of the object
- :type oid: str
:param snap_name: the name of the snapshot
- :type snap_name: str
:raises: :class:`TypeError`
:raises: :class:`Error`
Removes a self-managed snapshot
:param snap_id: the name of the snapshot
- :type snap_id: int
:raises: :class:`TypeError`
:raises: :class:`Error`
if ret != 0:
raise make_ex(ret, "Failed to remove self-managed snapshot")
- def set_self_managed_snap_write(self, snaps):
+ def set_self_managed_snap_write(self, snaps: Sequence[Union[int, str]]):
"""
Updates the write context to the specified self-managed
snapshot ids.
:param snaps: all associated self-managed snapshot ids
- :type snaps: list
:raises: :class:`TypeError`
:raises: :class:`Error`
Rolls an specific object back to a self-managed snapshot revision
:param oid: the name of the object
- :type oid: str
:param snap_id: the name of the snapshot
- :type snap_id: int
:raises: :class:`TypeError`
:raises: :class:`Error`
"""
write_op.release()
- def release_read_op(self, read_op):
+ def release_read_op(self, read_op: ReadOp):
"""
release memory alloc by create_read_op
:para read_op: read_op object
- :type: int
"""
read_op.release()
"""
set keys values to write_op
:para write_op: write_operation object
- :type write_op: WriteOp
:para keys: a tuple of keys
- :type keys: tuple
:para values: a tuple of values
- :type values: tuple
"""
if len(keys) != len(values):
"""
execute the real write operation
:para write_op: write operation object
- :type write_op: WriteOp
:para oid: object name
- :type oid: str
:para mtime: the time to set the mtime to, 0 for the current time
- :type mtime: int
:para flags: flags to apply to the entire operation
- :type flags: int
"""
oid_raw = cstr(oid, 'oid')
"""
execute the real write operation asynchronously
:para write_op: write operation object
- :type write_op: WriteOp
:para oid: object name
- :type oid: str
:param oncomplete: what to do when the remove is safe and complete in memory
on all replicas
- :type oncomplete: completion
:param onsafe: what to do when the remove is safe and complete on storage
on all replicas
- :type onsafe: completion
:para mtime: the time to set the mtime to, 0 for the current time
- :type mtime: int
:para flags: flags to apply to the entire operation
- :type flags: int
:raises: :class:`Error`
:returns: completion object
"""
execute the real read operation
:para read_op: read operation object
- :type read_op: ReadOp
:para oid: object name
- :type oid: str
:para flag: flags to apply to the entire operation
- :type flag: int
"""
oid_raw = cstr(oid, 'oid')
cdef:
"""
execute the real read operation
:para read_op: read operation object
- :type read_op: ReadOp
:para oid: object name
- :type oid: str
:param oncomplete: what to do when the remove is safe and complete in memory
on all replicas
- :type oncomplete: completion
:param onsafe: what to do when the remove is safe and complete on storage
on all replicas
- :type onsafe: completion
:para flag: flags to apply to the entire operation
- :type flag: int
"""
oid_raw = cstr(oid, 'oid')
cdef:
"""
get the omap values
:para read_op: read operation object
- :type read_op: ReadOp
:para start_after: list keys starting after start_after
- :type start_after: str
:para filter_prefix: list only keys beginning with filter_prefix
- :type filter_prefix: str
:para max_return: list no more than max_return key/value pairs
- :type max_return: int
:returns: an iterator over the requested omap values, return value from this action
"""
"""
get the omap keys
:para read_op: read operation object
- :type read_op: ReadOp
:para start_after: list keys starting after start_after
- :type start_after: str
:para max_return: list no more than max_return key/value pairs
- :type max_return: int
:returns: an iterator over the requested omap values, return value from this action
"""
start_after = cstr(start_after, 'start_after') if start_after else None
"""
get the omap values by keys
:para read_op: read operation object
- :type read_op: ReadOp
:para keys: input key tuple
- :type keys: tuple
:returns: an iterator over the requested omap values, return value from this action
"""
keys = cstr_list(keys, 'keys')
"""
remove omap keys specifiled
:para write_op: write operation object
- :type write_op: WriteOp
:para keys: input key tuple
- :type keys: tuple
"""
keys = cstr_list(keys, 'keys')
"""
Remove all key/value pairs from an object
:para write_op: write operation object
- :type write_op: WriteOp
"""
cdef:
Take an exclusive lock on an object
:param key: name of the object
- :type key: str
:param name: name of the lock
- :type name: str
:param cookie: cookie of the lock
- :type cookie: str
:param desc: description of the lock
- :type desc: str
:param duration: duration of the lock in seconds
- :type duration: int
:param flags: flags
- :type flags: int
:raises: :class:`TypeError`
:raises: :class:`Error`
Take a shared lock on an object
:param key: name of the object
- :type key: str
:param name: name of the lock
- :type name: str
:param cookie: cookie of the lock
- :type cookie: str
:param tag: tag of the lock
- :type tag: str
:param desc: description of the lock
- :type desc: str
:param duration: duration of the lock in seconds
- :type duration: int
:param flags: flags
- :type flags: int
:raises: :class:`TypeError`
:raises: :class:`Error`
Release a shared or exclusive lock on an object
:param key: name of the object
- :type key: str
:param name: name of the lock
- :type name: str
:param cookie: cookie of the lock
- :type cookie: str
:raises: :class:`TypeError`
:raises: :class:`Error`