#NEWLINE# def do_copyimage( self , os_id ) : #NEWLINE# #INDENT# LOG . debug ( '--- Copying images (do_copyimage) ---' ) #NEWLINE# for image in self . driver . image_scheme . get_os_images ( os_id ) : #NEWLINE# #INDENT# LOG . debug ( ( 'Processing image: %s' % image . uri ) ) #NEWLINE# processing = au . Chain ( ) #NEWLINE# LOG . debug ( ( 'Appending uri processor: %s' % image . uri ) ) #NEWLINE# processing . append ( image . uri ) #NEWLINE# if image . uri . startswith ( 'http://' ) : #NEWLINE# #INDENT# LOG . debug ( 'Appending HTTP processor' ) #NEWLINE# processing . append ( au . HttpUrl ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if image . uri . startswith ( 'file://' ) : #NEWLINE# #INDENT# LOG . debug ( 'Appending FILE processor' ) #NEWLINE# processing . append ( au . LocalFile ) #NEWLINE# #UNINDENT# #UNINDENT# if ( image . container == 'gzip' ) : #NEWLINE# #INDENT# LOG . debug ( 'Appending GZIP processor' ) #NEWLINE# processing . append ( au . GunzipStream ) #NEWLINE# #UNINDENT# LOG . debug ( ( 'Appending TARGET processor: %s' % image . target_device ) ) #NEWLINE# target = self . driver . partition_scheme . fs_by_mount ( image . target_device , os_id = os_id ) . device #NEWLINE# processing . append ( target ) #NEWLINE# LOG . debug ( 'Launching image processing chain' ) #NEWLINE# processing . process ( ) #NEWLINE# if ( image . size and image . md5 ) : #NEWLINE# #INDENT# LOG . debug ( 'Trying to compare image checksum' ) #NEWLINE# actual_md5 = utils . calculate_md5 ( image . target_device , image . size ) #NEWLINE# if ( actual_md5 == image . md5 ) : #NEWLINE# #INDENT# LOG . debug ( ( 'Checksum matches successfully: md5=%s' % actual_md5 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise errors . ImageChecksumMismatchError ( ( 'Actual checksum %s mismatches with expected %s for file %s' % ( actual_md5 , image . md5 , image . target_device ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# LOG . debug ( 'Skipping image checksum comparing. Ether size or hash have been missed' ) #NEWLINE# #UNINDENT# LOG . debug ( 'Extending image file systems' ) #NEWLINE# if ( image . format in ( 'ext2' , 'ext3' , 'ext4' , 'xfs' ) ) : #NEWLINE# #INDENT# LOG . debug ( ( 'Extending %s %s' % ( image . format , image . target_device ) ) ) #NEWLINE# fu . extend_fs ( image . format , image . target_device ) #NEWLINE# #UNINDENT# fu . change_uuid ( target )