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    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / nova / virt / libvirt / imagebackend.pyc
Size: Mime:
ó
±EYc@sƒddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddlm
Z
ddlmZddlmZddlZddlZddlmZdd	lmZdd
lmZmZmZddlmZddlmZdd
lmZddlmZddlm Z!ddl"m#Z#ddl$m%Z&ddl'm(Z(ddl'm)Z)ddl'm*Z*dd
l$mZ+ej,j-Z-ej.e/ƒZ0ej1ƒZ2ej3ej4ƒde5fd„ƒYƒZ6de6fd„ƒYZ7de6fd„ƒYZ8de6fd„ƒYZ9de6fd„ƒYZ:de6fd „ƒYZ;d!e5fd"„ƒYZ<dS(#iÿÿÿÿN(tlog(t	jsonutils(texcutils(t	fileutils(tstrutils(tunits(t	exception(t_(t_LEt_LIt_LW(timage(tkeymgr(tutils(tapi(tmodel(timages(tconfig(tdmcrypt(tlvm(t	rbd_utilstImagecBs.eZeZed„Zd„Zejd„ƒZejd„ƒZ	dd„Zd„Zdd„Z
d„Zdd„Zd	„Zd
d„Zd„Zd
„Zd„Zd„Zed„ƒZed„ƒZd„Zd„Zeed„Zd„Zd„Zd„Zd„Zed„Z d„Z!RS(cCsžtjjr1|jƒr1tjtdƒƒ‚n||_||_||_	d|_tjj
|_||_t|_d|_tjjtjdƒ|_dS(sÙImage initialization.

        :param path: libvirt's representation of the path of this disk.
        :param source_type: block or file
        :param driver_format: raw or qcow2
        :param is_block_dev:
        sUIncompatible settings: ephemeral storage encryption is supported only for LVM images.tlocksN(tCONFtephemeral_storage_encryptiontenabledt_supports_encryptionRt
NovaExceptionRtpathtsource_typet
driver_formattNonet	driver_iotlibvirtthw_disk_discardtdiscard_modetis_block_devtFalsetpreallocatetdisk_info_pathtostjointinstances_patht	lock_path(tselfRRRR$((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyt__init__:s
							cCstS(s|Used to test that the backend supports encryption.
        Override in the subclass if backend supports encryption.
        (R%(R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR[scOsdS(s"Create image from template.

        Contains specific behavior for each image type.

        :prepare_template: function, that creates template.
                           Should accept `target` argument.
        :base: Template name
        :size: Size of created image in bytes

        N((R,tprepare_templatetbasetsizetargstkwargs((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytcreate_imageascCsdS(sYResize image to size (in bytes).

        :size: Desired size of image in bytes

        N((R,R0((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytresize_imageosc
Cs§tjƒ}|j|_||_||_||_||_|j|_|j	|_	|j
|_
tj||j
ƒ}	|	|_|j|_||_|j||ƒ|S(sGet `LibvirtConfigGuestDisk` filled for this image.

        :disk_dev: Disk bus device name
        :disk_bus: Disk bus type
        :device_type: Device type for this image.
        :cache_mode: Caching mode for this image
        :extra_specs: Instance type extra specs dict.
        :hypervisor_version: the hypervisor version
        :boot_order: Disk device boot order
        (tvconfigtLibvirtConfigGuestDiskRt
source_devicet
target_bust
target_devtdriver_cacheR#tdriver_discardR Rt
libvirt_utilstpick_disk_driver_nameR$tdriver_nameRtsource_patht
boot_ordertdisk_qos(
R,tdisk_bustdisk_devtdevice_typet
cache_modetextra_specsthypervisor_versionR@tinfoR>((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytlibvirt_infoxs 							cCs—ddddddg}xxtj|ƒD]g\}}|jdƒ}t|ƒdkr(|d	d
kr(|d|krt||d|ƒqq(q(WdS(Ntdisk_read_bytes_sectdisk_read_iops_sectdisk_write_bytes_sectdisk_write_iops_sectdisk_total_bytes_sectdisk_total_iops_sect:iitquota(tsixt	iteritemstsplittlentsetattr(R,RHRFt
tune_itemstkeytvaluetscope((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRA—s"cCs‘tjƒ}||_|jr6d|_|j|_nWd|_|j|_|j|_|ri||_	n$|jdkr„d|_	n	d|_	|S(sÔGet `LibvirtConfigGuestFilesys` filled for this image.

        :target: target directory inside a container.
        :driver_type: filesystem driver type, can be loop
                      nbd or ploop.
        tblocktfiletrawtlooptnbd(
R5tLibvirtConfigGuestFilesyst
target_dirR$RRt
source_devtsource_fileRtdriver_type(R,ttargetRdRH((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytlibvirt_fs_info¡s					cCstjj|jƒS(N(R(Rtexists(R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRg¼sc	
sKtj|dtd|jƒ‡fd†ƒ}tjjtjtj	ƒ}tjj
|ƒsjtj|ƒntjj||ƒ}|j
ƒsŸtjj
|ƒr»|j
|||||Žn|rGtjj
|ƒrø||j|ƒkrø|j|ƒn|jrG|jƒrGtj|jtjƒrGtjddd||jƒqGndS(sžCreates image from template.

        Ensures that template and image not already exists.
        Ensures that base directory exists.
        Synchronizes on template fetching.

        :fetch_func: Function that creates the base image
                     Should accept `target` argument.
        :filename: Name of the file in the image directory
        :size: Size of created image in bytes (optional)
        texternalR+cs,tjj|ƒs(ˆd|||ŽndS(NRe(R(RRg(ReR1R2(t
fetch_func(sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytfetch_func_syncËst	fallocates-ns-lN(R
tsynchronizedtTrueR+R(RR)RR*timage_cache_subdirectory_nameRgRtensure_treeR3t
get_disk_sizeR4R&t_can_fallocatetaccesstW_OKtexecute(	R,RitfilenameR0R1R2Rjtbase_dirR/((RisS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytcache¿s- 
'cCsœt|jddƒ}|dkr˜|jd}tjddd|ƒ\}}tj|ƒ|}||j_|s˜t	j
tdƒi|jd6ƒq˜n|S(	s„Check once per class, whether fallocate(1) is available,
           and that the instances directory supports fallocate(2).
        t
can_fallocates.fallocate_testRks-lt1s-Unable to preallocate image at path: %(path)sRN(tgetattrt	__class__RRR
ttrycmdRtdelete_if_existsRxtLOGtwarningR
(R,Rxt	test_patht_outterr((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRqæs

icCsŒ|dkrdS|r/|r/|j|ƒ}n||krˆtdƒ}tj|i|d6|d6|d6ƒtjd|d|ƒ‚ndS(s·Check that the base image is not larger than size.
           Since images can't be generally shrunk, enforce this
           constraint taking account of virtual image size.
        NsN%(base)s virtual size %(base_size)s larger than flavor root disk size %(size)sR/t	base_sizeR0tflavor_sizet
image_size(RRpRR~terrorRtFlavorDiskSmallerThanImage(R,R/R0Rƒtmsg((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytverify_base_sizeös
	cCs
tj|ƒS(N(tdiskRp(R,tname((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRpscCs
tƒ‚dS(N(tNotImplementedError(R,Ret
out_format((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytsnapshot_extractscCs|jS(N(R(R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyt_get_driver_formatscsId„‰tjˆjdtdˆjƒ‡‡‡fd†ƒ}yՈjdk	rÒtjjˆjƒrÒt	ˆjƒX}|j
ƒjƒ}ˆ|ƒ}x0tj
|ƒD]\}‰|ˆjkr¦ˆSq¦WWdQXnˆjƒ‰ˆjdk	rtjtjjˆjƒƒ|ƒnWn.tk
rD}tjdtj|ƒƒ‚nXˆS(sReturn the driver format for self.path.

        First checks self.disk_info_path for an entry.
        If it's not there, calls self._get_driver_format(), and then
        stores the result in self.disk_info_path

        See https://bugs.launchpad.net/nova/+bug/1221190
        cSsk|s
iSytj|ƒSWnIttfk
rf}tdƒi|d6|d6}tjd|ƒ‚nXdS(Ns1Could not load line %(line)s, got error %(error)stlineR†treason(Rtloadst	TypeErrort
ValueErrorRRtInvalidDiskInfo(RteRˆ((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyt_dict_from_line&s	RhR+c	stjˆjtjtjBdƒ}tj|dƒ%}|jƒjƒ}ˆ|ƒ}WdQXˆj|kr‹t	dƒ}t
jd|ƒ‚n|jiˆˆj6ƒˆjd}tj|tj
tjBdƒ}tj|dƒ!}|jdtj|ƒƒWdQXtj|ˆjƒdS(Ni¤trs)Attempted overwrite of an existing value.R‘s.tmptws%s
(R(topenR'tO_RDONLYtO_CREATtfdopentreadtrstripRRRR•tupdatetO_WRONLYtwriteRtdumpstrename(tfdtdisk_info_fileRtdctRˆttmp_pathttmp_file(R—RR,(sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytwrite_to_disk_info_file1s"
 NR‘(R
RlR'R%R+RR(RRgRšRžRŸRRRSRRRotdirnametOSErrorRtDiskInfoReadWriteFailt	text_type(R,RªR¦RR§RR–((R—RR,sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytresolve_driver_formats&		!cCstS(s:True if the backend puts images on a shared block storage.(R%(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytis_shared_block_storageVscCstS(s?True if the backend stores images in files under instance path.(R%(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytis_file_in_instance_path[scCs(tdƒ}tjd|d|ƒ‚dS(soClone an image.

        Note that clone operation is backend-dependent. The backend may ask
        the image API for a list of image "locations" and select one or more
        of those locations to clone an image from.

        :param image_id_or_uri: The ID or URI of an image to clone.

        :raises: exception.ImageUnacceptable if it cannot be cloned
        sclone() is not implementedtimage_idR‘N(RRtImageUnacceptable(R,tcontexttimage_id_or_uriR‘((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytclone`scCsttdƒƒ‚dS(séPrepare a snapshot for direct reference from glance

        :raises: exception.ImageUnacceptable if it cannot be
                 referenced directly in the specified image format
        :returns: URL to be given to glance
        s$direct_snapshot() is not implementedN(RŒR(R,R´t
snapshot_nametimage_formatR²t
base_image_id((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytdirect_snapshotoscCsdS(sÑPerforms any cleanup actions required after calling
        direct_snapshot(), for graceful exception handling and the like.

        This should be a no-op on any backend where it is not implemented.
        N((R,tlocationtalso_destroy_volumet
ignore_errors((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytcleanup_direct_snapshotyscCstjj|ƒdS(s#Get an image's name of a base file.iÿÿÿÿ(R(RRT(R,R/((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyt_get_lock_name‚scCs
tƒ‚dS(sfGet the image information model

        :returns: an instance of nova.virt.image.model.Image
        N(RŒ(R,t
connection((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyt	get_model†scCsdS(s¸Import an image from local storage into this backend.

        Import a local file into the store used by this image type. Note that
        this is a noop for stores using local disk (the local file is
        considered "in the store").

        If the image already exists it will be overridden by the new file

        :param local_file: path to the file to import
        :param remote_name: the name for the file in the store
        N((R,tinstancet
local_filetremote_name((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytimport_filescCsdS(sCreate a snapshot on the image.  A noop on backends that don't
        support snapshots.

        :param name: name of the snapshot
        N((R,R‹((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytcreate_snapžscCsdS(sÛRemove a snapshot on the image.  A noop on backends that don't
        support snapshots.

        :param name: name of the snapshot
        :param ignore_errors: don't log errors if the snapshot does not exist
        N((R,R‹R½((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytremove_snap¦scCsdS(s–Rollback the image to the named snapshot. A noop on backends that
        don't support snapshots.

        :param name: name of the snapshot
        N((R,R‹((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytrollback_to_snap¯sN("t__name__t
__module__R%tSUPPORTS_CLONER-RtabctabstractmethodR3R4RRIRARfRgRwRqR‰RpRŽRR¯tstaticmethodR°R±R¶RºR¾R¿RÁRÅRÆRÇRÈ(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR5s8!	
	
	'					9		
					tFlatcBsneZdZd
d
d
d„Zd„Zd„Zd„Zd„Zd„Z	d„Z
ed„ƒZd	„Z
RS(s*The Flat backend uses either raw or qcow2 storage. It never uses
    a backing store, so when using qcow2 it copies an image rather than
    creating an overlay. By default it creates raw files, but will use qcow2
    when creating a disk from a qcow2 if force_raw_images is not set in config.
    cCs±||_|p*tjjtj|ƒ|ƒ}tt|ƒj|dddt	ƒt
jtj
ƒdk|_|jrd|_ntjjtjj|ƒdƒ|_|jƒdS(NR\R]R$tspacetnatives	disk.info(t	disk_nameR(RR)R<tget_instance_pathtsuperRÏR-R%Rtto_slugRtpreallocate_imagesR&R R«R'tcorrect_format(R,RÂRÒR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR-¾s		"	$cCsbytj|jƒ}|jSWn>tjk
r]}tjtdƒi|jd6|d6ƒdSXdS(Ns=Failed to get image info from path %(path)s; error: %(error)sRR†R](	Rt
qemu_img_infoRtfile_formatRR•R~RHR	(R,tdataR–((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRËs
cCs|jdkrtStSdS(Ntkerneltramdisksdisk.config(skernelsramdisksdisk.config(RÒR%Rm(R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRÖscCs+tjj|jƒr'|jƒ|_ndS(N(R(RRgR¯R(R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR×âsc	s
ˆj|ƒ}tj|dtdˆjƒ‡fd†ƒ}d|k}|rvˆjƒsÿ|dˆj||Žqÿn‰tjj|ƒsž|d|||Žntj	|ƒˆj
||ƒtjjˆjƒsÿtjˆjƒ||ˆj|ƒWdQXnˆj
ƒdS(NRhR+csBtj||ƒ|r>tj|ˆjƒ}tj||ƒndS(N(R<t
copy_imagetimgmodeltLocalFileImageRRŠtextend(R/ReR0R(R,(sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytcopy_raw_imageés
	R²Re(R¿R
RlRmR+RgRR(R<tupdate_mtimeR‰Rtremove_path_on_errorR×(	R,R.R/R0R1R2RuRát
generating((R,sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR3æs-
cCs,tj|j|jƒ}tj||ƒdS(N(RÞRßRRRŠRà(R,R0R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR4scCs tj|j||j|ƒdS(N(Rt
convert_imageRR(R,ReR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRŽscCstS(N(Rm(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR±scCstj|jtjƒS(N(RÞRßRt
FORMAT_RAW(R,RÀ((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRÁsN(RÉRÊt__doc__RR-RRR×R3R4RŽRÎR±RÁ(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRϸs
						tQcow2cBsMeZdddd„Zd„Zd„Zd„Zed„ƒZd„Z	RS(cCs¨|p!tjjtj|ƒ|ƒ}tt|ƒj|dddtƒt	j
tjƒdk|_
|j
rvd|_ntjjtjj|ƒdƒ|_|jƒdS(NR\tqcow2R$RÐRÑs	disk.info(R(RR)R<RÓRÔRèR-R%RRÕRRÖR&R R«R'R¯(R,RÂRÒR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR-s	"	$c
Osà|j|ƒ}tj|dtd|jƒd„ƒ}tjj|ƒs^|d|||Žntj	|ƒ|j
||ƒd}|}	tjj|jƒr/tj|jƒ}
|
dk	r/tjj
|
ƒ}|jdƒ}||dkr,|djƒr,t|dƒ}|	d|7}	|tj9}q,q/n|r˜tjj|	ƒs˜tj|	ƒ:tj||	ƒtj|	tjƒ}
tj|
|ƒWdQXq˜ntjj|jƒsÜtj|jƒ|||j|ƒWdQXndS(NRhR+cSsBtj||ƒ|r>tj|tjƒ}tj||ƒndS(N(R<tcreate_cow_imageRÞRßtFORMAT_QCOW2RŠRà(R/ReR0R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytcopy_qcow2_image$sReRiÿÿÿÿs_%d(R¿R
RlRmR+R(RRgR<RâR‰Rtget_disk_backing_filetbasenamet
rpartitiontisdigittintRtGiRRãRÝRÞRßRëRŠRà(R,R.R/R0R1R2RuRìtlegacy_backing_sizetlegacy_basetbacking_pathtbacking_filet
backing_partsR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR3!s8'
	cCs,tj|jtjƒ}tj||ƒdS(N(RÞRßRRëRŠRà(R,R0R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR4UscCstj|jd||ƒdS(NRé(R<textract_snapshotR(R,ReR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRŽYscCstS(N(Rm(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR±^scCstj|jtjƒS(N(RÞRßRRë(R,RÀ((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRÁbsN(
RÉRÊRR-R3R4RŽRÎR±RÁ(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRès	4		tLvmcBsqeZed„ƒZd	d	d	d„Zd„Zd„Zd„Zd„Z	e
jd„ƒZd„Z
d„ZRS(
cCs|jddƒS(NRt__(treplace(Ru((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytescapehscCsŸ|jdƒ|_|jdk	r6tjtƒ|_n	d|_|r’|jdkr€tj|ƒ}|d|_	|d|_
qHtjj|_	n¶tjjs³t
tdƒƒ‚ntjj|_	d|j|j|ƒf|_
|jdkrtjjd|j	|j
ƒ}n7tjjd|j	|j
ƒ|_dtj|j
ƒ}tt|ƒj|dd	d
tƒtjj|_|j|_|js›d|_ndS(Ntephemeral_key_uuidtVGtLVs>You should specify images_volume_group flag to use LVM images.s%s_%ss/devs/dev/mapper/R[R]R$RÑ(tgetRýRRtAPIRtkey_managerRtvolume_infotvgtlvR!timages_volume_grouptRuntimeErrorRtuuidRüR(RR)tlv_pathRtvolume_nameRÔRùR-Rmtsparse_logical_volumestsparseR&R (R,RÂRÒRRH((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR-ls0	
	!!"
	cCstS(N(Rm(R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR“scCstS(N(R%(R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRq–sc	s¾‡‡fd†‰ˆj|ƒ}tj|dtdˆjƒ‡‡fd†ƒ}d|k}ˆjdk	ród|krÛy&ˆjj|dˆjƒj	ƒ‰Wqðt
k
r×tjƒt
jtdƒƒWdQXqðXqótjtdƒƒ‚n|rl|rltjˆjˆj|d	ˆjƒˆjˆjƒ4ˆjdk	rMˆƒn|d
ˆj||ŽWdQXnNtjj|ƒs”|d
|||Žnˆjˆjƒ|||ƒWdQXdS(Ncs<tjˆjjdƒdˆjtjjtjjˆƒdS(Nt/i(	Rt
create_volumeRRïR	RRtciphertkey_size((RXR,(sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytencrypt_lvm_imagešs
		RhR+csÀtj|ƒ}ˆj||d|ƒ||k}|r=|n|}tjˆjˆj|dˆjƒˆjdk	r~ˆƒnt
j|ˆjˆj
dtƒ|r¼tjˆjdtƒndS(NRƒRtrun_as_root(RŠRpR‰RRRRRRýRRtconvert_image_unsafeRRRmt	resize2fs(R/R0Rƒtresize(RR,(sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytcreate_lvm_image£s
	tephemeral_sizeR´s+Failed to retrieve ephemeral encryption keys5Instance disk to be encrypted but no context providedRRe(R¿R
RlRmR+RýRRRtget_encodedt	ExceptionRtsave_and_reraise_exceptionR~R†RRRRRRRRRtremove_volume_on_errorRR(Rg(	R,R.R/R0R1R2RuRt	generated((RRXR,sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR3™s20

 
cCsdS(N((R,R0((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR4Úsccsƒy	dVWnstk
r~tjƒT|jdkrHtj|gƒn-tj|j	dƒdƒtj|j
gƒWdQXnXdS(NR
i(RRRRýRRtremove_volumesRt
delete_volumeRïR	(R,R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRÝs	

cCs&tj|j||j|dtƒdS(NR(RRåRRRm(R,ReR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRŽéscCstj|jƒS(N(RÞtLocalBlockImageR(R,RÀ((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRÁísN(RÉRÊRÎRüRR-RRqR3R4t
contextlibtcontextmanagerRRŽRÁ(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRùgs'			A		tRbdcBsËeZeZdddd„Zdd„Zd„Zd„Zd„Z	d„Z
d„Zd„Ze
d„ƒZd	„Zd
„Zd„Zd„Zed
„Zd„Zd„Zd„Zeed„ZRS(cKs\tjjs!ttdƒƒ‚n|rjy|jdƒd|_Wq€tk
rftj	d|ƒ‚q€Xnd|j
|f|_tjj|_tjj|_tjj
|_d|j|jf}|jrà|d|j7}n|jrý|d|j7}ntt|ƒj|d	d
dtƒtjd|jd
|jd|jƒ|_tjj|_dS(Ns:You should specify images_rbd_pool flag to use rbd images.R
iRs%s_%ss	rbd:%s/%ss:id=s:conf=R[trbdR$tpoolt	ceph_conftrbd_user(RR!timages_rbd_poolRRRTtrbd_namet
IndexErrorRtInvalidDevicePathRR$R&timages_rbd_ceph_confR%RÔR"R-R%Rt	RBDDrivertdriverR"R#(R,RÂRÒRR2((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR-õs,
		"			cCs)tjƒ}|jjƒ\}	}
||_d|_||_|j|_||_	||_
d|_d|_d|j
|jf|_|	|_|
|_||_tjjdk	}tjjrôtjj|_t}tjjrôtjj|_qôn|rd|_tjj|_n|j||ƒ|S(sGet `LibvirtConfigGuestDisk` filled for this image.

        :disk_dev: Disk bus device name
        :disk_bus: Disk bus type
        :device_type: Device type for this image.
        :cache_mode: Caching mode for this image
        :extra_specs: Instance type extra specs dict.
        :hypervisor_version: the hypervisor version
        :boot_order: Disk device boot order
        R]tnetworkR#s%s/%stcephN(R5R6R-t
get_mon_addrsR7RR:R#R;R8R9Rtsource_protocolR$R(tsource_nametsource_hoststsource_portsR@RR!R&Rtrbd_secret_uuidtauth_secret_uuidRmt
auth_usernametauth_secret_typeRA(R,RBRCRDRERFRGR@RHthoststportstauth_enabled((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRIs2											cCstS(N(R%(R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRq?scCs|jj|jƒS(N(R-RgR((R,((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRgBscCs|jj|jƒS(sÅReturns the size of the virtual disk in bytes.

        The name argument is ignored since this backend already knows
        its name, and callers may pass a non-existent local file path.
        (R-R0R((R,R‹((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRpEscOs’|jƒs"|d|||Žn|jƒsG|jj||jƒn|j||ƒ|rŽ||j|jƒkrŽ|jj|j|ƒndS(NRe(RgR-timport_imageR(R‰RpR(R,R.R/R0R1R2((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR3MscCs|jj|j|ƒdS(N(R-RR((R,R0((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR4[scCstj|j|d|ƒdS(NR](RRåR(R,ReR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRŽ^scCstS(N(Rm(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR°ascCsñtj||dtƒ}|d}tjdi|d6ƒ|jdƒdkrvtdƒ}tjd	|d
|ƒ‚nxP|D]H}|jj	||ƒr}tjdi|d6ƒ|jj
||jƒSq}Wtd
ƒ}tjd	|d
|ƒ‚dS(Ntinclude_locationst	locationssImage locations are: %(locs)stlocstdisk_formatR]tisosImage is not raw formatR²R‘sSelected location: %(loc)stlocs!No image locations are accessible(srawsiso(t	IMAGE_APIRRmR~tdebugRRR³R-tis_cloneableR¶R((R,R´Rµt
image_metaR>R‘R»((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR¶es	

cCs§d}tjjr?|jtjjƒ}tj|jƒƒ}n|jj	ƒ\}}gt
||ƒD]}tdj|ƒƒ^qd}t
j|j|j|j||ƒS(NRP(RRR!R5tsecretLookupByUUIDStringtbase64t	b64encodeRYR-R0tziptstrR)RÞtRBDImageR(R$R&(R,RÀtsecrett	secretobjR9R:tktservers((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRÁzs1cCsId|j|f}|jƒr2|jj|ƒn|jj||ƒdS(Ns%s_%s(RRgR-tremove_imageR<(R,RÂRÃRÄR‹((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRŊscCs|jj|j|ƒS(N(R-RÆR((R,R‹((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRƐscCs|jj|j||ƒS(N(R-RÇR((R,R‹R½((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRǓscCs|jj|j|ƒS(N(R-RÈR((R,R‹((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRȖscCs>d}y"|jj|jƒ\}}}Wnítjk
rtjd|ƒytj	||dt
ƒ}Wn7tk
r }tjdi|d6|d6ƒi}nXxt|j	dgƒD]\}	y<|jj|	dƒ\}
}}}|
|krïPnd}Wq´tjk
rq´q´Xq´WnX|s:tjt
dƒ|ƒ‚n|S(	Ns>No parent info for %s; asking the Image API where its store isR=s2Unable to get image %(image_id)s; error: %(error)sR²R†R>turlsWCannot determine the parent storage pool for %s; cannot determine where to store images(RR-tparent_infoR(RR³R~RDRCRRmRt	parse_urlR(R,R´R¹tfsidtparent_poolt_imt_snapRFR–R»tparent_fsid((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyt_get_parent_pool™s4"	
	
"
	
c	Csò|jjƒ}|j|||ƒ}|jj|j|dtƒidtd|d|jd|jd|ƒd6}z3|jj||d|ƒ|jj	|d|ƒWd	|j
|ƒX|jj|dd|dtƒd
td|d|d|ƒS(s*Creates an RBD snapshot directly.
        tprotects*rbd://%(fsid)s/%(pool)s/%(image)s/%(snap)sRUR$RtsnapRRt	dest_poolNs&rbd://%(fsid)s/%(pool)s/%(image)s/snap(R-tget_fsidRZRÆR(RmtdictR$R¶tflattenR¾(	R,R´R·R¸R²R¹RURVR»((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRºÀs 		c	Css|ro|jj|dƒ\}}}}|jj||d|dtd|ƒ|ro|jj|d|ƒqondS(sîUnprotects and destroys the name snapshot.

        With also_destroy_volume=True, it will also cleanup/destroy the parent
        volume.  This is useful for cleaning up when the target volume fails
        to snapshot properly.
        RRR$tforceR½N(R-RTRÇRmtdestroy_volume(R,R»R¼R½t_fsidt_poolRWRX((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR¾äs"N(RÉRÊRmRËRR-RIRqRgRpR3R4RŽRÎR°R¶RÁRÅRÆR%RÇRÈRZRºR¾(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR"ñs("(												'	$tPloopcBs5eZdddd„Zd„Zd„Zd„ZRS(cCsT|p!tjjtj|ƒ|ƒ}tt|ƒj|dddtƒ|j	ƒdS(NR\tploopR$(
R(RR)R<RÓRÔReR-R%R¯(R,RÂRÒR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR-õs	"cs§tjj|ƒd}tj|dtdˆjƒ‡fd†ƒ}tjjˆjƒsõtj	rmdˆ_
qõtj|d|dƒ}|jdƒ}	|	d	kr®d
ˆ_
qõ|	dkrÆdˆ_
qõt
dƒ|	}
tjd|dd|
ƒ‚ntjj|ƒs|d
|||Žnˆj||ƒtjjˆjƒrFdStjˆjƒtjtjdtjƒ}tjˆjd|ƒ||ˆj|ƒWdQXdS(NiÿÿÿÿRhR+cs^tjj|dƒ}tj||ƒtjdddˆj||ƒ|rZˆj|ƒndS(Nsroot.hdsRfsrestore-descriptors-f(	R(RR)R<RÝR
Rtt
pcs_formatR4(R/ReR0t
image_path(R,(sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytcreate_ploop_imageÿs
R]R´R²R@Rftexpandeds‰PCS doesn't support images in %s format. You should either set force_raw_images=True in config or upload an image in ploop or raw format.R‘Retremove(R(RRTR
RlRmR+RgRtforce_raw_imagesRgRCRRRR³R‰RRot	functoolstpartialR}tshutiltrmtreeRã(R,R.R/R0R1R2RuRiRFtformatR‘tremove_func((R,sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR3üs6-		

		
cCs,tj|jtjƒ}tj||ƒdS(N(RÞRßRtFORMAT_PLOOPRŠRà(R,R0R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR4*scCs2tjj|jdƒ}tj|d||ƒdS(Nsroot.hdst	parallels(R(RR)R<Rø(R,ReRtimg_path((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRŽ.s
	N(RÉRÊRR-R3R4RŽ(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyReôs	.	tBackendcBs5eZd„Zdd„Zdd„Zdd„ZRS(cCsJitd6td6td6td6td6td6|r9tntd6|_dS(NR]tflatRéRR#Rftdefault(RÏRèRùR"RetBACKEND(R,tuse_cow((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyR-7scCsJ|stjj}n|jj|ƒ}|sFttdƒ|ƒ‚n|S(NsUnknown image_type=%s(RR!timages_typeRyRRR(R,t
image_typeR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytbackendBscCs"|j|ƒ}|d|d|ƒS(sÔConstructs image for selected backend

        :instance: Instance name.
        :name: Image name.
        :image_type: Image type.
                     Optional, is CONF.libvirt.images_type by default.
        RÂRÒ(R}(R,RÂRÒR|R}((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRJscCs"|j|ƒ}|d|d|ƒS(sjReturns snapshot for given image

        :path: path to image
        :image_type: type of image
        RÂR(R}(R,RÂt	disk_pathR|R}((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pytsnapshotUsN(RÉRÊR-RR}RR(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyRv6s	(=RÌRHR RmR(Rotoslo_logRtloggingtoslo_serializationRt
oslo_utilsRRRRRRt	nova.conftnovaRt	nova.i18nRRR	R
RRR
tnova.virt.diskRRŠtnova.virt.imageRRÞt	nova.virtRtnova.virt.libvirtRR5tnova.virt.libvirt.storageRRRR<tconfRt	getLoggerRÉR~RRCt
add_metaclasstABCMetatobjectRRÏRèRùR"ReRv(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/nova/virt/libvirt/imagebackend.pyt<module>sPÿƒ\SŠÿB