LEFT | RIGHT |
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 Loading... |
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 Loading... |
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 } |
LEFT | RIGHT |