Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
r™EYc@s¤dZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZddlmZddlZddlZdZdZdZdZd	ZdZd
efd„ƒYZdefd
„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZ defd„ƒYZ!defd„ƒYZ"defd„ƒYZ#d efd!„ƒYZ$d"efd#„ƒYZ%d$efd%„ƒYZ&d&efd'„ƒYZ'd(efd)„ƒYZ(d*„Z)d+e
fd,„ƒYZ*d-e
fd.„ƒYZ+d/„Z,d0e-fd1„ƒYZ.d2e-fd3„ƒYZ/d4e-fd5„ƒYZ0d6e-fd7„ƒYZ1dS(8s@
This module is a thin wrapper around librbd.

It currently provides all the synchronous methods of librbd that do
not use callbacks.

Error codes from librbd are turned into exceptions that subclass
:class:`Error`. Almost all methods may raise :class:`Error`
(the base class of all rbd exceptions), :class:`PermissionError`
and :class:`IOError`, in addition to those documented for the
method.

A number of methods have string arguments, which must not be unicode
to interact correctly with librbd. If unicode is passed to these
methods, a :class:`TypeError` will be raised.
iÿÿÿÿ(
tCDLLtc_chartc_char_ptc_size_ttc_void_ptc_inttcreate_string_buffertbyreft	Structuretc_uint64tc_int64tc_uint8t	CFUNCTYPE(tfind_libraryNlÿÿÿÿiiiitErrorcBseZRS((t__name__t
__module__(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR"stPermissionErrorcBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR%st
ImageNotFoundcBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR(stImageExistscBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR+stIOErrorcBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR.stNoSpacecBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR1stIncompleteWriteErrorcBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR4stInvalidArgumentcBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR7st
LogicErrorcBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR:st
ReadOnlyImagecBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR=st	ImageBusycBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR@stImageHasSnapshotscBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRCstFunctionNotSupportedcBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRFstArgumentOutOfRangecBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRIstConnectionShutdowncBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRLstTimeoutcBseZRS((RR(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyROscCsÄi
ttj6ttj6ttj6ttj6t	tj
6ttj6t
tj6ttj6ttj6ttj6ttj6ttj6ttj6}t|ƒ}||kr®|||ƒSt|d|ƒSdS(sÖ
    Translate a librbd return code into an exception.

    :param ret: the return code
    :type ret: int
    :param msg: the error message to use
    :type msg: str
    :returns: a subclass of :class:`Error`
    s: error code %dN(RterrnotEPERMRtENOENTRtEIORtENOSPCRtEEXISTRtEINVALRtEROFSRtEBUSYRt	ENOTEMPTYRtENOSYSRtEDOMRt	ESHUTDOWNRt	ETIMEDOUTtabsR(trettmsgterrors((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytmake_exRs$













trbd_image_info_tc	BsUeZdefdefdefdefdedfdefdedfgZRS(	tsizetobj_sizetnum_objstordertblock_name_prefixitparent_pooltparent_namei`(RRR	RRR
t_fields_(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR3qs				
	trbd_snap_info_tcBs)eZdefdefdefgZRS(tidR4tname(RRR	RR;(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR<zs		cCsTtdƒ}|rt|ƒSytdƒSWn#tk
rO}td|ƒ‚nXdS(s)
    Load the librbd shared library.
    trbdslibrbd.so.1sUnable to load librbd: %sN(R
RtOSErrortEnvironmentError(tlibrbd_pathte((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytload_librbds
tRBDcBsbeZdZd„Zd„Zd	edddd„Zdd	d„Zd„Z	d„Z
d„ZRS(
s1
    This class wraps librbd CRUD functions.
    cCstƒ|_dS(N(RDtlibrbd(tself((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt__init__’scCsbtdƒ}tdƒ}tdƒ}|jjt|ƒt|ƒt|ƒƒ|j|j|jfS(s°
        Get the version number of the ``librbd`` C library.

        :returns: a tuple of ``(major, minor, extra)`` components of the
                  librbd version
        i(RRFtrbd_versionRtvalue(RGtmajortminortextra((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytversion•s
(ic	CsÁ|d	krd}nt|tƒs3tdƒ‚n|r¥|dks]|dks]|dkrltdƒ‚n|jj|jt|ƒt	|ƒt
t|ƒƒƒ}	nút|jdƒsÆt
dƒ‚nt|jdƒ}
|dksð|dkr|
rt
dƒ‚n|
r`|jj|jt|ƒt	|ƒt	|ƒt
t|ƒƒt	|ƒt	|ƒƒ}	n?|jj|jt|ƒt	|ƒt	|ƒt
t|ƒƒƒ}	|	dkr½t|	dƒ‚nd	S(
s1
        Create an rbd image.

        :param ioctx: the context in which to create the image
        :type ioctx: :class:`rados.Ioctx`
        :param name: what the image is called
        :type name: str
        :param size: how big the image is in bytes
        :type size: int
        :param order: the image is split into (2**order) byte objects
        :type order: int
        :param old_format: whether to create an old-style image that
                           is accessible by old clients, but can't
                           use more advanced features like layering.
        :type old_format: bool
        :param features: bitmask of features to enable
        :type features: int
        :param stripe_unit: stripe unit in bytes (default 0 for object size)
        :type stripe_unit: int
        :param stripe_count: objects to stripe over before looping
        :type stripe_count: int
        :raises: :class:`ImageExists`
        :raises: :class:`TypeError`
        :raises: :class:`InvalidArgument`
        :raises: :class:`FunctionNotSupported`
        isname must be a stringsDformat 1 images do not support feature masks or non-default stripingtrbd_create2s<installed version of librbd does not support format 2 imagestrbd_create3sAinstalled version of librbd does not support stripe unit or countserror creating imageN(tNonet
isinstancetstrt	TypeErrorRRFt
rbd_createtioRR	RRthasattrRRPROR2(RGtioctxR>R4R7t
old_formattfeatureststripe_unittstripe_countR/thas_create3((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytcreate¢s8	$						c	CsÒ|dkrd}nt|tƒs5t|tƒrDtdƒ‚nt|tƒsbtdƒ‚n|jj|jt|ƒt|ƒ|jt|ƒt|ƒt	t
|ƒƒƒ}|dkrÎt|dƒ‚ndS(s¬
        Clone a parent rbd snapshot into a COW sparse child.

        :param p_ioctx: the parent context that represents the parent snap
        :type ioctx: :class:`rados.Ioctx`
        :param p_name: the parent image name
        :type name: str
        :param p_snapname: the parent image snapshot name
        :type name: str
        :param c_ioctx: the child context that represents the new clone
        :type ioctx: :class:`rados.Ioctx`
        :param c_name: the clone (child) name
        :type name: str
        :param features: bitmask of features to enable; if set, must include layering
        :type features: int
        :param order: the image is split into (2**order) byte objects
        :type order: int
        :raises: :class:`TypeError`
        :raises: :class:`InvalidArgument`
        :raises: :class:`ImageExists`
        :raises: :class:`FunctionNotSupported`
        :raises: :class:`ArgumentOutOfRange`
        is(parent name and snapname must be stringsschild name must be a stringserror creating cloneN(RQRRRSRTRFt	rbd_cloneRVRR	RRR2(	RGtp_ioctxtp_namet
p_snapnametc_ioctxtc_nameRZR7R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytcloneàs	 		cCstdƒ}xrtr€t|jƒ}|jj|jt|ƒt|ƒƒ}|dkr[Pq|tj	krt
|dƒ‚qqWtd„|jj
dƒƒS(s¸
        List image names.

        :param ioctx: determines which RADOS pool is read
        :type ioctx: :class:`rados.Ioctx`
        :returns: list -- a list of image names
        iiserror listing imagescSs
|dkS(Nt((R>((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt<lambda>st(RtTrueRRJRFtrbd_listRVRR tERANGER2tfiltertrawtsplit(RGRXR4tc_namesR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytlists	'cCs^t|tƒstdƒ‚n|jj|jt|ƒƒ}|dkrZt|dƒ‚ndS(så
        Delete an RBD image. This may take a long time, since it does
        not return until every object that comprises the image has
        been deleted. Note that all snapshots must be deleted before
        the image can be removed. If there are snapshots left,
        :class:`ImageHasSnapshots` is raised. If the image is still
        open, or the watch from a crashed client has not expired,
        :class:`ImageBusy` is raised.

        :param ioctx: determines which RADOS pool the image is in
        :type ioctx: :class:`rados.Ioctx`
        :param name: the name of the image to remove
        :type name: str
        :raises: :class:`ImageNotFound`, :class:`ImageBusy`,
                 :class:`ImageHasSnapshots`
        sname must be a stringiserror removing imageN(RRRSRTRFt
rbd_removeRVRR2(RGRXR>R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytremoves
cCsxt|tƒs t|tƒr/tdƒ‚n|jj|jt|ƒt|ƒƒ}|dkrtt|dƒ‚ndS(sa
        Rename an RBD image.

        :param ioctx: determines which RADOS pool the image is in
        :type ioctx: :class:`rados.Ioctx`
        :param src: the current name of the image
        :type src: str
        :param dest: the new name of the image
        :type dest: str
        :raises: :class:`ImageNotFound`, :class:`ImageExists`
        ssrc and dest must be stringsiserror renaming imageN(RRRSRTRFt
rbd_renameRVRR2(RGRXtsrctdestR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytrename1s
 'N(RRt__doc__RHRNRQRiR^ReRpRrRv(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyREŽs		
>'		tImagecBsyeZdZd)ed„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd„Zd	„Z
d
„Zd„Zd„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Zd„Zdd„Zd„Z d„Z!d„Z"d „Z#d!„Z$d"„Z%d#„Z&d$„Z'd%„Z(d&„Z)d'„Z*d(„Z+RS(*sá
    This class represents an RBD image. It is used to perform I/O on
    the image and interact with snapshots.

    **Note**: Any method of this class may raise :class:`ImageNotFound`
    if the image has been deleted.
    cCs8t|_tƒ|_tƒ|_||_t|tƒsHt	dƒ‚n|dk	rst|tƒrst	dƒ‚n|rÐt|jdƒsštdƒ‚n|jj
|jt|ƒt|jƒt|ƒƒ}n3|jj|jt|ƒt|jƒt|ƒƒ}|dkr+t|d||fƒ‚nt|_dS(s›
        Open the image at the given snapshot.
        If a snapshot is specified, the image will be read-only, unless
        :func:`Image.set_snap` is called later.

        If read-only mode is used, metadata for the :class:`Image`
        object (such as which snapshots exist) may become obsolete. See
        the C api for more details.

        To clean up from opening the image, :func:`Image.close` should
        be called.  For ease of use, this is done automatically when
        an :class:`Image` is used as a context manager (see :pep:`343`).

        :param ioctx: determines which RADOS pool the image is in
        :type ioctx: :class:`rados.Ioctx`
        :param name: the name of the image
        :type name: str
        :param snapshot: which snapshot to read from
        :type snaphshot: str
        :param read_only: whether to open the image in read-only mode
        :type read_only: bool
        sname must be a strings!snapshot must be a string or Nonetrbd_open_read_onlysCinstalled version of librbd does not support open in read-only modeis%error opening image %s at snapshot %sN(RitclosedRDRFRtimageR>RRRSRTRQRWRRyRVRRtrbd_openR2tFalse(RGRXR>tsnapshott	read_onlyR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRHLs&		cCs|S(N((RG((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt	__enter__yscCs|jƒtS(s5
        Closes the image. See :func:`close`
        (tcloseR}(RGttype_RJt	traceback((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt__exit__|s
cCs,|js(t|_|jj|jƒndS(s
        Release the resources used by this image object.

        After this is called, this object should not be used.
        N(RzRiRFt	rbd_closeR{(RG((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRƒs		cCs|jƒdS(N(R(RG((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt__del__scCsdtj|jƒd}|S(Ns
rbd.Image(t)(tdictt__repr__t__dict__(RGts((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt__str__scCsJ|jj|jt|ƒƒ}|dkrFt|d|jfƒ‚ndS(sw
        Change the size of the image.

        :param size: the new size of the image
        :type size: int
        iserror resizing image %sN(RFt
rbd_resizeR{R	R2R>(RGR4R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytresize”scCs¥tƒ}|jj|jt|ƒtj|ƒƒ}|dkr[t|d|jfƒ‚ni|j	d6|j
d6|jd6|jd6|j
d6|jd6|jd	6S(
sÞ
        Get information about the image. Currently parent pool and
        parent name are always -1 and ''.

        :returns: dict - contains the following keys:

            * ``size`` (int) - the size of the image in bytes

            * ``obj_size`` (int) - the size of each object that comprises the
              image

            * ``num_objs`` (int) - the number of objects in the image

            * ``order`` (int) - log_2(object_size)

            * ``block_name_prefix`` (str) - the prefix of the RADOS objects used
              to store the image

            * ``parent_pool`` (int) - deprecated

            * ``parent_name``  (str) - deprecated

            See also :meth:`format` and :meth:`features`.

        iserror getting info for image %sR4R5R6R7R8R9R:(R3RFtrbd_statR{RtctypestsizeofR2R>R4R5R6R7R8R9R:(RGtinfoR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytstatŸs	*





c
Csýtj}d}x¬|tjkr¾|dkr¾t|ƒ}t|ƒ}t|ƒ}|jj|jt|ƒt|ƒt|ƒt|ƒt|ƒt|ƒƒ}|tjkr|d9}qqW|dkrçt|d|j	fƒ‚n|j
|j
|j
fS(s

        Get information about a cloned image's parent (if any)

        :returns: tuple - ``(pool name, image name, snapshot name)`` components
                  of the parent image
        :raises: :class:`ImageNotFound` if the image doesn't have a parent
        iiiis&error getting parent info for image %s(R RkRRFtrbd_get_parent_infoR{RRR2R>RJ(RGR/R4tpoolR>tsnapname((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytparent_infoÇs"
				cCsYtƒ}|jj|jt|ƒƒ}|dkrLt|d|jƒ‚n|jdkS(s‰
        Find out whether the image uses the old RBD format.

        :returns: bool - whether the image uses the old RBD format
        is"error getting old_format for image(RRFtrbd_get_old_formatR{RR2R>RJ(RGtoldR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRYâs
	cCsStƒ}|jj|jt|ƒƒ}|dkrLt|d|jƒ‚n|jS(s 
        Get the size of the image. If open to a snapshot, returns the
        size of that snapshot.

        :returns: the size of the image in bytes
        iserror getting size for image(R	RFtrbd_get_sizeR{RR2R>RJ(RGt
image_sizeR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR4îs
	cCsStƒ}|jj|jt|ƒƒ}|dkrLt|d|jƒ‚n|jS(st
        Gets the features bitmask of the image.

        :returns: int - the features bitmask of the image
        is error getting features for image(R	RFtrbd_get_featuresR{RR2R>RJ(RGRZR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRZûs
	cCsStƒ}|jj|jt|ƒƒ}|dkrLt|d|jƒ‚n|jS(s=
        Gets the number of overlapping bytes between the image and its parent
        image. If open to a snapshot, returns the overlap between the snapshot
        and the parent image.

        :returns: int - the overlap in bytes
        :raises: :class:`ImageNotFound` if the image doesn't have a parent
        iserror getting overlap for image(R	RFtrbd_get_overlapR{RR2R>RJ(RGtoverlapR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRžs
		cCsStƒ}|jj|jt|ƒƒ}|dkrLt|d|jƒ‚n|jS(sn
        Gets the flags bitmask of the image.

        :returns: int - the flags bitmask of the image
        iserror getting flags for image(R	RFt
rbd_get_flagsR{RR2R>RJ(RGtflagsR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR s
	cCsYtƒ}|jj|jt|ƒƒ}|dkrLt|d|jƒ‚n|jdkS(s€
        Gets the status of the image exclusive lock.

        :returns: bool - true if the image is exclusively locked
        is#error getting lock status for imagei(RRFtrbd_is_exclusive_lock_ownerR{RR2R>RJ(RGtownerR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytis_exclusive_lock_owner"s
	cCsqt|tƒstdƒ‚n|jj|j|jt|ƒƒ}|dkrmt|d|j	|fƒ‚ndS(s
        Copy the image to another location.

        :param dest_ioctx: determines which pool to copy into
        :type dest_ioctx: :class:`rados.Ioctx`
        :param dest_name: the name of the copy
        :type dest_name: str
        :raises: :class:`ImageExists`
        sdest_name must be a stringiserror copying image %s to %sN(
RRRSRTRFtrbd_copyR{RVRR2R>(RGt
dest_ioctxt	dest_nameR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytcopy.s

$cCs
t|ƒS(sb
        Iterate over the snapshots of an image.

        :returns: :class:`SnapIterator`
        (tSnapIterator(RG((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt
list_snaps>scCskt|tƒstdƒ‚n|jj|jt|ƒƒ}|dkrgt|d||jfƒ‚ndS(sž
        Create a snapshot of the image.

        :param name: the name of the snapshot
        :type name: str
        :raises: :class:`ImageExists`
        sname must be a stringis"error creating snapshot %s from %sN(	RRRSRTRFtrbd_snap_createR{RR2R>(RGR>R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytcreate_snapFs
cCskt|tƒstdƒ‚n|jj|jt|ƒƒ}|dkrgt|d||jfƒ‚ndS(s®
        Delete a snapshot of the image.

        :param name: the name of the snapshot
        :type name: str
        :raises: :class:`IOError`, :class:`ImageBusy`
        sname must be a stringis"error removing snapshot %s from %sN(	RRRSRTRFtrbd_snap_removeR{RR2R>(RGR>R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytremove_snapTs
cCskt|tƒstdƒ‚n|jj|jt|ƒƒ}|dkrgt|d|j|fƒ‚ndS(s
        Revert the image to its contents at a snapshot. This is a
        potentially expensive operation, since it rolls back each
        object individually.

        :param name: the snapshot to rollback to
        :type name: str
        :raises: :class:`IOError`
        sname must be a stringis*error rolling back image %s to snapshot %sN(	RRRSRTRFtrbd_snap_rollbackR{RR2R>(RGR>R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytrollback_to_snapbs

cCskt|tƒstdƒ‚n|jj|jt|ƒƒ}|dkrgt|d|j|fƒ‚ndS(sï
        Mark a snapshot as protected. This means it can't be deleted
        until it is unprotected.

        :param name: the snapshot to protect
        :type name: str
        :raises: :class:`IOError`, :class:`ImageNotFound`
        sname must be a stringiserror protecting snapshot %s@%sN(	RRRSRTRFtrbd_snap_protectR{RR2R>(RGR>R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytprotect_snaprs
	cCskt|tƒstdƒ‚n|jj|jt|ƒƒ}|dkrgt|d|j|fƒ‚ndS(sê
        Mark a snapshot unprotected. This allows it to be deleted if
        it was protected.

        :param name: the snapshot to unprotect
        :type name: str
        :raises: :class:`IOError`, :class:`ImageNotFound`
        sname must be a stringis!error unprotecting snapshot %s@%sN(	RRRSRTRFtrbd_snap_unprotectR{RR2R>(RGR>R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytunprotect_snaps
	cCs†t|tƒstdƒ‚ntƒ}|jj|jt|ƒt|ƒƒ}|dkryt	|d|j
|fƒ‚n|jdkS(s
        Find out whether a snapshot is protected from deletion.

        :param name: the snapshot to check
        :type name: str
        :returns: bool - whether the snapshot is protected
        :raises: :class:`IOError`, :class:`ImageNotFound`
        sname must be a stringis-error checking if snapshot %s@%s is protectedi(RRRSRTRRFtrbd_snap_is_protectedR{RRR2R>RJ(RGR>tis_protectedR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytis_protected_snaps		cCsx|dk	r+t|tƒr+tdƒ‚n|jj|jt|ƒƒ}|dkrtt|d|j	|fƒ‚ndS(sG
        Set the snapshot to read from. Writes will raise ReadOnlyImage
        while a snapshot is set. Pass None to unset the snapshot
        (reads come from the current image) , and allow writing again.

        :param name: the snapshot to read from, or None to unset the snapshot
        :type name: str or None
        sname must be a stringis%error setting image %s to snapshot %sN(
RQRRRSRTRFtrbd_snap_setR{RR2R>(RGR>R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytset_snap¢s
	icCsÂt|ƒ}|dkrK|jj|jt|ƒt|ƒt|ƒƒ}n9|jj|jt|ƒt|ƒt|ƒt|ƒƒ}|dkr²t	|d|j||fƒ‚nt
j||ƒS(sÐ
        Read data from the image. Raises :class:`InvalidArgument` if
        part of the range specified is outside the image.

        :param offset: the offset to start reading at
        :type offset: int
        :param length: how many bytes to read
        :type length: int
	:param fadvise_flags: fadvise flags for this read
	:type fadvise_flags: int
        :returns: str - the data read
        :raises: :class:`InvalidArgument`, :class:`IOError`
        iserror reading %s %ld~%ld(RRFtrbd_readR{R	RRt	rbd_read2RR2Rt	string_at(RGtoffsettlengtht
fadvise_flagstret_bufR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytread±s!"c
	CsÆ|dk	r+t|tƒr+tdƒ‚nttttttƒ}t	|ƒ}||j
ƒ}|jj|j
t|ƒt|ƒt|ƒ|tdƒƒ}|dkrÂd|}	t||	ƒ‚ndS(s
        Iterate over the changed extents of an image.

        This will call iterate_cb with three arguments:

        (offset, length, exists)

        where the changed extent starts at offset bytes, continues for
        length bytes, and is full of data (if exists is True) or zeroes
        (if exists is False).

        If from_snapshot is None, it is interpreted as the beginning
        of time and this generates all allocated extents.

        The end version is whatever is currently selected (via set_snap)
        for the image.

        Raises :class:`InvalidArgument` if from_snapshot is after
        the currently set snapshot.

        Raises :class:`ImageNotFound` if from_snapshot is not the name
        of a snapshot of the image.

        :param offset: start offset in bytes
        :type offset: int
        :param length: size of region to report on, in bytes
        :type length: int
        :param from_snapshot: starting snapshot name, or None
        :type from_snapshot: str or None
        :param iterate_cb: function to call for each extent
        :type iterate_cb: function acception arguments for offset,
                           length, and exists
        :raises: :class:`InvalidArgument`, :class:`IOError`,
                 :class:`ImageNotFound`
        sclient must be a stringis&error generating diff from snapshot %sN(RQRRRSRTRRR	RRt
DiffIterateCBtcallbackRFtrbd_diff_iterateR{RR2(
RGR¼R½t
from_snapshott
iterate_cbtRBD_DIFF_CBt	cb_holdertcbR/R0((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytdiff_iterateÊs$			
cCst|tƒstdƒ‚nt|ƒ}|dkri|jj|jt|ƒt|ƒt	|ƒƒ}n9|jj
|jt|ƒt|ƒt	|ƒt|ƒƒ}||kr²|S|dkrÚt|d|j
fƒ‚nA||krÿtd||fƒ‚ntd|j
||fƒ‚dS(s
        Write data to the image. Raises :class:`InvalidArgument` if
        part of the write would fall outside the image.

        :param data: the data to be written
        :type data: str
        :param offset: where to start writing data
        :type offset: int
	:param fadvise_flags: fadvise flags for this write
	:type fadvise_flags: int
        :returns: int - the number of bytes written
        :raises: :class:`IncompleteWriteError`, :class:`LogicError`,
                 :class:`InvalidArgument`, :class:`IOError`
        sdata must be a stringiserror writing to %ssWrote only %ld out of %ld bytesselogic error: rbd_write(%s) returned %d, but %d was the maximum number of bytes it could have written.N(RRRSRTtlenRFt	rbd_writeR{R	RRt
rbd_write2RR2R>RR(RGtdataR¼R¾R½R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytwriteþs !cCsY|jj|jt|ƒt|ƒƒ}|dkrUd||f}t||ƒ‚ndS(sa
        Trim the range from the image. It will be logically filled
        with zeroes.
        iserror discarding region %d~%dN(RFtrbd_discardR{R	R2(RGR¼R½R/R0((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytdiscard"s	cCs7|jj|jƒ}|dkr3t|dƒ‚ndS(sQ
        Block until all writes are fully flushed if caching is enabled.
        iserror flushing imageN(RFt	rbd_flushR{R2(RGR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytflush.scCs7|jj|jƒ}|dkr3t|dƒ‚ndS(s5
        Drop any cached data for the image.
        iserror invalidating cacheN(RFtrbd_invalidate_cacheR{R2(RGR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytinvalidate_cache6scCsStƒ}|jj|jt|ƒƒ}|dkrLt|d|jƒ‚n|jS(s=
        Returns the stripe unit used for the image.
        is#error getting stripe unit for image(R	RFtrbd_get_stripe_unitR{RR2R>RJ(RGR[R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR[>s
	cCsStƒ}|jj|jt|ƒƒ}|dkrLt|d|jƒ‚n|jS(s>
        Returns the stripe count used for the image.
        is$error getting stripe count for image(R	RFtrbd_get_stripe_countR{RR2R>RJ(RGR\R/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR\Hs
	cCs>|jj|jƒ}|dkr:t|d|jƒ‚ndS(sL
        Flatten clone image (copy all blocks from parent to child)
        iserror flattening %sN(RFtrbd_flattenR{R2R>(RGR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytflattenRscCstdƒ}tdƒ}x“tr­t|jƒ}t|jƒ}|jj|jt|ƒt|ƒt|ƒt|ƒƒ}|dkrˆPq|tj	krt
|dƒ‚qqW|dkr¾gS|j|jd jdƒ}|j|jd jdƒ}t
||ƒS(s–
        List children of the currently set snapshot (set via set_snap()).

        :returns: list - a list of (pool name, image name) tuples
        iiserror listing imagesiRh(RRiRRJRFtrbd_list_childrenR{RR RkR2RmRntzip(RGt
pools_sizetimages_sizetc_poolstc_imagesR/tpoolstimages((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt
list_childrenZs&				cCsµtdƒ}tdƒ}tdƒ}tdƒ}tdƒ}xÞtrt|jƒ}t|jƒ}t|jƒ}t|jƒ}	|jj|jt|ƒt|	ƒt|ƒt|ƒt|ƒt|ƒt|ƒt|ƒt|ƒƒ
}
|
dkr÷Pq?|
t	j
kr?t|
dƒ‚q?q?W|
dkr-gS|j|jd j
dƒ}|j|jd j
dƒ}|j|jd j
dƒ}
i|	jd6|jdkd6t|||
ƒd6S(	sñ
        List clients that have locked the image and information
        about the lock.

        :returns: dict - contains the following keys:

                  * ``tag`` - the tag associated with the lock (every
                    additional locker must use the same tag)
                  * ``exclusive`` - boolean indicating whether the
                     lock is exclusive or shared
                  * ``lockers`` - a list of (client, cookie, address)
                    tuples
        iiserror listing imagesiRhttagt	exclusivetlockers(RRRiRRJRFtrbd_list_lockersR{RR RkR2RmRnRÚ(RGtclients_sizetcookies_sizet
addrs_sizettag_sizeRãt	c_clientst	c_cookiestc_addrstc_tagR/tclientstcookiestaddrs((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytlist_lockerstsB									
cCs^t|tƒstdƒ‚n|jj|jt|ƒƒ}|dkrZt|dƒ‚ndS(sÓ
        Take an exclusive lock on the image.

        :raises: :class:`ImageBusy` if a different client or cookie locked it
                 :class:`ImageExists` if the same client and cookie locked it
        scookie must be a stringis'error acquiring exclusive lock on imageN(RRRSRTRFtrbd_lock_exclusiveR{RR2(RGtcookieR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytlock_exclusive¦s
cCs…t|tƒstdƒ‚nt|tƒs<tdƒ‚n|jj|jt|ƒt|ƒƒ}|dkrt|dƒ‚ndS(s
        Take a shared lock on the image. The tag must match
        that of the existing lockers, if any.

        :raises: :class:`ImageBusy` if a different client or cookie locked it
                 :class:`ImageExists` if the same client and cookie locked it
        scookie must be a stringstag must be a stringis$error acquiring shared lock on imageN(RRRSRTRFtrbd_lock_sharedR{RR2(RGRóRâR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytlock_shared³scCs^t|tƒstdƒ‚n|jj|jt|ƒƒ}|dkrZt|dƒ‚ndS(sS
        Release a lock on the image that was locked by this rados client.
        scookie must be a stringiserror unlocking imageN(RRRSRTRFt
rbd_unlockR{RR2(RGRóR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pytunlockÄs
cCs…t|tƒstdƒ‚nt|tƒs<tdƒ‚n|jj|jt|ƒt|ƒƒ}|dkrt|dƒ‚ndS(s>
        Release a lock held by another rados client.
        sclient must be a stringscookie must be a stringiserror unlocking imageN(RRRSRTRFtrbd_break_lockR{RR2(RGtclientRóR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt
break_lockÎsN(,RRRwRQR}RHR€R„RR†RŒRŽR“R—RYR4RZRžR R£R§R©R«R­R¯R±R³R¶R¸RÀRÉRÎRÐRÒRÔR[R\RØRáRñRôRöRøRû(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRxCsP-			
				(			
														4$				
	
			2	
		
RÁcBseZd„Zd„ZRS(cCs
||_dS(N(RÈ(RGRÈ((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRHÜscCs|j|||dkƒdS(Nii(RÈ(RGR¼R½texiststunused((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRÂßs(RRRHRÂ(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRÁÛs	R¨cBs)eZdZd„Zd„Zd„ZRS(s7
    Iterator over snapshot info for an image.

    Yields a dictionary containing information about a snapshot.

    Keys are:

    * ``id`` (int) - numeric identifier of the snapshot

    * ``size`` (int) - size of the image at the time of snapshot (in bytes)

    * ``name`` (str) - name of the snapshot
    cCs«|j|_tdƒ}xŒtr¦t|jƒ|_|jj|jt|jƒt|ƒƒ}|dkrw||_	Pq|t
jkrt|d|j
fƒ‚qqWdS(Ni
is$error listing snapshots for image %s(RFRRiR<RJtsnapst
rbd_snap_listR{Rt	num_snapsR RkR2R>(RGR{RR/((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyRHñs		ccsVxOt|jƒD]>}i|j|jd6|j|jd6|j|jd6VqWdS(NR=R4R>(txrangeRRþR=R4R>(RGti((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt__iter__þs
cCs|jj|jƒdS(N(RFtrbd_snap_list_endRþ(RG((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR†s(RRRwRHRR†(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyR¨ãs
	
	(2RwRRRRRRRRRRR	R
RRtctypes.utilR
R tANONYMOUS_AUIDt
ADMIN_AUIDtRBD_FEATURE_LAYERINGtRBD_FEATURE_STRIPINGV2tRBD_FEATURE_EXCLUSIVE_LOCKtRBD_FLAG_OBJECT_MAP_INVALIDt	ExceptionRRRRRRRRRRRRRRRRR2R3R<RDtobjectRERxRÁR¨(((s8/home/tvault/.virtenv/lib/python2.7/site-packages/rbd.pyt<module>sHX			µÿÿš