#NEWLINE# def test_recalculates_vg_sizes_when_disks_volumes_size_update( self ) : #NEWLINE# #INDENT# node_db = self . create_node ( ) #NEWLINE# disks = self . get ( node_db . id ) #NEWLINE# vgs_before_update = filter ( ( lambda volume : ( volume . get ( 'type' ) == 'vg' ) ) , VolumeManagerExtension . get_node_volumes ( node_db ) ) #NEWLINE# new_volume_size = 4200 #NEWLINE# updated_disks_count = 0 #NEWLINE# for disk in disks : #NEWLINE# #INDENT# if ( disk [ 'size' ] > 0 ) : #NEWLINE# #INDENT# for volume in disk [ 'volumes' ] : #NEWLINE# #INDENT# volume [ 'size' ] = new_volume_size #NEWLINE# #UNINDENT# updated_disks_count += 1 #NEWLINE# #UNINDENT# #UNINDENT# self . put ( node_db . id , disks ) #NEWLINE# vgs_after_update = filter ( ( lambda volume : ( volume . get ( 'type' ) == 'vg' ) ) , VolumeManagerExtension . get_node_volumes ( node_db ) ) #NEWLINE# for ( vg_before , vg_after ) in zip ( vgs_before_update , vgs_after_update ) : #NEWLINE# #INDENT# size_volumes_before = sum ( [ volume . get ( 'size' , 0 ) for volume in vg_before [ 'volumes' ] ] ) #NEWLINE# size_volumes_after = sum ( [ volume . get ( 'size' , 0 ) for volume in vg_after [ 'volumes' ] ] ) #NEWLINE# self . assertNotEqual ( size_volumes_before , size_volumes_after ) #NEWLINE# volume_group_size = ( disk * updated_disks_count ) #NEWLINE# self . assertEqual ( size_volumes_after , volume_group_size )