def auto_configure_disk(session, vdi_ref, new_gb):
 with vdi_attached_here(session, vdi_ref, read_only=False) as dev:
  partitions = _get_partitions(dev)
  if (len(partitions) != 1):
   return
  (_num, start, old_sectors, ptype) = partitions[0]
  if (ptype in ('ext3', 'ext4')):
   new_sectors = ((((new_gb * 1024) * 1024) * 1024) / SECTOR_SIZE)
   _resize_part_and_fs(dev, start, old_sectors, new_sectors)

def auto_configure_disk ( session , vdi_ref , new_gb ) : with vdi_attached_here ( session , vdi_ref , read_only = False ) as dev : partitions = _get_partitions ( dev ) if ( len ( partitions ) != 1 ) : return ( _num , start , old_sectors , ptype ) = partitions [ 0 ] if ( ptype in ( 'ext3' , 'ext4' ) ) : new_sectors = ( ( ( ( new_gb * 1024 ) * 1024 ) * 1024 ) / SECTOR_SIZE ) _resize_part_and_fs ( dev , start , old_sectors , new_sectors )
partition and resize fs to match the size specified by instance_types .