The nova.virt.libvirt.storage.rbd_utils Module

class RADOSClient(driver, pool=None)

Bases: object

Context manager to simplify error handling for connecting to ceph.

features
class RBDDriver(pool, ceph_conf, rbd_user)

Bases: object

ceph_args()

List of command line parameters to be passed to ceph commands to reflect RBDDriver configuration such as RBD user name and location of ceph.conf.

cleanup_volumes(instance)
clone(image_location, dest_name, dest_pool=None)
create_snap(volume, name, pool=None, protect=False)

Create a snapshot of an RBD volume.

Volume:Name of RBD object
Name:Name of snapshot
Pool:Name of pool
Protect:Set the snapshot to “protected”
destroy_volume(volume, pool=None)

A one-shot version of cleanup_volumes()

exists(name, pool=None, snapshot=None)
flatten(volume, pool=None)

“Flattens” a snapshotted image with the parents’ data, effectively detaching it from the parent.

Volume:Name of RBD object
Pool:Name of pool
get_fsid()
get_mon_addrs()
get_pool_info()
import_image(base, name)

Import RBD volume from image file.

Uses the command line import instead of librbd since rbd import command detects zeroes to preserve sparseness in the image.

Base:Path to image file
Name:Name of RBD volume
is_cloneable(image_location, image_meta)
parent_info(volume, pool=None)

Returns the pool, image and snapshot name for the parent of an RBD volume.

Volume:Name of RBD object
Pool:Name of pool
parse_url(url)
remove_image(name)

Remove RBD volume

Name:Name of RBD volume
remove_snap(volume, name, ignore_errors=False, pool=None, force=False)

Removes a snapshot from an RBD volume.

Volume:Name of RBD object
Name:Name of snapshot
Ignore_errors:whether or not to log warnings on failures
Pool:Name of pool
Force:Remove snapshot even if it is protected
resize(name, size)

Resize RBD volume.

Name:Name of RBD object
Size:New size in bytes
rollback_to_snap(volume, name)

Revert an RBD volume to its contents at a snapshot.

Volume:Name of RBD object
Name:Name of snapshot
size(name)
class RBDVolumeProxy(driver, name, pool=None, snapshot=None, read_only=False)

Bases: object

Context manager for dealing with an existing rbd volume.

This handles connecting to rados and opening an ioctx automatically, and otherwise acts like a librbd Image object.

The underlying librados client and ioctx can be accessed as the attributes ‘client’ and ‘ioctx’.