Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(600)

Delta Between Two Patch Sets: provider/joyent/environ_instance.go

Issue 97400043: Change StopInstances to take []instance.Id
Left Patch Set: Created 9 years, 10 months ago
Right Patch Set: Change StopInstances to take []instance.Id Created 9 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « provider/ec2/live_test.go ('k') | provider/joyent/instance.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2013 Joyent Inc. 1 // Copyright 2013 Joyent Inc.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package joyent 4 package joyent
5 5
6 import ( 6 import (
7 "fmt" 7 "fmt"
8 "strings" 8 "strings"
9 "sync" 9 "sync"
10 "time" 10 "time"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 return instances, nil 225 return instances, nil
226 } 226 }
227 227
228 // AllocateAddress requests a new address to be allocated for the 228 // AllocateAddress requests a new address to be allocated for the
229 // given instance on the given network. This is not implemented on the 229 // given instance on the given network. This is not implemented on the
230 // Joyent provider yet. 230 // Joyent provider yet.
231 func (*joyentEnviron) AllocateAddress(_ instance.Id, _ network.Id) (instance.Add ress, error) { 231 func (*joyentEnviron) AllocateAddress(_ instance.Id, _ network.Id) (instance.Add ress, error) {
232 return instance.Address{}, errors.NotImplementedf("AllocateAddress") 232 return instance.Address{}, errors.NotImplementedf("AllocateAddress")
233 } 233 }
234 234
235 func (env *joyentEnviron) StopInstances(ids []instance.Id) error { 235 func (env *joyentEnviron) StopInstances(ids ...instance.Id) error {
236 // Remove all the instances in parallel so that we incur less round-trip s. 236 // Remove all the instances in parallel so that we incur less round-trip s.
237 var wg sync.WaitGroup 237 var wg sync.WaitGroup
238 //var err error 238 //var err error
239 wg.Add(len(ids)) 239 wg.Add(len(ids))
240 errc := make(chan error, len(ids)) 240 errc := make(chan error, len(ids))
241 for _, id := range ids { 241 for _, id := range ids {
242 id := id // copy to new free var for closure 242 id := id // copy to new free var for closure
243 go func() { 243 go func() {
244 defer wg.Done() 244 defer wg.Done()
245 if err := env.stopInstance(string(id)); err != nil { 245 if err := env.stopInstance(string(id)); err != nil {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 if err != nil { 331 if err != nil {
332 return nil, err 332 return nil, err
333 } 333 }
334 images := instances.ImageMetadataToImages(matchingImages) 334 images := instances.ImageMetadataToImages(matchingImages)
335 spec, err := instances.FindInstanceSpec(images, ic, allInstanceTypes) 335 spec, err := instances.FindInstanceSpec(images, ic, allInstanceTypes)
336 if err != nil { 336 if err != nil {
337 return nil, err 337 return nil, err
338 } 338 }
339 return spec, nil 339 return spec, nil
340 } 340 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b