Merge lp:~therve/txaws/volume-zone into lp:txaws

Proposed by Thomas Herve
Status: Merged
Merged at revision: not available
Proposed branch: lp:~therve/txaws/volume-zone
Merge into: lp:txaws
Diff against target: 186 lines
4 files modified
txaws/ec2/client.py (+12/-8)
txaws/ec2/model.py (+6/-5)
txaws/ec2/tests/test_client.py (+8/-6)
txaws/testing/payload.py (+4/-3)
To merge this branch: bzr merge lp:~therve/txaws/volume-zone
Reviewer Review Type Date Requested Status
Duncan McGreggor Approve
Review via email: mp+12241@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Thomas Herve (therve) wrote :

Fairly trivial change, I think, although will break code using Volume directly.

lp:~therve/txaws/volume-zone updated
24. By Thomas Herve

Also move the snapshot id

25. By Thomas Herve

Add a test for the device

26. By Thomas Herve

Merge from trunk, resolve conflicts

Revision history for this message
Duncan McGreggor (oubiwann) wrote :

> Fairly trivial change, I think, although will break code using Volume
> directly.

+1

Due to the fact that we're basically in the process of developing the txAWS API, I think it's fine to be breaking usage that was only added a few weeks ago. Once we're feature-complete, we can worry about backwards compatibility with previous versions of txAWS.

Revision history for this message
Duncan McGreggor (oubiwann) wrote :

Woops -- forgot to set the "approve" status.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'txaws/ec2/client.py'
2--- txaws/ec2/client.py 2009-09-25 05:26:19 +0000
3+++ txaws/ec2/client.py 2009-09-29 14:11:55 +0000
4@@ -423,23 +423,24 @@
5 volume_id = volume_data.findtext("volumeId")
6 size = int(volume_data.findtext("size"))
7 status = volume_data.findtext("status")
8+ availability_zone = volume_data.findtext("availabilityZone")
9+ snapshot_id = volume_data.findtext("snapshotId")
10 create_time = volume_data.findtext("createTime")
11 create_time = datetime.strptime(
12 create_time[:19], "%Y-%m-%dT%H:%M:%S")
13- volume = model.Volume(volume_id, size, status, create_time)
14+ volume = model.Volume(
15+ volume_id, size, status, create_time, availability_zone,
16+ snapshot_id)
17 result.append(volume)
18 for attachment_data in volume_data.find("attachmentSet"):
19 instance_id = attachment_data.findtext("instanceId")
20- snapshot_id = attachment_data.findtext("snapshotId")
21- availability_zone = attachment_data.findtext(
22- "availabilityZone")
23 status = attachment_data.findtext("status")
24+ device = attachment_data.findtext("device")
25 attach_time = attachment_data.findtext("attachTime")
26 attach_time = datetime.strptime(
27 attach_time[:19], "%Y-%m-%dT%H:%M:%S")
28 attachment = model.Attachment(
29- instance_id, snapshot_id, availability_zone, status,
30- attach_time)
31+ instance_id, device, status, attach_time)
32 volume.attachments.append(attachment)
33 return result
34
35@@ -464,9 +465,13 @@
36 size = int(root.findtext("size"))
37 status = root.findtext("status")
38 create_time = root.findtext("createTime")
39+ availability_zone = root.findtext("availabilityZone")
40+ snapshot_id = root.findtext("snapshotId")
41 create_time = datetime.strptime(
42 create_time[:19], "%Y-%m-%dT%H:%M:%S")
43- volume = model.Volume(volume_id, size, status, create_time)
44+ volume = model.Volume(
45+ volume_id, size, status, create_time, availability_zone,
46+ snapshot_id)
47 return volume
48
49 def delete_volume(self, volume_id):
50@@ -579,7 +584,6 @@
51 return d.addCallback(self._parse_create_keypair)
52
53 def _parse_create_keypair(self, xml_bytes):
54- results = []
55 keypair_data = XML(xml_bytes)
56 key_name = keypair_data.findtext("keyName")
57 key_fingerprint = keypair_data.findtext("keyFingerprint")
58
59=== modified file 'txaws/ec2/model.py'
60--- txaws/ec2/model.py 2009-09-15 20:59:43 +0000
61+++ txaws/ec2/model.py 2009-09-29 14:11:55 +0000
62@@ -103,22 +103,23 @@
63 class Volume(object):
64 """An EBS volume instance."""
65
66- def __init__(self, id, size, status, create_time):
67+ def __init__(self, id, size, status, create_time, availability_zone,
68+ snapshot_id):
69 self.id = id
70 self.size = size
71 self.status = status
72 self.create_time = create_time
73+ self.availability_zone = availability_zone
74+ self.snapshot_id = snapshot_id
75 self.attachments = []
76
77
78 class Attachment(object):
79 """An attachment of a L{Volume}."""
80
81- def __init__(self, instance_id, snapshot_id, availability_zone, status,
82- attach_time):
83+ def __init__(self, instance_id, device, status, attach_time):
84 self.instance_id = instance_id
85- self.snapshot_id = snapshot_id
86- self.availability_zone = availability_zone
87+ self.device = device
88 self.status = status
89 self.attach_time = attach_time
90
91
92=== modified file 'txaws/ec2/tests/test_client.py'
93--- txaws/ec2/tests/test_client.py 2009-09-25 05:20:01 +0000
94+++ txaws/ec2/tests/test_client.py 2009-09-29 14:11:55 +0000
95@@ -445,7 +445,7 @@
96 "WebServers", ip_protocol="tcp", from_port="22")
97 except Exception, error:
98 self.assertEquals(
99- str(error),
100+ str(error),
101 ("You must specify either both group parameters or all the "
102 "ip parameters."))
103
104@@ -575,7 +575,7 @@
105 "WebServers", ip_protocol="tcp", from_port="22")
106 except Exception, error:
107 self.assertEquals(
108- str(error),
109+ str(error),
110 ("You must specify either both group parameters or all the "
111 "ip parameters."))
112
113@@ -645,14 +645,15 @@
114 self.assertEquals(volume.id, "vol-4282672b")
115 self.assertEquals(volume.size, 800)
116 self.assertEquals(volume.status, "in-use")
117+ self.assertEquals(volume.availability_zone, "us-east-1a")
118+ self.assertEquals(volume.snapshot_id, "snap-12345678")
119 create_time = datetime(2008, 05, 07, 11, 51, 50)
120 self.assertEquals(volume.create_time, create_time)
121 self.assertEquals(len(volume.attachments), 1)
122 attachment = volume.attachments[0]
123 self.assertEquals(attachment.instance_id, "i-6058a509")
124- self.assertEquals(attachment.snapshot_id, "snap-12345678")
125- self.assertEquals(attachment.availability_zone, "us-east-1a")
126 self.assertEquals(attachment.status, "attached")
127+ self.assertEquals(attachment.device, u"/dev/sdh")
128 attach_time = datetime(2008, 05, 07, 12, 51, 50)
129 self.assertEquals(attachment.attach_time, attach_time)
130
131@@ -759,6 +760,7 @@
132 def check_parsed_volume(volume):
133 self.assertEquals(volume.id, "vol-4d826724")
134 self.assertEquals(volume.size, 800)
135+ self.assertEquals(volume.snapshot_id, "")
136 create_time = datetime(2008, 05, 07, 11, 51, 50)
137 self.assertEquals(volume.create_time, create_time)
138
139@@ -1222,7 +1224,7 @@
140 "Message for Error.Code")
141 self.assertEquals(error.status, status)
142 self.assertEquals(error.response, payload.sample_ec2_error_message)
143-
144+
145 query = client.Query(
146 'BadQuery', self.creds, self.endpoint,
147 time_tuple=(2009,8,15,13,14,15,0,0,0))
148@@ -1248,7 +1250,7 @@
149 self.assertFalse(isinstance(error, EC2Error))
150 self.assertEquals(error.status, status)
151 self.assertEquals(str(error), "500 There's been an error")
152-
153+
154 query = client.Query(
155 'BadQuery', self.creds, self.endpoint,
156 time_tuple=(2009,8,15,13,14,15,0,0,0))
157
158=== modified file 'txaws/testing/payload.py'
159--- txaws/testing/payload.py 2009-09-25 20:17:52 +0000
160+++ txaws/testing/payload.py 2009-09-29 14:11:55 +0000
161@@ -233,7 +233,7 @@
162 </Errors>
163 <RequestID>89c977b5-22da-4c68-9148-9e0ebce5f68e</RequestID>
164 </Response>
165-"""
166+"""
167
168 sample_delete_security_group = """\
169 <DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/%s/">
170@@ -279,13 +279,14 @@
171 <size>800</size>
172 <status>in-use</status>
173 <createTime>2008-05-07T11:51:50.000Z</createTime>
174+ <availabilityZone>us-east-1a</availabilityZone>
175+ <snapshotId>snap-12345678</snapshotId>
176 <attachmentSet>
177 <item>
178 <volumeId>vol-4282672b</volumeId>
179 <instanceId>i-6058a509</instanceId>
180 <size>800</size>
181- <snapshotId>snap-12345678</snapshotId>
182- <availabilityZone>us-east-1a</availabilityZone>
183+ <device>/dev/sdh</device>
184 <status>attached</status>
185 <attachTime>2008-05-07T12:51:50.000Z</attachTime>
186 </item>

Subscribers

People subscribed via source and target branches

to all changes: