def compute_node_utilization_update(context, host, free_ram_mb_delta=0, free_disk_gb_delta=0, work_delta=0, vm_delta=0):
 session = get_session()
 compute_node = None
 with session.begin(subtransactions=True):
  compute_node = session.query(models.ComputeNode).options(joinedload('service')).filter((models.Service.host == host)).filter_by(deleted=False).with_lockmode('update').first()
  if (compute_node is None):
   raise exception.NotFound((_('No ComputeNode for %(host)s') % locals()))
  table = models.ComputeNode.__table__
  if (free_ram_mb_delta != 0):
   compute_node.free_ram_mb = (table.c.free_ram_mb + free_ram_mb_delta)
  if (free_disk_gb_delta != 0):
   compute_node.free_disk_gb = (table.c.free_disk_gb + free_disk_gb_delta)
  if (work_delta != 0):
   compute_node.current_workload = (table.c.current_workload + work_delta)
  if (vm_delta != 0):
   compute_node.running_vms = (table.c.running_vms + vm_delta)
 return compute_node

def compute_node_utilization_update ( context , host , free_ram_mb_delta = 0 , free_disk_gb_delta = 0 , work_delta = 0 , vm_delta = 0 ) : session = get_session ( ) compute_node = None with session . begin ( subtransactions = True ) : compute_node = session . query ( models . ComputeNode ) . options ( joinedload ( 'service' ) ) . filter ( ( models . Service . host == host ) ) . filter_by ( deleted = False ) . with_lockmode ( 'update' ) . first ( ) if ( compute_node is None ) : raise exception . NotFound ( ( _ ( 'No ComputeNode for %(host)s' ) % locals ( ) ) ) table = models . ComputeNode . __table__ if ( free_ram_mb_delta != 0 ) : compute_node . free_ram_mb = ( table . c . free_ram_mb + free_ram_mb_delta ) if ( free_disk_gb_delta != 0 ) : compute_node . free_disk_gb = ( table . c . free_disk_gb + free_disk_gb_delta ) if ( work_delta != 0 ) : compute_node . current_workload = ( table . c . current_workload + work_delta ) if ( vm_delta != 0 ) : compute_node . running_vms = ( table . c . running_vms + vm_delta ) return compute_node
update a specific computenode entry by a series of deltas .