Current File : //usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importvolume.pyc
�
��Xc@ s�ddlmZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlZdeeefd��YZdS(
i����(tdivisionN(tArgtMutuallyExclusiveArgList(t
ArgumentError(tFileTransferProgressBarMixin(tfilesize(t
EC2Request(t
S3AccessMixin(tResumeImport(t	GetObjecttImportVolumecB s�eZdZeddddd:dd�eddd	d
dddedd
�eddd	ddddedd�eddddd	ddedd�edd	ddddedd�eedddd:dd�ed d	d!dd"dd#��j	�ed$dd:dd%�ed&d'dd(ded)d*dd:dd+�ed,d-d.dd:dd/�ed0d1d	d2dd3�ed4d-d.dd:de
j�ed5d-d.dd:de
j�ed6d-d.dd:de
j�g
Zd7�Z
d8�Zd9�ZRS(;s&Import a file to a volume in the cloudtsourcetmetavartFILEtroute_tothelps3file containing the disk image to import (required)s-fs--formattdestsImage.FormattFORMATtrequiredsGthe image's format ("vmdk", "raw", or
                "vhd") (required)s-zs--availability-zonetAvailabilityZonetZONEs1the zone in which to create the volume (required)s-ss
--volume-sizetGiBsVolume.Sizettypes'size of the volume to import to, in GiBs--image-sizesImage.BytestBYTESs-size of the image (required for non-raw filess-bs--buckets"the bucket to upload the volume tos--manifest-urlsImage.ImportManifestUrltURLsNa pre-signed URL that points to
                    the import manifest to uses--prefixsUa prefix to add to the
                names of the volume parts as they are uploadeds-xs	--expirestDAYStdefaultis\how long the import manifest should
                remain valid, in days (default: 30 days)s--no-uploadtactiont
store_trueshstart the import process, but do not actually upload
                the volume (see euca-resume-import)s-ds
--descriptiontDescriptions2a description for the import task (not the volume)s--ignore-region-affinitys	--dry-runs--dont-verify-formatcC s�tj|�|j�|jdj�dkrM|jdj�|jd<n|jjd�s�|jddkr�tjj|j	d�}||jd<q�|jddkr�tjj
|j	d�}||jd<q�tdj|jd���n|jjd�s8t
j|jdd�}t|�|jd<n|j	jd�sZd
|j	d<n|j	ddkr|td
��ndS(NsImage.FormattVMDKtVHDtRAWsImage.BytesRs/argument --image-size is required for {0} filessVolume.Sizeiitexpiresis-argument -x/--expires: value must be positive(RRR i@(Rt	configuretconfigure_s3_accesstparamstuppertgett	euca2oolstutiltget_filesizetargstget_vmdk_image_sizeRtformattmathtceiltint(tselft
image_sizetvol_size((sG/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importvolume.pyR"Vs.

	cC s�|jjd�rdS|jjd�r?|j|jd�n|jjd�s4djtj�|jd�}|jjd�r�dj|jd|f�}ntj|d|jd	d
|jdddj|jd|f��}|jjd�p�d
}|j	|d�}|j
jd|�||jd<n|j
�}|jjd�s�tj|d|jdd|ddd	|jd	d|jdd|jdd|jjdt��}|j�n|S(Ntdry_runtbucketsImage.ImportManifestUrls{0}/{1}.manifest.xmlRtprefixt/tservicet
s3_servicetauthts3_authR!ii�Qsgenerated manifest GET URL: %st	no_uploadttasktconversionTasktconversionTaskIdt
show_progress(R*R&tensure_bucket_existsR,tuuidtuuid4tjoinR	t
from_othertget_presigned_url2tlogtinfoR$tsendRtFalsetmain(R0tmanifest_keytgetobjtdaystget_urltresulttresume((sG/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importvolume.pyRJrs6


cC s|j|d�dS(NR=(tprint_conversion_task(R0RO((sG/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importvolume.pytprint_result�sN(t__name__t
__module__tDESCRIPTIONRtNonetTrueR/RRRtargparsetSUPPRESStARGSR"RJRR(((sG/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importvolume.pyR
,sL				#(t
__future__RRXR-RAtrequestbuilderRRtrequestbuilder.exceptionsRtrequestbuilder.mixinsRteuca2ools.commands.argtypesRteuca2ools.commands.ec2Rteuca2ools.commands.ec2.mixinsRt#euca2ools.commands.ec2.resumeimportRteuca2ools.commands.s3.getobjectR	teuca2ools.utilR'R
(((sG/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importvolume.pyt<module>s