
                            S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  \R(                  " SSSS9\R*                   " S S\R,                  5      5       5       rSSSS.\l        g)zCommand for moving instances.    )absolute_import)division)unicode_literals)base_classes)poller)waiter)base)
completers)flags)log)	resourcesTzThis command is deprecated. Please see https://cloud.google.com/compute/docs/instances/moving-instance-across-zones for an alternative method.zThis command has been removed. Please see https://cloud.google.com/compute/docs/instances/moving-instance-across-zones for an alternative method.)
is_removedwarningerrorc                   .    \ rS rSrSr\S 5       rS rSrg)Move   AMove an instance and its attached persistent disks between zones.c                     [         R                  R                  U 5        U R                  S[        R
                  SSS9  [        R                  R                  U 5        g )Nz--destination-zonez!The zone to move the instance to.T)	completerhelprequired)	r   INSTANCE_ARGAddArgumentadd_argumentr
   ZonesCompleterr	   
ASYNC_FLAGAddToParser)parsers    %lib/surface/compute/instances/move.pyArgs	Move.Args0   sO    	""6*
++0	   	OO'    c                 |   [         R                  " U R                  5       5      n[        R                  R                  UUR                  [        R                  " UR                  5      S9nUR                  R                  UR                  SUR                  0SS9nUR                  R                  nUR                  R                  nUR                  UR                  UR!                  5       UR!                  5       S9UR                  S9nUR"                  R%                  U5      n[        R&                  R                  UR(                  SUR                  0SS9n	UR*                  (       a6  [,        R.                  " U	SR1                  UR3                  5       5      S	S
S9  U$ UR                  R                  UR3                  5       SUR                  UR3                  5       S.S9n
[4        R6                  " UR8                  U
5      n[:        R<                  " UU	SR1                  UR3                  5       5      5      $ )N)scope_listerprojectzcompute.zones)params
collection)destinationZonetargetInstance)instanceMoveRequestr&   zcompute.globalOperationszgce instance {0}TzWUse [gcloud compute operations describe] command to check the status of this operation.)kindis_asyncdetailszcompute.instances)r&   zone)r(   r'   zMoving gce instance {0})r   ComputeApiHolderReleaseTrackr   r   ResolveAsResourcer   GetInstanceZoneScopeListerclientParsedestination_zoner&   apitools_clientmessages"ComputeProjectsMoveInstanceRequestInstanceMoveRequestSelfLinkprojectsMoveInstanceREGISTRYnameasync_r   UpdatedResourceformatNamer   Poller	instancesr   WaitFor)selfargsholdertarget_instancer6   r4   r8   requestresultoperation_refdestination_instance_refoperation_pollers               r    RunMove.Run=   s   **4+<+<+>?F((::55fmmD ; O
 ''--?223" .  ]]**F}}%%H99$88,557*335 9 
  '' : G __))'2F&&,,?223- - M {{	
!(()=)=)?@7 m%//55&&..$))+
  6   }}V%5%57OP>>!(()=)=)?@ r#    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr!   rP   __static_attributes__rR   r#   r    r   r      s     J
( 
(9r#   r   r   a\  
        *{command}* moves a Compute Engine virtual machine
        from one zone to another. Moving a virtual machine might incur downtime
        if the guest OS must be shut down in order to quiesce disk volumes
        prior to snapshotting.

        For example, running the following command moves the instance
        called `example-instance-1` with its attached persistent disks,
        currently running in `us-central1-b`, to `us-central1-f`.

           $ gcloud compute instances move example-instance-1 --zone=us-central1-b --destination-zone=us-central1-f

        Note: Moving VMs or disks by using the `{command}` command might
        cause unexpected behavior. For more information, see https://cloud.google.com/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior.

        Please note that gcloud compute instances move does not yet support
        instances which have regional persistent disks attached. Please see
        https://cloud.google.com/compute/docs/disks/regional-persistent-disk for
        more details.
    z
    To move `instance-1` from `us-central-a` to `europe-west1-d`, run:

      $ {command} instance-1 --zone=us-central1-a --destination-zone=europe-west1-d
    )briefDESCRIPTIONEXAMPLESN)rW   
__future__r   r   r   googlecloudsdk.api_lib.computer   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   ,googlecloudsdk.command_lib.compute.instancesr   googlecloudsdk.corer   r   	DeprecateDefaultUniverseOnlySilentCommandr   detailed_helprR   r#   r    <module>ri      s    $ &  ' 7 < . ( 9 > # ) 	&
	& I4 I I\ 	L(1 r#   