diff options
| author | Isaku Yamahata <yamahata@valinux.co.jp> | 2011-05-27 11:07:45 +0900 |
|---|---|---|
| committer | Isaku Yamahata <yamahata@valinux.co.jp> | 2011-05-27 11:07:45 +0900 |
| commit | 9c3411c13936438964cc8a21b031c819edbd0ed1 (patch) | |
| tree | 0c53df89ead54e143a45c02b7688345dda364116 /nova/api | |
| parent | b802f28c0b24a04e7c12f44d18e90792ce9ee13b (diff) | |
teach ec2 parser multi dot-separted argument
nova.api.ec2.apirequest.APIRequest knows only single dot-separated
arguments.
EBS boot uses multi dot-separeted arguments like
BlockDeviceMapping.1.DeviceName=snap-id
This patch teaches the parser those argument as the preparetion for ebs boot
support.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/apirequest.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/nova/api/ec2/apirequest.py b/nova/api/ec2/apirequest.py index 94900dfbd..4d6aa7f0a 100644 --- a/nova/api/ec2/apirequest.py +++ b/nova/api/ec2/apirequest.py @@ -133,11 +133,18 @@ class APIRequest(object): # NOTE(vish): Automatically convert strings back # into their respective values value = _try_convert(value) - if len(parts) > 1: - d = args.get(key, {}) - d[parts[1]] = value - value = d - args[key] = value + + if len(parts) > 1: + d = args.get(key, {}) + args[key] = d + for k in parts[1:-1]: + k = _camelcase_to_underscore(k) + v = d.get(k, {}) + d[k] = v + d = v + d[_camelcase_to_underscore(parts[-1])] = value + else: + args[key] = value for key in args.keys(): # NOTE(vish): Turn numeric dict keys into lists |
