Viewing File: /usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyo

ó
¡ôXc@ søddlmZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZddl
mZmZddlmZddlmZdd	lmZdd
lmZddlZdeeefd„ƒYZdS(
iÿÿÿÿ(tdivisionN(tArgtMutuallyExclusiveArgList(t
ArgumentError(tFileTransferProgressBarMixin(tb64encoded_file_contentstfilesize(t
EC2Request(t
S3AccessMixin(tResumeImport(t	GetObjecttImportInstancecB sAeZdZedddddlddƒedddd	d
edddd
ƒeddddddd
eddƒeddddd
eddddƒeddddd
eddmddƒeedd ddldd!ƒed"dd#dd$dd%ƒƒjƒed&ddldd'ƒed(d)dd*d+ed,d-ddldd.ƒed/d0d1ddldd2ƒed3d4dd5dd6ƒed7d8dd9dd:dd;ƒed<d=dd>dd?dd@ƒedAdBddCd+eddDddEƒedFddGddHd+e	ddIƒeedJddKd+e
jddLddMƒedNddd+eddOddPƒƒedQddRddSddTƒedUddVddWddXƒedYd0d1ddZdd[ƒed\dd]ddndd`ƒedaddbddcdddƒeded0d1ddlde
jƒedfd0d1ddlde
jƒedgd0d1ddlde
jƒgZdhgZdi„Zdj„Zdk„ZRS(os!Import an instance into the cloudtsourcetmetavartFILEtroute_tothelps3file containing the disk image to import (required)s-ts--instance-typetINSTANCETYPEtrequiredtdests LaunchSpecification.InstanceTypes,the type of instance to import to (required)s-fs--formatsDiskImage.1.Image.FormattFORMATsGthe image's format
                ("vmdk", "raw", or "vhd") (required)s-as--architecturetARCHs LaunchSpecification.Architectures0the instance's processor architecture (required)s-ps
--platformtPlatformtchoicestWindowstLinuxs*the instance's operating system (required)s-bs--buckets"the bucket to upload the volume tos--manifest-urltURLs#DiskImage.1.Image.ImportManifestUrlsNa 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	--expirestDAYSttypetdefaultis\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-gs--grouptGROUPsLaunchSpecification.GroupName.1s4name of the security group to create the instance ins-zs--availability-zonetZONEs.LaunchSpecification.Placement.AvailabilityZones(the zone in which to create the instances-ss
--volume-sizetGiBsDiskImage.1.Volume.Sizes'size of the volume to import to, in GiBs--image-sizesDiskImage.1.Image.BytestBYTESs-size of the image (required for non-raw filess--user-datatDATAs!LaunchSpecification.UserData.Datas#user data to supply to the instances--user-data-filesLaunchSpecification.UserDatasGfile
                    containing user data to supply to the instances--subnettSUBNETsLaunchSpecification.SubnetIdsO[VPC only] subnet
                to create the instance's network interface ins--private-ip-addresstADDRESSs$LaunchSpecification.PrivateIpAddresssc[VPC only] assign a specific primary private IP address
                to the instance's interfaces	--monitors&LaunchSpecification.Monitoring.Enableds+enable detailed monitoring for the instances&--instance-initiated-shutdown-behaviors5LaunchSpecification.InstanceInitiatedShutdownBehaviortstopt	terminatesXwhether to "stop"
                (default) or terminate the instance when it shuts downs--keysLaunchSpecification.KeyNametKEYPAIRsW[Eucalyptus only] name of the key pair to use when
                running the instances--ignore-region-affinitys	--dry-runs--dont-verify-formattvolumescC 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(NsDiskImage.1.Image.FormattVMDKtVHDtRAWsDiskImage.1.Image.BytesRs/argument --image-size is required for {0} filessDiskImage.1.Volume.Sizeiitexpiresis-argument -x/--expires: value must be positive(R,R-R.i@(Rt	configuretconfigure_s3_accesstparamstuppertgett	euca2oolstutiltget_filesizetargstget_vmdk_image_sizeRtformattmathtceiltint(tselft
image_sizetvol_size((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyR0s2

		
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_runtbuckets#DiskImage.1.Image.ImportManifestUrls{0}/{1}.manifest.xmlRtprefixt/tservicet
s3_servicetauthts3_authR/ii€Qsgenerated manifest GET URL: %st	no_uploadttasktconversionTasktconversionTaskIdt
show_progress(R8R4tensure_bucket_existsR:tuuidtuuid4tjoinR
t
from_othertget_presigned_url2tlogtinfoR2tsendR	tFalsetmain(R>tmanifest_keytgetobjtdaystget_urltresulttresume((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyRXžs6


cC s|j|dƒdS(NRK(tprint_conversion_task(R>R]((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pytprint_resultÁsN(RR(sstopR)(t__name__t
__module__tDESCRIPTIONRtNonetTrueRRR=Rtbase64t	b64encodeRtargparsetSUPPRESStARGSt	LIST_TAGSR0RXR`(((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyR-s–							#(t
__future__RRhRfR;ROtrequestbuilderRRtrequestbuilder.exceptionsRtrequestbuilder.mixinsRteuca2ools.commands.argtypesRRteuca2ools.commands.ec2Rteuca2ools.commands.ec2.mixinsRt#euca2ools.commands.ec2.resumeimportR	teuca2ools.commands.s3.getobjectR
teuca2ools.utilR5R(((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyt<module>s
Back to Directory File Manager