def after_VBD_create(vbd_ref, vbd_rec):
 vbd_rec['currently_attached'] = False
 vbd_rec['device'] = ''
 vm_ref = vbd_rec['VM']
 vm_rec = _db_content['VM'][vm_ref]
 vm_rec['VBDs'].append(vbd_ref)
 vdi_ref = vbd_rec['VDI']
 vdi_rec = _db_content['VDI'][vdi_ref]
 vdi_rec['VBDs'].append(vbd_ref)
 vm_name_label = _db_content['VM'][vm_ref]['name_label']
 vbd_rec['vm_name_label'] = vm_name_label

def after_VBD_create ( vbd_ref , vbd_rec ) : vbd_rec [ 'currently_attached' ] = False vbd_rec [ 'device' ] = '' vm_ref = vbd_rec [ 'VM' ] vm_rec = _db_content [ 'VM' ] [ vm_ref ] vm_rec [ 'VBDs' ] . append ( vbd_ref ) vdi_ref = vbd_rec [ 'VDI' ] vdi_rec = _db_content [ 'VDI' ] [ vdi_ref ] vdi_rec [ 'VBDs' ] . append ( vbd_ref ) vm_name_label = _db_content [ 'VM' ] [ vm_ref ] [ 'name_label' ] vbd_rec [ 'vm_name_label' ] = vm_name_label
create read-only fields and backref from vm and vdi to vbd when vbd is created .