diff options
| author | Masanori Itoh <itoumsn@nttdata.co.jp> | 2011-03-06 22:33:07 +0900 |
|---|---|---|
| committer | Masanori Itoh <itoumsn@nttdata.co.jp> | 2011-03-06 22:33:07 +0900 |
| commit | fbecb23c5534ccc91aa6f9d3d9e32d9d6189d266 (patch) | |
| tree | a9b1e8186c56bcadf8ef54701c8661fc69ad67bc /nova/api | |
| parent | 0265cf6f3f60e1354610064340cc1b21dfa79353 (diff) | |
| parent | 9610c61055ab84038becf4af0b63bab9071a900a (diff) | |
| download | nova-fbecb23c5534ccc91aa6f9d3d9e32d9d6189d266.tar.gz nova-fbecb23c5534ccc91aa6f9d3d9e32d9d6189d266.tar.xz nova-fbecb23c5534ccc91aa6f9d3d9e32d9d6189d266.zip | |
Merged to trunk rev 760, and fixed comment line indent according to Jay's comment.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/__init__.py | 2 | ||||
| -rw-r--r-- | nova/api/ec2/apirequest.py | 18 | ||||
| -rw-r--r-- | nova/api/ec2/cloud.py | 4 |
3 files changed, 20 insertions, 4 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index 5a63dc8da..4425ba3cd 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -198,7 +198,7 @@ class Requestify(wsgi.Middleware): try: # Raise KeyError if omitted action = req.params['Action'] - # Fix bug lp:720157 for older (version 1) clients + # Fix bug lp:720157 for older (version 1) clients version = req.params['SignatureVersion'] if int(version) == 1: non_args.remove('SignatureMethod') diff --git a/nova/api/ec2/apirequest.py b/nova/api/ec2/apirequest.py index 2b1acba5a..d7ad08d2f 100644 --- a/nova/api/ec2/apirequest.py +++ b/nova/api/ec2/apirequest.py @@ -52,7 +52,23 @@ def _database_to_isoformat(datetimeobj): def _try_convert(value): - """Return a non-string if possible""" + """Return a non-string from a string or unicode, if possible. + + ============= ===================================================== + When value is returns + ============= ===================================================== + zero-length '' + 'None' None + 'True' True + 'False' False + '0', '-0' 0 + 0xN, -0xN int from hex (postitive) (N is any number) + 0bN, -0bN int from binary (positive) (N is any number) + * try conversion to int, float, complex, fallback value + + """ + if len(value) == 0: + return '' if value == 'None': return None if value == 'True': diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index c6309f03c..0d22a3f46 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -838,14 +838,14 @@ class CloudController(object): self.compute_api.unrescue(context, instance_id=instance_id) return True - def update_instance(self, context, ec2_id, **kwargs): + def update_instance(self, context, instance_id, **kwargs): updatable_fields = ['display_name', 'display_description'] changes = {} for field in updatable_fields: if field in kwargs: changes[field] = kwargs[field] if changes: - instance_id = ec2_id_to_id(ec2_id) + instance_id = ec2_id_to_id(instance_id) self.compute_api.update(context, instance_id=instance_id, **kwargs) return True |
