diff --git a/nova/compute/claims.py b/nova/compute/claims.py index fc170839ffa6..935c0f2aa275 100644 --- a/nova/compute/claims.py +++ b/nova/compute/claims.py @@ -159,28 +159,33 @@ class Claim(NopClaim): """Test if the given type of resource needed for a claim can be safely allocated. """ - msg = _("Total %(type_)s: %(total)d %(unit)s, used: %(used)d %(unit)s") - LOG.audit(msg % locals(), instance=self.instance) + LOG.audit(_('Total %(type)s: %(total)d %(unit)s, used: %(used).02f ' + '%(unit)s'), + {'type': type_, 'total': total, 'unit': unit, 'used': used}, + instance=self.instance) if limit is None: # treat resource as unlimited: - LOG.audit(_("%(type_)s limit not specified, defaulting to " - "unlimited") % locals(), instance=self.instance) + LOG.audit(_('%(type)s limit not specified, defaulting to ' + 'unlimited'), {'type': type_}, instance=self.instance) return True free = limit - used # Oversubscribed resource policy info: - msg = _("%(type_)s limit: %(limit)d %(unit)s, free: %(free)d " - "%(unit)s") % locals() - LOG.audit(msg, instance=self.instance) + LOG.audit(_('%(type)s limit: %(limit).02f %(unit)s, free: %(free).02f ' + '%(unit)s'), + {'type': type_, 'limit': limit, 'free': free, 'unit': unit}, + instance=self.instance) can_claim = requested <= free if not can_claim: - msg = _("Unable to claim resources. Free %(type_)s %(free)d " - "%(unit)s < requested %(requested)d %(unit)s") % locals() - LOG.info(msg, instance=self.instance) + LOG.info(_('Unable to claim resources. Free %(type)s %(free).02f ' + '%(unit)s < requested %(requested)d %(unit)s'), + {'type': type_, 'free': free, 'unit': unit, + 'requested': requested}, + instance=self.instance) return can_claim