+
    h*  c                   sp    ^ RI t ^ RIt^RIHt ^RIHtHtHt ^RIHt R t	R t
R tR tR	 tRR
 ltR tR# )    N)cli)failprint_stdoutprint_stderr)Clonerc                 s    V P                   pR pV P                  '       d'   \        V P                  4      P                  4       pW3# V'       g   \	        \        R4      4       W3# )NzNAn original machine name is required, use '--original src_name' and try again.)src_nameZoriginal_xmlZopenZreadr   _)optionsr   src_xml   &  -/usr/share/virt-manager/virtinst/virtclone.py_process_srcr      s^    HGw++,113  Q_`a    c                 s*   V P                   pV'       d   V^ ,          R8X  d   R# V F$  p\        P                  ! VP                  V4       K&  	  VP                  P
                  P                  R,           F  pVP                  ^ 4      Vn        K  	  R# )r    ZRANDOMNNNN)	new_macr   Zvalidate_macconn	new_guestZdevicesZ	interfacepopZmacaddr)r   clonerZnew_macsZmacZifaces   &&   r   _process_macsr      so    Hx{h.c*  !!))33A66 Q 7r   c                 sj   V P                   ;'       g    . R ,          pVP                  4       pV F  pVP                  P                  4       pRpV'       d   VP	                  ^ 4      pMV P
                  '       d    R# Vf   RpVP                  W`P                  4       VP                  4        K  	  R# )r   N)	new_diskfileget_nonshare_diskinfosdiskZget_source_pathr   
auto_cloneZset_new_pathsparseraise_error)r   r   ZnewpathsZ	diskinfosdiskinfoZorigpathZnewpaths   &&     r   _process_disksr   $   s    $$**A.H--/I==002ll1oGGg~~6 r   c                 s    V P                  4        F^  pVP                  4        VP                  '       g   K'  VP                  4       '       * p\        P
                  ! VP                  VR 7       K`  	  R# ))warn_overwriteN)get_diskinfosr   Znew_diskZis_preserve_requestedr   Zvalidate_disk)r   r   r   r
   r   _validate_disksr   6   sW    ((*   %;;==(++NK +r   c            	      s   \        R 4      p \        P                  ! RV 4      p\        P                  ! V4       VP	                  \        R4      4      pVP                  RRR\        R4      R7       VP                  R\        R	4      R
7       VP                  RR\        R4      R7       VP                  RRR\        R4      R7       VP                  RRR\        P                  R7       VP                  RR\        R4      R7       VP	                  \        R4      4      pVP                  RRRR\        R4      R7       VP                  RR R\        R!4      R7       VP                  R"R\        R#4      R7       VP                  R$R%R&R'\        R(4      R)7       VP                  R*R+RR,\        R-4      R.7       VP                  R/R0\        R14      R7       VP	                  \        R24      4      pVP                  R3R4R5R\        R64      R7       VP	                  \        R74      4      pVP                  R8RR9R,\        P                  R)7       \        P                  ! VR'R'R'R:7       \        P                  ! V4       VP                  4       # );a  Duplicate a virtual machine, changing all the unique host side configuration like MAC address, name, etc. 

The VM contents are NOT altered: virt-clone does not change anything _inside_ the guest OS, it only duplicates disks and does host side changes. So things like changing passwords, changing static IP address, etc are outside the scope of this tool. For these types of changes, please see virt-sysprep(1).z%(prog)s --original [NAME] ...zGeneral Optionsz-oz
--originalr   z$Name of the original guest to clone.)desthelpz--original-xmlz&XML file to use as the original guest.)r!   z--auto-cloneZ
store_truezQAuto generate clone name and storage paths from the original guest configuration.)actionr!   z-nz--namenew_namezName for the new guestz-uz--uuidnew_uuidz	--reflinkzuse btrfs COW lightweight copyzStorage Configurationz-fz--filer   Zappendz3New file to use as the disk image for the new guest)r    r"   r!   z--force-copytargetzQForce to copy devices (eg, if 'hdc' is a readonly cdrom device, --force-copy=hdc)z--skip-copyzSkip copy of the device target. (eg, if 'vda' is a disk you don't want to copy and use the same path in the new VM, use --skip-copy=vda)z--nonsparseZstore_falser   Tz3Do not use a sparse file for the clone's disk image)r"   r    defaultr!   z--preserve-datapreserveFzDo not clone storage contents to specified file paths, their contents will be left untouched. This requires specifying existing paths for every cloneable disk image.)r    r"   r&   r!   z--nvram	new_nvramz)New file to use as storage for nvram VARSzNetworking Configurationz-mz--macr   zNNew fixed MAC address for the clone guest. Default is a randomly generated MACzMiscellaneous Optionsz--__test-nodry
test_nodry)promptreplaceZprintxml)r   r   ZsetupParserZadd_connect_optionZadd_argument_groupZadd_argumentargparseZSUPPRESSZadd_misc_optionsZautocomplete
parse_args)ZdescZparserZgengZstogZnetgZmiscs         r   r-   r-   @   s   	MD __=tDF6"$$Q'8%9:Dl!4Z2[   	&Q/W-XYbc  
 	dH:A>V<WXdH:H<M<MNk,Q?_=`a$$Q'>%?@DDE   	bc	   	2
   	DE   	*
   	!,W*X   $$Q'A%BCD_`   $$Q'>%?@D 	   dD4HVr   c                 sP   \         P                  ! 4        \        4       pVP                  ;'       g    VP                  Vn        \         P
                  ! R VP                  VP                  4       \         P                  ! V4       \         P                  ! VP                  4       \         P                  ! VP                  4       \         P                  ! VP                  V R7      p VP                  f%   VP                  RJ d   \!        \#        R4      4       \%        V4      w  r#\'        WV4      pVP)                  \+        VP,                  4      4       VP/                  \+        VP0                  4      4       VP3                  \+        VP4                  4      4       VP6                  e   VP9                  VP6                  4       VP:                  '       d   VP=                  VP:                  4       VP>                  ;'       g    . pVP@                  ;'       g    . pVPC                  4        F[  pVPD                  P>                  V9   d   VPG                  4        VPD                  P>                  V9   g   KK  VPI                  4        K]  	  VPJ                  '       dT   VPM                  4        F  pVPO                  4        K  	  VPP                  '       d   VPP                  PO                  4        VPR                  '       d   VPU                  VPR                  4       M&VP                  '       g   \!        \#        R4      4       \W        W4       \Y        W4       VP[                  4        \]        V4       RpVP                  '       d2   VP^                  p\a        VPb                  Pe                  4       RR7       V'       d_   VPg                  \         Ph                  ! 4       4       \a        R4       \a        \#        R4      VPb                  Pj                  ,          4       ^ # )	z
virt-clone)r   FzVEither --auto-clone or --file is required, use '--auto-clone or --file' and try again.zXA name is required for the new virtual machine, use '--name NEW_VM_NAME' to specify one.T)Zdo_force z Clone '%s' created successfully.)6r   ZearlyLoggingr-   ZquietZxmlonlyZsetupLoggingZdebugZconvert_old_forceZparse_checkZcheckZ
set_promptr*   ZgetConnectionZconnectr   r   r   r   r   r   Zset_replaceZboolr+   Zset_reflinkZreflinkZ
set_sparser   r$   Zset_clone_uuidr(   Zset_nvram_pathr%   Z	skip_copyr   r   Zset_clone_requestedZset_share_requestedr'   r   Zset_preserve_requestedZnvram_diskinfor#   Zset_clone_namer   r   Zpreparer   r)   r   r   Zget_xmlZstart_duplicateZ	get_meterZname)	r   r   r   r	   r   Zforce_targetsZskip_targetsr   Zruns	   &        r   mainr/      s   lGMM44W__GM\7=='--@'"OOGMM"NN7>>"W__48D#(:(:e(C?	
 %W-HDG,F
tGOO,-
tGOO,-
d7>>*+#g../g//0NN((bM$$**L((*===0((*==</((*	 + 557H++- 8   !!88:g../<	
 '"7#
NNF
C  V%%--/$?
s}}/RQ9:V=M=M=R=RRSr   c                  s6    \         P                  ! \        4       4       R #   \         d,   p \         P                  ! T P                  4        R p ? R # R p ? i\
         d    \        \        R4      4        R # \         d   p\        T4        R p?R # R p?ii ; i)Nz$Installation aborted at user request)
sysZexitr/   Z
SystemExitZcodeZKeyboardInterruptr   r   Z	Exceptionr   )Zsys_eZmain_es     r   runclir1      sa      @Q=>? Vs2   " B AB B8BBBB)N)r,   r0   r.   r   r   r   r   r   r   r   r   r   r   r-   r/   r1   ) r   r   <module>r2      sA     
  1 1 	($LaHHVr   