Merge lp:~niemeyer/goamz/run-with-devices into lp:goamz
Proposed by
Gustavo Niemeyer
Status: | Merged |
---|---|
Merged at revision: | 43 |
Proposed branch: | lp:~niemeyer/goamz/run-with-devices |
Merge into: | lp:goamz |
Diff against target: |
85 lines (+42/-1) 2 files modified
ec2/ec2.go (+26/-1) ec2/ec2_test.go (+16/-0) |
To merge this branch: | bzr merge lp:~niemeyer/goamz/run-with-devices |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
goamz maintainers | Pending | ||
Review via email: mp+166428@code.launchpad.net |
Description of the change
ec2: support RunInstances with BlockDeviceMappings
To post a comment you must log in.
Reviewers: mp+166428_ code.launchpad. net,
Message:
Please take a look.
Description:
ec2: support RunInstances with BlockDeviceMappings
https:/ /code.launchpad .net/~niemeyer/ goamz/run- with-devices/ +merge/ 166428
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/9860044/
Affected files:
A [revision details]
M ec2/ec2.go
M ec2/ec2_test.go
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: ec2/ec2.go rmination bool pping
=== modified file 'ec2/ec2.go'
--- ec2/ec2.go 2013-05-23 01:06:45 +0000
+++ ec2/ec2.go 2013-05-30 03:05:27 +0000
@@ -209,6 +209,7 @@
DisableAPITe
ShutdownBehavior string
PrivateIPAddress string
+ BlockDeviceMappings []BlockDeviceMa
}
// Response to a RunInstances request. BlockDeviceMapp ings { "BlockDeviceMap ping."+ n+".DeviceName" ] = b.DeviceName "BlockDeviceMap ping."+ n+".VirtualName "] = b.VirtualName "BlockDeviceMap ping."+ n+".Ebs. SnapshotId" ] = b.SnapshotId "BlockDeviceMap ping."+ n+".Ebs. VolumeType" ] = b.VolumeType "BlockDeviceMap ping."+ n+".Ebs. VolumeSize" ] = FormatInt( b.VolumeSize, 10) "BlockDeviceMap ping."+ n+".Ebs. Iops"] = strconv. FormatInt( b.IOPS, nation { "BlockDeviceMap ping."+ n+".Ebs. DeleteOnTermina tion"] = "true" snapshotId" ` volumeType" ` volumeSize" ` volumeSize" ` // Size is given in GB ination bool `xml:"ebs> deleteOnTermina tion"`
@@ -275,6 +276,30 @@
j++
}
}
+ for i, b := range options.
+ n := strconv.Itoa(i + 1)
+ if b.DeviceName != "" {
+ params[
+ }
+ if b.VirtualName != "" {
+ params[
+ }
+ if b.SnapshotId != "" {
+ params[
+ }
+ if b.VolumeType != "" {
+ params[
+ }
+ if b.VolumeSize > 0 {
+ params[
strconv.
+ }
+ if b.IOPS > 0 {
+ params[
10)
+ }
+ if b.DeleteOnTermi
+ params[
+ }
+ }
token, err := clientToken()
if err != nil {
return nil, err
@@ -429,7 +454,7 @@
VirtualName string `xml:"virtualName"`
SnapshotId string `xml:"ebs>
VolumeType string `xml:"ebs>
- VolumeSize int64 `xml:"ebs>
+ VolumeSize int64 `xml:"ebs>
DeleteOnTerm
// The number of I/O operations per second (IOPS) that the volume
supports.
Index: ec2/ec2_test.go ermination: true, avior: "terminate", dress: "10.0.0.25", ings: []ec2.BlockDevi ceMapping{ { tion: true, ces(&options)
=== modified file 'ec2/ec2_test.go'
--- ec2/ec2_test.go 2013-05-23 02:56:41 +0000
+++ ec2/ec2_test.go 2013-05-30 03:05:27 +0000
@@ -96,6 +96,15 @@
DisableAPIT
ShutdownBeh
PrivateIPAd
+ BlockDeviceMapp
+ DeviceName: "device-name",
+ VirtualName: "virtual-name",
+ SnapshotId: "snapshot-id",
+ VolumeType: "volume-type",
+ VolumeSize: 10,
+ DeleteOnTermina
+ IOPS: 1000,
+ }},
}
resp, err := s.ec2.RunInstan
@@ -120,6 +129,13 @@ req.Form[ "DisableApiTerm ination" ], DeepEquals, []string{"true"}) req.Form[ "InstanceInitia tedShutdownBeha vior"], DeepEquals,
c.Assert(
c.Assert(
[]stri...