diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-05-14 02:14:26 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-05-14 02:14:26 +0000 |
| commit | 8b1b2acca63f779d33af12a8e2f4b725e7de7514 (patch) | |
| tree | 9d7d6b9ceeb0aea6262a8fbc94375c1264a74f2f /nova | |
| parent | 7f1dadf5e80b7fcdc111c80ac07d044b3c236528 (diff) | |
| parent | f53df8c4f50437eb7568979636c7503fcd43afee (diff) | |
Merge "Fix format error in claims."
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/compute/claims.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/nova/compute/claims.py b/nova/compute/claims.py index fc170839f..935c0f2aa 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 |
