diff options
| author | Eoghan Glynn <eglynn@redhat.com> | 2013-06-24 18:36:13 +0000 |
|---|---|---|
| committer | Eoghan Glynn <eglynn@redhat.com> | 2013-06-24 19:42:44 +0100 |
| commit | 52e3f6ffe188a82a67fdd573bb03ab1d9b0b95b4 (patch) | |
| tree | 00d096c65fc16708facfe65d9ec76553fa10c755 /ceilometerclient | |
| parent | ff77aeea56872be38914c851926af1fb504dba5f (diff) | |
| download | python-ceilometerclient-1.0.1.tar.gz | |
Avoid unnecessary GET of existing alarm for update1.0.1
The existing alarm representation is retrieved prior to update,
which is uneccessary as the API merges the new and existing
state in any case.
This change saves the threshold eval logic one unnecessary API
call per state transition.
Change-Id: If21c53d6f43164315e1e70e62b0c70520fb5a45c
Diffstat (limited to 'ceilometerclient')
| -rw-r--r-- | ceilometerclient/v2/alarms.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/ceilometerclient/v2/alarms.py b/ceilometerclient/v2/alarms.py index 6524c8d..6a8529b 100644 --- a/ceilometerclient/v2/alarms.py +++ b/ceilometerclient/v2/alarms.py @@ -64,11 +64,8 @@ class AlarmManager(base.Manager): return self._create(self._path(), new) def update(self, alarm_id, **kwargs): - existing = self.get(alarm_id) - updated = existing.to_dict() - for (key, value) in kwargs.items(): - if key in updated and key in UPDATABLE_ATTRIBUTES: - updated[key] = value + updated = dict((key, value) for (key, value) in kwargs.items() + if key in UPDATABLE_ATTRIBUTES) return self._update(self._path(alarm_id), updated) def delete(self, alarm_id): |
