File tree 4 files changed +17
-16
lines changed 4 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ require (
18
18
github.com/docker/go-events v0.0.0-20170721190031-9461782956ad // indirect
19
19
github.com/docker/go-metrics v0.0.0-20181218153428-b84716841b82 // indirect
20
20
github.com/docker/go-units v0.3.3
21
- github.com/firecracker-microvm/firecracker-go-sdk v0.17.1-0.20190920221449-6afccc1d121f
21
+ github.com/firecracker-microvm/firecracker-go-sdk v0.17.1-0.20191014182425-56995a05946a
22
22
github.com/go-ole/go-ole v1.2.4 // indirect
23
23
github.com/godbus/dbus v0.0.0-20181025153459-66d97aec3384 // indirect
24
24
github.com/gofrs/uuid v3.2.0+incompatible
Original file line number Diff line number Diff line change @@ -59,8 +59,8 @@ github.com/docker/go-metrics v0.0.0-20181218153428-b84716841b82 h1:X0fj836zx99zF
59
59
github.com/docker/go-metrics v0.0.0-20181218153428-b84716841b82 /go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI =
60
60
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk =
61
61
github.com/docker/go-units v0.3.3 /go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk =
62
- github.com/firecracker-microvm/firecracker-go-sdk v0.17.1-0.20190920221449-6afccc1d121f h1:G81Ey0lQDWCqwdIRq6aLN5RyYbnSDx2O7FKFl433shc =
63
- github.com/firecracker-microvm/firecracker-go-sdk v0.17.1-0.20190920221449-6afccc1d121f /go.mod h1:tVXziw7GjioCKVjI5/agymYxUaqJM6q7cp9e6kwjo8Q =
62
+ github.com/firecracker-microvm/firecracker-go-sdk v0.17.1-0.20191014182425-56995a05946a h1:WK1TpnYdiXA8Kb5UMMkybaZtlo+F1a2QeBmqCJHWeTE =
63
+ github.com/firecracker-microvm/firecracker-go-sdk v0.17.1-0.20191014182425-56995a05946a /go.mod h1:tVXziw7GjioCKVjI5/agymYxUaqJM6q7cp9e6kwjo8Q =
64
64
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb h1:D4uzjWwKYQ5XnAvUbuvHW93esHg7F8N/OYeBBcJoTr0 =
65
65
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb /go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q =
66
66
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI =
Original file line number Diff line number Diff line change @@ -140,6 +140,15 @@ func rateLimiterFromProto(rl *proto.FirecrackerRateLimiter) *models.RateLimiter
140
140
return & result
141
141
}
142
142
143
+ func withRateLimiterFromProto (rl * proto.FirecrackerRateLimiter ) firecracker.DriveOpt {
144
+ if rl == nil {
145
+ return func (d * models.Drive ) {
146
+ // no-op
147
+ }
148
+ }
149
+ return firecracker .WithRateLimiter (* rateLimiterFromProto (rl ))
150
+ }
151
+
143
152
// tokenBucketFromProto creates a firecracker TokenBucket object from the
144
153
// protobuf message.
145
154
func tokenBucketFromProto (bucket * proto.FirecrackerTokenBucket ) * models.TokenBucket {
Original file line number Diff line number Diff line change @@ -672,20 +672,12 @@ func (s *service) buildNonStubDrives(req *proto.CreateVMRequest) []models.Drive
672
672
var builder firecracker.DrivesBuilder
673
673
674
674
if input := req .RootDrive ; input != nil {
675
- builder = firecracker.DrivesBuilder {}.
676
- WithRootDrive (input .PathOnHost , func (d * models.Drive ) {
677
- d .IsReadOnly = firecracker .Bool (! input .IsWritable )
678
- d .Partuuid = input .Partuuid
679
-
680
- if limiter := input .RateLimiter ; limiter != nil {
681
- d .RateLimiter = rateLimiterFromProto (limiter )
682
- }
683
- })
675
+ builder = builder .WithRootDrive (input .PathOnHost ,
676
+ firecracker .WithReadOnly (! input .IsWritable ),
677
+ firecracker .WithPartuuid (input .Partuuid ),
678
+ withRateLimiterFromProto (input .RateLimiter ))
684
679
} else {
685
- builder = firecracker.DrivesBuilder {}.
686
- WithRootDrive (s .config .RootDrive , func (d * models.Drive ) {
687
- d .IsReadOnly = firecracker .Bool (true )
688
- })
680
+ builder = builder .WithRootDrive (s .config .RootDrive , firecracker .WithReadOnly (true ))
689
681
}
690
682
691
683
for _ , drive := range req .AdditionalDrives {
You can’t perform that action at this time.
0 commit comments